Search in sources :

Example 1 with ImproperStateException

use of maspack.matrix.ImproperStateException in project artisynth_core by artisynth.

the class NumericOutputProbe method apply.

public void apply(double t) {
    if (myPropList == null) {
        throw new ImproperStateException("probe not initialized");
    }
    // XXX don't we want to apply scaling here too?
    double tloc = (t - getStartTime()) / myScale;
    NumericListKnot knot = new NumericListKnot(myVsize);
    int i = 0;
    for (NumericProbeVariable var : myVariables.values()) {
        Object obj = myPropList.get(i).get();
        var.setValues(myConverters[i].objectToArray(obj));
        i++;
    }
    updateJythonVariables(myVariables, tloc);
    int k = 0;
    double[] buf = knot.v.getBuffer();
    for (NumericProbeDriver driver : myDrivers) {
        double[] vals = driver.eval(myVariables, myJythonLocals);
        for (int j = 0; j < vals.length; j++) {
            buf[k++] = vals[j];
        }
    }
    knot.t = tloc;
    myNumericList.add(knot);
    myNumericList.clearAfter(knot);
}
Also used : NumericListKnot(maspack.interpolation.NumericListKnot) ImproperStateException(maspack.matrix.ImproperStateException)

Aggregations

NumericListKnot (maspack.interpolation.NumericListKnot)1 ImproperStateException (maspack.matrix.ImproperStateException)1