use of artisynth.core.modelbase.Model 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);
}
}
use of artisynth.core.modelbase.Model 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);
}
Aggregations