MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Helpers.h File Reference
#include "ExtendedMath.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <Logger.h>

Go to the source code of this file.

Classes

class  helpers::KAndDisp
 return type specifically for fuctions returning k and disp at once More...
 
class  helpers::KAndDispAndKtAndDispt
 Set disp and k such that is matches a given collision time tc and restitution coefficient r for a collision of effective/reduced mass m. More...
 

Namespaces

 helpers
 

Functions

std::string helpers::lower (std::string s)
 
MERCURY_DEPRECATED
KAndDispAndKtAndDispt 
helpers::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 restitution coefficient r, beta for a collision of effective/reduced mass m. From Deen...Kuipers2006, eq. 43 and 30. More...
 
MERCURY_DEPRECATED Mdouble helpers::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 and particle mass m (for higher velocities particles could pass through each other) More...
 
unsigned int helpers::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. More...
 
void helpers::getLineFromStringStream (std::istream &in, std::stringstream &out)
 Reads a line from one stringstream into another, and prepares the latter for reading in. More...
 
bool helpers::writeToFile (std::string filename, std::string filecontent)
 Writes a string to a file. More...
 
void helpers::writeCommandLineToFile (const std::string filename, const int argc, char *const argv[])
 Writes a string to a file. More...
 
void helpers::gnuplot (std::string command)
 Plots to a gnuplot window. More...
 
bool helpers::addToFile (std::string filename, std::string filecontent)
 Adds a string to an existing file. More...
 
bool helpers::fileExists (std::string strFilename)
 Function to check if a file exists, is used to check if a run has already need done. More...
 
bool helpers::openFile (std::fstream &file, std::string filename, std::fstream::openmode mode)
 Provides a simple interface for opening a file. More...
 
Mdouble helpers::getEffectiveMass (Mdouble mass0, Mdouble mass1)
 Calculates the effective mass of a particle pair, i.e. half the harmonic mean of two particle masses. More...
 
std::vector< double > helpers::readArrayFromFile (std::string filename, int &n, int &m)
 
void helpers::more (std::string filename, unsigned nLines=constants::unsignedMax)
 
template<typename T >
std::string helpers::to_string (const T &n)
 
std::string helpers::to_string (Mdouble value, unsigned precision)
 
template<typename T >
bool helpers::readOptionalVariable (std::istream &is, const std::string &name, T &variable)
 Reads optional variables in the restart file. More...
 
void helpers::loadingTest (const ParticleSpecies *species, Mdouble displacement, Mdouble velocity, Mdouble radius, std::string name)
 Used to test the loading/unloading properties of a contact law. More...
 
void helpers::normalAndTangentialLoadingTest (const ParticleSpecies *species, Mdouble displacement, Mdouble tangentialDisplacement, Mdouble velocity, Mdouble radius, std::string name)
 Used to test the tangential loading/unloading/reloading properties of a frictional contact law. More...
 
void helpers::objectivenessTest (const ParticleSpecies *species, Mdouble displacement, Mdouble tangentialDisplacement, Mdouble velocity, Mdouble radius, std::string name)
 Used to test the tangential loading/unloading/reloading properties of a frictional contact law. More...
 
bool helpers::compare (std::istream &is, std::string s)
 Checks if the next argument in the input stream is a certain string. More...
 
template<typename T >
helpers::readFromFile (std::string fileName, std::string varName, T value)
 Allows a quick read-in from a parameter file. More...
 
bool helpers::readFromCommandLine (int argc, char *argv[], std::string varName)
 Returns true if command line arguments contain varName, false else Usage example: if (readFromCommandLine(argc, argv, '-verbose')) ... More...
 
template<typename T >
helpers::readFromCommandLine (int argc, char *argv[], std::string varName, T value)
 
template<typename T , size_t n>
std::array< T, n > helpers::readArrayFromCommandLine (int argc, char *argv[], std::string varName, std::array< T, n > value)
 
template<typename T >
std::vector< T > helpers::readVectorFromCommandLine (int argc, char *argv[], std::string varName, size_t n, std::vector< T > values)
 
template<>
std::string helpers::readFromCommandLine< std::string > (int argc, char *argv[], std::string varName, std::string value)
 
void helpers::check (double real, double ideal, double error, std::string errorMessage)
 
void helpers::check (Vec3D real, Vec3D ideal, double error, std::string errorMessage)
 
void helpers::check (Matrix3D real, Matrix3D ideal, double error, std::string errorMessage)
 
void helpers::check (MatrixSymmetric3D real, MatrixSymmetric3D ideal, double error, std::string errorMessage)
 
std::string helpers::getPath ()
 
Mdouble helpers::getRealTime ()
 
bool helpers::isNext (std::istream &is, const std::string name)
 reads next value in stream as a string and compares it with name. More...
 
bool helpers::createDirectory (std::string)
 
Mdouble helpers::round (const Mdouble value, unsigned precision)
 
Mdouble helpers::getRayleighTime (Mdouble radius, Mdouble shearModulus, Mdouble poisson, Mdouble density)