artisynth.core.femmodels
Class FemElement

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.modelbase.RenderableComponentBase
          extended by artisynth.core.femmodels.FemElement
All Implemented Interfaces:
CopyableComponent, ModelComponent, RenderableComponent, PropertyChangeListener, ScalableUnits, java.lang.Cloneable, HasProperties, HierarchyNode, GLRenderable, GLSelectable, HasRenderProps, Renderable, Scannable
Direct Known Subclasses:
FemElement3d, MFreeElement3d

public abstract class FemElement
extends RenderableComponentBase
implements ScalableUnits, CopyableComponent, PropertyChangeListener


Nested Class Summary
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Field Summary
static PropertyList myProps
           
 
Fields inherited from class artisynth.core.modelbase.ModelComponentBase
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
 
Fields inherited from interface artisynth.core.modelbase.CopyableComponent
COPY_REFERENCES
 
Fields inherited from interface maspack.render.GLRenderable
TRANSLUCENT, TWO_DIMENSIONAL
 
Constructor Summary
FemElement()
           
 
Method Summary
abstract  double computeVolumes()
          Computes the volume and partial volumes associated with this element.
abstract  void computeWarping()
           
 boolean containsNode(FemNode p)
           
 FemElement copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
          Create a copy of this component.
 RenderProps createRenderProps()
          Factory method to create render properties appropriate to this object.
 PropertyList getAllPropertyInfo()
          Returns a list giving static information about all properties exported by this object.
 boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
          Collects external references which must also be copied in order to duplicate this component.
 double getDensity()
           
 PropertyMode getDensityMode()
           
 FemMaterial getEffectiveMaterial()
           
 void getHardReferences(java.util.List<ModelComponent> refs)
          Appends all hard references for this component to a list.
 int getIndex()
           
 int getLocalNodeIndex(FemNode p)
           
 void getMarkerCoordinates(VectorNd coords, Point3d pnt)
           
 double getMass()
           
 FemMaterial getMaterial()
           
abstract  FemNode[] getNodes()
           
 double getRestVolume()
           
 void getSelection(java.util.LinkedList<java.lang.Object> list, int qid)
          Append to list the component (or components) associated with the qid-th selection query issued by this component's render method.
 double getVolume()
          Returns the most recently computed volume for this element, as determined by computeVolume().
 boolean hasActiveNodes()
          Returns true if at least one node in this element is active
 boolean hasControllableNodes()
          Returns true if at least one node in this element is controllable
 boolean integrationPointsMapToNodes()
          Returns true if there is a one-to-one mapping between integration points and nodes.
 void invalidateRestData()
          Invalidate data that relies on the element's rest position, such as rest Jacobians and the base stiffness for co-rotated stiffness.
 boolean isDuplicatable()
          Returns true if this component can be duplicated.
 boolean isInverted()
          Returns true if this element has been marked as inverted by the FEM code.
 java.lang.String numberString()
          Returns a string giving the node numbers associated with this element.
 int numNodes()
           
 void prerender(RenderList list)
          Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer.
 void propertyChanged(PropertyChangeEvent e)
           
 void render(GLRenderer renderer, int flags)
          Render this object using Open GL via the JOGL.
 void render(GLRenderer renderer, RenderProps rprops, int flags)
           
 void scaleDistance(double s)
          Scales all distance coordinates.
 void scaleMass(double s)
          Scales all mass units.
 void setDensity(double p)
           
 void setDensityMode(PropertyMode mode)
           
 void setIndex(int idx)
           
 void setInverted(boolean inverted)
          Used by the internal FEM code to mark whether or not this element is inverted.
 void setMass(double m)
           
 void setMaterial(FemMaterial mat)
           
 void updateBounds(Point3d pmin, Point3d pmax)
          Update the minimum and maximum points for this object.
 void updateNodeMasses(double elementMass)
           
 
Methods inherited from class artisynth.core.modelbase.RenderableComponentBase
getRenderHints, getRenderProps, isSelectable, numSelectionQueriesNeeded, setRenderProps, updateRenderProps
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface artisynth.core.modelbase.ModelComponent
connectToHierarchy, disconnectFromHierarchy, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
 
Methods inherited from interface maspack.properties.HasProperties
getProperty
 
Methods inherited from interface maspack.properties.HierarchyNode
getChildren, hasChildren
 
Methods inherited from interface maspack.util.Scannable
isWritable, write
 

Field Detail

myProps

public static PropertyList myProps
Constructor Detail

FemElement

public FemElement()
Method Detail

getAllPropertyInfo

public PropertyList getAllPropertyInfo()
Description copied from interface: HasProperties
Returns a list giving static information about all properties exported by this object.

Specified by:
getAllPropertyInfo in interface HasProperties
Overrides:
getAllPropertyInfo in class ModelComponentBase
Returns:
static information for all exported properties

getMaterial

public FemMaterial getMaterial()

setMaterial

public void setMaterial(FemMaterial mat)

getEffectiveMaterial

public FemMaterial getEffectiveMaterial()

updateNodeMasses

public void updateNodeMasses(double elementMass)

setMass

public void setMass(double m)

setDensity

public void setDensity(double p)

getDensity

public double getDensity()

setDensityMode

public void setDensityMode(PropertyMode mode)

getDensityMode

public PropertyMode getDensityMode()

numNodes

public int numNodes()

integrationPointsMapToNodes

public boolean integrationPointsMapToNodes()
Returns true if there is a one-to-one mapping between integration points and nodes. If so, this means that nodal values of quantities such as stress and volume can be adequately approximated by averaging the same quantities from all the associated integration points.


getNodes

public abstract FemNode[] getNodes()

getLocalNodeIndex

public int getLocalNodeIndex(FemNode p)

containsNode

public boolean containsNode(FemNode p)

getVolume

public double getVolume()
Returns the most recently computed volume for this element, as determined by computeVolume().

Returns:
element volume

computeVolumes

public abstract double computeVolumes()
Computes the volume and partial volumes associated with this element. The volume result is stored in the element's myVolume field, and the partial volumes are stored in the myVolumes field.

Returns:
minimum Jacobian value resulting from volume computation

getMass

public double getMass()

invalidateRestData

public void invalidateRestData()
Invalidate data that relies on the element's rest position, such as rest Jacobians and the base stiffness for co-rotated stiffness.


getRestVolume

public double getRestVolume()

computeWarping

public abstract void computeWarping()

createRenderProps

public RenderProps createRenderProps()
Description copied from interface: HasRenderProps
Factory method to create render properties appropriate to this object.

Specified by:
createRenderProps in interface HasRenderProps
Overrides:
createRenderProps in class RenderableComponentBase
Returns:
new render properties for this object

prerender

public void prerender(RenderList list)
Description copied from interface: GLRenderable
Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer.

Specified by:
prerender in interface GLRenderable
Overrides:
prerender in class RenderableComponentBase

updateBounds

public void updateBounds(Point3d pmin,
                         Point3d pmax)
Description copied from interface: GLRenderable
Update the minimum and maximum points for this object. In an x-y-z coordinate system with x directed to the right and y directed upwards, the minimum and maximum points can be thought of as defining the left-lower-far and right-upper-near corners of a bounding cube. This method should only reduce the elements of the minimum point and increase the elements of the maximum point, since it may be used as part of an iteration to determine the bounding cube for several different objects.

Specified by:
updateBounds in interface GLRenderable
Overrides:
updateBounds in class RenderableComponentBase
Parameters:
pmin - minimum point
pmax - maximum point

render

public void render(GLRenderer renderer,
                   RenderProps rprops,
                   int flags)

render

public void render(GLRenderer renderer,
                   int flags)
Description copied from interface: GLRenderable
Render this object using Open GL via the JOGL.

Specified by:
render in interface GLRenderable
Specified by:
render in class RenderableComponentBase
Parameters:
renderer - renderer object which is used to perform the rendering. Provides pointers to GL and GLU, along with helper functions.
flags - supplies flags that may be used to control different aspects of the rendering. Flags are defined in GLRenderer and currently include GLRenderer.SELECTED, GLRenderer.VERTEX_COLORING, GLRenderer.HSV_COLOR_INTERPOLATION, GLRenderer.SORT_FACES, and GLRenderer.CLEAR_MESH_DISPLAY_LISTS.

getSelection

public void getSelection(java.util.LinkedList<java.lang.Object> list,
                         int qid)
Description copied from interface: GLSelectable
Append to list the component (or components) associated with the qid-th selection query issued by this component's render method. This will only be called if this component manages its own selection (i.e., the number nums returned by GLSelectable.numSelectionQueriesNeeded() is positive), and qid will in turn be a number between 0 and nums-1.

Specified by:
getSelection in interface GLSelectable
Overrides:
getSelection in class RenderableComponentBase
Parameters:
list - selected objects are appended to the end of this list
qid - index of the selection query

scaleDistance

public void scaleDistance(double s)
Description copied from interface: ScalableUnits
Scales all distance coordinates.

Specified by:
scaleDistance in interface ScalableUnits
Parameters:
s - scaling factor

scaleMass

public void scaleMass(double s)
Description copied from interface: ScalableUnits
Scales all mass units.

Specified by:
scaleMass in interface ScalableUnits
Parameters:
s - scaling factor

numberString

public java.lang.String numberString()
Returns a string giving the node numbers associated with this element.

Returns:
node index string

setInverted

public void setInverted(boolean inverted)
Used by the internal FEM code to mark whether or not this element is inverted. An element is inverted if the deformation gradient has a non-positive determinant at one or more integration points.

Parameters:
inverted - if true, marks this element as inverted.

isInverted

public boolean isInverted()
Returns true if this element has been marked as inverted by the FEM code.

Returns:
true if this element has been marked as inverted.

getMarkerCoordinates

public void getMarkerCoordinates(VectorNd coords,
                                 Point3d pnt)

hasActiveNodes

public boolean hasActiveNodes()
Returns true if at least one node in this element is active

Returns:
true if one or more nodes are active

hasControllableNodes

public boolean hasControllableNodes()
Returns true if at least one node in this element is controllable

Returns:
true if one or more nodes are controllable

isDuplicatable

public boolean isDuplicatable()
Returns true if this component can be duplicated. Duplication means that we can expect to be able to make a complete copy of the component along with all it's external references. This method should return true if and only if CopyableComponent.getCopyReferences(java.util.List, artisynth.core.modelbase.ModelComponent) returns true.

This method is not currently used. It is intended to provide a faster way of determining if a component can be duplicated, without having to use CopyableComponent.getCopyReferences(java.util.List, artisynth.core.modelbase.ModelComponent) to build the list of copy references.

Specified by:
isDuplicatable in interface CopyableComponent
Returns:
true if this component can be duplicated.

getCopyReferences

public boolean getCopyReferences(java.util.List<ModelComponent> refs,
                                 ModelComponent ancestor)
Collects external references which must also be copied in order to duplicate this component. These references should exclude those which are contained within a specified component hierarchy. This method should return true if and only if CopyableComponent.isDuplicatable() returns true.

Specified by:
getCopyReferences in interface CopyableComponent
Parameters:
refs - list to which references are appended
ancestor - root node of the hierarchy from which references are to be excluded
Returns:
false if it is discovered that the component cannot be duplicated

getIndex

public int getIndex()

setIndex

public void setIndex(int idx)

getHardReferences

public void getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list. References are other components, outside of this component's immediate ancestry, on which this component depends. For example, an AxialSpring refers to two Point components as for it's end points. A hard reference is one which the referring component must have, and which if deleted, implies that the referring component should be deleted too.

Specified by:
getHardReferences in interface ModelComponent
Overrides:
getHardReferences in class ModelComponentBase
Parameters:
refs - list to which hard references are appended

copy

public FemElement copy(int flags,
                       java.util.Map<ModelComponent,ModelComponent> copyMap)
Description copied from interface: CopyableComponent
Create a copy of this component. If COPY_REFERENCES is set in flags, then any component referenced by this component should itself be set to a copy. This should be done first checking copyMap for an existing copy of the referenced component. If there is no existing copy, then a copy should be created by calling copy recursively and adding the new copy to copyMap.

Specified by:
copy in interface CopyableComponent
Overrides:
copy in class RenderableComponentBase

propertyChanged

public void propertyChanged(PropertyChangeEvent e)
Specified by:
propertyChanged in interface PropertyChangeListener