Commit 2f5bb780 authored by Peter Eastman's avatar Peter Eastman
Browse files

Loading a checkpoint marks that positions have been set

parent 71de4b1b
...@@ -449,4 +449,5 @@ void ContextImpl::loadCheckpoint(istream& stream) { ...@@ -449,4 +449,5 @@ void ContextImpl::loadCheckpoint(istream& stream) {
parameters[name] = value; parameters[name] = value;
} }
updateStateDataKernel.getAs<UpdateStateDataKernel>().loadCheckpoint(*this, stream); updateStateDataKernel.getAs<UpdateStateDataKernel>().loadCheckpoint(*this, stream);
hasSetPositions = true;
} }
...@@ -92,6 +92,15 @@ void testCheckpoint() { ...@@ -92,6 +92,15 @@ void testCheckpoint() {
integrator.step(10); integrator.step(10);
State s4 = context.getState(State::Positions | State::Velocities | State::Parameters); State s4 = context.getState(State::Positions | State::Velocities | State::Parameters);
compareStates(s2, s4); compareStates(s2, s4);
// See if a checkpoint created from one Context can be loaded into a different one.
VerletIntegrator integrator2(0.001);
Context context2(system, integrator2, platform);
stream1.seekg(0, stream1.beg);
context2.loadCheckpoint(stream1);
State s5 = context2.getState(State::Positions | State::Velocities | State::Parameters | State::Energy);
compareStates(s1, s5);
} }
void runPlatformTests() { void runPlatformTests() {
......
...@@ -120,6 +120,15 @@ void testCheckpoint() { ...@@ -120,6 +120,15 @@ void testCheckpoint() {
integrator2.step(10); integrator2.step(10);
State s8 = context2.getState(State::Positions | State::Velocities | State::Parameters); State s8 = context2.getState(State::Positions | State::Velocities | State::Parameters);
compareStates(s6, s8); compareStates(s6, s8);
// See if a checkpoint created from one Context can be loaded into a different one.
VerletIntegrator integrator3(0.001);
Context context3(system, integrator3, platform);
stream1.seekg(0, stream1.beg);
context3.loadCheckpoint(stream1);
State s9 = context3.getState(State::Positions | State::Velocities | State::Parameters | State::Energy);
compareStates(s1, s9);
} }
void runPlatformTests() { void runPlatformTests() {
......
...@@ -120,6 +120,15 @@ void testCheckpoint() { ...@@ -120,6 +120,15 @@ void testCheckpoint() {
integrator2.step(10); integrator2.step(10);
State s8 = context2.getState(State::Positions | State::Velocities | State::Parameters); State s8 = context2.getState(State::Positions | State::Velocities | State::Parameters);
compareStates(s6, s8); compareStates(s6, s8);
// See if a checkpoint created from one Context can be loaded into a different one.
VerletIntegrator integrator3(0.001);
Context context3(system, integrator3, platform);
stream1.seekg(0, stream1.beg);
context3.loadCheckpoint(stream1);
State s9 = context3.getState(State::Positions | State::Velocities | State::Parameters | State::Energy);
compareStates(s1, s9);
} }
void runPlatformTests() { void runPlatformTests() {
......
...@@ -92,6 +92,15 @@ void testCheckpoint() { ...@@ -92,6 +92,15 @@ void testCheckpoint() {
integrator.step(10); integrator.step(10);
State s4 = context.getState(State::Positions | State::Velocities | State::Parameters); State s4 = context.getState(State::Positions | State::Velocities | State::Parameters);
compareStates(s2, s4); compareStates(s2, s4);
// See if a checkpoint created from one Context can be loaded into a different one.
VerletIntegrator integrator2(0.001);
Context context2(system, integrator2, platform);
stream1.seekg(0, stream1.beg);
context2.loadCheckpoint(stream1);
State s5 = context2.getState(State::Positions | State::Velocities | State::Parameters | State::Energy);
compareStates(s1, s5);
} }
void runPlatformTests() { void runPlatformTests() {
......
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