11#ifndef UTIL_FUNCTION_H
12#define UTIL_FUNCTION_H
18#define COMPARE_EPS 1e-5
28bool isGreater(
const double &a,
const double &b);
36bool isLess(
const double &a,
const double &b);
61double hatFunction(
const double &x,
const double &x_min,
const double &x_max);
114double linearStepFunc(
const double &x,
const double &x1,
const double &x2);
128double gaussian(
const double &r,
const double &a,
const double &beta);
149 const std::vector<double> ¶ms);
166 const std::vector<double> ¶ms);
204 const double &horizon,
int horizonPower = 5);
226 int horizonPower = 5);
Collection of methods useful in simulation.
double selfContactStiffness(const double &K, const double &horizon, int horizonPower=5)
Contact stiffness for a body against itself.
double normalContactStiffness(const double &K1, const double &K2, const double &horizon, int horizonPower=5)
Silling normal contact stiffness from two bulk moduli and the horizon.
bool isGreater(const double &a, const double &b)
Returns true if a > b.
double hatFunction(const double &x, const double &x_min, const double &x_max)
Computes hat function at given point.
double linearStepFunc(const double &x, const double &x1, const double &x2)
Compute linear step function.
double doubleGaussian2d(const util::Point &x, const size_t &dof, const std::vector< double > ¶ms)
Compute sum of two gaussian function in 2-d.
double equivalentMass(const double &m1, const double &m2)
Compute harmonic mean of m1 and m2.
double hatFunctionQuick(const double &x, const double &x_min, const double &x_max)
Computes hat function at given point.
double gaussian(const double &r, const double &a, const double &beta)
Compute gaussian function in 1-d.
bool isLess(const double &a, const double &b)
Returns true if a < b.
double gaussian2d(const util::Point &x, const size_t &dof, const std::vector< double > ¶ms)
Compute gaussian function in 2-d.
double harmonicMean(const double &m1, const double &m2)
A structure to represent 3d vectors.