public class NumericControlProbe extends NumericDataFunctionProbe
Probe.ExportProps, Probe.ImportExportFileInfo
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static double |
EXPLICIT_TIME |
static PropertyList |
myProps |
mySmallDisplay
useOldSaveMethod, writeStartStopTimeInSeconds
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
COPY_REFERENCES, REST_POSITION
Constructor and Description |
---|
NumericControlProbe() |
NumericControlProbe(int vsize,
double[] data,
double timeStep,
double startTime,
double stopTime) |
NumericControlProbe(java.lang.String fileName) |
Modifier and Type | Method and Description |
---|---|
void |
addData(double[] data,
double timeStep)
Adds one or more data samples to internal data list.
Samples can be evenly distributed with given time step or time of each sample can be explicitly set. |
void |
addData(double t,
double[] v) |
void |
addData(double t,
Vector v)
Adds data to internal data list.
|
void |
addData(double t,
VectorNd v)
Adds data to internal data list.
|
void |
addData(java.io.File file,
double timeStep) |
void |
addData(ReaderTokenizer rtok,
double timeStep) |
void |
apply(double t)
Interpolate data to specified time and set related properties values.
|
void |
applyData(VectorNd vec,
double t,
double trel)
Applies the current numeric data of this probe, as input in the argument
vec , and uses it to update the simulation for either
the current absolute time t or probe relative time
trel . |
java.lang.Object |
clone() |
ModelComponent |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap)
Create a copy of this component.
|
void |
createNumericList(int vsize) |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
boolean |
getCopyReferences(java.util.List<ModelComponent> refs,
ModelComponent ancestor)
Collects external references which must also be copied in order to
duplicate this component.
|
boolean |
getExtendData()
Returns true if data is to be extended past the last knot point
|
NumericList |
getInput() |
boolean |
isInput()
Returns true if this probe is an input probe, and false otherwise.
|
boolean |
isSettable() |
void |
load()
When called (perhaps by the Artsynth timeline), causes information about
this probe to be loaded from the attached file.
|
void |
loadEmpty() |
void |
read(java.io.File file,
boolean setTimes)
Reads the start and stop times, scale value, and data for this probe from
an ascii file.
|
void |
save()
When called (perhaps by the Artsynth timeline), causes information about
this probe to be written to the attached file.
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
boolean |
scanItem(ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens) |
void |
setAttachedFileName(java.lang.String fileName) |
void |
setAttachedFileName(java.lang.String fileName,
java.lang.String fmtStr) |
void |
setData(double sec) |
void |
setExtendData(boolean extend)
Enables extension of data past the last knot point.
|
void |
setVsize(int vsize) |
void |
setVsize(int vsize,
PlotTraceInfo[] traceInfos) |
void |
write(java.io.PrintWriter pw,
java.lang.String fmtStr)
Writes the start and stop times, scale value, and data for this probe to a
PrintWriter, using the format described for
read(File) . |
void |
writeItems(java.io.PrintWriter pw,
NumberFormat fmt,
CompositeComponent ancestor)
Write probe attributes to a PrintWriter
|
createState, getDataFunction, getInitialState, getState, hasState, isCloneable, isDuplicatable, setDataFunction, setState
applyDefaultDisplayRanges, clearData, decreaseDisplayRanges, dispose, export, getAttachedProperties, getData, getDefaultDisplayMax, getDefaultDisplayMin, getDefaultDisplayRange, getDisplay, getDrivers, getExportFileInfo, getExportProps, getFormat, getInterpolation, getInterpolationOrder, getLegend, getMatlabName, getMinMaxValues, getNumericList, getOrderedTraceIndex, getPlotTraceInfo, getRange, getRange, getTraceColor, getTraceLabel, getTraceManager, getValues, getVariables, getVsize, importData, importText, increaseDisplayRanges, isDisplayable, isEmpty, isPrintable, isSmallDisplayVisible, isTraceVisible, isValidVariableName, isWritable, loadFromMatlab, print, removeDisplay, removeLegend, resetTraceColors, resetTraceOrder, saveToMatlab, scaleNumericList, setDefaultDisplayRange, setDefaultDisplayRange, setFormat, setInterpolation, setInterpolationOrder, setLegend, setLegendLabels, setScale, setSmallDisplayVisible, setTraceColor, setTraceLabel, setTraceOrder, setTraceVisible, setValues, smoothWithMovingAverage, smoothWithSavitzkyGolay, swapPlotTraceOrder, updateDisplays, updateDisplays, updateDisplaysForPropertyChanges, updateDisplaysWithoutAutoRanging, writeText
getAttachedFile, getAttachedFileName, getChildren, getClippedVirtualTime, getDefaultScale, getDefaultStartTime, getDefaultStopTime, getDefaultUpdateInterval, getDuration, getExportFile, getExportFileName, getFileFromPath, getImportFile, getImportFileInfo, getImportFileName, getPathFromFile, getProperty, getScale, getStartTime, getStopTime, getTimelineTime, getTrack, getUpdateInterval, getVirtualTime, hasAttachedFile, hasChildren, isAttachedFileRelative, isEventTime, isScalable, nextEventTime, setExportFileName, setImportFileName, setInterval, setName, setScalable, setStartStopTimes, setStartTime, setStopTime, setTrack, setUpdateInterval
finalize, getModel, initialize, isActive, setActive, setModel, setModelFromComponent, write
checkFlag, checkName, checkNameUniqueness, clearFlag, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isScanning, isSelected, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferences
getProperty
getChildren, hasChildren
postscan
isWritable, write
public static final double EXPLICIT_TIME
public static PropertyList myProps
public NumericControlProbe()
public NumericControlProbe(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public NumericControlProbe(int vsize, double[] data, double timeStep, double startTime, double stopTime)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class NumericProbeBase
public void setExtendData(boolean extend)
extend
- true if data is to be extended past the last knot pointpublic boolean getExtendData()
public void read(java.io.File file, boolean setTimes) throws java.io.IOException
setTimes
is false.
setTimes
is false.
setTimes
is false.
2.0 10.0 1.2 linear 2 explicit 0.0 2.0 2.0 1.1 4.0 3.0 3.0 0.0 1.0specifies a probe with a start and stop time of 2 and 10 seconds, respectively, a scale value of 1.2, linear interpolation, 2 values at each knot point, and three knot points at times 0.0, 1.1, and 3.0. If knot time is given implicitly by a time setp, then time is assumed to start at 0. The following input
2000000000 3000000000 2.5 step 2 2.0 2.0 2.0 4.0 3.0 0.0 1.0specifies a probe with a start and stop time of 2 and 3 seconds, respectively, a scale value of 2.5, step interpolation, 2 values at each knot point, and three knot points with times of 0, 2.0, and 4.0 (given implicity by a step size of 2.0).
The character '#' is a comment character, causing all subsequent input up to the next new line to be ignored.
read
in class NumericProbeBase
file
- File from which to read the probe informationsetTimes
- if true
, sets the start time, stop time,
and scale values to those indicated at the head of the file. If
false
, these values are ignored.java.io.IOException
- if an I/O or format error occurred.public void write(java.io.PrintWriter pw, java.lang.String fmtStr) throws java.io.IOException
read(File)
. The format used for producing floating point numbers can be
controlled using a printf-style format string, details of which are
described in NumberFormat
.pw
- writer which accepts the outputfmtStr
- printf-style format string (if set to null then "%g" will be assumed,
which will produce full precision output).java.io.IOException
- if an I/O error occurs.public void setAttachedFileName(java.lang.String fileName)
setAttachedFileName
in class Probe
public void setAttachedFileName(java.lang.String fileName, java.lang.String fmtStr)
public void save() throws java.io.IOException
save
in class Probe
java.io.IOException
write(java.io.PrintWriter, java.lang.String)
public void loadEmpty()
public void load() throws java.io.IOException
public void addData(java.io.File file, double timeStep) throws java.io.IOException
java.io.IOException
public void addData(double[] data, double timeStep)
EXPLICIT_TIME
and before every data sample must be its temporal
information.NumericProbeBase.getVsize()
method.data
- data array, which can contain multiple data samplestimeStep
- time step in seconds or EXPLICIT_TIME
if data contains explicitly
set timestampspublic void addData(double t, VectorNd v)
t
- time in secondsv
- vector of valuesjava.lang.IllegalArgumentException
- if size of vector is not equal to NumericProbeBase.getVsize()
public void addData(double t, double[] v)
public void addData(double t, Vector v)
t
- time in secondsv
- vector of valuesjava.lang.IllegalArgumentException
- if size of vector is not equal to NumericProbeBase.getVsize()
public void addData(ReaderTokenizer rtok, double timeStep) throws java.io.IOException
addData
in class NumericProbeBase
java.io.IOException
public void applyData(VectorNd vec, double t, double trel)
vec
, and uses it to update the simulation for either
the current absolute time t
or probe relative time
trel
. The size of
vec
will equal the vector size of the probe (as returned by
NumericProbeBase.getVsize()
. Probe relative time is determined
from the probe's start time and scale factor
using trel = (t - startTime)/scale.
vec
- supplies the current numeric datat
- absolute time (seconds)trel
- probe relative timepublic void apply(double t)
apply
in class NumericProbeBase
t
- current timepublic boolean isSettable()
isSettable
in class Probe
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class NumericDataFunctionProbe
java.lang.CloneNotSupportedException
public NumericList getInput()
public boolean scanItem(ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
java.io.IOException
public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
ModelComponentBase
write
.scan
in interface ModelComponent
scan
in interface Scannable
scan
in class Probe
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objectsjava.io.IOException
- if an I/O or formatting error occuredpublic void writeItems(java.io.PrintWriter pw, NumberFormat fmt, CompositeComponent ancestor) throws java.io.IOException
Probe
pw
- writer to which components are writtenfmt
- format for floating point numbersancestor
- ancestor component which respect to which references are
expressedjava.io.IOException
- if an I/O error occurredpublic boolean isInput()
Probe
public void createNumericList(int vsize)
createNumericList
in class NumericProbeBase
public void setVsize(int vsize)
public void setVsize(int vsize, PlotTraceInfo[] traceInfos)
public boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
true
if and only if CopyableComponent.isDuplicatable()
returns
true.refs
- list to which references are appendedancestor
- root node of the hierarchy from which references are to be excludedpublic ModelComponent 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 CopyableComponent
copy
in class ModelComponentBase
flags
- flags to control the copyingcopyMap
- map to possible existing instances of referenced
components