CGCoordinates::Base_X_Y_Z Class Reference

Contains common member functions of the X, Y, and Z classes. More...

#include <Base_X_Y_Z.h>

+ Inheritance diagram for CGCoordinates::Base_X_Y_Z:

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 X, Y, and Z classes.

As X, Y, and Z share a lot of functionality, the shared functions are stored in this common base class.

Member Function Documentation

◆ countVariables()

const unsigned Base_X_Y_Z::countVariables ( )
static

returns the number of variables (in this case one)

46 {
47  return 1;
48 }

◆ getGaussIntegralPrefactor()

Mdouble Base_X_Y_Z::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.

18 {
19  Mdouble widthSqrt2 = width * constants::sqrt_2;
20  Mdouble a = -cutoff;
21  Mdouble b = cutoff + distance;
22  return 0.5 / (
23  +erf(b / widthSqrt2) * b
24  + widthSqrt2 / constants::sqrt_pi * exp(-mathsFunc::square(b / widthSqrt2))
25  - erf(a / widthSqrt2) * a
26  - widthSqrt2 / constants::sqrt_pi * exp(-mathsFunc::square(a / widthSqrt2))
27  );
28 }
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_X_Y_Z::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  Mdouble prefactor = 1.0 / (constants::sqrt_2 * constants::sqrt_pi * width);
14  return prefactor / erf(cutoff / (constants::sqrt_2 * width));
15 }

References constants::sqrt_2, and constants::sqrt_pi.

◆ normalisePolynomialCoefficients()

void Base_X_Y_Z::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 dr = 2 \sum_{i=1}^n c_i/(i+1) \]

35 {
36  Mdouble volume = 0.0;
37  for (std::size_t i = 0; i < coefficients.size(); i++)
38  volume += coefficients[i] / static_cast<Mdouble>(i + 1);
39  volume *= 2.0 * cutoff;
40  for (double& coefficient : coefficients)
41  coefficient /= volume;
42  //logger(INFO,"Volume %",volume);
43 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9

References i.


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