Commit 3c2a3b1f authored by Kyle Beauchamp's avatar Kyle Beauchamp
Browse files

Add support for customIntegrator serialization and test

parent c2166480
......@@ -107,6 +107,12 @@ void* CustomIntegratorProxy::deserialize(const SerializationNode& node) const {
integrator->addConstrainVelocities();
} else if(computationType == CustomIntegrator::UpdateContextState) {
integrator->addUpdateContextState();
} else if(computationType == CustomIntegrator::IfBlockStart) {
integrator->beginIfBlock(cit->getStringProperty("computationExpression"));
} else if(computationType == CustomIntegrator::WhileBlockStart) {
integrator->beginWhileBlock(cit->getStringProperty("computationExpression"));
} else if(computationType == CustomIntegrator::BlockEnd) {
integrator->endBlock();
} else {
throw(OpenMMException("Custom Integrator Deserialization: Unknown computation type"));
}
......
......@@ -137,12 +137,20 @@ void testSerializeCustomIntegrator() {
intg->addGlobalVariable("oute", 0);
intg->addGlobalVariable("oute1", 0);
intg->addGlobalVariable("oute2", 0);
intg->addGlobalVariable("conditional_v1", 0);
intg->addGlobalVariable("conditional_v2", 0);
intg->addComputePerDof("outf", "f");
intg->addComputePerDof("outf1", "f1");
intg->addComputePerDof("outf2", "f2");
intg->addComputeGlobal("oute", "energy");
intg->addComputeGlobal("oute1", "energy1");
intg->addComputeGlobal("oute2", "energy2");
intg->beginIfBlock("1 > 0");
intg->addComputeGlobal("conditional_v1", "1");
intg->endBlock();
intg->beginWhileBlock("0 > 1");
intg->addComputeGlobal("conditional_v2", "1");
intg->endBlock();
intg->addUpdateContextState();
intg->addConstrainVelocities();
intg->addComputeSum("summand2", "v*v+f*f");
......@@ -224,5 +232,3 @@ int main() {
}
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment