"platforms/vscode:/vscode.git/clone" did not exist on "aa6abbbe49da513f85e2dfcbe05dfdb52ad02878"
Unverified Commit 0eb5bc0e authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Made getCollectiveVariableValues() const (#3599)

parent e9b8b6a2
...@@ -238,7 +238,7 @@ public: ...@@ -238,7 +238,7 @@ public:
* @param[out] values the values of the collective variables are computed and * @param[out] values the values of the collective variables are computed and
* stored into this * stored into this
*/ */
void getCollectiveVariableValues(Context& context, std::vector<double>& values); void getCollectiveVariableValues(Context& context, std::vector<double>& values) const;
/** /**
* Get the inner Context used for evaluating collective variables. * Get the inner Context used for evaluating collective variables.
* *
......
...@@ -108,7 +108,7 @@ protected: ...@@ -108,7 +108,7 @@ protected:
/** /**
* Get the ForceImpl corresponding to this Force in a Context. * Get the ForceImpl corresponding to this Force in a Context.
*/ */
ForceImpl& getImplInContext(Context& context); ForceImpl& getImplInContext(Context& context) const;
/** /**
* Get a const reference to the ForceImpl corresponding to this Force in a Context. * Get a const reference to the ForceImpl corresponding to this Force in a Context.
*/ */
...@@ -116,7 +116,7 @@ protected: ...@@ -116,7 +116,7 @@ protected:
/** /**
* Get the ContextImpl corresponding to a Context. * Get the ContextImpl corresponding to a Context.
*/ */
ContextImpl& getContextImpl(Context& context); ContextImpl& getContextImpl(Context& context) const;
private: private:
int forceGroup; int forceGroup;
std::string name; std::string name;
......
...@@ -116,7 +116,7 @@ protected: ...@@ -116,7 +116,7 @@ protected:
/** /**
* Get the ContextImpl corresponding to a Context. * Get the ContextImpl corresponding to a Context.
*/ */
ContextImpl& getContextImpl(Context& context) { ContextImpl& getContextImpl(Context& context) const {
return context.getImpl(); return context.getImpl();
} }
}; };
......
...@@ -140,7 +140,7 @@ const string& CustomCVForce::getTabulatedFunctionName(int index) const { ...@@ -140,7 +140,7 @@ const string& CustomCVForce::getTabulatedFunctionName(int index) const {
return functions[index].name; return functions[index].name;
} }
void CustomCVForce::getCollectiveVariableValues(Context& context, vector<double>& values) { void CustomCVForce::getCollectiveVariableValues(Context& context, vector<double>& values) const {
dynamic_cast<CustomCVForceImpl&>(getImplInContext(context)).getCollectiveVariableValues(getContextImpl(context), values); dynamic_cast<CustomCVForceImpl&>(getImplInContext(context)).getCollectiveVariableValues(getContextImpl(context), values);
} }
......
...@@ -76,7 +76,7 @@ bool Force::usesPeriodicBoundaryConditions() const { ...@@ -76,7 +76,7 @@ bool Force::usesPeriodicBoundaryConditions() const {
throw OpenMMException("usesPeriodicBoundaryConditions is not implemented"); throw OpenMMException("usesPeriodicBoundaryConditions is not implemented");
} }
ForceImpl& Force::getImplInContext(Context& context) { ForceImpl& Force::getImplInContext(Context& context) const {
for (auto impl : context.getImpl().getForceImpls()) for (auto impl : context.getImpl().getForceImpls())
if (&impl->getOwner() == this) if (&impl->getOwner() == this)
return *impl; return *impl;
...@@ -90,6 +90,6 @@ const ForceImpl& Force::getImplInContext(const Context& context) const { ...@@ -90,6 +90,6 @@ const ForceImpl& Force::getImplInContext(const Context& context) const {
throw OpenMMException("getImplInContext: This Force is not present in the Context"); throw OpenMMException("getImplInContext: This Force is not present in the Context");
} }
ContextImpl& Force::getContextImpl(Context& context) { ContextImpl& Force::getContextImpl(Context& context) const {
return context.getImpl(); return context.getImpl();
} }
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