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

#include <GradVelocityField.h>

Public Member Functions

 GradVelocityField ()
 Default constructor, sets all field values to zero. More...
 
 GradVelocityField (const GradVelocityField &P)=default
 Default copy constructor, copies the values of all fields. More...
 
 ~GradVelocityField ()=default
 Destructor, it simply destructs the GradVelocityField and all the objects it contains. More...
 
void write (std::ostream &os) const
 Writes class content into an output stream, typically a stat file. More...
 
void output (std::ostream &os) const
 Writes human-readable class content into an output stream, typically a stat file. More...
 
void setZero ()
 Sets all fields to zero. More...
 
GradVelocityField getSquared () const
 Returns the square of all field values (to calculate standard deviation). More...
 
GradVelocityFieldoperator= (const GradVelocityField &P)
 Copies all field values. More...
 
GradVelocityFieldoperator+= (const GradVelocityField &P)
 Adds the field values on the RHS to the LHS of the equation. More...
 
GradVelocityFieldoperator-= (const GradVelocityField &P)
 Subtracts the field values on the RHS from the LHS of the equation. More...
 
GradVelocityFieldoperator/= (Mdouble a)
 Divides the field values on the LHS by the RHS of the equation. More...
 
GradVelocityField operator* (Mdouble a) const
 Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and returns the answer. More...
 
void addParticleStatistics (Mdouble phi, const GradVelocityField &currentInteraction)
 This function should be called from within a loop over all particles to compute all the fields that are defined as a sum over all particles (e.g. density, momentum). More...
 
void addParticleDifferentialStatistics (Vec3D &dphi, const GradVelocityField &currentInteraction)
 
void addInteractionStatistics (Mdouble psi, const GradVelocityField &currentInteraction)
 This function should be called from within a loop over all Interactions to compute all the fields that are defined as a sum over all Interactions (e.g. stress). More...
 
void addContactPointStatistics (Mdouble phi, const GradVelocityField &currentInteraction)
 This function should be called from within a loop over all Interactions to compute all the fields that are defined as a sum over all Interactions with external objects (e.g. IFD). More...
 
void setFields (const BaseInteraction &c, IntegralType type)
 
void setCylindricalFields (const BaseInteraction &c, IntegralType type)
 
void setFields (const BaseParticle &p)
 
void setCylindricalFields (const BaseParticle &p)
 
Mdouble getDensity () const
 
Vec3D getMomentum () const
 
Vec3D getDDensity () const
 
Matrix3D getDMomentum () const
 

Static Public Member Functions

static void writeNames (std::ostream &os, unsigned countVariables)
 
static bool doInteractionStatistics ()
 Returns true if the class contains fields that are defined as a sum over all Interactions (e.g. stress), else returns false. More...
 
static bool evaluateFixedParticles ()
 
static bool isDifferentialField ()
 

Private Attributes

Mdouble density_
 
Vec3D momentum_
 
Vec3D ddensity_
 
Matrix3D dmomentum_
 

Detailed Description

Definition at line 39 of file GradVelocityField.h.

Constructor & Destructor Documentation

CGFields::GradVelocityField::GradVelocityField ( )

Default constructor, sets all field values to zero.

Definition at line 32 of file GradVelocityField.cc.

References setZero().

33 {
34  setZero();
35 #ifdef DEBUG_CONSTRUCTOR
36  std::cerr << "GradVelocityField::GradVelocityField() finished" << std::endl;
37 #endif
38 }
void setZero()
Sets all fields to zero.
CGFields::GradVelocityField::GradVelocityField ( const GradVelocityField P)
default

Default copy constructor, copies the values of all fields.

CGFields::GradVelocityField::~GradVelocityField ( )
default

Destructor, it simply destructs the GradVelocityField and all the objects it contains.

Member Function Documentation

void CGFields::GradVelocityField::addContactPointStatistics ( Mdouble  phi,
const GradVelocityField currentInteraction 
)

This function should be called from within a loop over all Interactions to compute all the fields that are defined as a sum over all Interactions with external objects (e.g. IFD).

Parameters
[in]phithe value of the cg function for the contact point of c and the current CGPoint
[in]cthe interaction which is used in the cg function

Definition at line 177 of file GradVelocityField.cc.

178 {
179 }
void CGFields::GradVelocityField::addInteractionStatistics ( Mdouble  psi,
const GradVelocityField currentInteraction 
)

This function should be called from within a loop over all Interactions to compute all the fields that are defined as a sum over all Interactions (e.g. stress).

Parameters
[in]psithe value of the line integral from C to P at the current CGPoint
[in]cthe contact which is used in the line integral

Definition at line 168 of file GradVelocityField.cc.

169 {
170 }
void CGFields::GradVelocityField::addParticleDifferentialStatistics ( Vec3D dphi,
const GradVelocityField currentInteraction 
)

Definition at line 181 of file GradVelocityField.cc.

References ddensity_, dmomentum_, Matrix3D::dyadic(), getDensity(), and getMomentum().

182 {
183  ddensity_ += currentInteraction.getDensity() * dphi;
184  dmomentum_ += Matrix3D::dyadic(currentInteraction.getMomentum(), dphi);
185 }
static Matrix3D dyadic(const Vec3D &a, const Vec3D &b)
Calculates the dyadic product of a two Vec3D: .
Definition: Matrix.cc:323
void CGFields::GradVelocityField::addParticleStatistics ( Mdouble  phi,
const GradVelocityField currentInteraction 
)

This function should be called from within a loop over all particles to compute all the fields that are defined as a sum over all particles (e.g. density, momentum).

Parameters
[in]phithe value of the cg function at the current CGPoint
[in]pthe particle which is used in the cg function

Definition at line 158 of file GradVelocityField.cc.

References density_, getDensity(), getMomentum(), and momentum_.

159 {
160  density_ += currentInteraction.getDensity() * phi;
161  momentum_ += currentInteraction.getMomentum() * phi;
162 }
bool CGFields::GradVelocityField::doInteractionStatistics ( )
static

Returns true if the class contains fields that are defined as a sum over all Interactions (e.g. stress), else returns false.

If the functions returns false, addInteractionStatistics and addContactPointStatistics are never called.

Returns
True if the class contains fields that are defined as a sum over all Interactions, else false.

Definition at line 193 of file GradVelocityField.cc.

194 {
195  return false;
196 }
static bool CGFields::GradVelocityField::evaluateFixedParticles ( )
inlinestatic

Definition at line 165 of file GradVelocityField.h.

166  {
167  return false;
168  }
Vec3D CGFields::GradVelocityField::getDDensity ( ) const
inline

Definition at line 155 of file GradVelocityField.h.

References ddensity_.

156  {
157  return ddensity_;
158  }
Mdouble CGFields::GradVelocityField::getDensity ( ) const
inline

Definition at line 145 of file GradVelocityField.h.

References density_.

Referenced by addParticleDifferentialStatistics(), and addParticleStatistics().

146  {
147  return density_;
148  }
Matrix3D CGFields::GradVelocityField::getDMomentum ( ) const
inline

Definition at line 160 of file GradVelocityField.h.

References dmomentum_.

161  {
162  return dmomentum_;
163  }
Vec3D CGFields::GradVelocityField::getMomentum ( ) const
inline

Definition at line 150 of file GradVelocityField.h.

References momentum_.

Referenced by addParticleDifferentialStatistics(), and addParticleStatistics().

151  {
152  return momentum_;
153  }
GradVelocityField CGFields::GradVelocityField::getSquared ( ) const

Returns the square of all field values (to calculate standard deviation).

Returns
a CGField containing the square of the values in the current object

Definition at line 84 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, momentum_, mathsFunc::square(), Matrix3D::square(), and Vec3D::square().

85 {
87  P.density_ = mathsFunc::square(density_);
88  P.momentum_ = Vec3D::square(momentum_);
89  P.ddensity_ = Vec3D::square(ddensity_);
90  P.dmomentum_ = Matrix3D::square(dmomentum_);
91  return P;
92 }
static Vec3D square(const Vec3D &a)
Calculates the pointwise square of a Vec3D.
Definition: Vector.cc:114
GradVelocityField()
Default constructor, sets all field values to zero.
T square(const T val)
squares a number
Definition: ExtendedMath.h:106
static Matrix3D square(const Matrix3D &A)
Calculates the pointwise square.
Definition: Matrix.cc:298
static bool CGFields::GradVelocityField::isDifferentialField ( )
inlinestatic

A bool that determines if the derivative of the CG function has to be computed

Definition at line 174 of file GradVelocityField.h.

175  {
176  return true;
177  }
GradVelocityField CGFields::GradVelocityField::operator* ( Mdouble  a) const

Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and returns the answer.

Parameters
[in]athe scalar that we multiply with
Returns
the CGField to which the multiplied values are written

Definition at line 131 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

132 {
134  p.density_ = density_ * a;
135  p.momentum_ = momentum_ * a;
136  p.ddensity_ = ddensity_ * a;
137  p.dmomentum_ = dmomentum_ * a;
138  return p;
139 }
GradVelocityField()
Default constructor, sets all field values to zero.
GradVelocityField & CGFields::GradVelocityField::operator+= ( const GradVelocityField P)

Adds the field values on the RHS to the LHS of the equation.

Parameters
[in]Pthe CGField that has to be added
Returns
the CGField to which the values are added

Definition at line 105 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

106 {
107  density_ += P.density_;
108  momentum_ += P.momentum_;
109  ddensity_ += P.ddensity_;
110  dmomentum_ += P.dmomentum_;
111  return *this;
112 }
GradVelocityField & CGFields::GradVelocityField::operator-= ( const GradVelocityField P)

Subtracts the field values on the RHS from the LHS of the equation.

Parameters
[in]Pthe CGField that has to be subtracted
Returns
the CGField from which the values are subtracted

Definition at line 118 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

119 {
120  density_ -= P.density_;
121  momentum_ -= P.momentum_;
122  ddensity_ -= P.ddensity_;
123  dmomentum_ -= P.dmomentum_;
124  return *this;
125 }
GradVelocityField & CGFields::GradVelocityField::operator/= ( Mdouble  a)

Divides the field values on the LHS by the RHS of the equation.

Parameters
[in]athe scalar that we divide by
Returns
the CGField to which the divided values are written

Definition at line 145 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

146 {
147  density_ /= a;
148  momentum_ /= a;
149  ddensity_ /= a;
150  dmomentum_ /= a;
151  return *this;
152 }
GradVelocityField & CGFields::GradVelocityField::operator= ( const GradVelocityField P)
default

Copies all field values.

Parameters
[in]Pthe CGField that has to be copied
Returns
the CGField into which the values are copied
void CGFields::GradVelocityField::output ( std::ostream &  os) const

Writes human-readable class content into an output stream, typically a stat file.

Parameters
[out]osthe ostream into which the data is written.

Definition at line 65 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

66 {
67  os << "density " << density_;
68  os << " momentum " << momentum_;
69  os << " ddensity " << ddensity_;
70  os << " dmomentum " << dmomentum_;
71 }
void CGFields::GradVelocityField::setCylindricalFields ( const BaseInteraction c,
IntegralType  type 
)

Definition at line 208 of file GradVelocityField.cc.

209 {
210 }
void CGFields::GradVelocityField::setCylindricalFields ( const BaseParticle p)

Definition at line 212 of file GradVelocityField.cc.

References Vec3D::getCylindricalTensorField(), BaseInteractable::getPosition(), momentum_, and setFields().

213 {
214  setFields(p);
216 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Vec3D getCylindricalTensorField(const Vec3D &position) const
Returns this vector field at point p to cylindrical coordinates.
Definition: Vector.cc:261
void setFields(const BaseInteraction &c, IntegralType type)
void CGFields::GradVelocityField::setFields ( const BaseInteraction c,
IntegralType  type 
)

Definition at line 198 of file GradVelocityField.cc.

Referenced by setCylindricalFields().

199 {
200 }
void CGFields::GradVelocityField::setFields ( const BaseParticle p)

Definition at line 202 of file GradVelocityField.cc.

References density_, BaseParticle::getMass(), BaseInteractable::getVelocity(), and momentum_.

203 {
204  density_ = p.getMass();
205  momentum_ = p.getVelocity() * p.getMass();
206 }
Mdouble getMass() const
Returns the particle's mass.
Definition: BaseParticle.h:322
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
void CGFields::GradVelocityField::setZero ( )

Sets all fields to zero.

Definition at line 73 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, momentum_, Matrix3D::setZero(), and Vec3D::setZero().

Referenced by GradVelocityField().

74 {
75  density_ = 0.0;
79 }
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
void setZero()
Sets all elements to zero.
Definition: Matrix.cc:75
void CGFields::GradVelocityField::write ( std::ostream &  os) const

Writes class content into an output stream, typically a stat file.

Parameters
[out]osthe ostream into which the data is written.

Definition at line 54 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

55 {
56  os << density_;
57  os << " " << momentum_;
58  os << " " << ddensity_;
59  os << " " << dmomentum_;
60 }
void CGFields::GradVelocityField::writeNames ( std::ostream &  os,
unsigned  countVariables 
)
static
Parameters
[out]osthe ostream into which the data is written.

Definition at line 43 of file GradVelocityField.cc.

44 {
45  os << countVariables + 1 << ":Density ";
46  os << countVariables + 2 << "-" << countVariables + 4 << ":momentum ";
47  os << countVariables + 5 << "-" << countVariables + 7 << ":ddensity ";
48  os << countVariables + 8 << "-" << countVariables + 16 << ":dmomentum ";
49 }

Member Data Documentation

Vec3D CGFields::GradVelocityField::ddensity_
private
Mdouble CGFields::GradVelocityField::density_
private
Matrix3D CGFields::GradVelocityField::dmomentum_
private
Vec3D CGFields::GradVelocityField::momentum_
private

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