poisson
Class Poisson

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byedu.davidson.tools.SApplet
                      extended bypoisson.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

Field Summary
 
Fields inherited from class edu.davidson.tools.SApplet
destroyed
 
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
 
Method Summary
 int addCircle(double x, double y, int r, double v)
          Add a circular conductor with a fixed voltage.
 int addCircleCharge(double x, double y, int r, double q)
          Add a circular charge distribution.
 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.
 int addRectangle(double x, double y, int w, int h, double q)
          Add a rectangular conductor with a fixed voltage.
 int addRectangleCharge(double x, double y, int w, int h, double v)
          Add a rectangular charge distribution.
 int getChargeArrayID()
          Gets the object identifier for the charge density.
 int getEnsembleID()
          Gets the object identifier for ensemble of objects in the poisson applet.
 int getPotentialArrayID()
          Gets the object identifier for the potential array.
 double getXPos(int id)
          Gets the x position.
 double getYPos(int id)
          Gets the y position.
 boolean set(int id, java.lang.String name, java.lang.String parList)
          Changes the properies of an object.
 boolean setAnimationSlave(int masterID, int slaveID)
          Forces an object to follow another object on the screen.
 void setAutoRefresh(boolean ar)
          Repaints when the system parameters are changed.
 void setCaption(java.lang.String caption)
          Set the caption.
 boolean setChargeDensity(int id, double q)
          Sets the charge density.
 boolean setChi(int id, double chi)
          Sets the dielectric permittivity.
 boolean setConnector(int id, int id1, int id2)
          Sets the connector line between two objects.
 boolean setConstantQ(int id, double q, boolean isConstant)
          Makes the charge rather than the voltage on this conductor constant.
 boolean setConstraint(int id, int constraintID)
          Sets a motion constraint on an object.
 void setDefault()
          Sets the default values: grid=false, fild vectors=false,contours=true, drag=false, no E and no V on mouse drag.
 void setDefaultDragable(boolean drag)
          Sets the dragable property for all subsequent objects.
 void setDefaultRGB(int r, int g, int b)
          Sets 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)
          Makes an object dragable.
 void setDrawChargeDensity(boolean isChargeMode)
          Sets the drawing to chargedensity mode or conductor mode in the UI.
 void setFieldResolution(int r)
          Sets 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)
          Sets a gutter of grid points outside the viewing region.
 void setMaxIterations(int m)
          Sets the maximum number of inerations for the Poisson solver.
 void setMessage(java.lang.String msg)
          Display a message in the yellow message box.
 boolean setObjectFont(int id, java.lang.String family, int style, int size)
          Sets the object's font if the object has text that can be displayed.
 boolean setResizable(int id, boolean isResizable)
          Makes an object resizable.
 boolean setRGB(int id, int r, int g, int b)
          Sets the color for an object.
 boolean setShowCharge(int id, boolean isShowCharge)
          Shows the induced charge.
 void setShowContours(boolean isShowContours)
          Shows 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)
          Turns 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)
          Sets the tolerance of the Poisson solver.
 boolean setVisibility(int id, boolean isVisible)
          Makes an object visible.
 boolean setVoltage(int id, double v)
          Sets the voltage on the conductor.
 boolean setXPos(int id, double x)
          Sets the x position.
 void setXRange(double xmin, double xmax)
          Sets the scale using the horizontal axis.
 boolean setXYPos(int id, double x, double y)
          Sets the position.
 boolean setYPos(int id, double y)
          Sets the y position.
 void setYRange(double ymin, double ymax)
          Method setYRange
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, checkAppletNames, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, formatValue, forward, getAppletName, getClockID, getClockTime, getDataFromDS, getDataListener, getDataSource, getDataSource, getDebugLevel, getID, getSourceData, getSourceVariables, isClockRunning, isValidFunction, makeDataConnection, pause, removeDataListener, removeDataSource, reset, reverse, sendDataToListener, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setConnectionWindowX, setConnectionWindowY, setDebugLevel, setDt, setExternalClock, setFPS, setIndependentClock, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, stop, stopClock, updateDataConnection, updateDataConnections
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.

addCircle

public int addCircle(double x,
                     double y,
                     int r,
                     double v)
Add a circular conductor with a fixed voltage. Alternative to addObject method.

Parameters:
x - x postion of center
y - y postion of center
r - radius in pixels
v - voltage of conductor
Returns:
the integer indentifier for the object

addCircleCharge

public int addCircleCharge(double x,
                           double y,
                           int r,
                           double q)
Add a circular charge distribution. Alternative to addObject method.

Parameters:
x - x postion of center
y - y postion of center
r - radius in pixels
q - charge
Returns:
the integer indentifier for the object

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.

addRectangle

public int addRectangle(double x,
                        double y,
                        int w,
                        int h,
                        double q)
Add a rectangular conductor with a fixed voltage. Alternative to addObject method.

Parameters:
x - x postion of center
y - y postion of center
w - width in pixels
h - height in pixels
q -
Returns:
the integer indentifier for the object

addRectangleCharge

public int addRectangleCharge(double x,
                              double y,
                              int w,
                              int h,
                              double v)
Add a rectangular charge distribution. Alternative to addObject method.

Parameters:
x - x postion of center
y - y postion of center
w - width in pixels
h - height in pixels
v -
Returns:
the integer indentifier for the object

set

public boolean set(int id,
                   java.lang.String name,
                   java.lang.String parList)
Changes 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)
Forces 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)
Repaints when the system parameters are changed.

Overrides:
setAutoRefresh in class SApplet
Parameters:
ar -

setCaption

public void setCaption(java.lang.String caption)
Set the caption.

Parameters:
caption - The applet caption.

setConnector

public boolean setConnector(int id,
                            int id1,
                            int id2)
Sets 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.

setConstraint

public boolean setConstraint(int id,
                             int constraintID)
Sets a motion constraint on an object.

Parameters:
id - the ID of the object.
constraintID - the ID of the constraint.
Returns:
true if successful.

setDefaultRGB

public void setDefaultRGB(int r,
                          int g,
                          int b)
Sets the color for all subsequent drawing.

Parameters:
r - 0<=red<=255
g - 0<=green<=255
b - 0<=blue<=255

setDefault

public void setDefault()
Sets 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

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 -
yOff -
Returns:
True if successful.

setDefaultDragable

public void setDefaultDragable(boolean drag)
Sets the dragable property for all subsequent objects.

Parameters:
drag -

setShowFieldVectors

public void setShowFieldVectors(boolean isShowField)
Turn field vectors off and on.

Parameters:
isShowField -

setShowCharge

public boolean setShowCharge(int id,
                             boolean isShowCharge)
Shows the induced charge.

Parameters:
id - the id of the object.
isShowCharge - property
Returns:
true if successful

setShowContours

public void setShowContours(boolean isShowContours)
Shows the contour lines?

Parameters:
isShowContours -

setShowGrid

public void setShowGrid(boolean isShowGrid)
Turns grid off and on.

Parameters:
isShowGrid -

setDragable

public boolean setDragable(int id,
                           boolean isDragable)
Makes an object dragable.

Parameters:
id - The ID of the object.
isDragable -
Returns:
true if successful.

setResizable

public boolean setResizable(int id,
                            boolean isResizable)
Makes an object resizable.

Parameters:
id - the ID of the object.
isResizable -
Returns:
true if successful.

setConstantQ

public boolean setConstantQ(int id,
                            double q,
                            boolean isConstant)
Makes 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.

setVoltage

public boolean setVoltage(int id,
                          double v)
Sets the voltage on the conductor.

Parameters:
id - the object identifier.
v -
Returns:
true if successful.

getXPos

public double getXPos(int id)
Gets the x position.

Parameters:
id - the object identifier.
Returns:
true if successful.

getYPos

public double getYPos(int id)
Gets the y position.

Parameters:
id - the object identifier.
Returns:
true if successful.

setXPos

public boolean setXPos(int id,
                       double x)
Sets the x position.

Parameters:
id - the object identifier.
x - the x position
Returns:
true if successful.

setYPos

public boolean setYPos(int id,
                       double y)
Sets the y position.

Parameters:
id - the object identifier.
y -
Returns:
true if successful.

setXYPos

public boolean setXYPos(int id,
                        double x,
                        double y)
Sets the position.

Parameters:
id - the object identifier.
x - the x position
y -
Returns:
true if successful.

setChi

public boolean setChi(int id,
                      double chi)
Sets the dielectric permittivity.

Parameters:
id - the object identifier.
chi - the permittivity
Returns:
true if successful.

setChargeDensity

public boolean setChargeDensity(int id,
                                double q)
Sets the charge density.

Parameters:
id - the object identifier.
q - the charge value
Returns:
true if successful.

setVisibility

public boolean setVisibility(int id,
                             boolean isVisible)
Makes an object visible.

Parameters:
id - The ID of the object.
isVisible -
Returns:
true if successful.

setFieldResolution

public void setFieldResolution(int r)
Sets the resoltion for the field vectors. Default is 2.

Parameters:
r - the resolution

setGutter

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

Parameters:
g - the gutter

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.

setObjectFont

public boolean setObjectFont(int id,
                             java.lang.String family,
                             int style,
                             int size)
Sets the object's font if the object has text that can be 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.

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.

setMaxIterations

public void setMaxIterations(int m)
Sets the maximum number of inerations for the Poisson solver. Default is on part in 50.

Parameters:
m -

setTolerance

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

Parameters:
tol -

setDrawChargeDensity

public void setDrawChargeDensity(boolean isChargeMode)
Sets the drawing to chargedensity mode or conductor mode in the UI.

Parameters:
isChargeMode - true if chargedensity mode and false otherwise

setXRange

public void setXRange(double xmin,
                      double xmax)
Sets 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)
Method setYRange

Parameters:
ymin -
ymax -

setShowEOnDrag

public void setShowEOnDrag(boolean isShowEOnDrag)
Show the magnitude of the electric field when the mouse is dragged.

Parameters:
isShowEOnDrag -

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:
isShowVOnDrag -

setRGB

public boolean setRGB(int id,
                      int r,
                      int g,
                      int b)
Sets 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.

getPotentialArrayID

public int getPotentialArrayID()
Gets the object identifier for the potential array.

Returns:
the integer identifier.

getChargeArrayID

public int getChargeArrayID()
Gets the object identifier for the charge density.

Returns:
the integer identifier.

getEnsembleID

public int getEnsembleID()
Gets 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.


Visit the Davidson College Physlet Site for additional information.