artisynth.core.mfreemodels
Class MFreeElement3d

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

public class MFreeElement3d
extends FemElement
implements Boundable


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
MFreeElement3d(MFreeNode3d[] nodes)
           
 
Method Summary
 void addAuxiliaryMaterial(AuxiliaryMaterial mat)
           
 void addDilationalStiffness(int i, int j, double kp, Vector3d intGi, Vector3d intGj)
           
 void addDilationalStiffness(int i, int j, MatrixNd Rinv, MatrixBlock GT_i, MatrixBlock GT_j)
           
 void addIntegrationPoint(MFreeIntegrationPoint3d ipnt, IntegrationData3d idata, double iwgt, boolean updateVolumes)
           
 void addMaterialStiffness(int i, int j, Vector3d gi, Matrix6d D, SymmetricMatrix3d sig, Vector3d gj, double dv)
           
 void addNodeForce(Vector3d f, int i, boolean corotated)
           
 void addNodeStiffness(int i, int j, boolean corotated)
           
 void addPressureStiffness(int i, int j, Vector3d gi, double p, Vector3d gj, double dv)
           
 void clearState()
           
 void computeCentroid(Vector3d centroid)
          Computed the centroid of this element.
 double computeCovariance(Matrix3d C)
          Computes the covariance of the element, assuming a uniform density of one.
 void computeRenderCoordsAndGradient(Matrix3d F, float[] coords)
          Computes the current coordinates and deformation gradient at the warping point, using render coordinates.
 double computeVolumes()
          Computes the volume and partial volumes associated with this element.
 void computeWarping()
           
 void computeWarping(Matrix3d F, SymmetricMatrix3d P)
           
 void connectToHierarchy()
          Called by the system after this component is added to the component hierarchy (i.e., when it is added as a child of another CompositeComponent).
 void disconnectFromHierarchy()
          Called by the system after this component is removed from the component hierarchy (i.e., when it is removed as a child of its parent).
 PropertyList getAllPropertyInfo()
          Returns a list giving static information about all properties exported by this object.
 AuxiliaryMaterial[] getAuxiliaryMaterials()
           
 PolygonalMesh getBoundaryMesh()
           
 double getElementWidgetSize()
           
 PropertyMode getElementWidgetSizeMode()
           
 Matrix3d getFrame()
           
 MatrixBlock[] getIncompressConstraints()
          Returns an array of MatrixBlocks to be used as constraints to make the element incompressible.
 java.util.ArrayList<IntegrationData3d> getIntegrationData()
           
 IntegrationData3d getIntegrationData(int idx)
           
 java.util.ArrayList<int[]> getIntegrationIndices()
           
 int[] getIntegrationIndices(int idx)
           
 MFreeIntegrationPoint3d getIntegrationPoint(int idx)
           
 int getIntegrationPointIndex(IntegrationPoint3d pnt)
           
 java.util.ArrayList<MFreeIntegrationPoint3d> getIntegrationPoints()
           
 double getIntegrationWeight(int idx)
           
 VectorNd getIntegrationWeights()
           
 MFreeNode3d getNode(int idx)
           
 int getNodeIdx(MFreeNode3d node)
           
 MFreeNode3d[] getNodes()
           
 Point3d getPoint(int idx)
          Returns the idx-th point associated with this element.
 double getRestVolume()
           
 FemNodeNeighbor getStiffnessBlock(int i, int j)
           
 FemNodeNeighbor[][] getStiffnessBlocks()
           
 MFreeStiffnessWarper3d getStiffnessWarper()
           
 IntegrationData3d getWarpingData()
           
 MFreeIntegrationPoint3d getWarpingPoint()
           
 boolean isInside(Point3d pnt)
           
 boolean isInvertedAtRest()
           
 boolean isTermActive(int i, int j)
           
 boolean isTermActive(MFreeNode3d rowNode, MFreeNode3d colNode)
           
 int numAuxiliaryMaterials()
           
 int numIntegrationPoints()
           
 int numNodes()
           
 int numPoints()
          Returns the number of points associated with this element, if any, or zero otherwise.
 void prerender(RenderList list)
          Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer.
 boolean removeAuxiliaryMaterial(AuxiliaryMaterial mat)
           
 void render(GLRenderer renderer, int flags)
          Render this object using Open GL via the JOGL.
 void renderWidget(GLRenderer renderer, double size, RenderProps props, int flags)
           
 void renderWidget(GLRenderer renderer, RenderProps props, int flags)
           
 void setAllTermsActive(boolean act)
           
 void setBoundaryMesh(PolygonalMesh bmesh)
           
 void setColTermsActive(int j, boolean act)
           
 void setColTermsActive(MFreeNode3d node, boolean act)
           
 void setDiagonalTermsActive(boolean act)
           
 void setElementWidgetSize(double size)
           
 void setElementWidgetSizeMode(PropertyMode mode)
           
 void setFrame(Matrix3dBase M)
          Set reference frame information for this element.
 void setIntegrationData(java.util.ArrayList<IntegrationData3d> data)
           
 void setIntegrationPoints(java.util.ArrayList<MFreeIntegrationPoint3d> points)
           
 void setIntegrationPoints(java.util.ArrayList<MFreeIntegrationPoint3d> points, java.util.ArrayList<IntegrationData3d> data)
           
 void setIntegrationWeights(VectorNd weights)
           
 void setRestVolume(double vol)
           
 void setRowTermsActive(int i, boolean act)
           
 void setRowTermsActive(MFreeNode3d node, boolean act)
           
 void setTermActive(int i, int j, boolean act)
           
 void setTermActive(MFreeNode3d nodei, MFreeNode3d nodej, boolean act)
           
 void setTransposedStiffness()
           
 void setTransposedStiffness(int i, int j)
          Sets K[i][j] = K[j][i]^T
 void setVolume(double vol)
           
 void setWarpingPoint(MFreeIntegrationPoint3d warp)
           
 void setWarpingPoint(MFreeIntegrationPoint3d warp, IntegrationData3d data)
           
 void setWarpingPointData(IntegrationData3d data)
           
 void updateAllVolumes()
           
 void updateBounds(Point3d min, Point3d max)
          Update the minimum and maximum points for this object.
 void updateJacobiansAndGradients()
           
 void updateWarpingStiffness()
           
 
Methods inherited from class artisynth.core.femmodels.FemElement
containsNode, copy, createRenderProps, getCopyReferences, getDensity, getDensityMode, getEffectiveMaterial, getHardReferences, getIndex, getLocalNodeIndex, getMarkerCoordinates, getMass, getMaterial, getSelection, getVolume, hasActiveNodes, hasControllableNodes, integrationPointsMapToNodes, invalidateRestData, isDuplicatable, isInverted, numberString, propertyChanged, render, scaleDistance, scaleMass, setDensity, setDensityMode, setIndex, setInverted, setMass, setMaterial, updateNodeMasses
 
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, createTempFlag, 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
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

MFreeElement3d

public MFreeElement3d(MFreeNode3d[] nodes)
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 FemElement
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()

isInside

public boolean isInside(Point3d pnt)

isInvertedAtRest

public boolean isInvertedAtRest()

setAllTermsActive

public void setAllTermsActive(boolean act)

setColTermsActive

public void setColTermsActive(int j,
                              boolean act)

setRowTermsActive

public void setRowTermsActive(int i,
                              boolean act)

setTermActive

public void setTermActive(int i,
                          int j,
                          boolean act)

setDiagonalTermsActive

public void setDiagonalTermsActive(boolean act)

isTermActive

public boolean isTermActive(int i,
                            int j)

isTermActive

public boolean isTermActive(MFreeNode3d rowNode,
                            MFreeNode3d colNode)

getNodeIdx

public int getNodeIdx(MFreeNode3d node)

setColTermsActive

public void setColTermsActive(MFreeNode3d node,
                              boolean act)

setRowTermsActive

public void setRowTermsActive(MFreeNode3d node,
                              boolean act)

setTermActive

public void setTermActive(MFreeNode3d nodei,
                          MFreeNode3d nodej,
                          boolean act)

getNodes

public MFreeNode3d[] getNodes()
Specified by:
getNodes in class FemElement

getNode

public MFreeNode3d getNode(int idx)

numNodes

public int numNodes()
Overrides:
numNodes in class FemElement

numIntegrationPoints

public int numIntegrationPoints()

getIntegrationPoints

public java.util.ArrayList<MFreeIntegrationPoint3d> getIntegrationPoints()

getIntegrationPoint

public MFreeIntegrationPoint3d getIntegrationPoint(int idx)

getIntegrationPointIndex

public int getIntegrationPointIndex(IntegrationPoint3d pnt)

getIntegrationData

public java.util.ArrayList<IntegrationData3d> getIntegrationData()

getIntegrationData

public IntegrationData3d getIntegrationData(int idx)

getIntegrationIndices

public java.util.ArrayList<int[]> getIntegrationIndices()

getIntegrationIndices

public int[] getIntegrationIndices(int idx)

clearState

public void clearState()

getIntegrationWeights

public VectorNd getIntegrationWeights()

getIntegrationWeight

public double getIntegrationWeight(int idx)

setIntegrationWeights

public void setIntegrationWeights(VectorNd weights)

updateAllVolumes

public void updateAllVolumes()

addIntegrationPoint

public void addIntegrationPoint(MFreeIntegrationPoint3d ipnt,
                                IntegrationData3d idata,
                                double iwgt,
                                boolean updateVolumes)

setIntegrationData

public void setIntegrationData(java.util.ArrayList<IntegrationData3d> data)

setIntegrationPoints

public void setIntegrationPoints(java.util.ArrayList<MFreeIntegrationPoint3d> points,
                                 java.util.ArrayList<IntegrationData3d> data)

setIntegrationPoints

public void setIntegrationPoints(java.util.ArrayList<MFreeIntegrationPoint3d> points)

getWarpingPoint

public MFreeIntegrationPoint3d getWarpingPoint()

getWarpingData

public IntegrationData3d getWarpingData()

setWarpingPoint

public void setWarpingPoint(MFreeIntegrationPoint3d warp)

setWarpingPoint

public void setWarpingPoint(MFreeIntegrationPoint3d warp,
                            IntegrationData3d data)

setWarpingPointData

public void setWarpingPointData(IntegrationData3d data)

addAuxiliaryMaterial

public void addAuxiliaryMaterial(AuxiliaryMaterial mat)

removeAuxiliaryMaterial

public boolean removeAuxiliaryMaterial(AuxiliaryMaterial mat)

numAuxiliaryMaterials

public int numAuxiliaryMaterials()

getAuxiliaryMaterials

public AuxiliaryMaterial[] getAuxiliaryMaterials()

connectToHierarchy

public void connectToHierarchy()
Description copied from class: ModelComponentBase
Called by the system after this component is added to the component hierarchy (i.e., when it is added as a child of another CompositeComponent). This method is responsible for doing any required hierarchy-dependent initialization.

When this method is called, ModelComponent.getParent() will return the new parent component; the system will have set this beforehand.

Specified by:
connectToHierarchy in interface ModelComponent
Overrides:
connectToHierarchy in class ModelComponentBase

disconnectFromHierarchy

public void disconnectFromHierarchy()
Description copied from class: ModelComponentBase
Called by the system after this component is removed from the component hierarchy (i.e., when it is removed as a child of its parent). This method is responsible for any required hierarchy-dependent deinitialization.

When this method is called, ModelComponent.getParent() will still return this original parent component; the system will set this to null after.

Specified by:
disconnectFromHierarchy in interface ModelComponent
Overrides:
disconnectFromHierarchy in class ModelComponentBase

addNodeStiffness

public void addNodeStiffness(int i,
                             int j,
                             boolean corotated)

addMaterialStiffness

public void addMaterialStiffness(int i,
                                 int j,
                                 Vector3d gi,
                                 Matrix6d D,
                                 SymmetricMatrix3d sig,
                                 Vector3d gj,
                                 double dv)

addPressureStiffness

public void addPressureStiffness(int i,
                                 int j,
                                 Vector3d gi,
                                 double p,
                                 Vector3d gj,
                                 double dv)

addDilationalStiffness

public void addDilationalStiffness(int i,
                                   int j,
                                   double kp,
                                   Vector3d intGi,
                                   Vector3d intGj)

addDilationalStiffness

public void addDilationalStiffness(int i,
                                   int j,
                                   MatrixNd Rinv,
                                   MatrixBlock GT_i,
                                   MatrixBlock GT_j)

setTransposedStiffness

public void setTransposedStiffness()

setTransposedStiffness

public void setTransposedStiffness(int i,
                                   int j)
Sets K[i][j] = K[j][i]^T


addNodeForce

public void addNodeForce(Vector3d f,
                         int i,
                         boolean corotated)

updateWarpingStiffness

public void updateWarpingStiffness()

computeWarping

public void computeWarping()
Specified by:
computeWarping in class FemElement

computeWarping

public void computeWarping(Matrix3d F,
                           SymmetricMatrix3d P)

getStiffnessBlock

public FemNodeNeighbor getStiffnessBlock(int i,
                                         int j)

getStiffnessBlocks

public FemNodeNeighbor[][] getStiffnessBlocks()

getStiffnessWarper

public MFreeStiffnessWarper3d getStiffnessWarper()

computeCentroid

public void computeCentroid(Vector3d centroid)
Description copied from interface: Boundable
Computed the centroid of this element.

Specified by:
computeCentroid in interface Boundable
Parameters:
centroid - returns the computed centroid value.

computeCovariance

public double computeCovariance(Matrix3d C)
Description copied from interface: Boundable
Computes the covariance of the element, assuming a uniform density of one. The covariance is defined as
 int_V \rho x x^T dV,
 
where \rho is the density, x is any spatial point within the element, and the integral is evaluated over the element's spatial extent. The method returns the element's spatial size, which for elements of dimension 3, 2, 1, or 0 will be a volume, area, length, or discrete value.

Implementation of this method is optional, with non-implementation indicated by having the method return -1. Non-implementation may prevent the element from being enclosed within certain types of oriented bounding box (OBB) constructions.

Specified by:
computeCovariance in interface Boundable
Parameters:
C - returns the covariance
Returns:
spatial size of the element, or -1 if this method is not implemented.

updateBounds

public void updateBounds(Point3d min,
                         Point3d max)
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 Boundable
Specified by:
updateBounds in interface GLRenderable
Overrides:
updateBounds in class FemElement
Parameters:
min - minimum point
max - maximum point

getRestVolume

public double getRestVolume()
Overrides:
getRestVolume in class FemElement

setRestVolume

public void setRestVolume(double vol)

updateJacobiansAndGradients

public void updateJacobiansAndGradients()

computeVolumes

public double computeVolumes()
Description copied from class: FemElement
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.

Specified by:
computeVolumes in class FemElement
Returns:
minimum Jacobian value resulting from volume computation

setVolume

public void setVolume(double vol)

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 FemElement

renderWidget

public void renderWidget(GLRenderer renderer,
                         RenderProps props,
                         int flags)

renderWidget

public void renderWidget(GLRenderer renderer,
                         double size,
                         RenderProps props,
                         int flags)

setBoundaryMesh

public void setBoundaryMesh(PolygonalMesh bmesh)

getBoundaryMesh

public PolygonalMesh getBoundaryMesh()

computeRenderCoordsAndGradient

public void computeRenderCoordsAndGradient(Matrix3d F,
                                           float[] coords)
Computes the current coordinates and deformation gradient at the warping point, using render coordinates. This is used in element rendering.


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 FemElement
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.

setFrame

public void setFrame(Matrix3dBase M)
Set reference frame information for this element. This can be used for computing anisotropic material parameters. In principle, each integration point can have its own frame information, but this method simply sets the same frame information for all the integration points, storing it in each IntegrationData structure. Setting M to null removes the frame information.

Parameters:
M - frame information (is copied by the method)

getFrame

public Matrix3d getFrame()

getIncompressConstraints

public MatrixBlock[] getIncompressConstraints()
Returns an array of MatrixBlocks to be used as constraints to make the element incompressible. Note this method does not compute values for these constraints; it only returns storage for them.

Returns:
incompressibility constraints

numPoints

public int numPoints()
Description copied from interface: Boundable
Returns the number of points associated with this element, if any, or zero otherwise. If the element has points, then it's spatial extent is assumed to be enclosed within their convex hull. At present, elements that do not have points cannot be enclosed within oriented bounding box (OBB) trees.

Specified by:
numPoints in interface Boundable
Returns:
number of points associated with this element

getPoint

public Point3d getPoint(int idx)
Description copied from interface: Boundable
Returns the idx-th point associated with this element.

Specified by:
getPoint in interface Boundable
Parameters:
idx - index of the point (must be on the range 0 to Boundable.numPoints()).
Returns:
idx-th point associated with this element. Must not be modified.