Skip to content
Snippets Groups Projects
Commit ccaf7962 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Make as little virtual as possible

parent 7b1dfa20
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ class FrictionPotential : public FrictionPotentialWrapper { ...@@ -48,7 +48,7 @@ class FrictionPotential : public FrictionPotentialWrapper {
// which would avoid the std::exp(std::log()) // which would avoid the std::exp(std::log())
{} {}
double virtual evaluate(double V) const { double evaluate(double V) const {
assert(V >= 0); assert(V >= 0);
if (V <= V_m) if (V <= V_m)
return 0; return 0;
...@@ -59,7 +59,7 @@ class FrictionPotential : public FrictionPotentialWrapper { ...@@ -59,7 +59,7 @@ class FrictionPotential : public FrictionPotentialWrapper {
// log(V/V_m) if V >= V_0 // log(V/V_m) if V >= V_0
// 0 otherwise // 0 otherwise
double virtual differential(double V) const { double differential(double V) const {
assert(V >= 0); assert(V >= 0);
if (V <= V_m) if (V <= V_m)
return 0; return 0;
...@@ -70,7 +70,7 @@ class FrictionPotential : public FrictionPotentialWrapper { ...@@ -70,7 +70,7 @@ class FrictionPotential : public FrictionPotentialWrapper {
// 1/V if V > V_0 // 1/V if V > V_0
// undefined if V == V_0 // undefined if V == V_0
// 0 if V < V_0 // 0 if V < V_0
double virtual second_deriv(double V) const { double second_deriv(double V) const {
assert(V >= 0); assert(V >= 0);
if (V <= V_m) if (V <= V_m)
return 0; return 0;
...@@ -78,7 +78,7 @@ class FrictionPotential : public FrictionPotentialWrapper { ...@@ -78,7 +78,7 @@ class FrictionPotential : public FrictionPotentialWrapper {
return coefficientProduct / V; return coefficientProduct / V;
} }
double virtual regularity(double V) const { double regularity(double V) const {
assert(V >= 0); assert(V >= 0);
// TODO: Make this controllable // TODO: Make this controllable
if (std::abs(V - V_m) < 1e-14) if (std::abs(V - V_m) < 1e-14)
...@@ -87,7 +87,7 @@ class FrictionPotential : public FrictionPotentialWrapper { ...@@ -87,7 +87,7 @@ class FrictionPotential : public FrictionPotentialWrapper {
return std::abs(second_deriv(V)); return std::abs(second_deriv(V));
} }
double virtual smallestPositivePoint() const { return V_m; } double smallestPositivePoint() const { return V_m; }
private: private:
double const coefficientProduct; double const coefficientProduct;
...@@ -96,15 +96,15 @@ class FrictionPotential : public FrictionPotentialWrapper { ...@@ -96,15 +96,15 @@ class FrictionPotential : public FrictionPotentialWrapper {
class TrivialFunction : public FrictionPotentialWrapper { class TrivialFunction : public FrictionPotentialWrapper {
public: public:
double virtual evaluate(double) const { return 0; } double evaluate(double) const { return 0; }
double virtual differential(double) const { return 0; } double differential(double) const { return 0; }
double virtual second_deriv(double) const { return 0; } double second_deriv(double) const { return 0; }
double virtual regularity(double) const { return 0; } double regularity(double) const { return 0; }
double virtual smallestPositivePoint() const { double smallestPositivePoint() const {
return std::numeric_limits<double>::infinity(); return std::numeric_limits<double>::infinity();
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment