public abstract class ConstrainerBase extends ModelComponentBase implements Constrainer, HasNumericState
ModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibilityenforceUniqueCompositeNames, enforceUniqueNames, myNumber, myProps, NULL_OBJ, useCompactPathNames| Constructor and Description |
|---|
ConstrainerBase() |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
addBilateralConstraints(SparseBlockMatrix GT,
VectorNd dg,
int numb)
Appends the current bilateral force constraint matrix
Gc^T to the
matrix GT, by appending block columns to it. |
int |
addFrictionConstraints(SparseBlockMatrix DT,
java.util.ArrayList<FrictionInfo> finfo,
boolean prune,
int idx)
Appends the friction force constraint matrix
Dc^T to the matrix
DT, by appending block columns to it. |
int |
addUnilateralConstraints(SparseBlockMatrix NT,
VectorNd dn,
int numu)
Appends the current unilateral force constraint matrix
Nc^T to the
matrix NT, by appending block columns to it. |
abstract int |
getBilateralForces(VectorNd lam,
int idx)
Returns the bilateral forces that were most recently set for this
constrainer using
Constrainer.setBilateralForces(maspack.matrix.VectorNd, double, int). |
abstract int |
getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
int idx)
Returns constraint information for each row of the bilateral
constraint system
|
abstract void |
getBilateralSizes(VectorNi sizes)
Returns the sizes of each block column in the bilateral force constraint
matrix.
|
abstract void |
getConstrainedComponents(java.util.HashSet<DynamicComponent> comps)
Collected all the dynamic components constrained by this constrainer.
|
int |
getFrictionForces(VectorNd phi,
int idx)
Returns the friction forces that were most recently set for this
constrainer using
Constrainer.setFrictionForces(maspack.matrix.VectorNd, double, int). |
int |
getFrictionState(VectorNi state,
int idx) |
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
int |
getUnilateralForces(VectorNd the,
int idx)
Returns the unilateral forces that were most recently set for this
constrainer using
Constrainer.setUnilateralForces(maspack.matrix.VectorNd, double, int). |
int |
getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo,
int idx)
Returns constraint information for each row of the unilateral
constraint system
|
void |
getUnilateralSizes(VectorNi sizes)
Returns the sizes of each block column in the unilateral force constraint
matrix.
|
int |
getUnilateralState(VectorNi state,
int idx) |
boolean |
hasState()
Queries if this component has state.
|
int |
maxFrictionConstraintSets()
Returns the maximum number of friction constraint sets that can be
expected for this constraint.
|
abstract int |
setBilateralForces(VectorNd lam,
double s,
int idx)
Sets the bilateral forces that were computed to enforce this
constraint.
|
int |
setFrictionForces(VectorNd phi,
double s,
int idx)
Sets the friction forces that were computed to enforce this
constraint.
|
int |
setFrictionState(VectorNi state,
int idx) |
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
int |
setUnilateralForces(VectorNd the,
double s,
int idx)
Sets the unilateral forces that were computed to enforce this
constraint.
|
int |
setUnilateralState(VectorNi state,
int idx) |
abstract double |
updateConstraints(double t,
int flags)
Updates the current set of constraints, and returns the maximum
penetration
> 0 associated with all of them. |
abstract void |
zeroForces()
Zeros all bilateral and unilateral constraint forces in this constraint.
|
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, copy, createTempFlag, disconnectFromHierarchy, getAllPropertyInfo, getChildren, getGrandParent, getHardReferences, 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, writeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadvanceState, getAuxVarDerivative, getAuxVarState, getStateVersion, numAuxVars, requiresAdvance, setAuxVarStatepublic abstract void getBilateralSizes(VectorNi sizes)
Constrainersizes.getBilateralSizes in interface Constrainersizes - vector to which the block column sizes are appendedpublic abstract int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb)
ConstrainerGc^T to the
matrix GT, by appending block columns to it. If the argument
dg is non-null, it should be used to return the
velocity constraint time derivative, defined by
\dot Gc velstarting at the location
numb. In all cases, the method must
return an updated value of numb, incremented by the total row
size of Gc.addBilateralConstraints in interface ConstrainerGT - matrix to which the bilateral force contraint matrix
is appended.dg - if non-null, returns the velocity constraint time
derivativenumb - starting index for time derivative in dgnumbpublic abstract int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
ConstrainerGc vel = 0.This information is placed in pre-allocated
MechSystem.ConstraintInfo
structures in ginfo, starting at idx. The method must
return an updated value of idx, incremented by the number of
rows of Gc.
The constraint information to be set in ConstraintInfo includes:
dist // distance to the constraint surface. compliance // if > 0, gives constraint compliance value damping // damping; only used if compliance > 0 force // used for computing non-linear compliance
getBilateralInfo in interface Constrainerginfo - returns the constraint informationidx - starting location in ginfo for returning constraint
infoidxpublic abstract int setBilateralForces(VectorNd lam, double s, int idx)
Constrainerlam, starting at the index idx, and should be
scaled by s. (In practice, s is used to convert from
impulses to forces.) The method must return an updated value of idx, incremented by the number of forces associated with this constraint.setBilateralForces in interface Constrainerlam - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in lamidxpublic abstract int getBilateralForces(VectorNd lam, int idx)
ConstrainerConstrainer.setBilateralForces(maspack.matrix.VectorNd, double, int). The forces are returned in
lam, starting at the index idx. The method must return
an updated value of idx, incremented by the number of forces
associated with this constraint.getBilateralForces in interface Constrainerlam - returns the forcesidx - starting index for forces in lamidxpublic abstract void zeroForces()
ConstrainerzeroForces in interface Constrainerpublic void getUnilateralSizes(VectorNi sizes)
Constrainersizes.getUnilateralSizes in interface Constrainersizes - vector to which the block column sizes are appendedpublic int addUnilateralConstraints(SparseBlockMatrix NT, VectorNd dn, int numu)
ConstrainerNc^T to the
matrix NT, by appending block columns to it. If the argument
dn is non-null, it should be used to return the
velocity constraint time derivative, defined by
\dot Nc velstarting at the location
numu. In all cases, the method must
return an updated value of numu, incremented by the total row
size of Nc.addUnilateralConstraints in interface ConstrainerNT - matrix to which the unilateral force contraint matrix
is appended.dn - if non-null, returns the velocity constraint time
derivativenumu - starting index for time derivative in dnnumupublic int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
ConstrainerNc vel > 0.This information is placed in pre-allocated
MechSystem.ConstraintInfo
structures in ninfo, starting at idx. The method must
return an updated value of idx, incremented by the number of
rows of Nc.
The constraint information to be set in ConstraintInfo includes:
dist // distance to the constraint surface. compliance // if > 0, gives constraint compliance value damping // damping; only used if compliance > 0 force // used for computing non-linear compliance
getUnilateralInfo in interface Constrainerninfo - returns the constraint informationidx - starting location in ninfo for returning constraint
infoidxpublic int setUnilateralForces(VectorNd the, double s, int idx)
Constrainerthe, starting at the index idx, and should be
scaled by s. (In practice, s is used to convert from
impulses to forces.) The method must return an updated value of idx, incremented by the number of forces associated with this constraint.setUnilateralForces in interface Constrainerthe - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in theidxpublic int getUnilateralForces(VectorNd the, int idx)
ConstrainerConstrainer.setUnilateralForces(maspack.matrix.VectorNd, double, int). The forces are returned in
the, starting at the index idx. The method must return
an updated value of idx, incremented by the number of forces
associated with this constraint.getUnilateralForces in interface Constrainerthe - returns the forcesidx - starting index for forces in theidxpublic int setUnilateralState(VectorNi state, int idx)
setUnilateralState in interface Constrainerpublic int getUnilateralState(VectorNi state, int idx)
getUnilateralState in interface Constrainerpublic int maxFrictionConstraintSets()
Constrainerfinfo argument that is
passed to Constrainer.addFrictionConstraints(maspack.matrix.SparseBlockMatrix, java.util.ArrayList<maspack.spatialmotion.FrictionInfo>, boolean, int).maxFrictionConstraintSets in interface Constrainerpublic int addFrictionConstraints(SparseBlockMatrix DT, java.util.ArrayList<FrictionInfo> finfo, boolean prune, int idx)
ConstrainerDc^T to the matrix
DT, by appending block columns to it. Each block column in Dc^T corresponds to a friction constraint set, for which
information should be supplied in the pre-allocated FrictionInfo
structures in finfo, starting at idx. The method must
return an updated value of idx, incremented by the number of
friction constraint sets.addFrictionConstraints in interface ConstrainerDT - matrix to which the friction force contraint matrix
is appended.finfo - returns friction constraint information for each
block column in Dc^Tprune - restrict entries of DT to friction constraints
for which the contact force is > 0.idx - starting index for friction information in finfoidxpublic int setFrictionForces(VectorNd phi, double s, int idx)
phi, starting at the index idx, and should be
scaled by s. (In practice, s is used to convert from
impulses to forces.) The method must return an updated value of idx, incremented by the number of forces associated with this constraint.setFrictionForces in interface Constrainerphi - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in phiidxpublic int getFrictionForces(VectorNd phi, int idx)
Constrainer.setFrictionForces(maspack.matrix.VectorNd, double, int). The forces are returned in
phi, starting at the index idx. The method must return
an updated value of idx, incremented by the number of forces
associated with this constraint.getFrictionForces in interface Constrainerphi - returns the forcesidx - starting index for forces in phiidxpublic int setFrictionState(VectorNi state, int idx)
setFrictionState in interface Constrainerpublic int getFrictionState(VectorNi state, int idx)
getFrictionState in interface Constrainerpublic abstract double updateConstraints(double t,
int flags)
Constrainer> 0 associated with all of them. If no constraints are
presently active, returns -1.updateConstraints in interface Constrainerpublic abstract void getConstrainedComponents(java.util.HashSet<DynamicComponent> comps)
ConstrainergetConstrainedComponents in interface Constrainercomps - set to which constrained components should be addedpublic void getState(DataBuffer data)
HasNumericStategetState in interface HasNumericStatedata - buffer for storing the state values.public void setState(DataBuffer data)
HasNumericStatesetState in interface HasNumericStatedata - buffer containing the state informationpublic boolean hasState()
hasState in interface HasNumericStatehasState in interface ModelComponenthasState in class ModelComponentBasetrue if this component has state