revision: v0.14
Helpers.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef HELPERS_H
27 #define HELPERS_H
28 
29 #include "ExtendedMath.h"
30 #include <iostream> //std::istream and std::stringstream
31 #include <fstream> //std::fstream
32 #include <vector> //std::fstream
33 #include <Logger.h>
34 
35 class ParticleSpecies;
36 
37 namespace helpers
38 {
39  // returns the input string after converting upper-case characters to lower case
40  std::string lower(std::string s);
41 
45 class KAndDisp
46 {
47 public:
50 };
51 
52 // /*!
53 // * \brief Set disp and k such that is matches a given collision time tc and restitution coefficient r
54 // * for a collision of effective/reduced mass m.
55 // * \deprecated use species->setCollisionTimeAndRestitutionCoefficient
56 // * (collisionTime, dissipationTimeScale, 2.0*effectiveMass) instead
57 // */
58 // MERCURY_DEPRECATED
59 // KAndDisp computeKAndDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass(Mdouble tc, Mdouble r, Mdouble mass);
60 //
61 // /*!
62 // * \brief Calculates the collision time for a given stiffness, dissipation, and effective mass
63 // * \deprecated use species->computeCollisionTime(2.0*effectiveMass) instead
64 // * \todo This does not result in the same value as the given alternative.
65 // */
66 // MERCURY_DEPRECATED
67 // Mdouble computeCollisionTimeFromKAndDispAndEffectiveMass(Mdouble k, Mdouble disp, Mdouble mass);
68 //
69 // /*!
70 // * \brief Calculates the restitution coefficient time for a given stiffness, dissipation, and effective mass
71 // * \deprecated use species->computeRestitutionCoefficient(2.0*effectiveMass) instead
72 // */
73 // MERCURY_DEPRECATED
74 // Mdouble computeRestitutionCoefficientFromKAndDispAndEffectiveMass(Mdouble k, Mdouble disp, Mdouble mass);
75 //
76 // /*!
77 // * \brief Calculates the dissipation for a given stiffness, restitution coefficient, and effective mass
78 // */
79 // MERCURY_DEPRECATED
80 // Mdouble computeDispFromKAndRestitutionCoefficientAndEffectiveMass(Mdouble k, Mdouble r, Mdouble mass);
81 //
82 // /*!
83 // * \brief Calculates the collision time for a given stiffness, restitution coefficient, and effective mass
84 // * \deprecated use species->computeCollisionTime(2.0*effectiveMass) instead
85 // */
86 // MERCURY_DEPRECATED
87 // Mdouble computeCollisionTimeFromKAndRestitutionCoefficientAndEffectiveMass(Mdouble k, Mdouble r, Mdouble mass);
88 //
89 // /*!
90 // * \brief Calculates the dissipation for a given stiffness, collision time, and effective mass
91 // * \deprecated use species->setStiffnessAndRestitutionCoefficient(2.0*effectiveMass) instead
92 // */
93 // MERCURY_DEPRECATED
94 // Mdouble computeDispFromKAndCollisionTimeAndEffectiveMass(Mdouble k, Mdouble tc, Mdouble mass);
95 //
96 // /*!
97 // * \brief Calculates the restitution coefficient for a given stiffness, collision time, and effective mass
98 // * \deprecated use species->computeRestitutionCoefficient(2.0*effectiveMass) instead
99 // */
100 // MERCURY_DEPRECATED
101 // Mdouble computeRestitutionCoefficientFromKAndCollisionTimeAndEffectiveMass(Mdouble k, Mdouble tc, Mdouble mass);
102 //
103 // /*!
104 // * \brief Calculates the dissipation for a given collision time, restitution coefficient, and effective mass
105 // * \deprecated use species->setCollisionTimeAndRestitutionCoefficient(2.0*effectiveMass) instead
106 // */
107 // MERCURY_DEPRECATED
108 // Mdouble computeDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass(Mdouble tc, Mdouble r, Mdouble mass);
109 //
110 // /*!
111 // * \brief Calculates the stiffness for a given collision time, restitution coefficient, and effective mass
112 // * \deprecated use species->setCollisionTimeAndRestitutionCoefficient(2.0*effectiveMass) instead
113 // */
114 // MERCURY_DEPRECATED
115 // Mdouble computeKFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass(Mdouble tc, Mdouble r, Mdouble mass);
116 //
117 // /*!
118 // * \brief Calculates the stiffness for a given collision time, dissipation, and effective mass
119 // */
120 // MERCURY_DEPRECATED
121 // Mdouble computeKFromCollisionTimeAndDispAndEffectiveMass(Mdouble tc, Mdouble disp, Mdouble mass);
122 //
123 // /*!
124 // * \brief Calculates the resitution coefficient for a given collision time, dissipation, and effective mass
125 // * \deprecated use species->computeRestitutionCoefficient(2.0*effectiveMass) instead
126 // */
127 // MERCURY_DEPRECATED
128 // Mdouble computeRestitutionCoefficientFromCollisionTimeAndDispAndEffectiveMass(Mdouble tc, Mdouble disp, Mdouble mass);
129 //
130 // /*!
131 // * \brief Calculates the stiffness for a given dissipation, restitution coefficient, and effective mass
132 // */
133 // MERCURY_DEPRECATED
134 // Mdouble computeKFromDispAndRestitutionCoefficientAndEffectiveMass(Mdouble disp, Mdouble r, Mdouble mass);
135 //
136 // /*!
137 // * \brief Calculates the collision time for a given dissipation, restitution coefficient, and effective mass
138 // * \deprecated use species->computeCollisionTime(2.0*effectiveMass) instead
139 // */
140 // MERCURY_DEPRECATED
141 // Mdouble computeCollisionTimeFromDispAndRestitutionCoefficientAndEffectiveMass(Mdouble disp, Mdouble r, Mdouble mass);
142 
144 
149 {
150 public:
155 };
156 
166  Mdouble tc, Mdouble r, Mdouble beta, Mdouble mass);
167 
175 
179 unsigned int getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep(unsigned int numberOfSaves, Mdouble timeMax,
180  Mdouble timeStep);
181 
185 void getLineFromStringStream(std::istream& in, std::stringstream& out);
186 
190 bool writeToFile(std::string filename, std::string filecontent);
191 
195 void writeCommandLineToFile(const std::string filename, const int argc, char * const argv[]);
196 
200 void gnuplot(std::string command);
201 
205 bool addToFile(std::string filename, std::string filecontent);
206 
210 bool fileExists(std::string strFilename);
211 
215 bool openFile(std::fstream& file, std::string filename, std::fstream::openmode mode);
216 
221 
222 std::vector<double> readArrayFromFile(std::string filename, int& n, int& m);
223 
224 void more(std::string filename, unsigned nLines = constants::unsignedMax);
225 
226 template<typename T>
227 std::string to_string(const T& n)
228 {
229  std::ostringstream stm;
230  stm << n;
231  return stm.str();
232 }
233 
234 std::string to_string(Mdouble value, unsigned precision);
235 
246 template<typename T>
247 bool readOptionalVariable(std::istream& is, const std::string& name, T& variable)
248 {
251  const auto pos = is.tellg();
252  std::string dummy;
253  is >> dummy;
254  if (dummy == name)
255  {
256  is >> variable;
257  return true;
258  } else {
259  is.seekg(pos);
260  return false;
261  }
262 }
263 
267 void loadingTest(const ParticleSpecies* species, Mdouble displacement, Mdouble velocity, Mdouble radius,
268  std::string name);
269 
273 void normalAndTangentialLoadingTest(const ParticleSpecies* species, Mdouble displacement,
274  Mdouble tangentialDisplacement, Mdouble velocity, Mdouble radius,
275  std::string name);
276 
280 void objectivenessTest(const ParticleSpecies* species, Mdouble displacement, Mdouble tangentialDisplacement,
281  Mdouble velocity, Mdouble radius, std::string name);
282 
286 bool compare(std::istream& is, std::string s);
287 
288 
310 template<typename T>
311 T readFromFile(std::string fileName, std::string varName, T value)
312 {
313  //open filestream
314  std::ifstream is(fileName.c_str(), std::ios::in);
315  if (is.fail())
316  {
317  logger(INFO, "readFromFile: file % could not be opened, variable % set to default value %",
318  fileName, varName, value);
319  return value;
320  }
321 
322  //read in variables, until the right one is fount
323  std::string s;
324  while (!is.eof())
325  {
326  is >> s;
327  if (!s.compare(varName))
328  {
329  is >> value;
330  logger(INFO, "readFromFile: variable % set to % ", varName, value);
331  return value;
332  }
333  }
334 
335  //if the right variable is never found
336  logger(WARN, "readFromFile: variable % not set in file %, using default value % ", varName, fileName, value);
337  return value;
338 }
339 
349 bool readFromCommandLine(int argc, char *argv[], std::string varName);
350 
351 template<typename T>
352 T readFromCommandLine(int argc, char *argv[], std::string varName, T value)
353 {
354  for (unsigned i=0; i<argc-1; ++i) {
355  if (varName == argv[i]) {
356  value = atof(argv[i+1]);
357  logger(INFO, "readFromCommandLine: % set to % ", varName.substr(1), value);
358  return value;
359  }
360  }
361  //if the variable is not found
362  logger(INFO, "readFromCommandLine: % set to default value % ", varName.substr(1), value);
363  return value;
364 }
365 
366 template<typename T, size_t n>
367 std::array<T,n> readArrayFromCommandLine(int argc, char *argv[], std::string varName, std::array<T,n> value)
368 {
369  for (unsigned i=0; i<argc-1; ++i) {
370  if (varName == argv[i]) {
371  unsigned j = i+1;
372  std::stringstream out;
373  for (auto& v : value) {
374  v = atof(argv[j]);
375  out << v << ' ';
376  ++j;
377  }
378  logger(INFO, "readFromCommandLine: % set to % ", varName.substr(1), out.str());
379  return value;
380  }
381  }
382  //if the variable is not found
383  std::stringstream out;
384  for (auto& v : value) out << v << ' ';
385  logger(INFO, "readFromCommandLine: % set to default value % ", varName.substr(1), out.str());
386  return value;
387 }
388 
389 template<typename T>
390 std::vector<T> readVectorFromCommandLine(int argc, char *argv[], std::string varName, size_t n, std::vector<T> values)
391 {
392  for (unsigned i=0; i<argc-1; ++i) {
393  if (varName == argv[i]) {
394  // read until the next argument starts
395  values.resize(0);
396  std::stringstream out;
397  for (int j = i+1; j<argc and argv[j][0]!='-'; ++j) {
398  values.push_back(atof(argv[j]));
399  out << values.back() << ' ';
400  }
401  logger(INFO, "readFromCommandLine: % set to % ", varName.substr(1), out.str());
402  return values;
403  }
404  }
405  //if the variable is not found
406  std::stringstream out;
407  for (auto& v: values) out << v << ' ';
408  logger(INFO, "readFromCommandLine: % set to default value % ", varName.substr(1), out.str());
409  return values;
410 }
411 
412 
413  template<>
414  std::string readFromCommandLine<std::string>(int argc, char* argv[], std::string varName, std::string value);
415 
416  /*
417  * \brief May be used to hide arguments from argc and argv.
418  */
419  bool removeFromCommandline(int& argc, char* argv[], std::string varName, int nArgs);
420 
421  void check(double real, double ideal, double error, std::string errorMessage);
422 
423  void check(Vec3D real, Vec3D ideal, double error, std::string errorMessage);
424 
425  void check(Matrix3D real, Matrix3D ideal, double error, std::string errorMessage);
426 
427  void check(MatrixSymmetric3D real, MatrixSymmetric3D ideal, double error, std::string errorMessage);
428 
429  std::string getPath();
430 
432 
433  bool isNext(std::istream& is, const std::string name);
434 
435  bool createDirectory(std::string);
436 
437  Mdouble round(const Mdouble value, unsigned precision);
438 
439 /*
440  * \brief Returns the Rayleigh time step for a Hertz contact law.
441  * \detailed An accepted time step for Hertz is 10-20% of the Rayleigh time step.
442  * See \cite Marigo2015
443  */
444  Mdouble getRayleighTime(Mdouble radius, Mdouble shearModulus, Mdouble poisson, Mdouble density);
445 
446  std::vector<Mdouble> linspace(Mdouble a, Mdouble b, int N);
447 }
448 #endif
helpers::KAndDispAndKtAndDispt::k
Mdouble k
Definition: Helpers.h:151
DPMBase::setMax
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1073
BaseInteractable::getAngularVelocity
virtual const Vec3D & getAngularVelocity() const
Returns the angular velocity of this interactable.
Definition: BaseInteractable.cc:341
mathsFunc::square
T square(const T val)
squares a number
Definition: ExtendedMath.h:106
helpers::openFile
bool openFile(std::fstream &file, std::string filename, std::fstream::openmode mode)
Provides a simple interface for opening a file.
Definition: Helpers.cc:539
constants::unsignedMax
const unsigned unsignedMax
Definition: GeneralDefine.h:46
DPMBase::setTimeStep
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
BaseSpecies.h
DPMBase::setMin
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1109
constants::pi
const Mdouble pi
Definition: ExtendedMath.h:45
Flusher::FLUSH
@ FLUSH
helpers::readArrayFromFile
std::vector< double > readArrayFromFile(std::string filename, int &n, int &m)
Definition: Helpers.cc:560
MixedSpecies::mixAll
void mixAll(BaseSpecies *const S, BaseSpecies *const T) final
sets the MixedSpecies properties by mixing the properties of two particle species
Definition: MixedSpecies.h:290
helpers::KAndDispAndKtAndDispt::kt
Mdouble kt
Definition: Helpers.h:153
DPMBase::setParticleDimensions
void setParticleDimensions(unsigned int particleDimensions)
Sets the particle dimensionality.
Definition: DPMBase.cc:1439
helpers::readArrayFromCommandLine
std::array< T, n > readArrayFromCommandLine(int argc, char *argv[], std::string varName, std::array< T, n > value)
Definition: Helpers.h:367
BaseInteractable::setPosition
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
Definition: BaseInteractable.h:239
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
mathsFunc::exp
Mdouble exp(Mdouble Exponent)
Definition: ExtendedMath.cc:84
BaseInteractable::getOrientation
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
Definition: BaseInteractable.h:230
INFO
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
ParticleSpecies
Definition: ParticleSpecies.h:37
helpers::check
void check(double real, double ideal, double error, std::string errorMessage)
Definition: Helpers.cc:911
mathsFunc::log
Mdouble log(Mdouble Power)
Definition: ExtendedMath.cc:104
helpers::getRealTime
Mdouble getRealTime()
Definition: Helpers.cc:940
helpers::KAndDisp::disp
Mdouble disp
Definition: Helpers.h:49
BaseInteractable::getVelocity
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:329
BaseParticle::setRadius
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species)
Definition: BaseParticle.cc:542
Vec3D
Definition: Vector.h:50
helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep
unsigned int getSaveCountFromNumberOfSavesAndTimeMaxAndTimeStep(unsigned int numberOfSaves, Mdouble timeMax, Mdouble timeStep)
Returns the correct saveCount if the total number of saves, the final time and the time step is known...
Definition: Helpers.cc:374
BaseInteractable::setOrientation
void setOrientation(const Quaternion &orientation)
Sets the orientation of this BaseInteractable.
Definition: BaseInteractable.h:260
main
int main(int argc UNUSED, char *argv[] UNUSED)
Definition: HelperFunctionsUnitTest.cpp:33
Helpers.h
helpers::getEffectiveMass
Mdouble getEffectiveMass(Mdouble mass0, Mdouble mass1)
Calculates the effective mass of a particle pair, i.e. half the harmonic mean of two particle masses.
Definition: Helpers.cc:555
helpers::gnuplot
void gnuplot(std::string command)
Plots to a gnuplot window.
Definition: Helpers.cc:469
Mdouble
double Mdouble
Definition: GeneralDefine.h:34
checkTemplate
void checkTemplate(T real, T ideal, double error, std::string whatIsChecked)
Definition: Helpers.cc:904
helpers::getRayleighTime
Mdouble getRayleighTime(Mdouble radius, Mdouble shearModulus, Mdouble poisson, Mdouble density)
Definition: Helpers.cc:1050
Matrix3D
Implementation of a 3D matrix.
Definition: Matrix.h:38
BaseInteractable::setVelocity
void setVelocity(const Vec3D &velocity)
set the velocity of the BaseInteractable.
Definition: BaseInteractable.cc:350
double
MixedSpecies
Contains contact force properties for contacts between particles with two different species.
Definition: MixedSpecies.h:43
BaseInteractable::setAngularVelocity
void setAngularVelocity(const Vec3D &angularVelocity)
set the angular velocity of the BaseInteractble.
Definition: BaseInteractable.cc:360
helpers::KAndDispAndKtAndDispt::dispt
Mdouble dispt
Definition: Helpers.h:154
VERBOSE
LL< Log::VERBOSE > VERBOSE
Verbose information.
Definition: Logger.cc:57
ERROR
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
mathsFunc::sin
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44
Logger.h
MERCURY_DEPRECATED
#define MERCURY_DEPRECATED
Definition: GeneralDefine.h:37
BaseParticle::setSpecies
void setSpecies(const ParticleSpecies *species)
Definition: BaseParticle.cc:804
LinearViscoelasticSpecies.h
LinearPlasticViscoelasticSpecies.h
DPMBase::getTime
Mdouble getTime() const
Returns the current simulation time.
Definition: DPMBase.cc:805
helpers::linspace
std::vector< Mdouble > linspace(Mdouble a, Mdouble b, int N)
Definition: Helpers.cc:887
Species< LinearViscoelasticNormalSpecies >
WARN
LL< Log::WARN > WARN
Warning log level.
Definition: Logger.cc:54
InfiniteWall.h
helpers::round
Mdouble round(const Mdouble value, unsigned precision)
Definition: Helpers.cc:598
helpers
Definition: Helpers.h:38
helpers::normalAndTangentialLoadingTest
void normalAndTangentialLoadingTest(const ParticleSpecies *species, Mdouble displacement, Mdouble tangentialDisplacement, Mdouble velocity, Mdouble radius, std::string name)
Definition: Helpers.cc:692
DPMBase.h
GetCurrentDir
#define GetCurrentDir
Definition: Helpers.cc:51
SphericalParticle
A spherical particle is the most simple particle used in MercuryDPM.
Definition: SphericalParticle.h:37
helpers::KAndDispAndKtAndDispt::disp
Mdouble disp
Definition: Helpers.h:152
DPMBase::setTimeMax
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:870
InfiniteWall
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:48
helpers::getLineFromStringStream
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in.
Definition: Helpers.cc:423
helpers::removeFromCommandline
bool removeFromCommandline(int &argc, char *argv[], std::string varName, int nArgs)
Definition: Helpers.cc:999
constants::i
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
BaseWall::setSpecies
void setSpecies(const ParticleSpecies *species)
Defines the species of the current wall.
Definition: BaseWall.cc:171
helpers::fileExists
bool fileExists(std::string strFilename)
Function to check if a file exists, is used to check if a run has already need done.
Definition: Helpers.cc:502
DPMBase::setFileType
void setFileType(FileType fileType)
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:457
helpers::getMaximumVelocity
MERCURY_DEPRECATED Mdouble getMaximumVelocity(Mdouble k, Mdouble disp, Mdouble radius, Mdouble mass)
Calculates the maximum relative velocity allowed for a normal collision of two particles of radius r ...
Definition: Helpers.cc:346
DPMBase::setupInitialConditions
virtual void setupInitialConditions()
This function allows to set the initial conditions for our problem to be solved, by default particle ...
Definition: DPMBase.cc:1989
BaseParticle
Definition: BaseParticle.h:54
helpers::KAndDispAndKtAndDispt
Calculates the collision time for a given stiffness, dissipation, and effective mass.
Definition: Helpers.h:149
UNUSED
#define UNUSED
Definition: GeneralDefine.h:39
helpers::objectivenessTest
void objectivenessTest(const ParticleSpecies *species, Mdouble displacement, Mdouble tangentialDisplacement, Mdouble velocity, Mdouble radius, std::string name)
Definition: Helpers.cc:772
n
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
helpers::addToFile
bool addToFile(std::string filename, std::string filecontent)
Adds a string to an existing file.
Definition: Helpers.cc:484
helpers::more
void more(std::string filename, unsigned nLines=constants::unsignedMax)
Definition: Helpers.cc:580
helpers::computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass
MERCURY_DEPRECATED KAndDispAndKtAndDispt computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass(Mdouble tc, Mdouble r, Mdouble beta, Mdouble mass)
Set disp, k, dispt and kt such that is matches a given collision time tc and a normal and tangential ...
Definition: Helpers.cc:330
helpers::KAndDisp::k
Mdouble k
Definition: Helpers.h:48
SphericalParticle.h
helpers::writeToFile
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: Helpers.cc:445
helpers::loadingTest
void loadingTest(const ParticleSpecies *species, Mdouble displacement, Mdouble velocity, Mdouble radius, std::string name)
Definition: Helpers.cc:618
helpers::lower
std::string lower(std::string s)
Definition: Helpers.cc:55
helpers::KAndDisp
return type specifically for fuctions returning k and disp at once
Definition: Helpers.h:46
mathsFunc::beta
Mdouble beta(Mdouble z, Mdouble w)
This is the beta function, returns the approximation based on cmath's implementation of ln(gamma)
Definition: ExtendedMath.cc:164
MatrixSymmetric3D
Implementation of a 3D symmetric matrix.
Definition: MatrixSymmetric.h:37
DPMBase::setSaveCount
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:406
helpers::getPath
std::string getPath()
Definition: Helpers.cc:931
helpers::readOptionalVariable
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: Helpers.h:247
ExtendedMath.h
InfiniteWall::set
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:118
helpers::compare
bool compare(std::istream &is, std::string s)
Checks if the next argument in the input stream is a certain string.
Definition: Helpers.cc:858
mathsFunc::isEqual
bool isEqual(Mdouble v1, Mdouble v2, Mdouble absError)
Compares the difference of two Mdouble with an absolute error, useful in UnitTests.
Definition: ExtendedMath.cc:251
BaseParticle.h
units::name
std::string name
Definition: MercuryProb.h:48
helpers::createDirectory
bool createDirectory(std::string)
Definition: Helpers.cc:1035
helpers::writeCommandLineToFile
void writeCommandLineToFile(const std::string filename, const int argc, char *const argv[])
Writes a string to a file.
Definition: Helpers.cc:459
helpers::to_string
std::string to_string(const T &n)
Definition: Helpers.h:227
DPMBase::actionsBeforeTimeStep
virtual void actionsBeforeTimeStep()
A virtual function which allows to define operations to be executed before the new time step.
Definition: DPMBase.cc:1855
helpers::isNext
bool isNext(std::istream &is, const std::string name)
Definition: Helpers.cc:957
mathsFunc::cos
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
BaseInteractable::getPosition
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
DPMBase::getTimeMax
Mdouble getTimeMax() const
Returns the maximum simulation duration.
Definition: DPMBase.cc:885
DPMBase
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:76
helpers::readVectorFromCommandLine
std::vector< T > readVectorFromCommandLine(int argc, char *argv[], std::string varName, size_t n, std::vector< T > values)
Definition: Helpers.h:390
helpers::readFromCommandLine
bool readFromCommandLine(int argc, char *argv[], std::string varName)
Definition: Helpers.cc:874
helpers::readFromFile
T readFromFile(std::string fileName, std::string varName, T value)
Definition: Helpers.h:311
DPMBase::setSystemDimensions
void setSystemDimensions(unsigned int newDim)
Sets the system dimensionality.
Definition: DPMBase.cc:1408