CGCoordinates::Base_XY_XZ_YZ Class Reference

Contains common member functions of the XY, XZ, and YZ classes. More...

#include <Base_XY_XZ_YZ.h>

+ Inheritance diagram for CGCoordinates::Base_XY_XZ_YZ:

Static Public Member Functions

static Mdouble getGaussPrefactor (Mdouble width, Mdouble cutoff)
 Computes the prefactor of the Gauss CGFunction, which is dependent on the number of non-averaged dimensions. More...
 
static Mdouble getGaussIntegralPrefactor (Mdouble distance, Mdouble width, Mdouble cutoff)
 Computes the prefactor of the Gauss line integral, which is dependent on the number of non-averaged dimensions. More...
 
static void normalisePolynomialCoefficients (std::vector< Mdouble > &coefficients, Mdouble cutoff)
 Normalises the coefficients of Polynomial CGFunction such that the integral over all non-averaged dimensions is unity. More...
 
static const unsigned countVariables ()
 
- Static Public Member Functions inherited from CGCoordinates::BaseCoordinates
static Mdouble getDomainVolume (const Vec3D &min, const Vec3D &max)
 

Additional Inherited Members

- Public Member Functions inherited from CGCoordinates::BaseCoordinates
virtual Mdouble getWeight ()
 

Detailed Description

Contains common member functions of the XY, XZ, and YZ classes.

As XY, XZ, and YZ share a lot of functionality, the shared functions are stored in this common base class.

Member Function Documentation

◆ countVariables()

const unsigned Base_XY_XZ_YZ::countVariables ( )
static

returns the number of variables (in this case two)

50 {
51  return 2;
52 }

◆ getGaussIntegralPrefactor()

Mdouble Base_XY_XZ_YZ::getGaussIntegralPrefactor ( Mdouble  distance,
Mdouble  width,
Mdouble  cutoff 
)
static

Computes the prefactor of the Gauss line integral, which is dependent on the number of non-averaged dimensions.

19 {
20  Mdouble widthSqrt2 = width * constants::sqrt_2;
21  Mdouble a = -cutoff;
22  Mdouble b = cutoff + distance;
23  //1D prefactor
24  Mdouble prefactor_ = 1.0 / (widthSqrt2 * constants::sqrt_pi);
25  prefactor_ /= erf(cutoff / (widthSqrt2));
26  return prefactor_ * 0.5 / (
27  +erf(b / widthSqrt2) * b
28  + widthSqrt2 / constants::sqrt_pi * exp(-mathsFunc::square(b / widthSqrt2))
29  - erf(a / widthSqrt2) * a
30  - widthSqrt2 / constants::sqrt_pi * exp(-mathsFunc::square(a / widthSqrt2))
31  );
32 }
Scalar * b
Definition: benchVecAdd.cpp:17
const Scalar * a
Definition: level2_cplx_impl.h:32
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 exp(const bfloat16 &a)
Definition: BFloat16.h:615
const Mdouble sqrt_pi
Definition: ExtendedMath.h:24
const Mdouble sqrt_2
Definition: ExtendedMath.h:26
T square(const T val)
squares a number
Definition: ExtendedMath.h:86

References a, b, Eigen::bfloat16_impl::exp(), constants::sqrt_2, constants::sqrt_pi, and mathsFunc::square().

◆ getGaussPrefactor()

Mdouble Base_XY_XZ_YZ::getGaussPrefactor ( Mdouble  width,
Mdouble  cutoff 
)
static

Computes the prefactor of the Gauss CGFunction, which is dependent on the number of non-averaged dimensions.

12 {
13  //Wolfram alpha: integrate(x*exp(-x^2/(2w^2)),{x,0,c})/integrate(x*exp(-x^2/(2w^2)),{x,0,inf})=1-e^(-c^2/(2 w^2))
14  Mdouble prefactor = 1.0 / (constants::sqrt_2 * constants::sqrt_pi * width);
15  return mathsFunc::square(prefactor) / (1.0 - exp(-0.5 * mathsFunc::square(cutoff / width)));
16 }

References Eigen::bfloat16_impl::exp(), constants::sqrt_2, constants::sqrt_pi, and mathsFunc::square().

◆ normalisePolynomialCoefficients()

void Base_XY_XZ_YZ::normalisePolynomialCoefficients ( std::vector< Mdouble > &  coefficients,
Mdouble  cutoff 
)
static

Normalises the coefficients of Polynomial CGFunction such that the integral over all non-averaged dimensions is unity.

The volume is computed as

\[volume=\int_0^1\sum_{i=1}^n c_i r^i 2 pi r dr = 2 pi \sum_{i=1}^n c_i/(i+2) \]

with 2 pi r the circumference of a circle.

40 {
41  Mdouble volume = 0.0;
42  for (std::size_t i = 0; i < coefficients.size(); i++)
43  volume += coefficients[i] / static_cast<Mdouble>(i + 2);
44  volume *= 2.0 * constants::pi * mathsFunc::square(cutoff);
45  for (double& coefficient : coefficients)
46  coefficient /= volume;
47 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const Mdouble pi
Definition: ExtendedMath.h:23

References i, constants::pi, and mathsFunc::square().


The documentation for this class was generated from the following files: