artisynth.core.mechmodels
Class DynamicAttachment

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.mechmodels.DynamicAttachment
All Implemented Interfaces:
ModelComponent, java.lang.Cloneable, HasProperties, HierarchyNode, Scannable
Direct Known Subclasses:
PointAttachment

public abstract class DynamicAttachment
extends ModelComponentBase


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
 
Constructor Summary
DynamicAttachment()
           
 
Method Summary
 void addAttachmentJacobian(SparseBlockMatrix S, VectorNd f, boolean[] reduced)
          Reduces the system matrix to account for this attachment.
abstract  void addMassToMaster(MatrixBlock mblk, MatrixBlock sblk, int i)
           
 void addSolveBlocks(SparseNumberedBlockMatrix S, boolean[] reduced)
           
abstract  void applyForces()
           
 java.lang.Object clone()
           
 void connectToHierarchy()
          Update the attachment position state whenever we connect to the parent (i.e., plug in to the hierarchy).
static boolean containsLoop(DynamicAttachment a, DynamicMechComponent slave, java.util.HashMap<DynamicMechComponent,DynamicAttachment> map)
           
static boolean containsLoops(java.util.List<DynamicAttachment> list)
           
 boolean containsMaster(DynamicMechComponent comp)
           
 DynamicAttachment copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
           
static java.util.ArrayList<DynamicAttachment> createOrderedList(java.util.List<DynamicAttachment> list)
           
abstract  boolean getDerivative(double[] buf, int idx)
           
abstract  DynamicMechComponent[] getMasters()
           
abstract  DynamicMechComponent getSlave()
          Returns the slave DynamicMechComponent associated with this attachment.
abstract  int getSlaveSolveIndex()
          Returns the block index within the system solve matrix of the slave DynamicMechComponent associated with this attachment.
 int numMasters()
           
 void reduceConstraints(SparseBlockMatrix GT, VectorNd dg)
          Reduces a sparse column matrix (such as the transpose of a constraint matrix) to account for this attachment.
 void reduceMass(SparseBlockMatrix M, VectorNd f)
           
 void reduceRowMatrix(SparseBlockMatrix G)
          Reduces a sparse row matrix (such as a constraint matrix) to account for this attachment.
abstract  void transformSlaveGeometry(AffineTransform3dBase X, TransformableGeometry topObject, int flags)
           
abstract  void updateAttachment()
          Update attachment to reflect changes in the slave state.
abstract  void updatePosStates()
           
abstract  void updateVelStates()
           
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, createTempFlag, disconnectFromHierarchy, getAllPropertyInfo, getChildren, getGrandParent, getHardReferences, 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
 

Constructor Detail

DynamicAttachment

public DynamicAttachment()
Method Detail

getMasters

public abstract DynamicMechComponent[] getMasters()

numMasters

public int numMasters()

containsMaster

public boolean containsMaster(DynamicMechComponent comp)

getSlave

public abstract DynamicMechComponent getSlave()
Returns the slave DynamicMechComponent associated with this attachment. In some cases, the attachment may connect some other entity (such as a mesh vertex) to the master components, in which case this method should return null.

Returns:
slave DynamicMechComponent, if any

getSlaveSolveIndex

public abstract int getSlaveSolveIndex()
Returns the block index within the system solve matrix of the slave DynamicMechComponent associated with this attachment. If there is no such component (see getSlave()), this method returns -1.

Returns:
solve index of slave DynamicMechComponent, or -1.

transformSlaveGeometry

public abstract void transformSlaveGeometry(AffineTransform3dBase X,
                                            TransformableGeometry topObject,
                                            int flags)

updatePosStates

public abstract void updatePosStates()

updateVelStates

public abstract void updateVelStates()

updateAttachment

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


applyForces

public abstract void applyForces()

reduceConstraints

public void reduceConstraints(SparseBlockMatrix GT,
                              VectorNd dg)
Reduces a sparse column matrix (such as the transpose of a constraint matrix) to account for this attachment. This is done by applying the transform
 GT = P GT
 
where
             T
     [ I -Gka  ]
 P = [         ]
     [ 0   0   ]
 
and Gka is the constraint matrix for this attachment.


reduceRowMatrix

public void reduceRowMatrix(SparseBlockMatrix G)
Reduces a sparse row matrix (such as a constraint matrix) to account for this attachment. This is done by applying the transform
        T
 G = G P
 
where
             T
     [ I -Gka  ]
 P = [         ]
     [ 0   0   ]
 
and Gka is the constraint matrix for this attachment.

At present, this method requires the matrix G to be vertically linked.


reduceMass

public void reduceMass(SparseBlockMatrix M,
                       VectorNd f)

addSolveBlocks

public void addSolveBlocks(SparseNumberedBlockMatrix S,
                           boolean[] reduced)

addAttachmentJacobian

public void addAttachmentJacobian(SparseBlockMatrix S,
                                  VectorNd f,
                                  boolean[] reduced)
Reduces the system matrix to account for this attachment. This is done by applying the transform
          T
 M = P M P
 
where
             T
     [ I -Gka  ]
 P = [         ]
     [ 0   0   ]
 
and Gka is the constraint matrix for this attachment.


addMassToMaster

public abstract void addMassToMaster(MatrixBlock mblk,
                                     MatrixBlock sblk,
                                     int i)

getDerivative

public abstract boolean getDerivative(double[] buf,
                                      int idx)

containsLoops

public static boolean containsLoops(java.util.List<DynamicAttachment> list)

containsLoop

public static boolean containsLoop(DynamicAttachment a,
                                   DynamicMechComponent slave,
                                   java.util.HashMap<DynamicMechComponent,DynamicAttachment> map)

createOrderedList

public static java.util.ArrayList<DynamicAttachment> createOrderedList(java.util.List<DynamicAttachment> list)

connectToHierarchy

public void connectToHierarchy()
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 ModelComponentBase

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class ModelComponentBase
Throws:
java.lang.CloneNotSupportedException

copy

public DynamicAttachment copy(int flags,
                              java.util.Map<ModelComponent,ModelComponent> copyMap)
Overrides:
copy in class ModelComponentBase