artisynth.core.femmodels
Class PointFem3dAttachment

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.mechmodels.DynamicAttachment
          extended by artisynth.core.mechmodels.PointAttachment
              extended by artisynth.core.femmodels.PointFem3dAttachment
All Implemented Interfaces:
CopyableComponent, ModelComponent, java.lang.Cloneable, HasProperties, HierarchyNode, Scannable

public class PointFem3dAttachment
extends PointAttachment


Nested Class Summary
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Field Summary
 
Fields inherited from class artisynth.core.modelbase.ModelComponentBase
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, myProps, NULL_OBJ, useCompactPathNames
 
Fields inherited from interface artisynth.core.modelbase.CopyableComponent
COPY_REFERENCES
 
Constructor Summary
PointFem3dAttachment()
           
PointFem3dAttachment(Point pnt)
           
PointFem3dAttachment(Point pnt, FemElement elem)
           
PointFem3dAttachment(Point pnt, FemNode[] nodes)
           
PointFem3dAttachment(Point pnt, FemNode[] nodes, double[] coords)
           
 
Method Summary
 void addMassToMaster(MatrixBlock mblk, MatrixBlock sblk, int idx)
           
 void addScaledExternalForce(Point3d pnt, double s, Vector3d f)
          Distributes an external force applied at a particular point to all masters
 int addTargetJacobian(SparseBlockMatrix J, int bi)
           
 void applyForces()
           
 void computeNodeCoordinates()
           
 void computePosState(Vector3d pos)
           
 void connectToHierarchy()
          Update the attachment position state whenever we connect to the parent (i.e., plug in to the hierarchy).
 PointFem3dAttachment copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
          Create a copy of this component.
static PointFem3dAttachment create(Point pnt, FemElement3d elem, Point3d loc, double reduceTol)
          Create an attachment that connects a point to a FemElement.
 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).
 VectorNd getCoordinates()
           
 boolean getDerivative(double[] buf, int idx)
           
 void getHardReferences(java.util.List<ModelComponent> refs)
          Appends all hard references for this component to a list.
 FemNode[] getMasters()
           
 void getRestPosition(Point3d pos)
           
 void mulSubG(MatrixBlock depBlk, MatrixBlock blk, int idx)
          Computes
 void mulSubGT(double[] ybuf, int yoff, double[] xbuf, int xoff, int idx)
          Computes
 void mulSubGT(MatrixBlock depBlk, MatrixBlock blk, int idx)
          Computes
 int numMasters()
           
 void setFromElement(FemElement elem)
          Sets the element associated with this attachment.
 void setNodes(java.util.Collection<FemNode> nodes, java.util.Collection<java.lang.Double> coords)
           
 void setNodes(FemNode[] nodes, double[] coords)
           
 void setPoint(Point pnt)
           
 void transformSlaveGeometry(AffineTransform3dBase X, TransformableGeometry topObject, int flags)
           
 void updateAttachment()
          Update attachment to reflect changes in the slave state.
 void updatePosStates()
           
 void updateVelStates()
           
 void writeItems(java.io.PrintWriter pw, NumberFormat fmt, CompositeComponent ancestor)
           
 
Methods inherited from class artisynth.core.mechmodels.PointAttachment
getCopyReferences, getPoint, getSlave, getSlaveSolveIndex, isDuplicatable
 
Methods inherited from class artisynth.core.mechmodels.DynamicAttachment
addAttachmentJacobian, addSolveBlocks, clone, containsLoop, containsLoops, containsMaster, createOrderedList, reduceConstraints, reduceMass, reduceRowMatrix
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, createTempFlag, getAllPropertyInfo, 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
getAllPropertyInfo, getProperty
 
Methods inherited from interface maspack.properties.HierarchyNode
getChildren, hasChildren
 
Methods inherited from interface maspack.util.Scannable
isWritable, write
 

Constructor Detail

PointFem3dAttachment

public PointFem3dAttachment()

PointFem3dAttachment

public PointFem3dAttachment(Point pnt)

PointFem3dAttachment

public PointFem3dAttachment(Point pnt,
                            FemElement elem)

PointFem3dAttachment

public PointFem3dAttachment(Point pnt,
                            FemNode[] nodes)

PointFem3dAttachment

public PointFem3dAttachment(Point pnt,
                            FemNode[] nodes,
                            double[] coords)
Method Detail

setPoint

public void setPoint(Point pnt)

getMasters

public FemNode[] getMasters()
Specified by:
getMasters in class DynamicAttachment

numMasters

public int numMasters()
Overrides:
numMasters in class DynamicAttachment

addScaledExternalForce

public void addScaledExternalForce(Point3d pnt,
                                   double s,
                                   Vector3d f)
Description copied from class: PointAttachment
Distributes an external force applied at a particular point to all masters

Specified by:
addScaledExternalForce in class PointAttachment
Parameters:
pnt - point at which to apply the force (to be used to compute a wrench)
s - force scale factor
f - force vector to apply

setNodes

public void setNodes(java.util.Collection<FemNode> nodes,
                     java.util.Collection<java.lang.Double> coords)

setNodes

public void setNodes(FemNode[] nodes,
                     double[] coords)

setFromElement

public void setFromElement(FemElement elem)
Sets the element associated with this attachment. If present, this is used solely for updating the nodal coordinates in the method updateAttachment


getCoordinates

public VectorNd getCoordinates()

updatePosStates

public void updatePosStates()
Specified by:
updatePosStates in class DynamicAttachment

computePosState

public void computePosState(Vector3d pos)
Specified by:
computePosState in class PointAttachment

updateVelStates

public void updateVelStates()
Specified by:
updateVelStates in class DynamicAttachment

updateAttachment

public void updateAttachment()
Update attachment to reflect changes in the slave state.

Specified by:
updateAttachment in class DynamicAttachment

applyForces

public void applyForces()
Specified by:
applyForces in class DynamicAttachment

getRestPosition

public void getRestPosition(Point3d pos)

mulSubGT

public void mulSubGT(MatrixBlock depBlk,
                     MatrixBlock blk,
                     int idx)
Description copied from class: DynamicAttachment
Computes
       T
 D -= G  B
 
where D and B are matrices associated with master and slave components, respectively, and G is the constraint matrix for the attachment.

Parameters:
depBlk - dependent matrix associated with a master component
blk - matrix associated with a slave component

mulSubG

public void mulSubG(MatrixBlock depBlk,
                    MatrixBlock blk,
                    int idx)
Description copied from class: DynamicAttachment
Computes
 D -= B G
 
where D and B are matrices associated with master and slave components, respectively, and G is the constraint matrix for the attachment.

Parameters:
depBlk - dependent matrix associated with a master component
blk - matrix associated with a slave component

mulSubGT

public void mulSubGT(double[] ybuf,
                     int yoff,
                     double[] xbuf,
                     int xoff,
                     int idx)
Description copied from class: DynamicAttachment
Computes
       T
 y -= G  x
 
where y and x are vectors associated with master and slave components, respectively, and G is the constraint matrix for the attachment.

Parameters:
ybuf - buffer into which to store result
yoff - offset into ybuf
xbuf - buffer containing right hand side vector
xoff - offset into xbuf
idx - master component index

writeItems

public void writeItems(java.io.PrintWriter pw,
                       NumberFormat fmt,
                       CompositeComponent ancestor)
                throws java.io.IOException
Overrides:
writeItems in class PointAttachment
Throws:
java.io.IOException

transformSlaveGeometry

public void transformSlaveGeometry(AffineTransform3dBase X,
                                   TransformableGeometry topObject,
                                   int flags)
Specified by:
transformSlaveGeometry in class DynamicAttachment

addTargetJacobian

public int addTargetJacobian(SparseBlockMatrix J,
                             int bi)

computeNodeCoordinates

public void computeNodeCoordinates()

create

public static PointFem3dAttachment create(Point pnt,
                                          FemElement3d elem,
                                          Point3d loc,
                                          double reduceTol)
Create an attachment that connects a point to a FemElement. If the point lies outside the model, then the attachment will be created for the location determined by projecting the point into the nearest element and the new location will be returned in loc.

Parameters:
pnt - Point to be attached
elem - FemElement3d to attach the point to
loc - point location with respect to the element. If null, will be assumed to be pnt.getPosition().
reduceTol - try to reduce the number of attached nodes by removing those whose coordinate values are less then this number. A value of zero ensures no reduction. If reduction is desired, a value around 1e-5 is reasonable.
Returns:
an attachment for

addMassToMaster

public void addMassToMaster(MatrixBlock mblk,
                            MatrixBlock sblk,
                            int idx)
Specified by:
addMassToMaster in class DynamicAttachment

getDerivative

public boolean getDerivative(double[] buf,
                             int idx)
Specified by:
getDerivative in class DynamicAttachment

connectToHierarchy

public void connectToHierarchy()
Description copied from class: DynamicAttachment
Update the attachment position state whenever we connect to the parent (i.e., plug in to the hierarchy).

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

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

getHardReferences

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

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

copy

public PointFem3dAttachment 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 PointAttachment