public abstract class FemElement3dBase extends FemElement implements PointAttachable, FrameAttachable
FemElement.ElementClass
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
setScannedNodesInPostscan, writeNodeRefsByNumber
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
COPY_REFERENCES, REST_POSITION
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
FemElement3dBase() |
Modifier and Type | Method and Description |
---|---|
void |
addConsistentGravity(Vector3d gacc) |
void |
addConsistentMass(SparseNumberedBlockMatrix M) |
void |
advanceState(double t0,
double t1)
If
HasNumericState.requiresAdvance() and HasNumericState.hasState() both return true , then this method is called each time step by the system integrator
to update this component's state. |
void |
clearRotationData()
Should be called only if we want to liberate rotation data memory for
some reason.
|
MatrixNd |
computeConsistentMass() |
double |
computeCovariance(Matrix3d C)
Computes the covariance of the element, assuming a uniform density
of one.
|
double |
computeDirectedRenderSize(Vector3d dir)
Compute size of an element's render coordinates along a specified
direction.
|
VectorNd |
computeGravityWeights() |
abstract void |
computeJacobian(Matrix3d J,
Vector3d ncoords) |
abstract void |
computeLocalPosition(Vector3d pnt,
Vector3d ncoords)
Compute position within element based on natural coordinates
|
void |
computeRenderCoordsAndGradient(Matrix3d F,
float[] coords)
Computes the current coordinates and deformation gradient at the
warping point, using render coordinates.
|
void |
connectToHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is added to the component hierarchy (i.e., added as
a child of another CompositeComponent).
|
boolean |
containsEdge(FemNode3d n0,
FemNode3d n1) |
boolean |
containsFace(FemNode3d n0,
FemNode3d n1,
FemNode3d n2) |
boolean |
containsFace(FemNode3d n0,
FemNode3d n1,
FemNode3d n2,
FemNode3d n3) |
boolean |
containsNode(FemNode3d n) |
abstract boolean |
coordsAreInside(Vector3d ncoords)
Queries whether or not a set of natural coordinates are inside this
element.
|
FemElement3dBase |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap)
Create a copy of this component.
|
FrameFem3dAttachment |
createFrameAttachment(Frame frame,
RigidTransform3d TFW)
Returns a FrameAttachment that attaches a
frame to this
component. |
static IntegrationPoint3d[] |
createIntegrationPoints(FemElement3dBase sampleElem,
double[] ncoords)
Create a set of integration points for a given element, using
a specified set of natural coordinates.
|
PointAttachment |
createPointAttachment(Point pnt)
Returns a PointAttachment that attaches
pnt
to this component. |
void |
disconnectFromHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is removed from the component hierarchy (i.e., removed as a
child of its parent).
|
IntegrationPoint3d[] |
getAllIntegrationPoints()
Returns all integration points actually used by this element, including
the warping point (see
getWarpingPoint() ). |
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.
|
Matrix3d |
getDeformation()
Returns the deformation matrix H of this element, computing it if
necessary.
|
Matrix3d |
getDeformation(PolarDecomposition3d polard)
Returns the deformation matrix H of this element, computing it if
necessary.
|
abstract void |
getdNds(Vector3d dNds,
int i,
Vector3d coords) |
abstract int[] |
getEdgeIndices() |
FemElement.ElementClass |
getElementClass() |
double |
getElementWidgetSize() |
PropertyMode |
getElementWidgetSizeMode() |
abstract int[] |
getFaceIndices() |
FaceNodes3d[] |
getFaces()
Returns an array of FaceNodes3d describing a set of faces
associated with this element.
|
FemModel3d |
getFemModel() |
Matrix3d |
getFrame() |
abstract double[] |
getIntegrationCoords()
Returns the natural coordinates and weights for the default integration
points associated with this element.
|
IntegrationData3d[] |
getIntegrationData() |
abstract IntegrationPoint3d[] |
getIntegrationPoints()
Returns the integration points associated with this element, not
including the warping point (see
getWarpingPoint() ). |
MatrixNd |
getIntegrationShapeMatrix()
Creates and returns a shape matrix for integration points of this
element.
|
Matrix3d |
getInvB()
Returns the inverse B matrix of this element, computing it if necessary.
|
Matrix3d |
getInvB(PolarDecomposition3d polard)
Returns the inverse B matrix of this element, computing it if necessary.
|
boolean |
getMarkerCoordinates(VectorNd coords,
Vector3d ncoords,
Point3d pnt,
boolean checkInside) |
abstract double |
getN(int i,
Vector3d coords) |
boolean |
getNaturalCoordinates(Vector3d coords,
Point3d pnt)
Calls
getNaturalCoordinates(Vector3d,Point3d,int)
with a default maximum number of iterations. |
int |
getNaturalCoordinates(Vector3d coords,
Point3d pnt,
int maxIters)
Given point p, get its natural coordinates with respect to this element.
|
int |
getNaturalCoordinatesGSS(Vector3d coords,
Point3d pnt,
int maxIters)
Given point p, get its natural coordinates with respect to this element.
|
MatrixNd |
getNodalAveragingMatrix()
Returns the nodal averaging matrix for this element, used for
extrapolating values from the integration points to the element nodes for
purposes of computing average nodal values.
|
abstract MatrixNd |
getNodalExtrapolationMatrix()
Returns the nodal extrapolation matrix for this element.
|
abstract double[] |
getNodeCoords() |
void |
getNodeCoords(Vector3d coords,
int nodeIdx) |
abstract double[] |
getNodeMassWeights() |
FemNodeNeighbor[][] |
getNodeNeighbors() |
FemNode3d[] |
getNodes() |
int |
getNumFaces() |
RotationMatrix3d |
getRotation()
Returns the rotation of this element, computing it if necessary.
|
RotationMatrix3d |
getRotation(PolarDecomposition3d polard)
Returns the rotation of this element, computing it if necessary.
|
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
StiffnessWarper3d |
getStiffnessWarper(double weight)
Retrieves the current stiffness warper.
|
abstract int[] |
getTriangulatedFaceIndices() |
IntegrationData3d |
getWarpingData() |
abstract IntegrationPoint3d |
getWarpingPoint()
Returns the special warping integration point which is located at
the center of the element and is used for computing stiffness warping and
other specialized applications.
|
void |
invalidateRestData()
Invalidate data that relies on the element's rest position,
such as rest Jacobians and the base stiffness for co-rotated
stiffness.
|
void |
invalidateRotationData()
Should be after node positions change and before subsequent calls to
getRotation() , getDeformation() , or getInvB() . |
boolean |
isInside(Point3d pnt)
Tests whether or not a point is inside an element.
|
boolean |
isInvertedAtRest()
Returns true if the rest position for this element results in a negative
Jacobian determinant for at least one integration point.
|
void |
notifyStateVersionChanged() |
int |
numAllIntegrationPoints()
Returns the number of integration points actually used by this element,
including the warping point.
|
abstract int |
numIntegrationPoints()
Returns the number of integration points actually used by this element
(not including the warping point, if any).
|
abstract void |
renderWidget(Renderer renderer,
double size,
RenderProps props) |
boolean |
requiresAdvance()
Returns
true if the state of this component must be
updated each time step using HasNumericState.advanceState(double, double) . |
void |
setElementWidgetSize(double size) |
void |
setElementWidgetSizeMode(PropertyMode mode) |
void |
setFrame(Matrix3dBase M)
Set reference frame information for this element.
|
void |
setNodes(FemNode3d[] nodes) |
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
void |
setStiffnessWarper(StiffnessWarper3d warper)
Explicitly sets a stiffness warper
|
FemNode3d[][] |
triangulateFace(FaceNodes3d face) |
addAugmentingMaterial, addAuxiliaryMaterial, computeCentroid, computeRestVolumes, computeVolumes, containsNode, createRenderProps, defaultRenderPropsAreNull, getAugmentingMaterials, getAuxiliaryMaterials, getDensity, getDensityMode, getEffectiveMaterial, getHardReferences, getIndex, getLocalNodeIndex, getMass, getMaterial, getPlasticDeformation, getPoint, getRestVolume, getSelection, getStateVersion, getStrainEnergy, getVolume, hasActiveNodes, hasControllableNodes, hasState, integrationPointsInterpolateToNodes, integrationPointsMapToNodes, invalidateMassIfNecessary, isDuplicatable, isInverted, isLinear, isMassExplicit, materialsAreInvertible, numAugmentingMaterials, numAuxiliaryMaterials, numberString, numNodes, numPoints, prerender, propertyChanged, removeAugmentingMaterial, removeAuxiliaryMaterial, render, render, scaleDistance, scaleMass, setDensity, setDensityMode, setExplicitMass, setIndex, setInverted, setMass, setMaterial, setPlasticDeformation, unsetExplicitMass, updateBounds, updateRestVolumeAndMass
getRenderHints, getRenderProps, isSelectable, isVisible, numSelectionQueriesNeeded, setRenderProps, setVisible, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, createTempFlag, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferences
getProperty
getChildren, hasChildren
postscan
isWritable, write
getAuxVarDerivative, getAuxVarState, numAuxVars, setAuxVarState
public static PropertyList myProps
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class FemElement
public FemElement.ElementClass getElementClass()
getElementClass
in class FemElement
public void setElementWidgetSize(double size)
public double getElementWidgetSize()
public void setElementWidgetSizeMode(PropertyMode mode)
public PropertyMode getElementWidgetSizeMode()
public FemModel3d getFemModel()
getFemModel
in class FemElement
public abstract double[] getNodeCoords()
public abstract double[] getNodeMassWeights()
public void getNodeCoords(Vector3d coords, int nodeIdx)
public FemNode3d[] getNodes()
getNodes
in class FemElement
public void setNodes(FemNode3d[] nodes)
public FemNodeNeighbor[][] getNodeNeighbors()
public boolean containsNode(FemNode3d n)
public abstract double[] getIntegrationCoords()
4*num
, where num
is the number of
coordinates, and the information for each coordinate consists of a
4-tuple giving the three natural coordinates followed by the weight.public abstract int numIntegrationPoints()
getIntegrationPoints()
, but in some cases (such as shell elements being
used as membrane elements), it will be less.public abstract IntegrationPoint3d[] getIntegrationPoints()
getWarpingPoint()
). In
some cases, such as with membrane elements, only the first n
points of these points are actaully used, where n is the number
returned by numIntegrationPoints()
.public int numAllIntegrationPoints()
numIntegrationPoints()
. In cases where
n = 1, the (one) integration point is also the warping
point, and so this method returns 1.public IntegrationPoint3d[] getAllIntegrationPoints()
getWarpingPoint()
). The number of
points equals numAllIntegrationPoints()
. The first n points
correspond to the first n points returned by getIntegrationPoints()
, where n is the number returned by numIntegrationPoints()
, and the last point is the warping point. In
cases where n = 1, there is only one integration point which is
also the warping point.public static IntegrationPoint3d[] createIntegrationPoints(FemElement3dBase sampleElem, double[] ncoords)
sampleElem
- representative elementncoords
- location of the integration points in natural coordinatespublic IntegrationData3d[] getIntegrationData()
public void invalidateRestData()
FemElement
invalidateRestData
in class FemElement
public RotationMatrix3d getRotation()
F = R HHere H is the deformation matrix, which is symmetric but not necessarily positive definite, in order to ensure that R is right-handed.
public RotationMatrix3d getRotation(PolarDecomposition3d polard)
getRotation()
for more details.polard
- if non-null, supplies a PolarDecomposition3d to be
used if needed for computing the polar decompositionpublic Matrix3d getDeformation()
getRotation()
for more details.public Matrix3d getDeformation(PolarDecomposition3d polard)
getRotation()
for more details.polard
- if non-null, supplies a PolarDecomposition3d to be
used if needed for computing the polar decompositionpublic Matrix3d getInvB()
inv(B) = inv (trace(H) - H)and is used in computing derivatives of quantities that depend on the rotation matrix R. See
getRotation()
for details about R and H.public Matrix3d getInvB(PolarDecomposition3d polard)
getInvB()
for details.polard
- if non-null, supplies a PolarDecomposition3d to be
used if needed for computing the polar decompositionpublic void invalidateRotationData()
getRotation()
, getDeformation()
, or getInvB()
.public void clearRotationData()
public abstract IntegrationPoint3d getWarpingPoint()
public IntegrationData3d getWarpingData()
public void setStiffnessWarper(StiffnessWarper3d warper)
warper
- new stiffness warper to usepublic StiffnessWarper3d getStiffnessWarper(double weight)
weight
- meta weighting to be applied to integration points
when updating the rest stiffness. Default value should be 1.0.public abstract boolean coordsAreInside(Vector3d ncoords)
true
if ncoords
are inside this element.public boolean isInside(Point3d pnt)
pnt
- point to check if is insidepublic boolean getMarkerCoordinates(VectorNd coords, Vector3d ncoords, Point3d pnt, boolean checkInside)
getMarkerCoordinates
in class FemElement
public boolean getNaturalCoordinates(Vector3d coords, Point3d pnt)
getNaturalCoordinates(Vector3d,Point3d,int)
with a default maximum number of iterations.coords
- Outputs the natural coordinates, and supplies (on input) an initial
guess as to their position.pnt
- A given point (in world coords)public int getNaturalCoordinates(Vector3d coords, Point3d pnt, int maxIters)
coords
argument that returned the
coordinates is used, on input, to supply an initial guess of the
coordinates. Zero is generally a safe guess.coords
- Outputs the natural coordinates, and supplies (on input) an initial
guess as to their position.pnt
- A given point (in world coords)maxIters
- Maximum number of Newton iterationspublic int getNaturalCoordinatesGSS(Vector3d coords, Point3d pnt, int maxIters)
coords
argument that returned the coordinates is
used, on input, to supply an initial guess of the coordinates.
Zero is generally a safe guess.coords
- Outputs the natural coordinates, and supplies (on input) an initial
guess as to their position.pnt
- A given point (in world coords)maxIters
- Maximum number of Newton iterationspublic MatrixNd getNodalAveragingMatrix()
getNodalExtrapolationMatrix()
.
However, since the purpose of this matrix is for computing nodal
averages, simpler matrices can sometimes be used, such as an identity or
permutation matrix that assigns the value at each node to that of a
specific integration point. Element subclasses may override this method
to supply such simplified matrices.public abstract MatrixNd getNodalExtrapolationMatrix()
getIntegrationShapeMatrix()
.public MatrixNd getIntegrationShapeMatrix()
p X n
matrix, where p is the number of
integration points and n is the number of nodes. Each row gives the
current nodal shape function values for a particular integration point.
The shape matrix maps data from the nodes to the integration points,
and so has inverse functionality to the matrix returned by
getNodalExtrapolationMatrix()
.
public abstract int[] getEdgeIndices()
public abstract int[] getFaceIndices()
public abstract int[] getTriangulatedFaceIndices()
public FemNode3d[][] triangulateFace(FaceNodes3d face)
public FaceNodes3d[] getFaces()
public int getNumFaces()
public abstract double getN(int i, Vector3d coords)
public abstract void computeLocalPosition(Vector3d pnt, Vector3d ncoords)
pnt
- position within elementncoords
- natural coordinatespublic void connectToHierarchy(CompositeComponent hcomp)
ModelComponentBase
When this method is called, ModelComponent.getParent()
will return the new
parent component; the system will have set this beforehand.
connectToHierarchy
in interface ModelComponent
connectToHierarchy
in class ModelComponentBase
hcomp
- hierarchy component to which this component,
or its ancestor, was attachedpublic void disconnectFromHierarchy(CompositeComponent hcomp)
ModelComponentBase
When this method is called, ModelComponent.getParent()
will still return this
original parent component; the system will set this to null
after.
disconnectFromHierarchy
in interface ModelComponent
disconnectFromHierarchy
in class ModelComponentBase
hcomp
- hierarchy component from which this component,
or its ancestor, was detachedpublic double computeCovariance(Matrix3d C)
Boundable
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.
computeCovariance
in interface Boundable
computeCovariance
in class FemElement
C
- returns the covariancepublic boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
true
if and only if CopyableComponent.isDuplicatable()
returns
true.getCopyReferences
in interface CopyableComponent
getCopyReferences
in class FemElement
refs
- list to which references are appendedancestor
- root node of the hierarchy from which references are to be excludedpublic FemElement3dBase copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
CopyableComponent
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
.copy
in interface CopyableComponent
copy
in class FemElement
flags
- flags to control the copyingcopyMap
- map to possible existing instances of referenced
componentspublic void setFrame(Matrix3dBase M)
M
to null
removes the frame information.M
- frame information (is copied by the method)public Matrix3d getFrame()
public abstract void renderWidget(Renderer renderer, double size, RenderProps props)
public double computeDirectedRenderSize(Vector3d dir)
public void computeRenderCoordsAndGradient(Matrix3d F, float[] coords)
F
- returns the deformation gradientcoords
- returns the current coordinatespublic PointAttachment createPointAttachment(Point pnt)
pnt
to this component. It should not be assumed that pnt
is currently connected to the component hierarchy, and no attempt
should be made to connect the returned attachment to the hierarchy;
the latter, if desired, is the responsibility of the caller.
In some cases, it may not be possible to attach the point at its present location. In that case, the method will create an attachment to the nearest feasible location.
createPointAttachment
in interface PointAttachable
pnt
- point for which an attachment should be createdpnt
to this componentpublic FrameFem3dAttachment createFrameAttachment(Frame frame, RigidTransform3d TFW)
frame
to this
component. Once attached the frame will follow the body around. The
initial pose of the frame is specified by TFW
, which gives
its position and orientation in world coordinates. If TFW
is
null
, then the current pose of the frame is used. If
frame
is null
, then a virtual attachment is
created at the initial pose specified by
TFW
. frame
and TFW
cannot both be
null
.
In some cases, it may not be possible to attach the frame at the requested location. In that case, the method will relocate the frame to the nearest feasible attachment location.
createFrameAttachment
in interface FrameAttachable
frame
- frame to be attachedTFW
- transform from (initial) frame coordinates to world
coordinatesframe
to this componentpublic VectorNd computeGravityWeights()
public MatrixNd computeConsistentMass()
public void addConsistentMass(SparseNumberedBlockMatrix M)
public void addConsistentGravity(Vector3d gacc)
public boolean isInvertedAtRest()
public void advanceState(double t0, double t1)
HasNumericState
HasNumericState.requiresAdvance()
and HasNumericState.hasState()
both return true
, then this method is called each time step by the system integrator
to update this component's state. For single step integrators, the method
is called once at the start of the integration, with t0
and
t1
set to the step's start and end times. For multi-step
integrators (such as Runge Kutta), the method is called for each
sub-step, with t0
and t1
set to the sub-step's time
bounds. Multi-step integrators will also use HasNumericState.getState(maspack.util.DataBuffer)
and
HasNumericState.setState(maspack.util.DataBuffer)
to save and restore state as required.advanceState
in interface HasNumericState
t0
- beginning time associated with the time step or sub-stept1
- end time associated with the time step or sub-steppublic boolean requiresAdvance()
true
if the state of this component must be
updated each time step using HasNumericState.advanceState(double, double)
.requiresAdvance
in interface HasNumericState
true
if advanceState
must be calledpublic void getState(DataBuffer data)
HasNumericState
getState
in interface HasNumericState
data
- buffer for storing the state values.public void setState(DataBuffer data)
HasNumericState
setState
in interface HasNumericState
data
- buffer containing the state informationpublic void notifyStateVersionChanged()
notifyStateVersionChanged
in class FemElement