poisson
Class Poisson

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--edu.davidson.tools.SApplet
                                |
                                +--poisson.Poisson
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Poisson
extends SApplet

This applet solves Poisson's equation. Both conductors and charge distributions can be specified using "add" methods.

See Also:
Serialized Form

Fields inherited from class edu.davidson.tools.SApplet
clock, dataConnections, dataListeners, dataSources, lock
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Poisson()
           
 
Method Summary
 int addConnectorLine(int id1, int id2)
          Add a connecting line between two objects
 int addObject(java.lang.String name, java.lang.String parList)
          Create an object and add it to the Physlet.
 void destroy()
          Used by the browser when the HTML page is closed.
 java.lang.String getAppletInfo()
           
 int getChargeArrayID()
          Get the object identifier for the charge density.
 int getEnsembleID()
          Get the object identifier for ensemble of objects in the poisson applet.
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 int getPotentialArrayID()
          Get the object identifier for the potential array.
 void init()
           
 boolean set(int id, java.lang.String name, java.lang.String parList)
          Change the properies of an object.
 boolean setAnimationSlave(int masterID, int slaveID)
          Force an object to follow another object on the screen.
 void setAutoRefresh(boolean ar)
          Repaint whenevers the system parameters are changed.
 void setCaption(java.lang.String caption)
          Set the caption.
 boolean setChargeDensity(int id, double q)
          Set the charge density.
 boolean setChi(int id, double chi)
          Set the dielectric permittivity.
 boolean setConnector(int id, int id1, int id2)
          Set the connector line between two objects.
 boolean setConstantQ(int id, double q, boolean isConstant)
          Make keep the charge rather than the voltage on this conductor constant.
 boolean setConstraint(int id, int constraintID)
          Set a motion constraint on an object.
 void setDefault()
          Set the default values: grid=false, fild vectors=false,contours=true, drag=false, no E and no V on mouse drag.
 void setDefaultDragable(boolean drag)
          Set the dragable property for all subsequent objects.
 void setDefaultRGB(int r, int g, int b)
          Set the color for all subsequent drawing.
 boolean setDisplayOffset(int id, int xOff, int yOff)
          Offset the object's position on the screen from its default drawing position.
 boolean setDragable(int id, boolean isDragable)
          Make an object dragable.
 void setDrawChargeDensity(boolean isChargeMode)
          Set the drawing to chargedensity mode or conductor mode in the UI.
 void setFieldResolution(int r)
          Set the resoltion for the field vectors.
 boolean setFont(int id, java.lang.String family, int style, int size)
          change the object's font for any text that is displayed.
 boolean setFormat(int id, java.lang.String format)
          change the object's numerical format for any numbers that is displayed.
 void setGutter(int g)
          Set a gutter of grid points outside the viewing region.
 void setMaxIterations(int m)
          Set the maximum number of inerations for the Poisson solver.
 void setMessage(java.lang.String msg)
          Display a message in the yellow message box.
 boolean setResizable(int id, boolean isResizable)
          Make an object resizable.
 boolean setRGB(int id, int r, int g, int b)
          Set the color for an object.
 boolean setShowCharge(int id, boolean isShowCharge)
          Show the induced charge.
 void setShowContours(boolean isShowContours)
          Show the contour lines?
 void setShowEOnDrag(boolean isShowEOnDrag)
          Show the magnitude of the electric field when the mouse is dragged.
 void setShowFieldVectors(boolean isShowField)
          Turn field vectors off and on.
 void setShowGrid(boolean isShowGrid)
          Turn grid off and on.
 void setShowRhoOnDrag(boolean isShowRhoOnDrag)
          Show the charge density when the mouse is dragged.
 void setShowVOnDrag(boolean isShowVOnDrag)
          Show the charge voltage when the mouse is dragged.
 void setTolerance(double tol)
          Set the tolerance of the Poisson solver.
 boolean setVisibility(int id, boolean isVisible)
          Make an object visibile.
 boolean setVoltage(int id, double v)
          Set the voltage on the conductor.
 void setXRange(double xmin, double xmax)
          Set the scale using the horizontal axis.
 void setYRange(double ymin, double ymax)
           
 void start()
          Used by the browser when the HTML page is active.
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, forward, getClockID, getClockTime, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, pause, removeDataListener, removeDataSource, reset, reverse, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDt, setExternalClock, setFPS, setRunningID, setRunningID, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, stopClock, updateDataConnection, updateDataConnections
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Poisson

public Poisson()
Method Detail

addConnectorLine

public int addConnectorLine(int id1,
                            int id2)
Add a connecting line between two objects
Parameters:
id1 - The first id of a screen object.
id2 - The second id of a screen object.
Returns:
id that identifies the connector.

addObject

public int addObject(java.lang.String name,
                     java.lang.String parList)
Create an object and add it to the Physlet. The first argument is the name of the object to be added and the second is a comma-delimited list of parameters. For example, a circle can be added a follows:

addObject ("circle", "x = 0, y = -1.0, r = 10");

See the supplemental documentation for a list of object names and parameters.
Parameters:
name - the type of object to be created.
parList - a list of parameters to be set
Returns:
id that identifies the object.

destroy

public void destroy()
Used by the browser when the HTML page is closed. Do not script.
Overrides:
destroy in class SApplet

getAppletInfo

public java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet

getChargeArrayID

public int getChargeArrayID()
Get the object identifier for the charge density.
Returns:
the integer identifier.

getEnsembleID

public int getEnsembleID()
Get the object identifier for ensemble of objects in the poisson applet. The ensemble is made up of conductors, dielectrics, and charge densities.
Returns:
the integer identifier.

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

getPotentialArrayID

public int getPotentialArrayID()
Get the object identifier for the potential array.
Returns:
the integer identifier.

init

public void init()
Overrides:
init in class java.applet.Applet

set

public boolean set(int id,
                   java.lang.String name,
                   java.lang.String parList)
Change the properies of an object. The first argument is the object identifier. The second argument is the name of the property and the third is a comma-delimited list of parameters. For example, the scale can be added a follows:

set(id, "sale", "xmin=0, xmax=2, autoscalx=false");

Parameters:
id - the identifier of the object
name - the type of property to be created.
parList - a list of parameters
Returns:
true if successful

setAnimationSlave

public boolean setAnimationSlave(int masterID,
                                 int slaveID)
Force an object to follow another object on the screen.
Parameters:
masterID - The id of the master object.
slaveID - The id of the slave object.
Returns:
true if successful.

setAutoRefresh

public void setAutoRefresh(boolean ar)
Repaint whenevers the system parameters are changed.
Overrides:
setAutoRefresh in class SApplet
Parameters:
autoRefresh - Automatic repaint?

setCaption

public void setCaption(java.lang.String caption)
Set the caption.
Parameters:
caption - The applet caption.

setChargeDensity

public boolean setChargeDensity(int id,
                                double q)
Set the charge density.
Parameters:
id - the object identifier.
q - the charge value
Returns:
true if successful.

setChi

public boolean setChi(int id,
                      double chi)
Set the dielectric permittivity.
Parameters:
id - the object identifier.
chi - the permittivity
Returns:
true if successful.

setConnector

public boolean setConnector(int id,
                            int id1,
                            int id2)
Set the connector line between two objects. Connectors are visual objects that are drawn on the screen. For example, a line connecting the centers of two rectangles.
Parameters:
id - the id of the connector object.
id1 - the id of the first object.
id2 - the id of the second object.
Returns:
true if successful.

setConstantQ

public boolean setConstantQ(int id,
                            double q,
                            boolean isConstant)
Make keep the charge rather than the voltage on this conductor constant. At present, this property can only be set for a SINGLE conductor.
Parameters:
id - the object identifier.
q - the charge value
isConstant - true if charge should be held constant.
Returns:
true if successful.

setConstraint

public boolean setConstraint(int id,
                             int constraintID)
Set a motion constraint on an object.
Parameters:
id - the ID of the object.
constraintID - the ID of the constraint.
Returns:
true if successful.

setDefault

public void setDefault()
Set the default values: grid=false, fild vectors=false,contours=true, drag=false, no E and no V on mouse drag.
Overrides:
setDefault in class SApplet

setDefaultDragable

public void setDefaultDragable(boolean drag)
Set the dragable property for all subsequent objects.
Parameters:
nd - NoDrag parameter; nd=0 turns drag off, nd=1 turns drag on.

setDefaultRGB

public void setDefaultRGB(int r,
                          int g,
                          int b)
Set the color for all subsequent drawing.
Parameters:
r - 0<=red<=255
g - 0<=green<=255
b - 0<=blue<=255

setDisplayOffset

public boolean setDisplayOffset(int id,
                                int xOff,
                                int yOff)
Offset the object's position on the screen from its default drawing position.
Parameters:
id - The id of the object.
xoff - The x offset.
yoff - The y offset.
Returns:
True if successful.

setDragable

public boolean setDragable(int id,
                           boolean isDragable)
Make an object dragable.
Parameters:
id - The ID of the object.
dragable - property
Returns:
true if successful.

setDrawChargeDensity

public void setDrawChargeDensity(boolean isChargeMode)
Set the drawing to chargedensity mode or conductor mode in the UI.
Parameters:
isChargeMode - true if chargedensity mode and false otherwise

setFieldResolution

public void setFieldResolution(int r)
Set the resoltion for the field vectors. Default is 2.
Parameters:
r - the resolution

setFont

public boolean setFont(int id,
                       java.lang.String family,
                       int style,
                       int size)
change the object's font for any text that is displayed.
Parameters:
id - The id of the object.
family - The font family: Helvetica, Times.
style - The style, 0=plain, 1=bold.
size - The size of the font;
Returns:
True if successful.

setFormat

public boolean setFormat(int id,
                         java.lang.String format)
change the object's numerical format for any numbers that is displayed.
Parameters:
id - The id of the object.
format - a string using unix printf conventions.
Returns:
true if successful.

setGutter

public void setGutter(int g)
Set a gutter of grid points outside the viewing region. Can be used to minimize the conducting boundary.
Parameters:
g - the gutter

setMaxIterations

public void setMaxIterations(int m)
Set the maximum number of inerations for the Poisson solver. Default is on part in 50.
Parameters:
tol -  

setMessage

public void setMessage(java.lang.String msg)
Display a message in the yellow message box.
Parameters:
msg - Message to display after the animation stops.

setResizable

public boolean setResizable(int id,
                            boolean isResizable)
Make an object resizable.
Parameters:
id - the ID of the object.
resizable - property
Returns:
true if successful.

setRGB

public boolean setRGB(int id,
                      int r,
                      int g,
                      int b)
Set the color for an object. Currently works for test charges and poles.
Parameters:
id - The ID of the object.
r - red.
g - green.
b - blue.
Returns:
True if successful.

setShowCharge

public boolean setShowCharge(int id,
                             boolean isShowCharge)
Show the induced charge.
Parameters:
id - the id of the object.
isShowCharge - property

setShowContours

public void setShowContours(boolean isShowContours)
Show the contour lines?
Parameters:
sc - true to show contours

setShowEOnDrag

public void setShowEOnDrag(boolean isShowEOnDrag)
Show the magnitude of the electric field when the mouse is dragged.
Parameters:
se - Show electric field on drag?

setShowFieldVectors

public void setShowFieldVectors(boolean isShowField)
Turn field vectors off and on.
Parameters:
sfv - ShowFieldVector parameter.

setShowGrid

public void setShowGrid(boolean isShowGrid)
Turn grid off and on.
Parameters:
sg - Show grid parameter.

setShowRhoOnDrag

public void setShowRhoOnDrag(boolean isShowRhoOnDrag)
Show the charge density when the mouse is dragged.
Parameters:
isShowRhoOnDrag - Show charge density on drag?

setShowVOnDrag

public void setShowVOnDrag(boolean isShowVOnDrag)
Show the charge voltage when the mouse is dragged.
Parameters:
sv - Show voltage on drag?

setTolerance

public void setTolerance(double tol)
Set the tolerance of the Poisson solver. Default is on part in 1.0e-3.
Parameters:
tol -  

setVisibility

public boolean setVisibility(int id,
                             boolean isVisible)
Make an object visibile.
Parameters:
id - The ID of the object.
visibility - property
Returns:
true if successful.

setVoltage

public boolean setVoltage(int id,
                          double v)
Set the voltage on the conductor.
Parameters:
id - the object identifier.
q - the charge value
Returns:
true if successful.

setXRange

public void setXRange(double xmin,
                      double xmax)
Set the scale using the horizontal axis. The leftmost pixel will be xmin. The rightmost pixel will be xmax. The vertical axis will be rescaled to maintian an aspect ratio of one.
Parameters:
xmin - Minimuum value on x axis.
xmax - Maximum value on x axis.

setYRange

public void setYRange(double ymin,
                      double ymax)

start

public void start()
Used by the browser when the HTML page is active. Do not script.
Overrides:
start in class java.applet.Applet

Copyright Wolfgang Christian

Visit the Davidson CollegePhyslets Page