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:
* @param[out] values the values of the collective variables are computed and
* 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.
*
......
......@@ -108,7 +108,7 @@ protected:
/**
* 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.
*/
......@@ -116,7 +116,7 @@ protected:
/**
* Get the ContextImpl corresponding to a Context.
*/
ContextImpl& getContextImpl(Context& context);
ContextImpl& getContextImpl(Context& context) const;
private:
int forceGroup;
std::string name;
......
......@@ -116,7 +116,7 @@ protected:
/**
* Get the ContextImpl corresponding to a Context.
*/
ContextImpl& getContextImpl(Context& context) {
ContextImpl& getContextImpl(Context& context) const {
return context.getImpl();
}
};
......
......@@ -140,7 +140,7 @@ const string& CustomCVForce::getTabulatedFunctionName(int index) const {
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);
}
......
......@@ -76,7 +76,7 @@ bool Force::usesPeriodicBoundaryConditions() const {
throw OpenMMException("usesPeriodicBoundaryConditions is not implemented");
}
ForceImpl& Force::getImplInContext(Context& context) {
ForceImpl& Force::getImplInContext(Context& context) const {
for (auto impl : context.getImpl().getForceImpls())
if (&impl->getOwner() == this)
return *impl;
......@@ -90,6 +90,6 @@ const ForceImpl& Force::getImplInContext(const Context& context) const {
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();
}
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