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)

71 {
72  return 2;
73 }

◆ 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.

40 {
41  Mdouble widthSqrt2 = width * constants::sqrt_2;
42  Mdouble a = -cutoff;
43  Mdouble b = cutoff + distance;
44  //1D prefactor
45  Mdouble prefactor_ = 1.0 / (widthSqrt2 * constants::sqrt_pi);
46  prefactor_ /= erf(cutoff / (widthSqrt2));
47  return prefactor_ * 0.5 / (
48  +erf(b / widthSqrt2) * b
49  + widthSqrt2 / constants::sqrt_pi * exp(-mathsFunc::square(b / widthSqrt2))
50  - erf(a / widthSqrt2) * a
51  - widthSqrt2 / constants::sqrt_pi * exp(-mathsFunc::square(a / widthSqrt2))
52  );
53 }
double Mdouble
Definition: GeneralDefine.h:34
const Mdouble sqrt_pi
Definition: ExtendedMath.h:46
const Mdouble sqrt_2
Definition: ExtendedMath.h:48
T square(const T val)
squares a number
Definition: ExtendedMath.h:106
Mdouble exp(Mdouble Exponent)
Definition: ExtendedMath.cc:84

References mathsFunc::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.

33 {
34  //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))
35  Mdouble prefactor = 1.0 / (constants::sqrt_2 * constants::sqrt_pi * width);
36  return mathsFunc::square(prefactor) / (1.0 - exp(-0.5 * mathsFunc::square(cutoff / width)));
37 }

References mathsFunc::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.

61 {
62  Mdouble volume = 0.0;
63  for (std::size_t i = 0; i < coefficients.size(); i++)
64  volume += coefficients[i] / static_cast<Mdouble>(i + 2);
65  volume *= 2.0 * constants::pi * mathsFunc::square(cutoff);
66  for (double& coefficient : coefficients)
67  coefficient /= volume;
68 }
const Mdouble pi
Definition: ExtendedMath.h:45
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

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


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