artisynth.core.femmodels
Class FemModel3d

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.modelbase.ComponentList<ModelComponent>
          extended by artisynth.core.modelbase.ModelBase
              extended by artisynth.core.modelbase.RenderableModelBase
                  extended by artisynth.core.mechmodels.MechSystemBase
                      extended by artisynth.core.femmodels.FemModel
                          extended by artisynth.core.femmodels.FemModel3d
All Implemented Interfaces:
Collidable, Constrainer, ForceEffector, HasAuxState, HasSlaveObjects, MechSystem, MechSystemModel, ComponentChangeListener, ComponentListView<ModelComponent>, CompositeComponent, CopyableComponent, HasState, IndexedComponentList, Model, ModelComponent, MutableCompositeComponent<ModelComponent>, ParameterizedClass, RenderableComponent, PropertyChangeListener, ScalableUnits, TransformableGeometry, java.lang.Cloneable, java.lang.Iterable<ModelComponent>, java.util.Collection<ModelComponent>, HasProperties, HierarchyNode, GLRenderable, GLSelectable, HasRenderProps, Renderable, Disposable, ListView<ModelComponent>, Scannable
Direct Known Subclasses:
FemMuscleModel

public class FemModel3d
extends FemModel
implements TransformableGeometry, ScalableUnits, MechSystemModel, Collidable, CopyableComponent, HasAuxState


Nested Class Summary
 
Nested classes/interfaces inherited from class artisynth.core.femmodels.FemModel
FemModel.ElementFilter, FemModel.IncompMethod, FemModel.Ranging, FemModel.SurfaceRender
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Nested classes/interfaces inherited from interface artisynth.core.mechmodels.MechSystem
MechSystem.ConstraintInfo, MechSystem.FrictionInfo
 
Nested classes/interfaces inherited from interface artisynth.core.mechmodels.Collidable
Collidable.DefaultCollidable
 
Nested classes/interfaces inherited from interface artisynth.core.mechmodels.HasAuxState
HasAuxState.StateContext
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.CompositeComponent
CompositeComponent.NavpanelDisplay
 
Field Summary
static boolean abortOnInvertedElems
           
static boolean checkTangentStability
           
static FemModel.IncompMethod DEFAULT_HARD_INCOMP
           
static FemModel.IncompMethod DEFAULT_SOFT_INCOMP
           
static java.lang.String DEFAULT_SURFACEMESH_NAME
           
static boolean defaultAutoGenerateSurface
           
static ColorMapBase defaultColorMap
           
static double detJStepReductionLimit
           
static PropertyList myProps
           
static boolean noIncompressStiffnessDamping
           
 
Fields inherited from class artisynth.core.mechmodels.MechSystemBase
myParametricsInSystemMatrix
 
Fields inherited from class artisynth.core.modelbase.ComponentList
DEFAULT_NAVPANEL_DISPLAY
 
Fields inherited from class artisynth.core.modelbase.ModelComponentBase
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
 
Fields inherited from interface artisynth.core.util.TransformableGeometry
ARTICULATED, SIMULATING
 
Fields inherited from interface artisynth.core.mechmodels.MechSystem
COMPUTE_CONTACTS, UPDATE_CONTACTS
 
Fields inherited from interface artisynth.core.mechmodels.Collidable
Default, Deformable, RigidBody, Self
 
Fields inherited from interface artisynth.core.modelbase.CopyableComponent
COPY_REFERENCES
 
Fields inherited from interface maspack.render.GLRenderable
TRANSLUCENT, TWO_DIMENSIONAL
 
Constructor Summary
FemModel3d()
           
FemModel3d(java.lang.String name)
           
 
Method Summary
 int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb, IntHolder changeCnt)
           
 void addElement(FemElement3d e)
           
 void addMarker(FemMarker mkr)
          Adds a marker to this FemModel.
 void addMaterialBundle(AuxMaterialBundle bundle)
           
 void addMesh(FemMesh surf)
           
 FemMesh addMesh(MeshBase mesh)
           
 FemMesh addMesh(java.lang.String name, MeshBase mesh)
           
 void addNode(FemNode3d p)
           
 void addNumberedElement(FemElement3d e, int elemId)
           
 FemMarker addNumberedMarker(Point3d pos, int markerId)
           
 void addNumberedNode(FemNode3d p, int number)
           
 void addPosJacobian(SparseNumberedBlockMatrix M, double s)
          Scales the components of the position Jacobian associated with this force effector and adds it to the supplied solve matrix M.
 void addSolveBlocks(SparseNumberedBlockMatrix S)
          Adds any needed blocks to a solve matrix in order to accomodate the Jacobian terms associated with this force effector.
 void addVelJacobian(SparseNumberedBlockMatrix M, double s)
          Scales the components of the velocity Jacobian associated with this force effector and adds it to the supplied solve matrix M.
 StepAdjustment advance(double t0, double t1, int flags)
          Advances this object from time t0 to time t1.
 void advanceAuxState(double t0, double t1)
          Called at the very beginning of the time step (in the system's preadvance() method) to perform any required updating of the component's state before the application in input probes or controllers.
 void clearElements()
           
 void clearMaterialBundles()
           
 void componentChanged(ComponentChangeEvent e)
          Notifies this composite component that a change has occured within one or more of its descendants.
 FemModel3d copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
          Create a copy of this component.
 DeformableCollisionData createCollisionData()
           
 FemMesh createFineSurfaceMesh(int resolution, FemModel.ElementFilter efilter)
           
static FemModel3d createGrid(java.lang.String name, double widthX, double widthY, double widthZ, int numX, int numY, int numZ, double density)
           
static FemModel3d createHexGrid(java.lang.String name, double widthX, double widthY, double widthZ, int numX, int numY, int numZ, double density)
           
 FemMesh createSurfaceMesh(java.util.Collection<FemElement> elems)
           
 FemMesh createSurfaceMesh(FemModel.ElementFilter efilter)
           
 void dispose()
          Called when the model is discarded.
 FemElement3d findContainingElement(Point3d pnt)
          Returns the element within an FEM that contains a specified point, or null if there is no such element.
 FemElement3d findNearestElement(Point3d loc, Point3d pnt)
          Returns the element within an FEM that contains a specified point, or if there is no such element, finds the closest surface element.
 FemNode3d findNearestNode(Point3d pnt, double maxDist)
          Finds the nearest node to a specified point that is within a specified maximum distance.
 FemElement3d findNearestSurfaceElement(Point3d loc, Point3d pnt)
          Returns the nearest surface element to a specified point, which is found by projecting the point onto the FEM surface.
 PropertyList getAllPropertyInfo()
          Returns a list giving static information about all properties exported by this object.
 void getAuxState(DataBuffer data)
          Saves state information for this component by adding data to the supplied DataBuffer.
 void getAuxStateComponents(java.util.List<HasAuxState> comps, int level)
           
 int getBilateralImpulses(VectorNd lam, int idx)
           
 int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
           
 void getBilateralSizes(VectorNi sizes)
           
 FemNode3d getByNumber(int num)
          Get the component with the specified number, or null if there is no such component.
 void getCollidables(java.util.List<Collidable> list, int level)
           
 ColorMapBase getColorMap()
           
 PropertyMode getColorMapMode()
           
 boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
          Collects external references which must also be copied in order to duplicate this component.
 FemElement3d getElement(int idx)
           
 FemElement3d getElementByNumber(int num)
           
 java.util.LinkedList<FemElement3d> getElementNeighbors(FemNode3d node)
           
 RenderableComponentList<FemElement3d> getElements()
           
 double getElementWidgetSize()
           
 PropertyMode getElementWidgetSizeMode()
           
 FemModel.IncompMethod getHardIncompMethod()
           
 Range getHardIncompMethodRange()
           
 double getIncompCompliance()
           
 FemModel.IncompMethod getIncompressible()
           
 void getInitialAuxState(DataBuffer newData, DataBuffer oldData)
          Saves initial state information data for this component by adding data to the supplied data buffer.
 int getJacobianType()
          Returns a code indicating the matrix type that results when the Jacobian terms of this force effector are added to the solve matrix.
 RenderableComponentList<AuxMaterialBundle> getMaterialBundles()
           
 FemMesh getMesh(java.lang.String name)
           
 MeshComponentList<FemMesh> getMeshes()
           
 DoubleInterval getNodalPlotRange(FemModel.SurfaceRender rendering)
           
 FemNode3d getNode(int idx)
           
 java.util.LinkedList<FemNodeNeighbor> getNodeNeighbors(FemNode3d node)
           
 PointList<FemNode3d> getNodes()
           
 int getNumMeshes()
           
 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.
 FemModel.IncompMethod getSoftIncompMethod()
           
 Range getSoftIncompMethodRange()
           
 FemElement3d getSurfaceElement(Face face)
           
 PolygonalMesh getSurfaceMesh()
           
 FemMeshVertex getSurfaceMeshVertex(FemNode node)
           
 void invalidateRestData()
           
 void invalidateStressAndStiffness()
           
 void invalidateSurfaceMesh()
           
 boolean isAutoGeneratingSurface()
           
 boolean isCollidable()
           
 boolean isDuplicatable()
          Returns true if this component can be duplicated.
 boolean isSurfaceNode(FemNode3d node)
           
 int markInvertedRestElements()
           
 int numQuadraticElements()
           
 int numTetElements()
           
 void postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor)
          Performs any required post-scanning for this component.
 void prerender(RenderList list)
          Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer.
 void printANSYSElements(java.io.PrintWriter pw)
          Prints the elements of this FEM in a format which is compatible with ANSYS.
 void printANSYSNodes(java.io.PrintWriter pw)
          Prints the nodes of this FEM in a format which is compatible with ANSYS.
 void recursivelyFinalizeAdvance(StepAdjustment stepAdjust, double t0, double t1, int flags, int level)
           
 void recursivelyInitialize(double t, int level)
           
 void removeAllMeshes()
           
 boolean removeElement(FemElement3d e)
           
 boolean removeMaterialBundle(AuxMaterialBundle bundle)
           
 boolean removeMesh(FemMesh surf)
           
 boolean removeNode(FemNode3d p)
           
 void render(GLRenderer renderer, int flags)
          Render this object using Open GL via the JOGL.
 void resetRestPosition()
           
 void scaleDistance(double s)
          Scales all distance coordinates.
 void scan(ReaderTokenizer rtok, java.lang.Object ref)
          Scans this element from a ReaderTokenizer.
 PolygonalMesh scanMesh(ReaderTokenizer rtok)
          Creates a triangular polygonal mesh from a list of faces whose vertices are described by FEM node numbers.
 PolygonalMesh scanMesh(java.lang.String fileName)
           
 void scanSurfaceMesh(ReaderTokenizer rtok)
           
 void scanSurfaceMesh(java.lang.String fileName)
           
 void setAutoGenerateSurface(boolean val)
           
 void setAuxState(DataBuffer data)
          Restores the state for this component by reading from the supplied data buffer, starting at the current buffer offsets.
 int setBilateralImpulses(VectorNd lam, double h, int idx)
           
 void setColorMap(ColorMapBase colorMap)
           
 void setColorMapMode(PropertyMode mode)
           
 void setComputeNodalStrain(boolean enable)
           
 void setComputeNodalStress(boolean enable)
           
 void setElementWidgetSize(double size)
           
 void setElementWidgetSizeMode(PropertyMode mode)
           
 void setIncompCompliance(double c)
           
 void setIncompressible(FemModel.IncompMethod method)
           
 void setMaterial(FemMaterial mat)
           
 void setSoftIncompMethod(FemModel.IncompMethod method)
           
 FemMesh setSurfaceMesh(PolygonalMesh mesh)
           
 void setSurfaceRendering(FemModel.SurfaceRender mode)
           
 void skipAuxState(DataBuffer data)
          Skips over the state information for this component contained in the supplied data buffer, starting at the current buffer offsets.
 void subdivideHex(HexElement hex)
           
 void subdivideHexs(java.util.List<HexElement> hexs)
           
 void transformGeometry(AffineTransform3dBase X)
          Applies an affine transformation to the geometry of this object.
 void transformGeometry(AffineTransform3dBase X, TransformableGeometry topObject, int flags)
          Applies an affine transformation to the geometry of this object.
 double updateConstraints(double t, int flags)
           
 void updateSlavePos()
          Called when the system's dynamic position state changes, to update the position state of the slave objects.
 void updateStress()
           
 void updateStressAndStiffness()
           
 void useAnsysNumbering()
           
 void writeMesh(java.io.PrintWriter pw, PolygonalMesh mesh)
           
 void writeSurfaceMesh(java.io.PrintWriter pw)
           
 void writeSurfaceMesh(java.lang.String fileName)
           
 void zeroImpulses()
           
 
Methods inherited from class artisynth.core.femmodels.FemModel
addFrictionConstraints, addMarker, addMarker, addUnilateralConstraints, applyForces, attachments, attachPoint, checkVelocityStability, clear, createDefaultMaterial, detachAllNodes, detachPoint, forcesNeedUpdating, getAttachments, getCharacteristicSize, getCollidables, getConstrainers, getDensity, getDensityMode, getDynamicComponents, getEnergy, getForceEffectors, getGravity, getGravityMode, getImplicitIterations, getImplicitPrecision, getIntegrator, getMass, getMaterial, getMatrixSolver, getNodeMass, getNumInverted, getParticleDamping, getRestVolume, getSlaveObjectComponents, getStiffnessDamping, getStressPlotRange, getStressPlotRangeMode, getStressPlotRanging, getStressPlotRangingMode, getSurfaceRendering, getSurfaceRenderingMode, getToleranceType, getUnilateralImpulses, getUnilateralInfo, getUnilateralSizes, getVolume, hasState, isProfile, markers, maxFrictionConstraintSets, numElements, numNodes, propertyChanged, removeMarker, resetStressPlotRange, scaleMass, setBounds, setDensity, setDensityMode, setGravity, setGravity, setGravityMode, setImplicitIterations, setImplicitPrecision, setIntegrator, setLinearMaterial, setMatrixSolver, setMaxStepSize, setParticleDamping, setProfile, setStiffnessDamping, setStressPlotRange, setStressPlotRangeMode, setStressPlotRanging, setStressPlotRangingMode, setSurfaceRenderingMode, setToleranceType, setUnilateralImpulses, updateBounds, updateRestVolume, updateSlaveVel, updateVolume, validateMatrixSolver, zeroExternalForces
 
Methods inherited from class artisynth.core.mechmodels.MechSystemBase
addActivePosImpulse, addAttachmentJacobian, addAttachmentSolveBlocks, addGeneralSolveBlocks, addPosJacobian, addVelJacobian, applyAttachmentForces, buildMassMatrix, buildSolveMatrix, createState, createVelocityJacobian, getActiveForces, getActivePosDerivative, getActivePosState, getActivePosStateSize, getActiveStiffness, getActiveVelState, getActiveVelState, getActiveVelStateSize, getAttachmentConstraints, getAttachmentDerivatives, getBilateralConstraints, getBilateralConstraintSizes, getBilateralImpulses, getBilateralInfo, getDefaultStabilization, getDynamicsEnabled, getFrictionConstraints, getInitialState, getInverseMassMatrix, getMassMatrix, getNumBilateralImpulses, getNumUnilateralImpulses, getParametricForces, getParametricPosState, getParametricPosStateSize, getParametricPosTarget, getParametricVelState, getParametricVelStateSize, getParametricVelTarget, getPenetrationLimit, getSolveMatrixType, getSolver, getStabilization, getState, getStructureVersion, getUnilateralConstraints, getUnilateralConstraintSizes, getUnilateralImpulses, getUnilateralInfo, getUpdateForcesAtStepEnd, hasParameterizedType, initialize, numActiveComponents, numAttachedComponents, numParametricComponents, preadvance, printActiveStiffness, reduceVelocityJacobian, setActiveForces, setActivePosState, setActiveVelState, setBilateralImpulses, setDefaultStabilization, setDynamicsEnabled, setParametricForces, setParametricPosState, setParametricVelState, setPenetrationLimit, setStabilization, setState, setUnilateralImpulses, setUpdateForcesAtStepEnd, updateAttachmentPos, updateAttachmentVel, updateConstraints, updateForces, updatePosState, updateVelState, writeBilateralConstraintMatrix, writeMassMatrix, writeStiffnessMatrix
 
Methods inherited from class artisynth.core.modelbase.RenderableModelBase
createRenderProps, getRenderHints, getRenderProps, isSelectable, numSelectionQueriesNeeded, setRenderProps
 
Methods inherited from class artisynth.core.modelbase.ModelBase
copy, getInitialState, getMaxStepSize, hierarchyContainsReferences, setInitialState
 
Methods inherited from class artisynth.core.modelbase.ComponentList
add, add, addAll, addComponents, addFixed, addNumbered, clone, contains, contains, containsAll, ensureCapacity, findComponent, get, get, getChildren, getNavpanelDisplay, getNumberLimit, getShortName, getTypeParameter, hasChildren, indexOf, isEmpty, iterator, nextComponentNumber, numComponents, remove, remove, removeAll, removeAll, removeComponents, retainAll, setNavpanelDisplay, setNumberingStartAtOne, setShortName, size, toArray, toArray, updateNameMap
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, 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.util.ScalableUnits
scaleMass
 
Methods inherited from interface artisynth.core.mechmodels.MechSystemModel
checkVelocityStability, getAttachments, getConstrainers, getDynamicComponents, getForceEffectors, getSlaveObjectComponents
 
Methods inherited from interface artisynth.core.modelbase.Model
getMaxStepSize, initialize, preadvance
 
Methods inherited from interface artisynth.core.modelbase.ModelComponent
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, 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
 
Methods inherited from interface artisynth.core.modelbase.HasState
createState, getInitialState, getState, setState
 
Methods inherited from interface artisynth.core.mechmodels.MechSystem
addActivePosImpulse, addPosJacobian, addVelJacobian, buildMassMatrix, buildSolveMatrix, getActiveForces, getActivePosDerivative, getActivePosState, getActivePosStateSize, getActiveVelState, getActiveVelStateSize, getBilateralConstraints, getBilateralImpulses, getBilateralInfo, getFrictionConstraints, getInverseMassMatrix, getMassMatrix, getParametricForces, getParametricPosState, getParametricPosStateSize, getParametricPosTarget, getParametricVelState, getParametricVelStateSize, getParametricVelTarget, getSolveMatrixType, getStructureVersion, getUnilateralConstraints, getUnilateralImpulses, getUnilateralInfo, maxFrictionConstraintSets, numActiveComponents, numParametricComponents, setActiveForces, setActivePosState, setActiveVelState, setBilateralImpulses, setParametricForces, setParametricPosState, setParametricVelState, setUnilateralImpulses, updateConstraints, updateForces
 
Methods inherited from interface artisynth.core.mechmodels.Collidable
getMass
 
Methods inherited from interface artisynth.core.modelbase.ComponentListView
getName
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

abortOnInvertedElems

public static boolean abortOnInvertedElems

checkTangentStability

public static boolean checkTangentStability

noIncompressStiffnessDamping

public static boolean noIncompressStiffnessDamping

detJStepReductionLimit

public static double detJStepReductionLimit

DEFAULT_HARD_INCOMP

public static FemModel.IncompMethod DEFAULT_HARD_INCOMP

DEFAULT_SOFT_INCOMP

public static FemModel.IncompMethod DEFAULT_SOFT_INCOMP

defaultColorMap

public static ColorMapBase defaultColorMap

myProps

public static PropertyList myProps

defaultAutoGenerateSurface

public static boolean defaultAutoGenerateSurface

DEFAULT_SURFACEMESH_NAME

public static java.lang.String DEFAULT_SURFACEMESH_NAME
Constructor Detail

FemModel3d

public FemModel3d()

FemModel3d

public FemModel3d(java.lang.String name)
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 FemModel
Returns:
static information for all exported properties

setElementWidgetSize

public void setElementWidgetSize(double size)

getElementWidgetSize

public double getElementWidgetSize()

setElementWidgetSizeMode

public void setElementWidgetSizeMode(PropertyMode mode)

getElementWidgetSizeMode

public PropertyMode getElementWidgetSizeMode()

getCollidables

public void getCollidables(java.util.List<Collidable> list,
                           int level)
Specified by:
getCollidables in interface MechSystemModel

setComputeNodalStress

public void setComputeNodalStress(boolean enable)

setComputeNodalStrain

public void setComputeNodalStrain(boolean enable)

addMaterialBundle

public void addMaterialBundle(AuxMaterialBundle bundle)

removeMaterialBundle

public boolean removeMaterialBundle(AuxMaterialBundle bundle)

clearMaterialBundles

public void clearMaterialBundles()

getMaterialBundles

public RenderableComponentList<AuxMaterialBundle> getMaterialBundles()

getNodes

public PointList<FemNode3d> getNodes()
Specified by:
getNodes in class FemModel

getNode

public FemNode3d getNode(int idx)
Specified by:
getNode in class FemModel

getByNumber

public FemNode3d getByNumber(int num)
Description copied from class: ComponentList
Get the component with the specified number, or null if there is no such component.

Specified by:
getByNumber in interface ComponentListView<ModelComponent>
Specified by:
getByNumber in interface CompositeComponent
Overrides:
getByNumber in class ComponentList<ModelComponent>
Parameters:
num - number of the component
Returns:
component with specified number

getElementByNumber

public FemElement3d getElementByNumber(int num)

getElements

public RenderableComponentList<FemElement3d> getElements()
Specified by:
getElements in class FemModel

addNode

public void addNode(FemNode3d p)

addNumberedNode

public void addNumberedNode(FemNode3d p,
                            int number)

removeNode

public boolean removeNode(FemNode3d p)

getElement

public FemElement3d getElement(int idx)
Specified by:
getElement in class FemModel

getNodeNeighbors

public java.util.LinkedList<FemNodeNeighbor> getNodeNeighbors(FemNode3d node)

getElementNeighbors

public java.util.LinkedList<FemElement3d> getElementNeighbors(FemNode3d node)

addElement

public void addElement(FemElement3d e)

addNumberedElement

public void addNumberedElement(FemElement3d e,
                               int elemId)

removeElement

public boolean removeElement(FemElement3d e)

clearElements

public void clearElements()

addMarker

public void addMarker(FemMarker mkr)
Adds a marker to this FemModel. The element to which it belongs is determined automatically. If the marker's current position does not lie within the model, it is projected onto the model's surface.

Parameters:
mkr - marker point to add to the model

addNumberedMarker

public FemMarker addNumberedMarker(Point3d pos,
                                   int markerId)

updateStressAndStiffness

public void updateStressAndStiffness()

updateStress

public void updateStress()

getJacobianType

public int getJacobianType()
Description copied from interface: ForceEffector
Returns a code indicating the matrix type that results when the Jacobian terms of this force effector are added to the solve matrix. This should be a logical or-ing of either Matrix.SYMMETRIC or Matrix.POSITIVE_DEFINITE. The former should be set if adding the Jacobian terms preserves symmetry, and the latter should be set if positive definiteness if preserved. Both should be set if there is no Jacobian for this effector (i.e., the Jacobian methods are not implemented). Matrix types from all the force effectors are logically and-ed together to determine the type for the entire solve matrix.

Specified by:
getJacobianType in interface ForceEffector
Overrides:
getJacobianType in class FemModel
Returns:
solve matrix type resulting from adding Jacobian terms

addVelJacobian

public void addVelJacobian(SparseNumberedBlockMatrix M,
                           double s)
Description copied from interface: ForceEffector
Scales the components of the velocity Jacobian associated with this force effector and adds it to the supplied solve matrix M.

M is guaranteed to be the same matrix supplied in the most recent call to addSolveBlocks, and so implementations may choose to cache the relevant matrix blocks from that call, instead of retrieving them directly from M.

Specified by:
addVelJacobian in interface ForceEffector
Parameters:
M - solve matrix to which scaled velocity Jacobian is to be added
s - scaling factor for velocity Jacobian

addPosJacobian

public void addPosJacobian(SparseNumberedBlockMatrix M,
                           double s)
Description copied from interface: ForceEffector
Scales the components of the position Jacobian associated with this force effector and adds it to the supplied solve matrix M.

M is guaranteed to be the same matrix supplied in the most recent call to addSolveBlocks, and so implementations may choose to cache the relevant matrix blocks from that call, instead of retrieving them directly from M.

Specified by:
addPosJacobian in interface ForceEffector
Parameters:
M - solve matrix to which scaled position Jacobian is to be added
s - scaling factor for position Jacobian

addSolveBlocks

public void addSolveBlocks(SparseNumberedBlockMatrix S)
Description copied from interface: ForceEffector
Adds any needed blocks to a solve matrix in order to accomodate the Jacobian terms associated with this force effector. In general, blocks will be need to be added at locations given by the block indices (bi, bj), where bi and bj correspond to the solve indices (as returned by getSolveIndex) for all dynamic or attached components affected by this force effector.

Specified by:
addSolveBlocks in interface ForceEffector
Specified by:
addSolveBlocks in class FemModel
Parameters:
S - solve matrix to which blocks should be added

recursivelyInitialize

public void recursivelyInitialize(double t,
                                  int level)
Specified by:
recursivelyInitialize in interface MechSystemModel
Overrides:
recursivelyInitialize in class FemModel

advance

public StepAdjustment advance(double t0,
                              double t1,
                              int flags)
Description copied from class: ModelBase
Advances this object from time t0 to time t1.

If the method determines that the step size should be reduced, it can return a StepAdjustment object indicating the recommended reduction. Otherwise, the method may return null

Specified by:
advance in interface Model
Specified by:
advance in class ModelBase
Parameters:
t0 - current time (seconds)
t1 - new time to advance to (seconds)
flags - reserved for future use
Returns:
null, or a step adjustment recommendation

setSurfaceRendering

public void setSurfaceRendering(FemModel.SurfaceRender mode)
Overrides:
setSurfaceRendering in class FemModel

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
Overrides:
render in class FemModel
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.

getNodalPlotRange

public DoubleInterval getNodalPlotRange(FemModel.SurfaceRender rendering)

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 RenderableModelBase

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 RenderableModelBase
Parameters:
list - selected objects are appended to the end of this list
qid - index of the selection query

createGrid

public static FemModel3d createGrid(java.lang.String name,
                                    double widthX,
                                    double widthY,
                                    double widthZ,
                                    int numX,
                                    int numY,
                                    int numZ,
                                    double density)

createHexGrid

public static FemModel3d createHexGrid(java.lang.String name,
                                       double widthX,
                                       double widthY,
                                       double widthZ,
                                       int numX,
                                       int numY,
                                       int numZ,
                                       double density)

scan

public void scan(ReaderTokenizer rtok,
                 java.lang.Object ref)
          throws java.io.IOException
Description copied from class: ModelComponentBase
Scans this element from a ReaderTokenizer. The expected text format is assumed to be compatible with that produced by write.

Specified by:
scan in interface ModelComponent
Specified by:
scan in interface Scannable
Overrides:
scan in class ComponentList<ModelComponent>
Parameters:
rtok - Tokenizer from which to scan the element
ref - optional reference object which can be used for resolving references to other objects
Throws:
java.io.IOException - if an I/O or formatting error occured

postscan

public void postscan(java.util.Deque<ScanToken> tokens,
                     CompositeComponent ancestor)
              throws java.io.IOException
Description copied from interface: ModelComponent
Performs any required post-scanning for this component. This involves handling any information whose processing was deferred during the scan() method and stored in the token queue. The most common use of this method is to resolve the paths of component references, which may not have been created at the time of the initial scan() call.

Specified by:
postscan in interface ModelComponent
Overrides:
postscan in class ComponentList<ModelComponent>
Parameters:
tokens - token information that was stored during scan().
ancestor - ancestor component with respect to which reference component paths are defined.
Throws:
java.io.IOException

writeMesh

public void writeMesh(java.io.PrintWriter pw,
                      PolygonalMesh mesh)

scanMesh

public PolygonalMesh scanMesh(java.lang.String fileName)
                       throws java.io.IOException
Throws:
java.io.IOException

scanMesh

public PolygonalMesh scanMesh(ReaderTokenizer rtok)
                       throws java.io.IOException
Creates a triangular polygonal mesh from a list of faces whose vertices are described by FEM node numbers.

Throws:
java.io.IOException

writeSurfaceMesh

public void writeSurfaceMesh(java.io.PrintWriter pw)

writeSurfaceMesh

public void writeSurfaceMesh(java.lang.String fileName)

scanSurfaceMesh

public void scanSurfaceMesh(ReaderTokenizer rtok)
                     throws java.io.IOException
Throws:
java.io.IOException

scanSurfaceMesh

public void scanSurfaceMesh(java.lang.String fileName)
                     throws java.io.IOException
Throws:
java.io.IOException

transformGeometry

public void transformGeometry(AffineTransform3dBase X)
Description copied from interface: TransformableGeometry
Applies an affine transformation to the geometry of this object. This method should be equivalent to
 transformGeometry (X, this, 0);
 

Specified by:
transformGeometry in interface TransformableGeometry
Parameters:
X - affine transformation

transformGeometry

public void transformGeometry(AffineTransform3dBase X,
                              TransformableGeometry topObject,
                              int flags)
Description copied from interface: TransformableGeometry
Applies an affine transformation to the geometry of this object. If recursively invoked within a component hierarchy, then topComponent should be the component for which the method was initially invoked. The variable flags provides information about the context in which the transformation is being applied. At present, the available flags are TransformableGeometry.SIMULATING and TransformableGeometry.ARTICULATED.

Specified by:
transformGeometry in interface TransformableGeometry
Parameters:
X - affine transformation
topObject - component on which the method was initially invoked
flags - provides information about the context in which the transformation is being applied.

getIncompressible

public FemModel.IncompMethod getIncompressible()

setMaterial

public void setMaterial(FemMaterial mat)
Overrides:
setMaterial in class FemModel

getHardIncompMethod

public FemModel.IncompMethod getHardIncompMethod()

setIncompressible

public void setIncompressible(FemModel.IncompMethod method)

getHardIncompMethodRange

public Range getHardIncompMethodRange()

setSoftIncompMethod

public void setSoftIncompMethod(FemModel.IncompMethod method)

getSoftIncompMethod

public FemModel.IncompMethod getSoftIncompMethod()

getSoftIncompMethodRange

public Range getSoftIncompMethodRange()

getIncompCompliance

public double getIncompCompliance()

setIncompCompliance

public void setIncompCompliance(double c)

numTetElements

public int numTetElements()

numQuadraticElements

public int numQuadraticElements()

printANSYSNodes

public void printANSYSNodes(java.io.PrintWriter pw)
Prints the nodes of this FEM in a format which is compatible with ANSYS.

Parameters:
pw - PrintWriter to which nodes are written

printANSYSElements

public void printANSYSElements(java.io.PrintWriter pw)
Prints the elements of this FEM in a format which is compatible with ANSYS.

Parameters:
pw - PrintWriter to which elements are written

getSurfaceMeshVertex

public FemMeshVertex getSurfaceMeshVertex(FemNode node)

isSurfaceNode

public boolean isSurfaceNode(FemNode3d node)

createSurfaceMesh

public FemMesh createSurfaceMesh(java.util.Collection<FemElement> elems)

createSurfaceMesh

public FemMesh createSurfaceMesh(FemModel.ElementFilter efilter)

createFineSurfaceMesh

public FemMesh createFineSurfaceMesh(int resolution,
                                     FemModel.ElementFilter efilter)

getSurfaceMesh

public PolygonalMesh getSurfaceMesh()

isCollidable

public boolean isCollidable()
Specified by:
isCollidable in interface Collidable

addMesh

public FemMesh addMesh(MeshBase mesh)

addMesh

public FemMesh addMesh(java.lang.String name,
                       MeshBase mesh)

getMesh

public FemMesh getMesh(java.lang.String name)

getMeshes

public MeshComponentList<FemMesh> getMeshes()

getNumMeshes

public int getNumMeshes()

addMesh

public void addMesh(FemMesh surf)

removeMesh

public boolean removeMesh(FemMesh surf)

removeAllMeshes

public void removeAllMeshes()

setAutoGenerateSurface

public void setAutoGenerateSurface(boolean val)

isAutoGeneratingSurface

public boolean isAutoGeneratingSurface()

setSurfaceMesh

public FemMesh setSurfaceMesh(PolygonalMesh mesh)

invalidateSurfaceMesh

public void invalidateSurfaceMesh()

componentChanged

public void componentChanged(ComponentChangeEvent e)
Description copied from class: ComponentList
Notifies this composite component that a change has occured within one or more of its descendants. When this occurs, the composite may need to invalidate cached information that depends on the descendants.

This method should propagate the notification up the component hierarchy by calling notifyParentOfChange.

Specified by:
componentChanged in interface ComponentChangeListener
Specified by:
componentChanged in interface CompositeComponent
Overrides:
componentChanged in class ComponentList<ModelComponent>
Parameters:
e - optional argument giving specific information about the change

getSurfaceElement

public FemElement3d getSurfaceElement(Face face)

findContainingElement

public FemElement3d findContainingElement(Point3d pnt)
Returns the element within an FEM that contains a specified point, or null if there is no such element.

Parameters:
pnt - Point for which containing element is desired.
Returns:
containing element, or null.

findNearestSurfaceElement

public FemElement3d findNearestSurfaceElement(Point3d loc,
                                              Point3d pnt)
Returns the nearest surface element to a specified point, which is found by projecting the point onto the FEM surface. The location of the projection is returned in loc.

Parameters:
loc - Projected location of the point onto the surface.
pnt - Point for which nearest surface element is desired.
Returns:
Nearest surface element.

findNearestElement

public FemElement3d findNearestElement(Point3d loc,
                                       Point3d pnt)
Returns the element within an FEM that contains a specified point, or if there is no such element, finds the closest surface element.

Parameters:
loc - Location of the point, within the FEM or projected onto the surface.
pnt - Point for which the nearest element is desired.
Returns:
Nearest element.

findNearestNode

public FemNode3d findNearestNode(Point3d pnt,
                                 double maxDist)
Finds the nearest node to a specified point that is within a specified maximum distance. If no node is within the specified maximum distance, null is returned.

Parameters:
pnt - Point for which the nearest node should be located
maxDist - Maximum distance that the node must be from the point. If maxDist < 0, then null will be returned.
Returns:
Nearest point within the prescribed distance, or null if there is no such point

updateSlavePos

public void updateSlavePos()
Description copied from interface: HasSlaveObjects
Called when the system's dynamic position state changes, to update the position state of the slave objects.

Specified by:
updateSlavePos in interface HasSlaveObjects
Overrides:
updateSlavePos in class FemModel

markInvertedRestElements

public int markInvertedRestElements()

recursivelyFinalizeAdvance

public void recursivelyFinalizeAdvance(StepAdjustment stepAdjust,
                                       double t0,
                                       double t1,
                                       int flags,
                                       int level)
Specified by:
recursivelyFinalizeAdvance in interface MechSystemModel
Overrides:
recursivelyFinalizeAdvance in class MechSystemBase

invalidateStressAndStiffness

public void invalidateStressAndStiffness()
Overrides:
invalidateStressAndStiffness in class FemModel

invalidateRestData

public void invalidateRestData()
Overrides:
invalidateRestData in class FemModel

resetRestPosition

public void resetRestPosition()

updateConstraints

public double updateConstraints(double t,
                                int flags)
Specified by:
updateConstraints in interface Constrainer
Overrides:
updateConstraints in class FemModel

setBilateralImpulses

public int setBilateralImpulses(VectorNd lam,
                                double h,
                                int idx)
Specified by:
setBilateralImpulses in interface Constrainer
Overrides:
setBilateralImpulses in class FemModel

zeroImpulses

public void zeroImpulses()
Specified by:
zeroImpulses in interface Constrainer
Overrides:
zeroImpulses in class FemModel

getBilateralImpulses

public int getBilateralImpulses(VectorNd lam,
                                int idx)
Specified by:
getBilateralImpulses in interface Constrainer
Overrides:
getBilateralImpulses in class FemModel

getBilateralSizes

public void getBilateralSizes(VectorNi sizes)
Specified by:
getBilateralSizes in interface Constrainer
Overrides:
getBilateralSizes in class FemModel

addBilateralConstraints

public int addBilateralConstraints(SparseBlockMatrix GT,
                                   VectorNd dg,
                                   int numb,
                                   IntHolder changeCnt)
Specified by:
addBilateralConstraints in interface Constrainer
Overrides:
addBilateralConstraints in class FemModel

getBilateralInfo

public int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
                            int idx)
Specified by:
getBilateralInfo in interface Constrainer
Overrides:
getBilateralInfo in class FemModel

subdivideHexs

public void subdivideHexs(java.util.List<HexElement> hexs)

subdivideHex

public void subdivideHex(HexElement hex)

dispose

public void dispose()
Description copied from class: ModelBase
Called when the model is discarded. Disposes of any resources used.

Specified by:
dispose in interface Model
Specified by:
dispose in interface Disposable
Overrides:
dispose in class ModelBase

useAnsysNumbering

public void useAnsysNumbering()

scaleDistance

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

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

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)
Description copied from interface: CopyableComponent
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

getAuxStateComponents

public void getAuxStateComponents(java.util.List<HasAuxState> comps,
                                  int level)
Specified by:
getAuxStateComponents in interface MechSystemModel

advanceAuxState

public void advanceAuxState(double t0,
                            double t1)
Description copied from interface: HasAuxState
Called at the very beginning of the time step (in the system's preadvance() method) to perform any required updating of the component's state before the application in input probes or controllers. If no such updating is required, this method may do nothing.

Specified by:
advanceAuxState in interface HasAuxState
Parameters:
t0 - beginning time associated with the time step advance
t1 - end time associated with the time step advance

skipAuxState

public void skipAuxState(DataBuffer data)
Skips over the state information for this component contained in the supplied data buffer, starting at the current buffer offsets. Essentially this a dummy read; the buffer offsets should be advanced over the state information, but that information should not actually be stored in the component.

Specified by:
skipAuxState in interface HasAuxState
Parameters:
data - buffer containing the state information

getAuxState

public void getAuxState(DataBuffer data)
Description copied from interface: HasAuxState
Saves state information for this component by adding data to the supplied DataBuffer. Existing data in the buffer should not be disturbed.

Specified by:
getAuxState in interface HasAuxState
Overrides:
getAuxState in class MechSystemBase
Parameters:
data - buffer for storing the state values.

getInitialAuxState

public void getInitialAuxState(DataBuffer newData,
                               DataBuffer oldData)
Description copied from interface: HasAuxState
Saves initial state information data for this component by adding data to the supplied data buffer. Existing data in the buffer should not be disturbed.

If oldData is non-null, then this contains previously stored initial state information (starting at its current buffer offsets), which should be stored into newData in place of the current component state data. This may only be partially possible if the component's state structure has changed since oldData was written.

Specified by:
getInitialAuxState in interface HasAuxState
Parameters:
newData - buffer for storing the state values.
oldData - if non-null, contains old state information that should be written into newData in place of the current state information.

setAuxState

public void setAuxState(DataBuffer data)
Description copied from interface: HasAuxState
Restores the state for this component by reading from the supplied data buffer, starting at the current buffer offsets.

Specified by:
setAuxState in interface HasAuxState
Overrides:
setAuxState in class MechSystemBase
Parameters:
data - buffer containing the state information

copy

public FemModel3d 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 FemModel

getColorMap

public ColorMapBase getColorMap()

setColorMap

public void setColorMap(ColorMapBase colorMap)

getColorMapMode

public PropertyMode getColorMapMode()

setColorMapMode

public void setColorMapMode(PropertyMode mode)

createCollisionData

public DeformableCollisionData createCollisionData()
Specified by:
createCollisionData in interface Collidable