MercuryDPM
Alpha
|
Namespace for some extra maths function that are often needed. More...
Functions | |
Mdouble | gamma (Mdouble gamma_in) |
This is the gamma function returns the true value for the half integer value. More... | |
Mdouble | chi_squared (const Mdouble x, const unsigned int k) |
This is a chi_squared function return the value x and degrees of freedom k. More... | |
Mdouble | chi_squared_prob (const Mdouble x, const unsigned int k) |
This is the function which actually gives the probability back using a chi squared test. More... | |
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. More... | |
template<typename T > | |
int | sign (T val) |
This is a sign function, it returns -1 for negative numbers, 1 for positive numbers and 0 for 0. More... | |
template<typename T > | |
T | square (T val) |
squares a number More... | |
template<typename T > | |
T | cubic (T val) |
calculates the cube of a number More... | |
bool | isEqual (Mdouble v1, Mdouble v2, Mdouble absError) |
Compares the difference of two Mdouble with an absolute error, useful in UnitTests. More... | |
bool | isEqual (Vec3D v1, Vec3D v2, Mdouble absError) |
Compares the difference of two Vec3D with an absolute error, useful in UnitTests. More... | |
template<typename T > | |
constexpr T | factorial (const T t) |
factorial function More... | |
Mdouble | sin (Mdouble x) |
Mdouble | cos (Mdouble x) |
Mdouble | exp (Mdouble Exponent) |
Mdouble | log (Mdouble Power) |
template<typename T > | |
T | tan (T x) |
Mdouble | chebyshev (Mdouble x, const Mdouble coef[], int N) |
Namespace for evaluating the zeroth modified Bessel function of the first kind, I0(x), required in StatisticsPoint.hcc. More... | |
Mdouble | I0_exp (Mdouble x) |
Mdouble | I0 (Mdouble x) |
Namespace for some extra maths function that are often needed.
Namespace for evaluating the zeroth modified Bessel function of the first kind, I0(x), required in StatisticsPoint.hcc.
Definition at line 242 of file ExtendedMath.cc.
References assert.
Referenced by I0_exp().
This is a chi_squared function return the value x and degrees of freedom k.
Definition at line 153 of file ExtendedMath.cc.
References exp(), and gamma().
Referenced by chi_squared_prob().
This is the function which actually gives the probability back using a chi squared test.
This calulates the probabity based on a chi squared test First we calculated the cummelative chi_squared function.
This is the function which actually gives the probability back It is calculated by calling the normal chi_squated function and using the trapezoidal rule. The final results is 1-the cummulative chi_squared function
Definition at line 169 of file ExtendedMath.cc.
References chi_squared().
Referenced by RNG::test().
Definition at line 60 of file ExtendedMath.cc.
References constants::pi.
Referenced by ChuteWithHopper::addHopper(), LiquidBridgeWilletInteraction::computeAdhesionForce(), LiquidMigrationWilletInteraction::computeAdhesionForce(), CircularPeriodicBoundary::createPeriodicParticles(), HopperInsertionBoundary::generateParticle(), Screw::getDistanceAndNormal(), Coil::getDistanceAndNormal(), InfiniteWallWithHole::getDistanceAndNormal(), Vec3D::getFromCylindricalCoordinates(), Screw::getTriangulation(), Quarternion::integrate(), helpers::objectivenessTest(), Quarternion::Quarternion(), CircularPeriodicBoundary::rotateParticle(), Chute::setChuteAngleAndMagnitudeOfGravity(), tan(), and AxisymmetricIntersectionOfWalls::writeVTK().
T mathsFunc::cubic | ( | T | val | ) |
calculates the cube of a number
Definition at line 99 of file ExtendedMath.h.
Referenced by ChuteBottom::setupInitialConditions().
Definition at line 78 of file ExtendedMath.cc.
References X.
Referenced by chi_squared(), helpers::computeRestitutionCoefficientFromCollisionTimeAndDispAndEffectiveMass(), helpers::computeRestitutionCoefficientFromKAndCollisionTimeAndEffectiveMass(), helpers::computeRestitutionCoefficientFromKAndDispAndEffectiveMass(), helpers::getMaximumVelocity(), LinearViscoelasticNormalSpecies::getRestitutionCoefficient(), HGridOptimiser::histNumberParticlesPerCell(), I0(), log(), ParhamiMcMeekingSinterSpecies::set(), and SinterNormalSpecies::setParhamiMcKeeping().
constexpr T mathsFunc::factorial | ( | const T | t | ) |
factorial function
Definition at line 124 of file ExtendedMath.h.
Referenced by HGridOptimiser::histNumberParticlesPerCell().
This is the gamma function returns the true value for the half integer value.
This is the gamma function, gives 'exact' answers for the half integer values This is done using the recussion relation and the known values for 1 and 0.5 Note, return NaN for non-half integer values.
Definition at line 130 of file ExtendedMath.cc.
References constants::sqrt_pi.
Referenced by chi_squared(), and HopperInsertionBoundary::generateParticle().
Mdouble mathsFunc::goldenSectionSearch | ( | Mdouble(*)(const Mdouble) | function, |
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.
[in] | function | A function pointer to the function of which you want to calculate the location of its minimum. |
[in] | min | The minimum location |
[in] | cur | The current location |
[in] | max | The maximum location |
[in] | endCondition | The algorithm terminates when abs(max - min) < endCondition |
[in] | curVal | The value of the function at the current location (on default this value is calculated internally) |
Definition at line 187 of file ExtendedMath.cc.
Definition at line 261 of file ExtendedMath.cc.
References A, and chebyshev().
Referenced by I0().
Compares the difference of two Mdouble with an absolute error, useful in UnitTests.
[in] | v1 | The first Mdouble |
[in] | v2 | The second Mdouble |
[in] | absError | The allowed maximum absolute error |
Definition at line 231 of file ExtendedMath.cc.
Referenced by helpers::check(), ChuteInsertionBoundary::generateParticle(), isEqual(), and MercuryBase::setHGridCellOverSizeRatio().
Compares the difference of two Vec3D with an absolute error, useful in UnitTests.
[in] | v1 | The first Vec3D |
[in] | v2 | The second Vec3D |
[in] | absError | The allowed maximum absolute error |
Definition at line 237 of file ExtendedMath.cc.
References isEqual(), Vec3D::X, Vec3D::Y, and Vec3D::Z.
Definition at line 97 of file ExtendedMath.cc.
Referenced by CircularPeriodicBoundary::checkBoundaryAfterParticleMoved(), helpers::computeCollisionTimeFromDispAndRestitutionCoefficientAndEffectiveMass(), helpers::computeCollisionTimeFromKAndRestitutionCoefficientAndEffectiveMass(), helpers::computeDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass(), helpers::computeDispFromKAndRestitutionCoefficientAndEffectiveMass(), helpers::computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass(), helpers::computeKFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass(), helpers::computeKFromDispAndRestitutionCoefficientAndEffectiveMass(), CircularPeriodicBoundary::createPeriodicParticles(), SlidingFrictionSpecies::setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(), LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), HertzianViscoelasticNormalSpecies::setElasticModulusAndRestitutionCoefficient(), LinearViscoelasticNormalSpecies::setStiffnessAndRestitutionCoefficient(), LinearPlasticViscoelasticNormalSpecies::setStiffnessAndRestitutionCoefficient(), and SinterNormalSpecies::setStiffnessAndRestitutionCoefficient().
int mathsFunc::sign | ( | T | val | ) |
This is a sign function, it returns -1 for negative numbers, 1 for positive numbers and 0 for 0.
Definition at line 83 of file ExtendedMath.h.
Referenced by Screw::getDistanceAndNormal().
Definition at line 42 of file ExtendedMath.cc.
References constants::pi.
Referenced by ChuteWithHopper::addHopper(), HopperInsertionBoundary::generateParticle(), Quarternion::getAxisAndAngle(), Screw::getDistanceAndNormal(), Coil::getDistanceAndNormal(), InfiniteWallWithHole::getDistanceAndNormal(), Vec3D::getFromCylindricalCoordinates(), ChuteWithHopper::getMaximumVelocityInducedByGravity(), Screw::getTriangulation(), Quarternion::integrate(), helpers::objectivenessTest(), Quarternion::Quarternion(), CircularPeriodicBoundary::rotateParticle(), Chute::setChuteAngleAndMagnitudeOfGravity(), tan(), and AxisymmetricIntersectionOfWalls::writeVTK().
T mathsFunc::square | ( | T | val | ) |
squares a number
Definition at line 91 of file ExtendedMath.h.
Referenced by DPMBase::areInContact(), DPMBase::checkParticleForInteractionLocal(), helpers::computeCollisionTimeFromKAndDispAndEffectiveMass(), helpers::computeCollisionTimeFromKAndRestitutionCoefficientAndEffectiveMass(), helpers::computeDispFromKAndCollisionTimeAndEffectiveMass(), helpers::computeDispFromKAndRestitutionCoefficientAndEffectiveMass(), helpers::computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass(), SlidingFrictionInteraction::computeFrictionForce(), FrictionInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), helpers::computeKFromCollisionTimeAndDispAndEffectiveMass(), helpers::computeKFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass(), helpers::computeKFromDispAndRestitutionCoefficientAndEffectiveMass(), ParticleSpecies::computeMass(), SinterInteraction::computeNormalForce(), helpers::computeRestitutionCoefficientFromKAndCollisionTimeAndEffectiveMass(), helpers::computeRestitutionCoefficientFromKAndDispAndEffectiveMass(), HertzianSinterInteraction::computeSinterForce(), LinearPlasticViscoelasticNormalSpecies::computeTimeStep(), SinterNormalSpecies::computeTimeStep(), HertzianViscoelasticNormalSpecies::getCollisionTime(), LinearPlasticViscoelasticNormalSpecies::getCollisionTime(), LinearViscoelasticNormalSpecies::getCollisionTime(), SinterNormalSpecies::getCollisionTime(), StatisticsVector< T >::getCutoff2(), Screw::getDistanceAndNormal(), ChargedBondedInteraction::getElasticEnergy(), HertzianSinterInteraction::getElasticEnergy(), SinterInteraction::getElasticEnergy(), LinearViscoelasticInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergy(), LinearPlasticViscoelasticInteraction::getElasticEnergy(), IrreversibleAdhesiveInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergyAtEquilibrium(), helpers::getMaximumVelocity(), StatisticsVector< T >::setCGWidth(), SlidingFrictionSpecies::setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(), SlidingFrictionSpecies::setCollisionTimeAndNormalAndTangentialRestitutionCoefficientNoDispt(), LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), LinearViscoelasticNormalSpecies::setStiffnessAndRestitutionCoefficient(), LinearPlasticViscoelasticNormalSpecies::setStiffnessAndRestitutionCoefficient(), SinterNormalSpecies::setStiffnessAndRestitutionCoefficient(), MatrixSymmetric3D::square(), and Matrix3D::square().
T mathsFunc::tan | ( | T | x | ) |
Definition at line 146 of file ExtendedMath.h.
Referenced by ChuteWithHopper::addHopper(), and ChuteWithHopper::setHopper().