public abstract class PointSpringBase extends Spring implements RenderableComponent, ScalableUnits, HasNumericState
ModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibility| Modifier and Type | Field and Description |
|---|---|
static boolean |
myIgnoreCoriolisInJacobian |
static PropertyList |
myProps |
static boolean |
useMaterial |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNamesTRANSPARENT, TWO_DIMENSIONAL| Constructor and Description |
|---|
PointSpringBase(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
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. |
double |
computeDFdl(double l,
double ldot)
Computes the derivative of the tension F (acting along the unit vector
from the first to the second particle) with respect to spring length.
|
double |
computeDFdl(double l,
double ldot,
double ex)
Computes the derivative of the tension F (acting along the unit vector
from the first to the second particle) with respect to spring length.
|
double |
computeDFdldot(double l,
double ldot)
Computes the derivative of the tension F (acting along the unit vector
from the first to the second particle)with respect to the time derivative
of spring length.
|
double |
computeDFdldot(double l,
double ldot,
double ex)
Computes the derivative of the tension F (acting along the unit vector
from the first to the second particle)with respect to the time derivative
of spring length.
|
double |
computeF(double l,
double ldot)
Computes the tension F acting along the unit vector from the first to the
second particle.
|
double |
computeF(double l,
double ldot,
double ex)
Computes the tension F acting along the unit vector from the first to the
second particle.
|
boolean |
containsPoint(Point pnt)
Queries whether this spring contains a specified point.
|
ModelComponent |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap) |
static AxialMaterial |
createDefaultMaterial() |
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
int |
getAuxVarDerivative(double[] buf,
int idx)
If this component has auxiliary variables, returns the current values of
their derivatives in
buf, starting at the location idx. |
int |
getAuxVarState(double[] buf,
int idx)
If this component has auxiliary variables, returns their values in
buf, starting at the location idx. |
AxialMaterial |
getEffectiveMaterial() |
double |
getForceScaling()
Special method that checks if the material is an instance of
AxialMuscleMaterial, and if it is, returns the forceScaling of that
material.
|
abstract double |
getLength() |
abstract double |
getLengthDot() |
AxialMaterial |
getMaterial() |
static double |
getMaxForce(PointSpringBase s) |
abstract Point |
getPoint(int idx)
Returns the
idx-th point in this spring. |
float[] |
getRenderColor() |
int |
getRenderHints()
Returns a bit code giving rendering hints about this renderable.
|
RenderProps |
getRenderProps()
Returns the render properities for this object.
|
double |
getRestLength() |
void |
getSelection(java.util.LinkedList<java.lang.Object> list,
int qid)
Append to
list the component (or components) associated with
the qid-th selection query issued by this component's render
method. |
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
int |
getStateVersion()
Returns a version number for this component's state.
|
boolean |
hasState()
Queries if this component has state.
|
abstract int |
indexOfPoint(Point pnt)
Returns the index of a specified point in this spring, or -1 if the
point is not present.
|
boolean |
isSelectable()
Returns true if this object is in fact selectable.
|
void |
normalizeForceScaling()
Special method that checks if the material is an instance of
AxialMuscleMaterial, and if it is, sets the forceScaling to 1 and adjusts
the maxforce and damping accordingly.
|
int |
numAuxVars()
Returns the number of auxiliary variables associated with this
component, or 0 if there are no auxiliary variables.
|
abstract int |
numPoints()
Queries the number of points in this spring.
|
int |
numSelectionQueriesNeeded()
If this selectable manages its own selection (by issuing selection
queries within its
render method), then this method should
return the maximum number of selection queries that will be
required. |
void |
prerender(RenderList list)
Called prior to rendering to allow this object to update the internal
state required for rendering (such as by caching rendering coordinates).
|
abstract void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer. |
boolean |
requiresAdvance()
Returns
true if the state of this component must be
updated each time step using HasNumericState.advanceState(double, double). |
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMass(double s)
Scales all mass units.
|
int |
setAuxVarState(double[] buf,
int idx)
If this component has auxiliary variables, sets them from the values in
buf, starting at the location idx. |
static void |
setDamping(PointSpringBase s,
double d) |
void |
setLinearMaterial(double k,
double d) |
<T extends AxialMaterial> |
setMaterial(T mat) |
static void |
setMaxForce(PointSpringBase s,
double maxf) |
abstract void |
setPoint(int idx,
Point pnt)
Sets a point at a particular index.
|
void |
setRenderProps(RenderProps props)
Assigns a new set of render properties to this object.
|
void |
setRestLength(double l) |
abstract double |
setRestLengthFromPoints()
Sets the rest length of the spring from the current point locations
|
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
static void |
setStiffness(PointSpringBase s,
double k) |
abstract void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
applyForcescheckFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, 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, waitconnectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferencesgetPropertygetChildren, hasChildrenpostscanisWritable, writeaddPosJacobian, addSolveBlocks, addVelJacobian, getJacobianTypepublic static boolean myIgnoreCoriolisInJacobian
public static boolean useMaterial
public static PropertyList myProps
public PropertyList getAllPropertyInfo()
HasPropertiesgetAllPropertyInfo in interface HasPropertiesgetAllPropertyInfo in class ModelComponentBasepublic abstract int numPoints()
public abstract Point getPoint(int idx)
idx-th point in this spring.idx - point indexidx-th pointpublic abstract void setPoint(int idx,
Point pnt)
<
numPoints().idx - specifies point positionpnt - replacement pointpublic abstract int indexOfPoint(Point pnt)
pnt - point whose index is desiredpublic boolean containsPoint(Point pnt)
true if the spring contains the pointpublic static AxialMaterial createDefaultMaterial()
public AxialMaterial getMaterial()
public double getForceScaling()
public void normalizeForceScaling()
public void setLinearMaterial(double k,
double d)
public <T extends AxialMaterial> void setMaterial(T mat)
public AxialMaterial getEffectiveMaterial()
public abstract double getLength()
public abstract double getLengthDot()
public abstract double setRestLengthFromPoints()
public double getRestLength()
public void setRestLength(double l)
public RenderProps getRenderProps()
HasRenderPropsgetRenderProps in interface HasRenderPropspublic void setRenderProps(RenderProps props)
HasRenderPropsnull will remove render properties from this object.setRenderProps in interface HasRenderPropsprops - new render properties for this objectpublic RenderProps createRenderProps()
HasRenderPropscreateRenderProps in interface HasRenderPropspublic void prerender(RenderList list)
IsRenderablelist.addIfVisible (obj);
for each of the objects in question.prerender in interface IsRenderablelist - list of objects to be renderedpublic abstract void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderableupdateBounds in interface IsRenderablepmin - minimum pointpmax - maximum pointpublic int getRenderHints()
IsRenderableTRANSPARENT and
TWO_DIMENSIONAL.getRenderHints in interface IsRenderablepublic boolean isSelectable()
IsSelectableisSelectable in interface IsSelectablepublic int numSelectionQueriesNeeded()
IsSelectablerender method), then this method should
return the maximum number of selection queries that will be
required. Otherwise, this method should return -1.numSelectionQueriesNeeded in interface IsSelectablepublic abstract void render(Renderer renderer, int flags)
IsRenderableRenderer.render in interface IsRenderablerenderer - provides the functionality used to perform the rendering.flags - flags that may be used to control different
aspects of the rendering. Flags are defined in Renderer
and currently include
Renderer.HIGHLIGHT and
Renderer.SORT_FACES.public void getSelection(java.util.LinkedList<java.lang.Object> list,
int qid)
IsSelectablelist the component (or components) associated with
the qid-th selection query issued by this component's render
method. This will only be called if this component manages its own
selection (i.e., the number nums returned by IsSelectable.numSelectionQueriesNeeded() is positive), and qid will in
turn be a number between 0 and nums-1.getSelection in interface IsSelectablelist - selected objects are appended to the end of this listqid - index of the selection querypublic double computeF(double l,
double ldot)
l - spring lengthldot - spring length derivativepublic double computeF(double l,
double ldot,
double ex)
l - spring lengthldot - spring length derivativeex - excitation applied to the muscle materialpublic double computeDFdl(double l,
double ldot)
l - spring lengthldot - spring length derivativepublic double computeDFdl(double l,
double ldot,
double ex)
l - spring lengthldot - spring length derivativeex - excitation applied to the muscle materialpublic double computeDFdldot(double l,
double ldot)
l - spring lengthldot - spring length derivativepublic double computeDFdldot(double l,
double ldot,
double ex)
l - spring lengthldot - spring length derivativeex - excitation applied to the muscle materialpublic float[] getRenderColor()
public void scaleDistance(double s)
ScalableUnitsscaleDistance in interface ScalableUnitss - scaling factorpublic void scaleMass(double s)
ScalableUnitsscaleMass in interface ScalableUnitss - scaling factorpublic static void setStiffness(PointSpringBase s, double k)
public static void setDamping(PointSpringBase s, double d)
public static void setMaxForce(PointSpringBase s, double maxf)
public static double getMaxForce(PointSpringBase s)
public boolean hasState()
hasState in interface HasNumericStatehasState in interface ModelComponenthasState in class ModelComponentBasetrue if this component has statepublic int getStateVersion()
getStateVersion in interface HasNumericStatepublic void getState(DataBuffer data)
getState in interface HasNumericStatedata - buffer for storing the state values.public void setState(DataBuffer data)
setState in interface HasNumericStatedata - buffer containing the state informationpublic boolean requiresAdvance()
true if the state of this component must be
updated each time step using HasNumericState.advanceState(double, double).requiresAdvance in interface HasNumericStatetrue if advanceState must be calledpublic void advanceState(double t0,
double t1)
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 HasNumericStatet0 - beginning time associated with the time step or sub-stept1 - end time associated with the time step or sub-steppublic int numAuxVars()
If HasNumericState.hasState() returns true and the component has
auxiliary variables, the variables are updated each time step by the
system integrator using explcit integration of the form
w += h dwdtwhere
h is a time increment, w is a vector of variables
accessed using HasNumericState.getAuxVarState(double[], int) and HasNumericState.setAuxVarState(double[], int), and
dwdt is a time derivative obtained using HasNumericState.getAuxVarDerivative(double[], int). For single step integrators, this will be done
once at the start of the integration, with h set to the time step
size. For multi-step integrators (such as Runge Kutta), this will be done
at the start of each sub-step, with h set to the sub-step size.
If present, auxiliary variables are also assumed to be contained
within the state accessed using HasNumericState.getState(maspack.util.DataBuffer) and HasNumericState.setState(maspack.util.DataBuffer).
numAuxVars in interface HasNumericStatepublic int getAuxVarState(double[] buf,
int idx)
buf, starting at the location idx. See HasNumericState.numAuxVars() for
a description of auxiliary variables. The method returns idx +
num, where num is the number of variables.getAuxVarState in interface HasNumericStatebuf - returns the variable valuesidx - starting point within bufidx plus the number of variablespublic int setAuxVarState(double[] buf,
int idx)
buf, starting at the location idx. See HasNumericState.numAuxVars() for a description of auxiliary variables. The method
returns idx + num, where num is the number of variables.setAuxVarState in interface HasNumericStatebuf - contains the new variable valuesidx - starting point within bufidx plus the number of variablespublic int getAuxVarDerivative(double[] buf,
int idx)
buf, starting at the location idx.
See HasNumericState.numAuxVars() for a description of auxiliary variables. The
method returns idx + num, where num is the number of
variables.getAuxVarDerivative in interface HasNumericStatebuf - returns the variable derivative valuesidx - starting point within bufidx plus the number of variablespublic ModelComponent copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
copy in class ModelComponentBase