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

[Cleanup] Use override

parent 8c878ee4
No related branches found
No related tags found
No related merge requests found
...@@ -33,32 +33,32 @@ class TruncatedRateState : public FrictionPotential { ...@@ -33,32 +33,32 @@ class TruncatedRateState : public FrictionPotential {
FrictionData _fd) FrictionData _fd)
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {} : fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double coefficientOfFriction(double V) const { double coefficientOfFriction(double V) const override {
if (V <= Vmin) if (V <= Vmin)
return 0.0; return 0.0;
return fd.a * std::log(V / Vmin); return fd.a * std::log(V / Vmin);
} }
double differential(double V) const { double differential(double V) const override {
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V); return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
} }
double second_deriv(double V) const { double second_deriv(double V) const override {
if (V <= Vmin) if (V <= Vmin)
return 0; return 0;
return -weightedNormalStress * (fd.a / V); return -weightedNormalStress * (fd.a / V);
} }
double regularity(double V) const { double regularity(double V) const override {
if (std::abs(V - Vmin) < 1e-14) // TODO if (std::abs(V - Vmin) < 1e-14) // TODO
return std::numeric_limits<double>::infinity(); return std::numeric_limits<double>::infinity();
return std::abs(second_deriv(V)); return std::abs(second_deriv(V));
} }
void updateAlpha(double alpha) { void updateAlpha(double alpha) override {
double const logrest = (fd.mu0 + fd.b * alpha) / fd.a; double const logrest = (fd.mu0 + fd.b * alpha) / fd.a;
Vmin = fd.V0 / std::exp(logrest); Vmin = fd.V0 / std::exp(logrest);
} }
...@@ -76,21 +76,23 @@ class RegularisedRateState : public FrictionPotential { ...@@ -76,21 +76,23 @@ class RegularisedRateState : public FrictionPotential {
FrictionData _fd) FrictionData _fd)
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {} : fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double coefficientOfFriction(double V) const { double coefficientOfFriction(double V) const override {
return fd.a * std::asinh(0.5 * V / Vmin); return fd.a * std::asinh(0.5 * V / Vmin);
} }
double differential(double V) const { double differential(double V) const override {
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V); return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
} }
double second_deriv(double V) const { double second_deriv(double V) const override {
return -weightedNormalStress * fd.a / std::hypot(2.0 * Vmin, V); return -weightedNormalStress * fd.a / std::hypot(2.0 * Vmin, V);
} }
double regularity(double V) const { return std::abs(second_deriv(V)); } double regularity(double V) const override {
return std::abs(second_deriv(V));
}
void updateAlpha(double alpha) { void updateAlpha(double alpha) override {
double const logrest = (fd.mu0 + fd.b * alpha) / fd.a; double const logrest = (fd.mu0 + fd.b * alpha) / fd.a;
Vmin = fd.V0 / std::exp(logrest); Vmin = fd.V0 / std::exp(logrest);
} }
...@@ -104,16 +106,16 @@ class RegularisedRateState : public FrictionPotential { ...@@ -104,16 +106,16 @@ class RegularisedRateState : public FrictionPotential {
class ZeroFunction : public FrictionPotential { class ZeroFunction : public FrictionPotential {
public: public:
double evaluate(double) const { return 0; } double evaluate(double) const override { return 0; }
double coefficientOfFriction(double s) const { return 0; } double coefficientOfFriction(double s) const override { return 0; }
double differential(double) const { return 0; } double differential(double) const override { return 0; }
double second_deriv(double) const { return 0; } double second_deriv(double) const override { return 0; }
double regularity(double) const { return 0; } double regularity(double) const override { return 0; }
void updateAlpha(double) {} void updateAlpha(double) override {}
}; };
#endif #endif
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