![]() |
|
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 | beta (Mdouble z, Mdouble w) |
This is the beta function, returns the approximation based on cmath's implementation of ln(gamma) More... | |
Mdouble | chi_squared (Mdouble x, unsigned int k) |
This is a chi_squared function return the value x and degrees of freedom k. More... | |
Mdouble | chi_squared_prob (Mdouble x, 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 (const T val) |
squares a number More... | |
template<typename T > | |
T | cubic (const 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... | |
bool | isEqual (Matrix3D m1, Matrix3D m2, Mdouble absError) |
Compares the difference of two Vec3D with an absolute error, useful in UnitTests. More... | |
bool | isEqual (MatrixSymmetric3D m1, MatrixSymmetric3D m2, Mdouble absError) |
bool | isEqual (Quaternion v1, Quaternion v2, double absError) |
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
This is the beta function, returns the approximation based on cmath's implementation of ln(gamma)
Computes the beta function for real numbers, based on cmath's approximation of the ln of the gamma function. See https://en.wikipedia.org/wiki/Beta_function for more details
z | first Mdouble argument to compute the beta function of |
w | second Mdouble argument to compute the beta function of |
References Eigen::bfloat16_impl::exp(), and w.
Referenced by SuperQuadricParticle::computeMass(), SuperQuadricParticle::getVolume(), and SuperQuadricParticle::setInertia().
Namespace for evaluating the zeroth modified Bessel function of the first kind, I0(x), required in StatisticsPoint.hcc.
References i, logger, N, p, and plotDoE::x.
Referenced by I0_exp().
This is a chi_squared function return the value x and degrees of freedom k.
This is a chi_squared function return the value x and degrees of freedom k
References Eigen::bfloat16_impl::exp(), gamma(), k, Eigen::ArrayBase< Derived >::pow(), and plotDoE::x.
Referenced by chi_squared_prob().
This is the function which actually gives the probability back using a chi squared test.
This calculates the probability based on a chi squared test First we calculated the cumulative chi_squared function. This is the function which actually gives the probability back It is calculated by calling the normal chi_squared function and using the trapezoidal rule. The final results is 1-the cumulative chi_squared function
References chi_squared(), i, k, and plotDoE::x.
Referenced by main(), and RNG::test().
References Eigen::bfloat16_impl::floor(), i, N, constants::pi, FishSolnOneDPoisson::Sign, plotDoE::x, and Global_parameters::x2().
Referenced by ChuteWithHopper::addHopper(), AxisymmetricHopper::create_inflow_particle(), main(), HopperInsertionBoundary::placeParticle(), HourGlass::setupInitialConditions(), Tutorial11::setupInitialConditions(), and tan().
calculates the cube of a number
References calibrate::val.
Referenced by OneParticleHeatingSelfTest::actionsAfterTimeStep(), OneParticleCoolingSelfTest::actionsAfterTimeStep(), ChutePeriodic::add_flow_particles(), Vreman::add_particles(), Chute::addFlowParticlesCompactly(), MeltableNormalSpecies::analyseTimeScales(), CGCoordinates::XYZ::getGaussPrefactor(), PSDContinuous::getVolumetricMean(), PSD::getVolumetricMeanRadius(), LawinenBox::LawinenBox(), SolidProblem< ELEMENT_TYPE >::loadSolidMesh(), main(), CGCoordinates::XYZ::normalisePolynomialCoefficients(), ParticleBeam::ParticleBeam(), FlowRule::set_Polydispersity(), FlowRule::setPolydispersity(), StressStrainControl::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), DPM::setupInitialConditions(), SinterForceUnitTest::setupInitialConditions(), ChuteBottom::setupInitialConditions(), ScaleCoupledBeam::setupMercury(), Siegen::Siegen(), and StressStrainControl::StressStrainControl().
References I, L, Global_Physical_Variables::P, and X.
Referenced by MeltableInteraction::computeNormalForce(), and main().
factorial function
References plotPSD::t.
Referenced by sphericalHarmonics::computeSquaredFactorialValues(), HGridOptimiser::histNumberParticlesPerCell(), and sphericalHarmonics::sphericalHarmonics().
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
References e(), and constants::sqrt_pi.
Referenced by TwoDDGProblem< ELEMENT >::apply_initial_conditions(), Eigen::internal::bicgstabl(), FourierDecomposedHelmholtzProblem< ELEMENT >::check_gamma(), chi_squared(), SegregationWithHopper::create_inflow_particle(), AngleOfRepose::create_inflow_particle(), ElasticRefineableQuarterCircleSectorMesh< ELEMENT >::ElasticRefineableQuarterCircleSectorMesh(), Eigen::internal::erfc_double_large(), eulerangles_manual(), oomph::PVDEquations< DIM >::extended_output(), oomph::PVDEquationsWithPressure< DIM >::extended_output(), oomph::KirchhoffLoveBeamEquations::fill_in_contribution_to_residuals_beam(), oomph::KirchhoffLoveShellEquations::fill_in_contribution_to_residuals_shell(), oomph::RefineableQDPVDElement< DIM, NNODE_1D >::fill_in_generic_contribution_to_residuals_pvd(), oomph::RefineablePVDEquations< DIM >::fill_in_generic_contribution_to_residuals_pvd(), oomph::PVDEquations< DIM >::fill_in_generic_contribution_to_residuals_pvd(), oomph::ScaleCoupledElement< ELEMENT >::fill_in_generic_contribution_to_residuals_pvd(), oomph::VolumeCoupledElement< ELEMENT >::fill_in_generic_contribution_to_residuals_pvd(), oomph::FourierDecomposedHelmholtzDtNBoundaryElement< ELEMENT >::fill_in_generic_residual_contribution_fourier_decomposed_helmholtz_DtN_bc(), oomph::HelmholtzDtNBoundaryElement< ELEMENT >::fill_in_generic_residual_contribution_helmholtz_DtN_bc(), oomph::RefineablePVDEquationsWithPressure< DIM >::fill_in_generic_residual_contribution_pvd_with_pressure(), oomph::PVDEquationsWithPressure< DIM >::fill_in_generic_residual_contribution_pvd_with_pressure(), oomph::KirchhoffLoveShellEquations::get_energy(), oomph::PVDEquationsBase< DIM >::get_energy(), oomph::KirchhoffLoveBeamEquations::get_energy(), RachelsAdvectionDiffusion::get_exact_u(), QThermalPVDElement< DIM >::get_isotropic_growth(), oomph::PVDEquationsBase< DIM >::get_isotropic_growth(), oomph::SCoupledElement< ELEMENT >::get_momentum_and_energy(), oomph::VolumeCoupledElement< ELEMENT >::get_momentum_and_energy(), oomph::PVDEquationsBase< DIM >::get_strain(), oomph::PVDEquations< DIM >::get_stress(), oomph::PVDEquationsWithPressure< DIM >::get_stress(), InfiniteWall::getFurthestPointSuperQuadric(), SolidProblem< ELEMENT_TYPE >::getMassMomentumEnergy(), Eigen::internal::idrs(), Eigen::internal::idrstabl(), TwoDDGProblem< ELEMENT >::limit(), Eigen::internal::llt_rank_update_lower(), main(), oomph::DGEulerFaceElement< ELEMENT >::numerical_flux(), oomph::PVDEquations< DIM >::output(), oomph::PVDEquationsWithPressure< DIM >::output(), ElasticBeamProblem::parameter_study(), HopperInsertionBoundary::placeParticle(), oomph::EulerEquations< DIM >::pressure(), Eigen::internal::generic_fast_erfc< Scalar >::run(), SuperQuadricParticle::setBoundingRadius(), test_scalar_sugar_add_mul(), test_scalar_sugar_sub_div(), Eigen::internal::ldlt_inplace< Lower >::updateInPlace(), Eigen::internal::veltkamp_splitting(), oomph::MooneyRivlin::W(), and oomph::GeneralisedMooneyRivlin::W().
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) |
References abs(), INFO, isnan, logger, max, min, sqrt(), and plotDoE::x.
References Eigen::bfloat16_impl::exp(), I0_exp(), and plotDoE::x.
References chebyshev(), sqrt(), plotDoE::x, and y.
Referenced by I0().
Compares the difference of two Vec3D with an absolute error, useful in UnitTests.
[in] | m1 | The first Vec3D |
[in] | m2 | The second Vec3D |
[in] | absError | The allowed maximum absolute error |
bool mathsFunc::isEqual | ( | MatrixSymmetric3D | m1, |
MatrixSymmetric3D | m2, | ||
Mdouble | absError | ||
) |
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 |
References abs(), v1(), and v2().
Referenced by SphericalSuperQuadricCollision::actionsAfterSolve(), ContactDetectionNormalSpheresTest::actionsAfterTimeStep(), ContactDetectionRotatedSpheresTest::actionsAfterTimeStep(), checkTemplate(), compareParticles(), main(), TriangleMeshWall::moveVerticesToMatchVolume(), SuperQuadricParticle::setBoundingRadius(), MercuryBase::setHGridCellOverSizeRatio(), BouncingSuperQuadric::setupInitialConditions(), SlidingSpheresUnitTest::setupInitialConditions(), ContactDetectionNormalSpheresTest::setupInitialConditions(), ContactDetectionRotatedSpheresTest::setupInitialConditions(), BoundingRadiusTester::test(), ContactDetectionNormalSpheresTest::test(), VolumeTest::test(), Packing::test(), HertzContactRestitutionUnitTest::test(), test1(), test2(), ShapeGradientHessianTester::testCushion(), ShapeGradientHessianTester::testEllipsoid(), ContactDetectionWithWallTester::testEllipsoidsContact(), ShapeGradientHessianTester::testRoundedBeam(), ShapeGradientHessianTester::testSphere(), and ContactDetectionWithWallTester::testSpheresContact().
bool mathsFunc::isEqual | ( | Quaternion | v1, |
Quaternion | v2, | ||
double | absError | ||
) |
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 |
References Global_Physical_Variables::E, Eigen::bfloat16_impl::exp(), L, N, Global_Physical_Variables::P, and R.
Referenced by main(), LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), and SPHNormalSpecies::setCollisionTimeAndRestitutionCoefficient().
This is a sign function, it returns -1 for negative numbers, 1 for positive numbers and 0 for 0.
References calibrate::val.
Referenced by PeriodicBoundaryHandler::checkIsReal(), SuperQuadricParticle::computeHessianLabFixed(), SuperQuadricParticle::computeShapeGradientLabFixed(), HorizontalScrew::getDistanceAndNormal(), Screw::getDistanceAndNormalLabCoordinates(), InfiniteWall::getFurthestPointSuperQuadric(), and PeriodicBoundaryHandler::updateParticles().
References Eigen::bfloat16_impl::floor(), i, N, constants::pi, FishSolnOneDPoisson::Sign, plotDoE::x, and Global_parameters::x2().
Referenced by ChuteWithHopper::addHopper(), AxisymmetricHopper::create_inflow_particle(), ChuteWithHopper::getMaximumVelocityInducedByGravity(), main(), HopperInsertionBoundary::placeParticle(), AxisymmetricHopper::setupInitialConditions(), HourGlass::setupInitialConditions(), Tutorial11::setupInitialConditions(), and tan().
squares a number
References calibrate::val.
Referenced by MeltableInteraction::actionsAfterTimeStep(), AngleOfRepose::actionsBeforeTimeStep(), MeltableParticle::actionsBeforeTimeStep(), MeltableNormalSpecies::analyseTimeScales(), DPMBase::checkParticleForInteractionLocal(), helpers::computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass(), FrictionInteraction::computeFrictionForce(), MindlinRollingTorsionInteraction::computeFrictionForce(), SlidingFrictionInteraction::computeFrictionForce(), ChuteWithPeriodicInflow::computeInternalForces(), BaseParticle::computeMass(), MeltableInteraction::computeNormalForce(), SinterInteraction::computeNormalForce(), HertzianSinterInteraction::computeSinterForce(), LinearPlasticViscoelasticNormalSpecies::computeTimeStep(), LinearViscoelasticNormalSpecies::computeTimeStep(), SinterLinNormalSpecies::computeTimeStep(), SinterNormalSpecies::computeTimeStep(), AngleOfRepose::create_inflow_particle(), Slide::create_rough_wall(), Matrix3D::deviator(), statistics_while_running< T >::finishStatistics(), SinterNormalSpecies::getCollisionTime(), LinearPlasticViscoelasticNormalSpecies::getCollisionTime(), LinearViscoelasticNormalSpecies::getCollisionTime(), SinterLinNormalSpecies::getCollisionTime(), SPHNormalSpecies::getCollisionTime(), HertzianViscoelasticNormalSpecies::getCollisionTime(), StatisticsVector< T >::getCutoff2(), Coil::getDistanceAndNormal(), ParabolaChute::getDistanceAndNormal(), SineWall::getDistanceAndNormal(), Screw::getDistanceAndNormalLabCoordinates(), CGCoordinates::R::getDistanceSquared(), CGCoordinates::RZ::getDistanceSquared(), CGCoordinates::X::getDistanceSquared(), CGCoordinates::XY::getDistanceSquared(), CGCoordinates::XZ::getDistanceSquared(), CGCoordinates::Y::getDistanceSquared(), CGCoordinates::YZ::getDistanceSquared(), CGCoordinates::Z::getDistanceSquared(), MeltableNormalSpecies::getEffectiveElasticModulus(), ChargedBondedInteraction::getElasticEnergy(), IrreversibleAdhesiveInteraction::getElasticEnergy(), HertzianSinterInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergy(), LinearPlasticViscoelasticInteraction::getElasticEnergy(), LinearViscoelasticInteraction::getElasticEnergy(), SinterInteraction::getElasticEnergy(), SinterLinInteraction::getElasticEnergy(), SPHInteraction::getElasticEnergy(), HertzianViscoelasticInteraction::getElasticEnergyAtEquilibrium(), CGCoordinates::Base_X_Y_Z::getGaussIntegralPrefactor(), CGCoordinates::Base_XY_XZ_YZ::getGaussIntegralPrefactor(), CGCoordinates::XYZ::getGaussIntegralPrefactor(), CGCoordinates::Base_XY_XZ_YZ::getGaussPrefactor(), CGCoordinates::XYZ::getGaussPrefactor(), WallSpecies::getInfo(), helpers::getMaximumVelocity(), CGFields::GradVelocityField::getSquared(), CGFields::LiquidMigrationFields::getSquared(), CGFields::StandardFields::getSquared(), CGCoordinates::RZ::getTangentialSquared(), CGCoordinates::XY::getTangentialSquared(), CGCoordinates::XYZ::getTangentialSquared(), CGCoordinates::XZ::getTangentialSquared(), CGCoordinates::YZ::getTangentialSquared(), Mercury3D::hGridFindContactsWithTargetCell(), MercuryBase::hGridUpdateMove(), BaseParticle::isInContactWith(), LaserOnLayer::LaserOnLayer(), main(), CGCoordinates::Base_XY_XZ_YZ::normalisePolynomialCoefficients(), particleParticleTest(), statistics_while_running< T >::processStatistics(), Vreman::set_symmetric_contraction(), ContractionWithPeriodicInflow::set_symmetric_contraction(), ChuteWithPeriodicInflowAndContraction::set_symmetric_contraction(), ChuteWithContraction::set_symmetric_contraction(), SuperQuadricParticle::setBoundingRadius(), StatisticsVector< T >::setCGWidth(), SlidingFrictionSpecies::setCollisionTimeAndNormalAndTangentialRestitutionCoefficient(), SlidingFrictionSpecies::setCollisionTimeAndNormalAndTangentialRestitutionCoefficientNoDispt(), LinearPlasticViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), LinearViscoelasticNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), SinterLinNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), SinterNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), SPHNormalSpecies::setCollisionTimeAndRestitutionCoefficient(), LinearPlasticViscoelasticNormalSpecies::setRestitutionCoefficient(), LinearViscoelasticNormalSpecies::setRestitutionCoefficient(), SinterLinNormalSpecies::setRestitutionCoefficient(), SPHNormalSpecies::setRestitutionCoefficient(), SinterLinNormalSpecies::setStiffnessAndRestitutionCoefficient(), SinterNormalSpecies::setStiffnessAndRestitutionCoefficient(), RotatingDrumWet::setupInitialConditions(), StressStrainControl::setupInitialConditions(), AngleOfRepose::setupInitialConditions(), HertzianSinterForceUnitTest::setupInitialConditions(), SinterForceUnitTest::setupInitialConditions(), Matrix3D::square(), MatrixSymmetric3D::square(), and wallParticleTest().
References cos(), sin(), and plotDoE::x.
Referenced by ChuteWithHopper::addHopper(), and ChuteWithHopper::setHopper().