MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.

Definition at line 48 of file Base_X_Y_Z.h.

Member Function Documentation

const unsigned Base_X_Y_Z::countVariables ( )
static

returns the number of variables (in this case one)

Definition at line 66 of file Base_X_Y_Z.cc.

67 {
68  return 1;
69 }
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.

Definition at line 38 of file Base_X_Y_Z.cc.

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

39 {
40  Mdouble widthSqrt2 = width * constants::sqrt_2;
41  Mdouble a = -cutoff;
42  Mdouble b = cutoff + distance;
43  return 0.5 / (
44  +erf(b / widthSqrt2) * b
45  + widthSqrt2 / constants::sqrt_pi * exp(-mathsFunc::square(b / widthSqrt2))
46  - erf(a / widthSqrt2) * a
47  - widthSqrt2 / constants::sqrt_pi * exp(-mathsFunc::square(a / widthSqrt2))
48  );
49 }
double Mdouble
Definition: GeneralDefine.h:34
Mdouble exp(Mdouble Exponent)
Definition: ExtendedMath.cc:84
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:104
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.

Definition at line 32 of file Base_X_Y_Z.cc.

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

33 {
34  Mdouble prefactor = 1.0 / (constants::sqrt_2 * constants::sqrt_pi * width);
35  return prefactor / erf(cutoff / (constants::sqrt_2 * width));
36 }
double Mdouble
Definition: GeneralDefine.h:34
const Mdouble sqrt_pi
Definition: ExtendedMath.h:46
const Mdouble sqrt_2
Definition: ExtendedMath.h:48
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) \]

Definition at line 55 of file Base_X_Y_Z.cc.

References constants::i.

56 {
57  Mdouble volume = 0.0;
58  for (std::size_t i = 0; i < coefficients.size(); i++)
59  volume += coefficients[i] / static_cast<Mdouble>(i + 1);
60  volume *= 2.0 * cutoff;
61  for (double& coefficient : coefficients)
62  coefficient /= volume;
63  //logger(INFO,"Volume %",volume);
64 }
double Mdouble
Definition: GeneralDefine.h:34
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50

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