Commit bcf95386 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed more destructor order errors

parent 9353e464
...@@ -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) 2008 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -116,6 +116,11 @@ protected: ...@@ -116,6 +116,11 @@ protected:
* It will also get called again if the application calls reinitialize() on the Context. * It will also get called again if the application calls reinitialize() on the Context.
*/ */
void initialize(ContextImpl& context); void initialize(ContextImpl& context);
/**
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
void cleanup();
/** /**
* Get the names of all Kernels used by this Integrator. * Get the names of all Kernels used by this Integrator.
*/ */
......
...@@ -408,6 +408,11 @@ protected: ...@@ -408,6 +408,11 @@ protected:
* It will also get called again if the application calls reinitialize() on the Context. * It will also get called again if the application calls reinitialize() on the Context.
*/ */
void initialize(ContextImpl& context); void initialize(ContextImpl& context);
/**
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
void cleanup();
/** /**
* When the user modifies the state, we need to mark that the forces need to be recalculated. * When the user modifies the state, we need to mark that the forces need to be recalculated.
*/ */
......
...@@ -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) 2008 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -99,6 +99,11 @@ protected: ...@@ -99,6 +99,11 @@ protected:
* It will also get called again if the application calls reinitialize() on the Context. * It will also get called again if the application calls reinitialize() on the Context.
*/ */
virtual void initialize(ContextImpl& context) = 0; virtual void initialize(ContextImpl& context) = 0;
/**
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
virtual void cleanup() = 0;
/** /**
* Get the names of all Kernels used by this Integrator. * Get the names of all Kernels used by this Integrator.
*/ */
......
...@@ -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) 2008 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -116,6 +116,11 @@ protected: ...@@ -116,6 +116,11 @@ protected:
* It will also get called again if the application calls reinitialize() on the Context. * It will also get called again if the application calls reinitialize() on the Context.
*/ */
void initialize(ContextImpl& context); void initialize(ContextImpl& context);
/**
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
void cleanup();
/** /**
* Get the names of all Kernels used by this Integrator. * Get the names of all Kernels used by this Integrator.
*/ */
......
...@@ -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) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -147,6 +147,11 @@ protected: ...@@ -147,6 +147,11 @@ protected:
* It will also get called again if the application calls reinitialize() on the Context. * It will also get called again if the application calls reinitialize() on the Context.
*/ */
void initialize(ContextImpl& context); void initialize(ContextImpl& context);
/**
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
void cleanup();
/** /**
* Get the names of all Kernels used by this Integrator. * Get the names of all Kernels used by this Integrator.
*/ */
......
...@@ -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) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -100,6 +100,11 @@ protected: ...@@ -100,6 +100,11 @@ protected:
* It will also get called again if the application calls reinitialize() on the Context. * It will also get called again if the application calls reinitialize() on the Context.
*/ */
void initialize(ContextImpl& context); void initialize(ContextImpl& context);
/**
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
void cleanup();
/** /**
* Get the names of all Kernels used by this Integrator. * Get the names of all Kernels used by this Integrator.
*/ */
......
...@@ -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) 2008 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -63,6 +63,11 @@ protected: ...@@ -63,6 +63,11 @@ protected:
* It will also get called again if the application calls reinitialize() on the Context. * It will also get called again if the application calls reinitialize() on the Context.
*/ */
void initialize(ContextImpl& context); void initialize(ContextImpl& context);
/**
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
void cleanup();
/** /**
* Get the names of all Kernels used by this Integrator. * Get the names of all Kernels used by this Integrator.
*/ */
......
...@@ -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) 2008 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -58,6 +58,10 @@ void BrownianIntegrator::initialize(ContextImpl& contextRef) { ...@@ -58,6 +58,10 @@ void BrownianIntegrator::initialize(ContextImpl& contextRef) {
kernel.getAs<IntegrateBrownianStepKernel>().initialize(contextRef.getSystem(), *this); kernel.getAs<IntegrateBrownianStepKernel>().initialize(contextRef.getSystem(), *this);
} }
void BrownianIntegrator::cleanup() {
kernel = Kernel();
}
vector<string> BrownianIntegrator::getKernelNames() { vector<string> BrownianIntegrator::getKernelNames() {
std::vector<std::string> names; std::vector<std::string> names;
names.push_back(IntegrateBrownianStepKernel::Name()); names.push_back(IntegrateBrownianStepKernel::Name());
......
...@@ -126,6 +126,7 @@ ContextImpl::~ContextImpl() { ...@@ -126,6 +126,7 @@ ContextImpl::~ContextImpl() {
updateStateDataKernel = Kernel(); updateStateDataKernel = Kernel();
applyConstraintsKernel = Kernel(); applyConstraintsKernel = Kernel();
virtualSitesKernel = Kernel(); virtualSitesKernel = Kernel();
integrator.cleanup();
platform->contextDestroyed(*this); platform->contextDestroyed(*this);
} }
......
...@@ -63,6 +63,10 @@ void CustomIntegrator::initialize(ContextImpl& contextRef) { ...@@ -63,6 +63,10 @@ void CustomIntegrator::initialize(ContextImpl& contextRef) {
} }
} }
void CustomIntegrator::cleanup() {
kernel = Kernel();
}
void CustomIntegrator::stateChanged(State::DataType changed) { void CustomIntegrator::stateChanged(State::DataType changed) {
forcesAreValid = false; forcesAreValid = false;
} }
......
...@@ -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) 2008 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -58,6 +58,10 @@ void LangevinIntegrator::initialize(ContextImpl& contextRef) { ...@@ -58,6 +58,10 @@ void LangevinIntegrator::initialize(ContextImpl& contextRef) {
kernel.getAs<IntegrateLangevinStepKernel>().initialize(contextRef.getSystem(), *this); kernel.getAs<IntegrateLangevinStepKernel>().initialize(contextRef.getSystem(), *this);
} }
void LangevinIntegrator::cleanup() {
kernel = Kernel();
}
vector<string> LangevinIntegrator::getKernelNames() { vector<string> LangevinIntegrator::getKernelNames() {
std::vector<std::string> names; std::vector<std::string> names;
names.push_back(IntegrateLangevinStepKernel::Name()); names.push_back(IntegrateLangevinStepKernel::Name());
......
...@@ -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) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -59,6 +59,10 @@ void VariableLangevinIntegrator::initialize(ContextImpl& contextRef) { ...@@ -59,6 +59,10 @@ void VariableLangevinIntegrator::initialize(ContextImpl& contextRef) {
kernel.getAs<IntegrateVariableLangevinStepKernel>().initialize(contextRef.getSystem(), *this); kernel.getAs<IntegrateVariableLangevinStepKernel>().initialize(contextRef.getSystem(), *this);
} }
void VariableLangevinIntegrator::cleanup() {
kernel = Kernel();
}
vector<string> VariableLangevinIntegrator::getKernelNames() { vector<string> VariableLangevinIntegrator::getKernelNames() {
std::vector<std::string> names; std::vector<std::string> names;
names.push_back(IntegrateVariableLangevinStepKernel::Name()); names.push_back(IntegrateVariableLangevinStepKernel::Name());
......
...@@ -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) 2008-2009 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -54,6 +54,10 @@ void VariableVerletIntegrator::initialize(ContextImpl& contextRef) { ...@@ -54,6 +54,10 @@ void VariableVerletIntegrator::initialize(ContextImpl& contextRef) {
kernel.getAs<IntegrateVariableVerletStepKernel>().initialize(contextRef.getSystem(), *this); kernel.getAs<IntegrateVariableVerletStepKernel>().initialize(contextRef.getSystem(), *this);
} }
void VariableVerletIntegrator::cleanup() {
kernel = Kernel();
}
vector<string> VariableVerletIntegrator::getKernelNames() { vector<string> VariableVerletIntegrator::getKernelNames() {
std::vector<std::string> names; std::vector<std::string> names;
names.push_back(IntegrateVariableVerletStepKernel::Name()); names.push_back(IntegrateVariableVerletStepKernel::Name());
......
...@@ -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) 2008 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -54,6 +54,10 @@ void VerletIntegrator::initialize(ContextImpl& contextRef) { ...@@ -54,6 +54,10 @@ void VerletIntegrator::initialize(ContextImpl& contextRef) {
kernel.getAs<IntegrateVerletStepKernel>().initialize(contextRef.getSystem(), *this); kernel.getAs<IntegrateVerletStepKernel>().initialize(contextRef.getSystem(), *this);
} }
void VerletIntegrator::cleanup() {
kernel = Kernel();
}
vector<string> VerletIntegrator::getKernelNames() { vector<string> VerletIntegrator::getKernelNames() {
std::vector<std::string> names; std::vector<std::string> names;
names.push_back(IntegrateVerletStepKernel::Name()); names.push_back(IntegrateVerletStepKernel::Name());
......
...@@ -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) 2008-2011 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -162,6 +162,11 @@ protected: ...@@ -162,6 +162,11 @@ protected:
* It will also get called again if the application calls reinitialize() on the Context. * It will also get called again if the application calls reinitialize() on the Context.
*/ */
void initialize(ContextImpl& context); void initialize(ContextImpl& context);
/**
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
void cleanup();
/** /**
* When the user modifies the state, we need to mark that the forces need to be recalculated. * When the user modifies the state, we need to mark that the forces need to be recalculated.
*/ */
......
...@@ -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) 2008-2011 Stanford University and the Authors. * * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -61,6 +61,10 @@ void RPMDIntegrator::initialize(ContextImpl& contextRef) { ...@@ -61,6 +61,10 @@ void RPMDIntegrator::initialize(ContextImpl& contextRef) {
kernel.getAs<IntegrateRPMDStepKernel>().initialize(contextRef.getSystem(), *this); kernel.getAs<IntegrateRPMDStepKernel>().initialize(contextRef.getSystem(), *this);
} }
void RPMDIntegrator::cleanup() {
kernel = Kernel();
}
void RPMDIntegrator::stateChanged(State::DataType changed) { void RPMDIntegrator::stateChanged(State::DataType changed) {
forcesAreValid = false; forcesAreValid = false;
} }
......
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