Search in sources :

Example 11 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class InverseManager method findOrCreateInputProbe.

public static NumericInputProbe findOrCreateInputProbe(RootModel root, String name) {
    NumericInputProbe inProbe;
    Probe p = root.getInputProbes().get(name);
    if (p != null && p instanceof NumericInputProbe) {
        inProbe = (NumericInputProbe) p;
    } else {
        inProbe = new NumericInputProbe();
        inProbe.setName(name);
        root.addInputProbe(inProbe);
    }
    return inProbe;
}
Also used : NumericInputProbe(artisynth.core.probes.NumericInputProbe) NumericOutputProbe(artisynth.core.probes.NumericOutputProbe) Probe(artisynth.core.probes.Probe) NumericInputProbe(artisynth.core.probes.NumericInputProbe)

Example 12 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class InverseManager method findOrCreateOutputProbe.

public static NumericOutputProbe findOrCreateOutputProbe(RootModel root, String name) {
    NumericOutputProbe outProbe;
    Probe p = root.getOutputProbes().get(name);
    if (p != null && p instanceof NumericOutputProbe) {
        outProbe = (NumericOutputProbe) p;
    } else {
        outProbe = new NumericOutputProbe();
        outProbe.setName(name);
        root.addOutputProbe(outProbe);
    }
    return outProbe;
}
Also used : NumericOutputProbe(artisynth.core.probes.NumericOutputProbe) NumericOutputProbe(artisynth.core.probes.NumericOutputProbe) Probe(artisynth.core.probes.Probe) NumericInputProbe(artisynth.core.probes.NumericInputProbe)

Example 13 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class RootModel method initialize.

/**
 * {@inheritDoc}
 */
public void initialize(double t) {
    if (!myModelInfoValid) {
        updateModelInfo();
        myModelInfoValid = true;
    }
    for (Probe p : myInputProbes) {
        p.initialize(t);
    }
    for (Controller c : myControllers) {
        c.initialize(t);
    }
    for (Iterator<Model> it = myModels.iterator(); it.hasNext(); ) {
        it.next().initialize(t);
    }
    for (Monitor m : myMonitors) {
        m.initialize(t);
    }
    for (Probe p : myOutputProbes) {
        p.initialize(t);
    }
}
Also used : Monitor(artisynth.core.modelbase.Monitor) Model(artisynth.core.modelbase.Model) Probe(artisynth.core.probes.Probe) TracingProbe(artisynth.core.probes.TracingProbe) WayPointProbe(artisynth.core.probes.WayPointProbe) Controller(artisynth.core.modelbase.Controller)

Example 14 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class RootModel method updateModelInfo.

private void updateModelInfo() {
    myRootInfo = new ModelInfo(this);
    // rebuild modelinfo, removing info for deleted models
    // and adding info for new models.
    LinkedHashMap<Model, ModelInfo> newinfo = new LinkedHashMap<Model, ModelInfo>();
    for (int i = 0; i < myModels.size(); i++) {
        // add model info for any new models
        Model model = myModels.get(i);
        ModelInfo info = myModelInfo.get(model);
        if (info != null) {
            info.clear();
        } else {
            info = new ModelInfo(model);
        }
        newinfo.put(model, info);
    }
    myModelInfo = newinfo;
    myRootInfo.clear();
    for (int i = 0; i < myMonitors.size(); i++) {
        Monitor mon = myMonitors.get(i);
        ModelInfo info = getModelInfo(mon);
        info.monitors.add(mon);
    }
    for (int i = 0; i < myControllers.size(); i++) {
        Controller ctl = myControllers.get(i);
        ModelInfo info = getModelInfo(ctl);
        info.controllers.add(ctl);
    }
    for (int i = 0; i < myInputProbes.size(); i++) {
        Probe p = myInputProbes.get(i);
        ModelInfo info = getModelInfo(p);
        info.inputProbes.add(p);
    }
    for (int i = 0; i < myOutputProbes.size(); i++) {
        Probe p = myOutputProbes.get(i);
        ModelInfo info = getModelInfo(p);
        info.outputProbes.add(p);
    }
    for (ModelInfo info : myModelInfo.values()) {
        info.createState();
    }
    myRootInfo.createState();
    myRootInfo.outputProbes.add(myWayPoints);
}
Also used : Monitor(artisynth.core.modelbase.Monitor) Model(artisynth.core.modelbase.Model) Controller(artisynth.core.modelbase.Controller) Probe(artisynth.core.probes.Probe) TracingProbe(artisynth.core.probes.TracingProbe) WayPointProbe(artisynth.core.probes.WayPointProbe) Point(java.awt.Point) WayPoint(artisynth.core.probes.WayPoint)

Example 15 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class RootModel method applyOutputProbes.

public synchronized void applyOutputProbes(List<Probe> list, double t1, ModelInfo info) {
    // see if t1 coincides with the model's max step size
    double maxStep = info.model.getMaxStepSize();
    boolean coincidesWithStep = (maxStep != -1 && TimeBase.modulo(t1, maxStep) == 0);
    for (Probe p : list) {
        if (!p.isActive() || TimeBase.compare(t1, p.getStartTime()) < 0 || TimeBase.compare(t1, p.getStopTime()) > 0) {
            continue;
        }
        if (p.isEventTime(t1) || (coincidesWithStep && p.getUpdateInterval() < 0)) {
            p.apply(t1);
        }
    }
}
Also used : Probe(artisynth.core.probes.Probe) TracingProbe(artisynth.core.probes.TracingProbe) WayPointProbe(artisynth.core.probes.WayPointProbe)

Aggregations

Probe (artisynth.core.probes.Probe)16 WayPointProbe (artisynth.core.probes.WayPointProbe)11 NumericInputProbe (artisynth.core.probes.NumericInputProbe)5 TracingProbe (artisynth.core.probes.TracingProbe)5 NumericOutputProbe (artisynth.core.probes.NumericOutputProbe)4 WayPoint (artisynth.core.probes.WayPoint)4 RootModel (artisynth.core.workspace.RootModel)3 SelectionManager (artisynth.core.gui.selectionManager.SelectionManager)2 Controller (artisynth.core.modelbase.Controller)2 Model (artisynth.core.modelbase.Model)2 Monitor (artisynth.core.modelbase.Monitor)2 Point (java.awt.Point)2 InternalErrorException (maspack.util.InternalErrorException)2 FemModel3d (artisynth.core.femmodels.FemModel3d)1 NumericProbeDisplayLarge (artisynth.core.gui.NumericProbeDisplayLarge)1 AddComponentsCommand (artisynth.core.gui.editorManager.AddComponentsCommand)1 NumericProbeEditor (artisynth.core.gui.probeEditor.NumericProbeEditor)1 MechModel (artisynth.core.mechmodels.MechModel)1 RigidBody (artisynth.core.mechmodels.RigidBody)1 CopyableComponent (artisynth.core.modelbase.CopyableComponent)1