Commit 6cf592be authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #1601 from peastman/compoundstatechanged

CompoundIntegrator::stateChanged() calls through to component integrators
parents 283e97b2 222460ef
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2015 Stanford University and the Authors. * * Portions copyright (c) 2015-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -171,6 +171,16 @@ protected: ...@@ -171,6 +171,16 @@ protected:
* The implementation returns the union of all kernel names required by all Integrators that have been added. * The implementation returns the union of all kernel names required by all Integrators that have been added.
*/ */
std::vector<std::string> getKernelNames(); std::vector<std::string> getKernelNames();
/**
* This will be called by the Context when the user modifies aspects of the context state, such
* as positions, velocities, or parameters. This gives the Integrator a chance to discard cached
* information. This is <i>only</i> called when the user modifies information using methods of the Context
* object. It is <i>not</i> called when a ForceImpl object modifies state information in its updateContextState()
* method (unless the ForceImpl calls a Context method to perform the modification).
*
* @param changed this specifies what aspect of the Context was changed
*/
void stateChanged(State::DataType changed);
/** /**
* Compute the kinetic energy of the system at the current time. * Compute the kinetic energy of the system at the current time.
* *
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2015 Stanford University and the Authors. * * Portions copyright (c) 2015-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -120,6 +120,11 @@ vector<string> CompoundIntegrator::getKernelNames() { ...@@ -120,6 +120,11 @@ vector<string> CompoundIntegrator::getKernelNames() {
return kernels; return kernels;
} }
void CompoundIntegrator::stateChanged(State::DataType changed) {
for (int i = 0; i < integrators.size(); i++)
integrators[i]->stateChanged(changed);
}
double CompoundIntegrator::computeKineticEnergy() { double CompoundIntegrator::computeKineticEnergy() {
return integrators[currentIntegrator]->computeKineticEnergy(); return integrators[currentIntegrator]->computeKineticEnergy();
} }
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