16 return (a - b) > ((std::abs(a) < std::abs(b) ? std::abs(b) : std::abs(a)) *
21 return (b - a) > ((std::abs(a) < std::abs(b) ? std::abs(b) : std::abs(a)) *
26 const double &x_max) {
31 double x_mid = 0.5 * (x_min + x_max);
32 double l = x_mid - x_min;
39 return (x - x_min) / l;
41 return (x_max - x) / l;
47 const double &x_max) {
49 double x_mid = 0.5 * (x_min + x_max);
50 double l = x_mid - x_min;
57 return (x - x_min) / l;
59 return (x_max - x) / l;
79 double period = std::floor(x / (x1 + x2));
82 return x - period * x2;
84 return (period + 1.) * x1;
89 return a * std::exp(-std::pow(r, 2) / beta);
93 const std::vector<double> ¶ms) {
95 if (params.size() < 6) {
96 std::cerr <<
"Error: Not enough parameters to compute guassian 2-d "
109 const std::vector<double> ¶ms) {
111 if (params.size() < 10) {
112 std::cerr <<
"Error: Not enough parameters to compute guassian 2-d "
128 return 2. * m1 * m2 / (m1 + m2);
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.
A structure to represent 3d vectors.
double dist(const Point &b) const
Computes the distance between a given point from this point.