Skip to content

Commit

Permalink
fix destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhays committed Jul 30, 2019
1 parent 2b65ffd commit 8d712c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
17 changes: 2 additions & 15 deletions src/cpp/brerpotential.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class BRER {
double variance, double A, double tau, double g, double gsqrsum,
double eta, bool converged, double tolerance, double target,
unsigned int nSamples, std::string parameter_filename);

// If dispatching this virtual function is not fast enough, the compiler may
// be able to better optimize a free function that receives the current
// restraint as an argument.

gmx::PotentialPointData calculate(gmx::Vector v, gmx::Vector v0,
gmx_unused double t);

Expand All @@ -94,19 +94,6 @@ class BRER {
void callback(gmx::Vector v, gmx::Vector v0, double t,
const EnsembleResources &resources);

// Cache of historical distance data. Not thread safe
// std::vector<float> history{};

// The class will either be inherited as a mix-in or inherit a CRTP base
// class. Either way, it probably needs proper virtual destructor management.
virtual ~BRER() {
// for (auto&& distance: history)
// {
// std::cout << distance << "\n";
// }
// std::cout << std::endl;
}

double getAlphaMax() { return alpha_max_; }
double getTarget() { return target_; }

Expand Down Expand Up @@ -159,7 +146,7 @@ class BRERRestraint : public ::gmx::IRestraintPotential, private BRER {
std::shared_ptr<EnsembleResources> resources)
: BRER(params), sites_{std::move(sites)}, resources_{
std::move(resources)} {}

~BRERRestraint() override = default;
std::vector<int> sites() const override { return sites_; }

gmx::PotentialPointData evaluate(gmx::Vector r1, gmx::Vector r2,
Expand Down
3 changes: 1 addition & 2 deletions src/cpp/linearpotential.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class Linear {
void callback(gmx::Vector v, gmx::Vector v0, double t,
const EnsembleResources &resources);

virtual ~Linear() {}

private:
bool initialized_{FALSE};
double alpha_;
Expand All @@ -74,6 +72,7 @@ class LinearRestraint : public ::gmx::IRestraintPotential, private Linear {
: Linear(params), sites_{sites}, resources_{std::move(resources)} {}

std::vector<int> sites() const override { return sites_; }
~LinearRestraint() override = default;

gmx::PotentialPointData evaluate(gmx::Vector r1, gmx::Vector r2,
double t) override {
Expand Down
3 changes: 2 additions & 1 deletion src/cpp/linearstoppotential.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class LinearStop {
// periodically by the Restraint framework.
void callback(gmx::Vector v, gmx::Vector v0, double t,
const EnsembleResources &resources);
virtual ~LinearStop() {}

double getTime() { return time_; }

Expand Down Expand Up @@ -92,6 +91,8 @@ class LinearStopRestraint : public ::gmx::IRestraintPotential,
std::shared_ptr<EnsembleResources> resources)
: LinearStop(params), sites_{sites}, resources_{std::move(resources)} {}

~LinearStopRestraint() override = default;

std::vector<int> sites() const override { return sites_; }

gmx::PotentialPointData evaluate(gmx::Vector r1, gmx::Vector r2,
Expand Down

0 comments on commit 8d712c4

Please sign in to comment.