 |
revision: v0.14
|
Go to the documentation of this file.
26 #ifndef EXTENDEDMATH_H
27 #define EXTENDEDMATH_H
45 const Mdouble pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068;
46 const Mdouble sqrt_pi = 1.772453850905516027298167483341145182797549456122387128213807789852911284591032181374950656738544665;
47 const Mdouble sqr_pi = 9.869604401089358618834490999876151135313699407240790626413349376220044822419205243001773403718552232;
48 const Mdouble sqrt_2 = 1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641573;
49 const Mdouble sqrt_3 = 1.732050807568877293527446341505872366942805253810380628055806979451933016908800037081146186757248576;
51 const std::complex<Mdouble>
i = {0.0, 1.0};
91 Mdouble endCondition,
Mdouble curVal = std::numeric_limits<Mdouble>::quiet_NaN());
99 return (T(0) < val) - (val < T(0));
117 return val * val * val;
157 return (t == 0) ? 1 : t *
factorial(t - 1);
NumericalVector< std::complex< Mdouble > > sphericalHarmonics(int p, Mdouble theta, Mdouble phi)
Definition: ExtendedMath.cc:445
T square(const T val)
squares a number
Definition: ExtendedMath.h:106
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:420
Mdouble YZ
Definition: Matrix.h:43
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1241
@ Y
Definition: StatisticsVector.h:42
const Mdouble pi
Definition: ExtendedMath.h:45
Definition: EnergyUnitTest.cpp:39
Mdouble XX
all nine matrix elements
Definition: Matrix.h:43
Mdouble XZ
Definition: Matrix.h:43
const Mdouble sqr_pi
Definition: ExtendedMath.h:47
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
Mdouble YX
Definition: Matrix.h:43
Mdouble exp(Mdouble Exponent)
Definition: ExtendedMath.cc:84
Namespace for some extra maths function that are often needed
Definition: ExtendedMath.h:59
Mdouble X
the vector components
Definition: Vector.h:65
Definition: NumericalVector.h:64
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1182
NumericalVector computeSquaredFactorialValues(int p)
Definition: ExtendedMath.cc:473
@ R
Definition: StatisticsVector.h:42
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Mdouble goldenSectionSearch(Mdouble(*function)(const Mdouble), Mdouble min, Mdouble cur, Mdouble max, Mdouble endCondition, Mdouble curVal=std::numeric_limits< Mdouble >::quiet_NaN())
This function performs a golden section search to find the location of the minimum of a function.
Definition: ExtendedMath.cc:206
Mdouble getComponent(int index) const
Returns the requested component of this Quaternion.
Definition: Quaternion.cc:232
Mdouble log(Mdouble Power)
Definition: ExtendedMath.cc:104
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:542
void solve()
The work horse of the code.
Definition: DPMBase.cc:4003
@ A
Definition: StatisticsVector.h:42
const Mdouble R
Definition: ExtendedMath.h:50
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1208
double Mdouble
Definition: GeneralDefine.h:34
Mdouble YY
Definition: Matrix.h:43
Mdouble ZX
Definition: Matrix.h:43
Implementation of a 3D matrix.
Definition: Matrix.h:38
NumericalVector associatedLegendrePolynomials(int n, Mdouble x)
Definition: ExtendedMath.cc:401
const Mdouble sqrt_3
Definition: ExtendedMath.h:49
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
int sign(T val)
This is a sign function, it returns -1 for negative numbers, 1 for positive numbers and 0 for 0.
Definition: ExtendedMath.h:97
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
Mdouble getKineticEnergy() const
Returns the global kinetic energy stored in the system.
Definition: DPMBase.cc:1535
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44
void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:804
Mdouble XZ
Definition: MatrixSymmetric.h:42
Contains material and contact force properties.
Definition: Species.h:35
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1156
Mdouble ZY
Definition: Matrix.h:43
void clear() override
Empties the whole ParticleHandler by removing all BaseParticle.
Definition: ParticleHandler.cc:973
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1385
Mdouble ZZ
Definition: MatrixSymmetric.h:42
Mdouble getElasticEnergy() const
Returns the global elastic energy within the system.
Definition: DPMBase.cc:1521
Mdouble chebyshev(Mdouble x, const Mdouble coef[], int N)
Namespace for evaluating the zeroth modified Bessel function of the first kind, I0(x),...
Definition: ExtendedMath.cc:293
Mdouble XY
Definition: MatrixSymmetric.h:42
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
const Mdouble sqrt_pi
Definition: ExtendedMath.h:46
Mdouble ZZ
Definition: Matrix.h:43
void setDimension(unsigned int newDim)
Sets both the system dimensions and the particle dimensionality.
Definition: DPMBase.cc:1394
Definition: ExtendedMath.h:200
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:870
Mdouble Y
Definition: Vector.h:65
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
This class contains the 4 components of a quaternion and the standard operators and functions needed ...
Definition: Quaternion.h:63
void setYMin(Mdouble newYMin)
Sets the value of YMin, the lower bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1025
void setFileType(FileType fileType)
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:457
int main(int argc UNUSED, char *argv[] UNUSED)
Definition: EnergyUnitTest.cpp:71
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
Mdouble XX
The six distinctive matrix elements.
Definition: MatrixSymmetric.h:42
T tan(T x)
Definition: ExtendedMath.h:178
#define UNUSED
Definition: GeneralDefine.h:39
@ X
Definition: StatisticsVector.h:42
Mdouble XY
Definition: Matrix.h:43
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
const Mdouble degree
Definition: ExtendedMath.h:52
Definition: GeneralDefine.h:42
void setXMin(Mdouble newXMin)
Sets the value of XMin, the lower bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1001
Mdouble YZ
Definition: MatrixSymmetric.h:42
Mdouble I0(Mdouble x)
Definition: ExtendedMath.cc:391
Mdouble beta(Mdouble z, Mdouble w)
This is the beta function, returns the approximation based on cmath's implementation of ln(gamma)
Definition: ExtendedMath.cc:164
const Mdouble sqrt_2
Definition: ExtendedMath.h:48
constexpr T factorial(const T t)
factorial function
Definition: ExtendedMath.h:155
Implementation of a 3D symmetric matrix.
Definition: MatrixSymmetric.h:37
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1395
Mdouble Z
Definition: Vector.h:65
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:406
void setupInitialConditions() override
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: EnergyUnitTest.cpp:42
Mdouble chi_squared(Mdouble x, unsigned int k)
This is a chi_squared function return the value x and degrees of freedom k.
Definition: ExtendedMath.cc:172
Mdouble I0_exp(Mdouble x)
Definition: ExtendedMath.cc:311
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:115
bool isEqual(Mdouble v1, Mdouble v2, Mdouble absError)
Compares the difference of two Mdouble with an absolute error, useful in UnitTests.
Definition: ExtendedMath.cc:251
Mdouble gamma(Mdouble gamma_in)
This is the gamma function returns the true value for the half integer value.
Definition: ExtendedMath.cc:137
void setZMin(Mdouble newZMin)
Sets the value of ZMin, the lower bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1049
Mdouble chi_squared_prob(Mdouble x, unsigned int k)
This is the function which actually gives the probability back using a chi squared test.
Definition: ExtendedMath.cc:188
Mdouble YY
Definition: MatrixSymmetric.h:42
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:76