MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CGCoordinates::R Class Reference

Defines the non-averaged directions on which spatial coarse-graining is applied (the x-direction for R); all other directions are averaged over homogeneously. More...

#include <R.h>

+ Inheritance diagram for CGCoordinates::R:

Public Member Functions

void write (std::ostream &os) const
 Writes the coordinates in human-readable form to an ostream. More...
 
Mdouble getDistanceSquared (const Vec3D &p) const
 Returns the square of the distance between the particle p and the current CGPoint, in the non-averaged directions. More...
 
void setR (Mdouble r)
 Returns the position of the current CGPoint, in the non-averaged directions. More...
 
const Mdouble getR () const
 
Mdouble getINormal (const BaseInteraction &c, const Vec3D &normal) const
 For the Interaction between particles/walls P and I, this function returns the dot product between the normal vector of the interaction and the branch vector from the current CGPoint towards I. More...
 
Mdouble getPNormal (const BaseInteraction &c, const Vec3D &normal) const
 For the Interaction between particles/walls P and I, this function returns the dot product between the normal vector of the interaction and the branch vector from the current CGPoint towards P. More...
 
Mdouble getCNormal (const BaseInteraction &c, const Vec3D &normal) const
 For the Interaction between particles/walls P and I, this function returns the dot product between the normal vector of the interaction and the branch vector from the current CGPoint towards the contact point. More...
 
Mdouble getWeight () override
 

Static Public Member Functions

static void writeNames (std::ostream &os)
 Writes the coordinate names in human-readable form to an ostream. More...
 
static Mdouble getVolumeOfAveragedDimensions (const Vec3D &min, const Vec3D &max)
 returns the factor the CGFunction has to be divided by, due to integrating the variables over the averaged dimensions, 1.0 for XYZ. More...
 
static Mdouble getLength (const Vec3D &p)
 Returns the length of the input vector in the non-averaged directions. 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 Mdouble getDomainVolume (const Vec3D &min, const Vec3D &max)
 
static bool isResolvedIn (unsigned i)
 
static std::string getName ()
 
- Static Public Member Functions inherited from CGCoordinates::Base_X_Y_Z
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)
 

Protected Attributes

Mdouble r_
 

Detailed Description

Defines the non-averaged directions on which spatial coarse-graining is applied (the x-direction for R); all other directions are averaged over homogeneously.

See XYZ for details.

Definition at line 51 of file R.h.

Member Function Documentation

Mdouble R::getCNormal ( const BaseInteraction c,
const Vec3D normal 
) const

For the Interaction between particles/walls P and I, this function returns the dot product between the normal vector of the interaction and the branch vector from the current CGPoint towards the contact point.

Definition at line 91 of file R.cc.

References Vec3D::dot(), BaseInteraction::getContactPoint(), getLength(), and r_.

92 {
93  if (Vec3D::dot(c.getContactPoint(), normal) > 0)
94  {
95  return (getLength(c.getContactPoint()) - r_);
96  }
97  else
98  {
99  return -(getLength(c.getContactPoint()) - r_);
100  }
101 }
Mdouble r_
Definition: R.h:135
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: R.cc:57
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76
Mdouble R::getDistanceSquared ( const Vec3D p) const

Returns the square of the distance between the particle p and the current CGPoint, in the non-averaged directions.

Definition at line 62 of file R.cc.

References getLength(), r_, and mathsFunc::square().

63 {
64  return mathsFunc::square(getLength(p) - r_);
65 }
Mdouble r_
Definition: R.h:135
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: R.cc:57
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
Mdouble R::getDomainVolume ( const Vec3D min,
const Vec3D max 
)
static

Definition at line 123 of file R.cc.

References constants::pi, Vec3D::X, and Vec3D::Z.

124 {
125  //note, the x-coordinate represents the r-coordinate here
126  return constants::pi * (max.X * max.X - min.X * min.X) * (max.Z - min.Z);
127 }
Mdouble X
the vector components
Definition: Vector.h:65
const Mdouble pi
Definition: ExtendedMath.h:45
Mdouble Z
Definition: Vector.h:65
Mdouble R::getINormal ( const BaseInteraction c,
const Vec3D normal 
) const

For the Interaction between particles/walls P and I, this function returns the dot product between the normal vector of the interaction and the branch vector from the current CGPoint towards I.

Definition at line 67 of file R.cc.

References Vec3D::dot(), BaseInteraction::getContactPoint(), BaseInteraction::getI(), getLength(), BaseInteractable::getPosition(), and r_.

68 {
69  if (Vec3D::dot(c.getContactPoint(), normal) > 0)
70  {
71  return (getLength(c.getI()->getPosition()) - r_);
72  }
73  else
74  {
75  return -(getLength(c.getI()->getPosition()) - r_);
76  }
77 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble r_
Definition: R.h:135
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: R.cc:57
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
BaseInteractable * getI()
Returns a pointer to the second object involved in the interaction (often a wall or a particle)...
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76
Mdouble R::getLength ( const Vec3D p)
static

Returns the length of the input vector in the non-averaged directions.

Parameters
[in]pvector whose length should be determined
Returns
length of the vector in the non-averaged directions
Todo:

Definition at line 57 of file R.cc.

References Vec3D::X, and Vec3D::Y.

Referenced by getCNormal(), getDistanceSquared(), getINormal(), and getPNormal().

58 {
59  return sqrt(p.X * p.X + p.Y * p.Y);
60 }
Mdouble X
the vector components
Definition: Vector.h:65
Mdouble Y
Definition: Vector.h:65
std::string R::getName ( )
static

Definition at line 129 of file R.cc.

130 {
131  return "R";
132 }
Mdouble R::getPNormal ( const BaseInteraction c,
const Vec3D normal 
) const

For the Interaction between particles/walls P and I, this function returns the dot product between the normal vector of the interaction and the branch vector from the current CGPoint towards P.

Definition at line 79 of file R.cc.

References Vec3D::dot(), BaseInteraction::getContactPoint(), getLength(), BaseInteraction::getP(), BaseInteractable::getPosition(), and r_.

80 {
81  if (Vec3D::dot(c.getContactPoint(), normal) > 0)
82  {
83  return (getLength(c.getP()->getPosition()) - r_);
84  }
85  else
86  {
87  return -(getLength(c.getP()->getPosition()) - r_);
88  }
89 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble r_
Definition: R.h:135
static Mdouble getLength(const Vec3D &p)
Returns the length of the input vector in the non-averaged directions.
Definition: R.cc:57
const Vec3D & getContactPoint() const
Gets constant reference to contact point (vector).
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:76
BaseInteractable * getP()
Returns a pointer to first object involved in the interaction (normally a particle).
const Mdouble CGCoordinates::R::getR ( ) const
inline

Definition at line 88 of file R.h.

References r_.

89  { return r_; }
Mdouble r_
Definition: R.h:135
Mdouble R::getVolumeOfAveragedDimensions ( const Vec3D min,
const Vec3D max 
)
static

returns the factor the CGFunction has to be divided by, due to integrating the variables over the averaged dimensions, 1.0 for XYZ.

Definition at line 42 of file R.cc.

References Vec3D::Z.

43 {
44  return (max.Z - min.Z);//2*constants::pi
45 }
Mdouble Z
Definition: Vector.h:65
Mdouble R::getWeight ( )
overridevirtual

returns the weight function needed in getTotal (required as functions cannot be )

Returns

Reimplemented from CGCoordinates::BaseCoordinates.

Definition at line 118 of file R.cc.

References r_.

119 {
120  return r_;
121 }
Mdouble r_
Definition: R.h:135
static bool CGCoordinates::R::isResolvedIn ( unsigned  i)
inlinestatic

Definition at line 126 of file R.h.

126 {return i==0?true:false;}
void R::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) \]

Todo:

Definition at line 108 of file R.cc.

References constants::i.

109 {
110  Mdouble volume = 0.0;
111  for (std::size_t i = 0; i < coefficients.size(); i++)
112  volume += coefficients[i] / static_cast<Mdouble>(i + 1);
113  volume *= 2.0 * cutoff;
114  for (double& coefficient : coefficients)
115  coefficient /= volume;
116 }
double Mdouble
Definition: GeneralDefine.h:34
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
void R::setR ( Mdouble  r)

Returns the position of the current CGPoint, in the non-averaged directions.

Definition at line 47 of file R.cc.

References r_.

48 {
49  r_ = r;
50 }
Mdouble r_
Definition: R.h:135
void R::write ( std::ostream &  os) const

Writes the coordinates in human-readable form to an ostream.

Definition at line 37 of file R.cc.

References r_.

38 {
39  os << r_ << ' ';
40 }
Mdouble r_
Definition: R.h:135
void R::writeNames ( std::ostream &  os)
static

Writes the coordinate names in human-readable form to an ostream.

Definition at line 32 of file R.cc.

33 {
34  os << "r ";
35 }

Member Data Documentation

Mdouble CGCoordinates::R::r_
protected

The x-position of the current CGPoint.

Definition at line 135 of file R.h.

Referenced by getCNormal(), getDistanceSquared(), getINormal(), getPNormal(), getR(), getWeight(), setR(), and write().


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