Commit 0307a0db authored by Yutong Zhao's avatar Yutong Zhao
Browse files

Context constructor now uses const System&, guaranteeing that System won't be modified.

parent 19757775
......@@ -100,7 +100,7 @@ public:
randomNumberSeed = seed;
}
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
double defaultTemp, defaultFreq;
int randomNumberSeed;
......
......@@ -149,7 +149,7 @@ public:
*/
void setTorsionParameters(int index, int map, int a1, int a2, int a3, int a4, int b1, int b2, int b3, int b4);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class MapInfo;
class CMAPTorsionInfo;
......
......@@ -62,7 +62,7 @@ public:
frequency = freq;
}
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
int frequency;
};
......
......@@ -72,7 +72,7 @@ public:
* @param system the System which will be simulated
* @param integrator the Integrator which will be used to simulate the System
*/
Context(System& system, Integrator& integrator);
Context(const System& system, Integrator& integrator);
/**
* Construct a new Context in which to run a simulation, explicitly specifying what Platform should be used
* to perform calculations.
......@@ -81,7 +81,7 @@ public:
* @param integrator the Integrator which will be used to simulate the System
* @param platform the Platform to use for calculations
*/
Context(System& system, Integrator& integrator, Platform& platform);
Context(const System& system, Integrator& integrator, Platform& platform);
/**
* Construct a new Context in which to run a simulation, explicitly specifying what Platform should be used
* to perform calculations and the values of platform-specific properties.
......@@ -91,16 +91,12 @@ public:
* @param platform the Platform to use for calculations
* @param properties a set of values for platform-specific properties. Keys are the property names.
*/
Context(System& system, Integrator& integrator, Platform& platform, const std::map<std::string, std::string>& properties);
Context(const System& system, Integrator& integrator, Platform& platform, const std::map<std::string, std::string>& properties);
~Context();
/**
* Get System being simulated in this context.
*/
const System& getSystem() const;
/**
* Get System being simulated in this context.
*/
System& getSystem();
/**
* Get Integrator being used to by this context.
*/
......
......@@ -203,7 +203,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class AngleInfo;
class AngleParameterInfo;
......
......@@ -200,7 +200,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class BondInfo;
class BondParameterInfo;
......
......@@ -270,7 +270,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class BondInfo;
class BondParameterInfo;
......
......@@ -200,7 +200,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class ParticleInfo;
class ParticleParameterInfo;
......
......@@ -496,7 +496,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class ParticleInfo;
class PerParticleParameterInfo;
......
......@@ -416,7 +416,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class GroupInfo;
class PerPairParameterInfo;
......
......@@ -327,7 +327,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class ParticleInfo;
class PerParticleParameterInfo;
......
......@@ -206,7 +206,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class TorsionInfo;
class TorsionParameterInfo;
......
......@@ -85,7 +85,7 @@ protected:
* It should create a new ForceImpl object which can be used by the context for calculating forces.
* The ForceImpl will be deleted automatically when the Context is deleted.
*/
virtual ForceImpl* createImpl() = 0;
virtual ForceImpl* createImpl() const = 0;
/**
* Get the ForceImpl corresponding to this Force in a Context.
*/
......
......@@ -167,7 +167,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class ParticleInfo;
NonbondedMethod nonbondedMethod;
......
......@@ -228,7 +228,7 @@ public:
*/
void setQuinticUpperBornRadiusLimit(double quinticUpperBornRadiusLimit);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class ParticleInfo;
NonbondedMethod nonbondedMethod;
......
......@@ -103,7 +103,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class AngleInfo;
std::vector<AngleInfo> angles;
......
......@@ -100,7 +100,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class BondInfo;
std::vector<BondInfo> bonds;
......
......@@ -119,7 +119,7 @@ public:
randomNumberSeed = seed;
}
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
double defaultPressure, temperature;
int frequency, randomNumberSeed;
......
......@@ -296,7 +296,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class ParticleInfo;
class ExceptionInfo;
......
......@@ -109,7 +109,7 @@ public:
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
ForceImpl* createImpl() const;
private:
class PeriodicTorsionInfo;
std::vector<PeriodicTorsionInfo> periodicTorsions;
......
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