public class PointFem3dAttachment extends PointAttachment implements ContactMaster
ModelComponent.NavpanelVisibility
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, myProps, NULL_OBJ, useCompactPathNames
COPY_REFERENCES, REST_POSITION
Constructor and Description |
---|
PointFem3dAttachment() |
PointFem3dAttachment(Point pnt) |
PointFem3dAttachment(Point pnt,
FemModel3d fem) |
PointFem3dAttachment(Point pnt,
FemNode[] nodes,
double[] coords) |
Modifier and Type | Method and Description |
---|---|
void |
add1DConstraintBlocks(SparseBlockMatrix GT,
int bj,
double scale,
ContactPoint cpnt,
Vector3d dir)
Adds blocks to the constraint matrix GT to implement a 1D constraint in a
specified direction.
|
void |
add2DConstraintBlocks(SparseBlockMatrix GT,
int bj,
double scale,
ContactPoint cpnt,
Vector3d dir0,
Vector3d dir1)
Adds blocks to the constraint matrix GT to implement a 2D constraint in
two specified directions.
|
void |
addMassToMasters() |
static void |
addMassToNodeMasters(FemNode[] nodes,
double[] weights,
double m)
Distribute a mass
m amongst the master nodes on the basis of
their coordinate weights. |
void |
addRelativeVelocity(Vector3d vel,
double scale,
ContactPoint cpnt)
Accumulate the velocity at the contact due to the current
velocity of the underlying dynamic components.
|
int |
addTargetJacobian(SparseBlockMatrix J,
int bi) |
void |
applyForces() |
int |
collectMasterComponents(java.util.HashSet<DynamicComponent> masters,
boolean activeOnly)
Collects all the underlying dynamic ``master'' components.
|
void |
computeForceOnMasters(VectorNd uvec,
Vector3d fc,
double scale,
ContactPoint cpnt,
SparseBlockMatrix S)
XXX Experimental XXX
Compute the forces on the masters resulting from a force
fc applied at the contact point, and accumulate them in uvec,
whose size should equal that of the system forces.
|
void |
computeNodeCoordinates() |
PointFem3dAttachment |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap)
Create a copy of this component.
|
static PointFem3dAttachment |
create(Point pnt,
FemElement3dBase elem,
Point3d loc,
double reduceTol)
Create an attachment that connects a point to a FemElement
within a specified element.
|
double |
getCoordinate(int idx) |
VectorNd |
getCoordinates() |
void |
getCurrentPos(Vector3d pos)
Returns the current position of the attached point, in world coordinates.
|
void |
getCurrentVel(Vector3d vel) |
boolean |
getDerivative(double[] buf,
int idx) |
FemElement |
getElement() |
MatrixBlock |
getGT(int idx)
Returns the transpose of the constraint matrix G associated
with the idx-th master component.
|
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list.
|
FemNode[] |
getNodes() |
void |
getRestPosition(Point3d pos) |
boolean |
isControllable()
Queries whether at least one of the underlying dynamic components is
controllable.
|
void |
mulSubGT(double[] ybuf,
int yoff,
double[] xbuf,
int xoff,
int idx)
Computes
|
void |
mulSubGTM(MatrixBlock D,
MatrixBlock M,
int idx)
Computes
|
void |
mulSubMG(MatrixBlock D,
MatrixBlock M,
int idx)
Computes
|
boolean |
setFromElement(Point3d pos,
FemElement elem) |
boolean |
setFromElement(Point3d pos,
FemElement elem,
double reduceTol) |
void |
setFromFem(Point3d pos,
FemModel3d fem) |
boolean |
setFromFem(Point3d pos,
FemModel3d fem,
boolean project) |
void |
setFromNodes(java.util.Collection<? extends FemNode> nodes,
VectorNd weights) |
void |
setFromNodes(FemNode[] nodes,
double[] weights) |
boolean |
setFromNodes(Point3d pos,
java.util.Collection<? extends FemNode> nodes) |
boolean |
setFromNodes(Point3d pos,
FemNode[] nodes) |
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) |
checkMasterBlocks, getCopyReferences, getMasters, getPoint, getSlave, invalidateMasters, isDuplicatable, notifyMastersOfPositionChange, numMasters
addBackRefs, addBackRefs, addConnectedMasterRefs, clone, connectAttachment, connectToHierarchy, disconnectFromHierarchy, getAttachment, oneMasterActive, oneMasterNotAttached, removeBackRefs, removeBackRefs, removeConnectedMasterRefs, setSlaveAffectsStiffness, slaveAffectsStiffness
checkFlag, checkName, checkNameUniqueness, clearFlag, createTempFlag, getAllPropertyInfo, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, 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
connectToHierarchy, disconnectFromHierarchy, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferences
getAllPropertyInfo, getProperty
getChildren, hasChildren
postscan
isWritable, write
public PointFem3dAttachment()
public PointFem3dAttachment(Point pnt)
public PointFem3dAttachment(Point pnt, FemModel3d fem)
public FemElement getElement()
public void setFromNodes(java.util.Collection<? extends FemNode> nodes, VectorNd weights)
public boolean setFromNodes(Point3d pos, java.util.Collection<? extends FemNode> nodes)
public void setFromNodes(FemNode[] nodes, double[] weights)
public boolean setFromElement(Point3d pos, FemElement elem)
public boolean setFromElement(Point3d pos, FemElement elem, double reduceTol)
public void setFromFem(Point3d pos, FemModel3d fem)
public boolean setFromFem(Point3d pos, FemModel3d fem, boolean project)
public VectorNd getCoordinates()
public double getCoordinate(int idx)
public void updatePosStates()
updatePosStates
in interface DynamicAttachment
updatePosStates
in class DynamicAttachmentBase
public void getCurrentPos(Vector3d pos)
PointAttachment
getCurrentPos
in class PointAttachment
pos
- used to return current point positionpublic void getCurrentVel(Vector3d vel)
public void updateVelStates()
updateVelStates
in interface DynamicAttachment
updateVelStates
in class DynamicAttachmentBase
public void updateAttachment()
updateAttachment
in interface DynamicAttachment
updateAttachment
in class DynamicAttachmentBase
public void applyForces()
applyForces
in interface DynamicAttachment
applyForces
in class PointAttachment
public void getRestPosition(Point3d pos)
public void mulSubGTM(MatrixBlock D, MatrixBlock M, int idx)
DynamicAttachmentBase
T D -= G Mwhere D and M are matrices associated with master and slave components, respectively, and G is the constraint matrix for the attachment.
mulSubGTM
in interface DynamicAttachment
mulSubGTM
in class DynamicAttachmentBase
D
- dependent matrix associated with a master componentM
- matrix associated with a slave componentpublic void mulSubMG(MatrixBlock D, MatrixBlock M, int idx)
DynamicAttachmentBase
D -= M Gwhere D and M are matrices associated with master and slave components, respectively, and G is the constraint matrix for the attachment.
mulSubMG
in interface DynamicAttachment
mulSubMG
in class DynamicAttachmentBase
D
- dependent matrix associated with a master componentM
- matrix associated with a slave componentpublic MatrixBlock getGT(int idx)
DynamicAttachmentBase
getGT
in interface DynamicAttachment
getGT
in class DynamicAttachmentBase
idx
- index of the master componentpublic void mulSubGT(double[] ybuf, int yoff, double[] xbuf, int xoff, int idx)
DynamicAttachmentBase
T y -= G xwhere y and x are vectors associated with master and slave components, respectively, and G is the constraint matrix for the attachment.
mulSubGT
in interface DynamicAttachment
mulSubGT
in class DynamicAttachmentBase
ybuf
- buffer into which to store resultyoff
- offset into ybufxbuf
- buffer containing right hand side vectorxoff
- offset into xbufidx
- master component indexpublic void writeItems(java.io.PrintWriter pw, NumberFormat fmt, CompositeComponent ancestor) throws java.io.IOException
writeItems
in class PointAttachment
java.io.IOException
public int addTargetJacobian(SparseBlockMatrix J, int bi)
addTargetJacobian
in class PointAttachment
public void computeNodeCoordinates()
public static PointFem3dAttachment create(Point pnt, FemElement3dBase elem, Point3d loc, double reduceTol)
pnt
- Point to be attachedelem
- FemElement3d to attach the point toloc
- 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.public static void addMassToNodeMasters(FemNode[] nodes, double[] weights, double m)
m
amongst the master nodes on the basis of
their coordinate weights. To guard against negative weights, we use their
absolute value and then renormalize so that they sum to unity. Negative
weights will occur when the attached point lies outside of an element
associated with the nodes.
Using absolute values is necessary because we are using a lumped mass formulation; if we instead used a consistent mass formulation, the resulting distributed normal mass would be
m weights weights^Twhich is symmetric positive definite and so there would be no need to guard against negative weights.
nodes
- nodes to which mass should be addedweights
- coordinate weights of each nodem
- mass to be distributedpublic void addMassToMasters()
addMassToMasters
in interface DynamicAttachment
addMassToMasters
in class DynamicAttachmentBase
public boolean getDerivative(double[] buf, int idx)
getDerivative
in interface DynamicAttachment
getDerivative
in class DynamicAttachmentBase
public FemNode[] getNodes()
public void getHardReferences(java.util.List<ModelComponent> refs)
ModelComponentBase
getHardReferences
in interface ModelComponent
getHardReferences
in class DynamicAttachmentBase
refs
- list to which hard references are appendedpublic PointFem3dAttachment 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 DynamicAttachmentComp
copy
in interface CopyableComponent
copy
in class PointAttachment
flags
- flags to control the copyingcopyMap
- map to possible existing instances of referenced
componentspublic void add1DConstraintBlocks(SparseBlockMatrix GT, int bj, double scale, ContactPoint cpnt, Vector3d dir)
ContactMaster
bj
,
while the block row(s) are determined internally by the solve indices of
the underlying dynamic components.add1DConstraintBlocks
in interface ContactMaster
GT
- constraint matrixbj
- block column indexscale
- TODOcpnt
- contact pointdir
- friction directionpublic void add2DConstraintBlocks(SparseBlockMatrix GT, int bj, double scale, ContactPoint cpnt, Vector3d dir0, Vector3d dir1)
ContactMaster
bj
, while the block row(s) are determined internally
by the solve indices of the underlying dynamic components.add2DConstraintBlocks
in interface ContactMaster
GT
- constraint matrixbj
- block column indexscale
- TODOcpnt
- contact pointdir0
- first friction directiondir1
- second friction directionpublic void addRelativeVelocity(Vector3d vel, double scale, ContactPoint cpnt)
ContactMaster
addRelativeVelocity
in interface ContactMaster
vel
- accumulates velocityscale
- TODOcpnt
- contact pointpublic void computeForceOnMasters(VectorNd uvec, Vector3d fc, double scale, ContactPoint cpnt, SparseBlockMatrix S)
ContactMaster
computeForceOnMasters
in interface ContactMaster
public boolean isControllable()
ContactMaster
isControllable
in interface ContactMaster
true
if at least one dynamic component is
controllablepublic int collectMasterComponents(java.util.HashSet<DynamicComponent> masters, boolean activeOnly)
ContactMaster
masters
, i.e., the number of components that were not already present
there.collectMasterComponents
in interface ContactMaster
masters
- set to which the dynamic components should be addedactiveOnly
- restrict collected components to those which are active