PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
function.h
Go to the documentation of this file.
1/*
2 * -------------------------------------------
3 * Copyright (c) 2021 - 2024 Prashant K. Jha
4 * -------------------------------------------
5 * PeriDEM https://github.com/prashjha/PeriDEM
6 *
7 * Distributed under the Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE)
9 */
10
11#ifndef UTIL_FUNCTION_H
12#define UTIL_FUNCTION_H
13
14#include "point.h" // definition of Point
15#include <vector>
16
17// tolerance for float comparison
18#define COMPARE_EPS 1e-5
19
20namespace util {
21
28bool isGreater(const double &a, const double &b);
29
36bool isLess(const double &a, const double &b);
37
61double hatFunction(const double &x, const double &x_min, const double &x_max);
62
88double hatFunctionQuick(const double &x, const double &x_min,
89 const double &x_max);
90
114double linearStepFunc(const double &x, const double &x1, const double &x2);
115
128double gaussian(const double &r, const double &a, const double &beta);
129
148double gaussian2d(const util::Point &x, const size_t &dof,
149 const std::vector<double> &params);
150
165double doubleGaussian2d(const util::Point &x, const size_t &dof,
166 const std::vector<double> &params);
167
175double equivalentMass(const double &m1, const double &m2);
176
177} // namespace util
178
179#endif // UTIL_FUNCTION_H
Collection of methods useful in simulation.
bool isGreater(const double &a, const double &b)
Returns true if a > b.
Definition function.cpp:15
double hatFunction(const double &x, const double &x_min, const double &x_max)
Computes hat function at given point.
Definition function.cpp:25
double linearStepFunc(const double &x, const double &x1, const double &x2)
Compute linear step function.
Definition function.cpp:62
double doubleGaussian2d(const util::Point &x, const size_t &dof, const std::vector< double > &params)
Compute sum of two gaussian function in 2-d.
Definition function.cpp:107
double equivalentMass(const double &m1, const double &m2)
Compute harmonic mean of m1 and m2.
Definition function.cpp:127
double hatFunctionQuick(const double &x, const double &x_min, const double &x_max)
Computes hat function at given point.
Definition function.cpp:46
double gaussian(const double &r, const double &a, const double &beta)
Compute gaussian function in 1-d.
Definition function.cpp:87
bool isLess(const double &a, const double &b)
Returns true if a < b.
Definition function.cpp:20
double gaussian2d(const util::Point &x, const size_t &dof, const std::vector< double > &params)
Compute gaussian function in 2-d.
Definition function.cpp:92
A structure to represent 3d vectors.
Definition point.h:30