NDDEM
Classes | Macros | Typedefs | Enumerations | Functions | Variables
Discrete Element Simulations

Classes

class  Cell
 Individual cell for contact detection. More...
 
class  Cells< d >
 All the cells making the space, with related function for creating the cell array, neighbour arrays etc. Currently non implemented TODO: no pbc handling, no handling of moving boundaries. More...
 
class  Action< d >
 Handle force and torque contact information. More...
 
class  SpecificAction< d >
 Action on a specific particle for a specific duration. More...
 
class  cp< d >
 Contact properties class. More...
 
class  cpm< d >
 Contact properties for mesh contacts (mainly), including contact point location, specialising cp. More...
 
class  ContactList< d >
 Handles lists of contacts. More...
 
class  ContactListMesh< d >
 Handles lists of contacts with meshes. More...
 
class  Contacts< d >
 Calculate contact forces. More...
 
class  Simulation< d >
 
struct  CLp_it_t< d >
 Simple packing structure for the iterators to the contact list regions per particle. More...
 
class  Multiproc< d >
 Manual multiprocessor handling for OpenMP, for max efficiency & avoiding bugs & race conditions, hopefully. More...
 
class  number_gen< T >
 Small class to handle number generator (ie. first:step:last syntax) More...
 
class  Parameters< d >
 Generic class to handle the simulation set up. More...
 
class  TensorInfos
 Limited use: used to transfer data to the VTK writer. More...
 
class  Tools_2D
 Dimension specific mathematics. More...
 
class  Tools< d >
 Static class to handle multi-dimensional mathematics, and more. It gets specialised for speed with template parameter d:dimension. More...
 

Macros

#define CONTACTLIST
 
#define MAXDIM   4
 
#define MACRO(r, state)    case BOOST_PP_TUPLE_ELEM(2, 0, state): templatedmain<BOOST_PP_TUPLE_ELEM(2, 0, state)>(argv);break;
 
#define STR_PROTECT(s)   s
 
#define MAXDEFDIM   30
 For larger number of dimension, be taken in particular for periodic boundary conditions. More...
 

Typedefs

using json = nddem::json
 
using uint = unsigned int
 
using v1d = vector< double >
 
using v2d = vector< vector< double > >
 
using v3d = vector< vector< vector< double > >>
 
using v1f = vector< float >
 
using cv1d = const vector< double >
 
using cv2d = const vector< vector< double > >
 
using cv3d = const vector< vector< vector< double > >>
 
using cv1f = const vector< float >
 
using bitdim = unsigned int
 
using v1i = vector< int >
 

Enumerations

enum class  ExportType {
  NONE =0 , CSV =1 , VTK =2 , NETCDFF =4 ,
  XML =8 , XMLbase64 =16 , CSVA =32 , CSVCONTACT =64
}
 
enum class  ExportData {
  NONE =0 , POSITION =0x1 , VELOCITY =0x2 , OMEGA =0x4 ,
  OMEGAMAG =0x8 , ORIENTATION =0x10 , COORDINATION =0x20 , RADIUS =0x40 ,
  IDS =0x80 , FN =0x100 , FT =0x200 , TORQUE =0x400 ,
  GHOSTMASK =0x800 , GHOSTDIR =0x1000 , BRANCHVECTOR =0x2000 , FN_EL =0x4000 ,
  FN_VISC =0x8000 , FT_EL =0x10000 , FT_VISC =0x20000 , FT_FRIC =0x40000 ,
  FT_FRICTYPE =0x80000 , CONTACTPOSITION =0x100000 , MASS =0x200000
}
 
enum class  TensorType {
  SCALAR , VECTOR , TENSOR , SYMTENSOR ,
  SKEWTENSOR , SCALARMASK , NONE
}
 
enum  DataValue {
  radius , mass , Imom , pos ,
  vel , omega , id1 , id2 ,
  pospq , lpq , fpq , mpq ,
  mqp , extra_named , radius , mass ,
  Imom , pos , vel , omega ,
  id1 , id2 , pospq , lpq ,
  fpq , mpq , mqp , extra_named
}
 
enum  ContactModels { HOOKE =0 , HERTZ }
 
enum  ContactStrategies { NAIVE =0 , CELLS =1 , OCTREE =2 }
 
enum class  WallType {
  PBC =0 , WALL =1 , MOVINGWALL =2 , SPHERE =3 ,
  ROTATINGSPHERE =4 , PBC_LE =5 , ELLIPSE =6 , HEMISPHERE =7 ,
  AXIALCYLINDER , UNDEFINED
}
 

Functions

template<int d>
bool operator< (const cp< d > &a, const cp< d > &b)
 The contact list is order in increasing order of index i, and for two identical i in increasing order of j. More...
 
template<int d>
bool operator== (const cp< d > &a, const cp< d > &b)
 Contact equivalence is based solely on the index of objects in contact i and j. More...
 
void sig_handler (int p)
 Function handling signal reception for clean closing on SIGINT for example. More...
 
template<int d>
int templatedmain (char *argv[])
 Main simulation run. All the simulation is handled by this function. More...
 
int main (int argc, char *argv[])
 Calls the appropriate templatedmain() function. Templated function are used to allow compiler optimisation for speed. Only a handful of dimension are compiled on the base code to limit compilation time and memory. If you need dimensions that are not cmpiled by default, have a look at the code it's pretty straightforward to activate the needed dimension. If the compilation failed with low meomry, in particular on older system, head to the code and comment the dimensions which are unused. More...
 
ExportTypeoperator|= (ExportType &a, const ExportType b)
 
ExportDataoperator|= (ExportData &a, const ExportData b)
 
ExportData operator| (ExportData a, ExportData b)
 
ExportData operator~ (ExportData a)
 
ExportDataoperator&= (ExportData &a, const ExportData b)
 
ExportDataoperator>>= (ExportData &w, int u)
 
ExportDataoperator<<= (ExportData &w, int u)
 
bool operator& (ExportType &a, ExportType b)
 
bool operator& (ExportData &a, ExportData b)
 
template<typename T >
std::istream & operator>> (std::istream &in, number_gen< T > &n)
 
v1d operator* (v1d a, double b)
 
v1f operator* (v1f a, float b)
 
v1d operator* (v1d a, cv1d &b)
 
v1f operator* (v1f a, cv1f &b)
 
v1d operator+ (v1d a, double b)
 
v1d operator+ (v1d a, cv1d &b)
 
v1f operator+ (v1f a, cv1f &b)
 
v1d operator- (v1d a, double &b)
 
v1d operator- (v1d a, cv1d &b)
 
v1d operator- (v1d a, const double *b)
 
v1d operator- (const double *a, v1d b)
 
v1d operator- (v1d a)
 
v1f operator- (v1f a, cv1f &b)
 
v1d operator/ (v1d a, double b)
 
v1doperator-= (v1d &a, cv1d &b)
 
v1doperator*= (v1d &a, double b)
 
v1foperator*= (v1f &a, double b)
 
v1doperator+= (v1d &a, cv1d &b)
 
v1foperator+= (v1f &a, cv1f &b)
 
v1foperator/= (v1f &a, cv1f &b)
 
v1doperator/= (v1d &a, double b)
 
v1foperator/= (v1f &a, double b)
 
v1d operator- (v1d a, double b)
 
int ContactList< d >::insert (const cp< d > &a)
 Insert a contact, maintaining sorting with increasing i, and removing missing contacts on traversal. More...
 
int ContactListMesh< d >::insert (const cpm< d > &a)
 Insert a contact, maintaining sorting with increasing i, and removing missing contacts on traversal. More...
 
bool ContactList< d >::check_ghost_regular (bitdim gst, const Parameters< d > &P, cv1d &X1, cv1d &X2, double r1, double r2, cp< d > &tmpcp, int startd=0, double partialsum=0, bitdim mask=0)
 Find ghost-particle contact, going though pbc recursively. A beautiful piece of optimised algorithm if I may say so myself. More...
 
bool ContactList< d >::check_ghost_LE (bitdim gst, const Parameters< d > &P, cv1d &X1, cv1d &X2, double r1, double r2, cp< d > &tmpcp, int startd=0, double partialsum=0, bitdim mask=0)
 
void ContactList< d >::check_ghost_dst (uint32_t gst, int n, double partialsum, uint32_t mask, const Parameters< d > &P, cv1d &X1, cv1d &X2, cp< d > &contact)
 
void ContactList< d >::coordinance (v1d &Z)
 Calculate and store coordination number in Z. More...
 
 Contacts< d >::Contacts (Parameters< d > &PP)
 
void Contacts< d >::particle_particle (cv1d &Xi, cv1d &Vi, cv1d &Omegai, double ri, double mi, cv1d &Xj, cv1d &Vj, cv1d &Omegaj, double rj, double mj, cp< d > &Contact, bool isdumptime)
 Force & torque between 2 particles. More...
 
void Contacts< d >::particle_wall (cv1d &Vi, cv1d &Omegai, double ri, double mi, cv1d &cn, cp< d > &Contact)
 Force & torque between a particle and a wall. More...
 
void Contacts< d >::particle_movingwall (cv1d &Vi, cv1d &Omegai, double ri, double mi, cv1d &cn, cv1d &Vj, cp< d > &Contact)
 Force & torque between a particle and a moving wall. Vj is the velocity of the wall at the contact point. More...
 
void Contacts< d >::particle_mesh (cv1d &Xi, cv1d &Vi, cv1d &Omegai, double ri, double mi, cpm< d > &Contact)
 Force & torque between particle and mesh. More...
 
void Multiproc< d >::disp_share ()
 Display the # of particle on each thread. More...
 
void Multiproc< d >::split (int N, int P)
 Function to allocate the grains to threads taking into account the load balance in the contact detection. load_balance() takes over after a few iteration have run, and is usually more efficient. More...
 
void Multiproc< d >::splitcells (int C)
 
void Multiproc< d >::delaying (int ID, int j, Action< d > &act)
 Record the action to be added later to the relevent atom in sequencial settings, avoid potential race condition if an action was added to an atom that is not owned by the thread. This is for a particle-particle contact. More...
 
void Multiproc< d >::delayingwall (int ID, int j, Action< d > &act)
 Record the action on the wall. Only usefull if the force on the wall needs to be calculated. More...
 
void Multiproc< d >::delayed_clean ()
 Clean the record list. More...
 
void Multiproc< d >::delayedwall_clean ()
 Clean the record of the force on the wal. More...
 
void Multiproc< d >::load_balance (ContactStrategies contactstrategy)
 Modify the atom share between threads to achieve better load balance between the threads based on the current speed of each one during the previous iterations. More...
 
auto Multiproc< d >::contacts2array (ExportData exp, cv2d &X, Parameters< d > &P)
 pack the contact data in a 2d array More...
 

Variables

vector< std::pair< ExportType, ExportData > > * toclean
 
XMLWriterxmlout
 
vector< std::pair< ExportType, ExportData > > * toclean
 
XMLWriterxmlout
 
static vector< vector< int > > Tools< d >::MSigns
 For skew symetric matrix. -1 below the diagonal, 0 on the diagonal, +1 above the diagnal. More...
 
static vector< vector< int > > Tools< d >::MIndexAS
 For skew symmetric matrix, make the correspondance between linear index of a full matrix with the linear index of the skew-symetric storage. More...
 
static vector< pair< int, int > > Tools< d >::MASIndex
 For skew symmetric matrix, make the correspondance between linear index and (row,column) index. More...
 
static v1d Tools< d >::Eye
 The identity matrix in dimension <d> More...
 
static vector< FILE * > Tools< d >::outs
 Store the output file descriptors. More...
 
static boost::random::mt19937 Tools< d >::rng
 Random number generator. More...
 
static boost::random::uniform_01< boost::mt19937 > Tools< d >::rand
 Returns a random number between 0 and 1. More...
 

General functions

static void Tools< d >::initialise ()
 Initialise the member variables, in particular the variables to handle skew-symmetric flattened matrix, cf. the class detailed description. More...
 
static void Tools< d >::clear ()
 Get the class ready for a different dimension. More...
 
static std::pair< double, double > Tools< d >::two_max_element (cv1d &v)
 Return the two largest elements of v. More...
 
static bool Tools< d >::check_initialised (int dd)
 
static int Tools< d >::sgn (uint8_t a)
 Sign function. More...
 
static int Tools< d >::sgn (double a)
 Sign function. More...
 

Saving and writing functions

static int Tools< d >::savetxt (char path[], const v2d &table, char const header[])
 
static int Tools< d >::write1D (char path[], v1d table)
 
static void Tools< d >::savecsv (char path[], cv2d &X, cv1d &r, const vector< uint32_t > &PBCFlags, cv1d &Vmag, cv1d &OmegaMag, [[maybe_unused]] cv1d &Z)
 Save the location and a few more informations in a CSV file. More...
 
static void Tools< d >::savecsv (char path[], cv2d &X, cv2d &V, cv1d &r, const vector< uint32_t > &PBCFlags, cv1d &Vmag, cv1d &OmegaMag, [[maybe_unused]] cv1d &Z)
 Save the location and a few more informations in a CSV file. More...
 
static void Tools< d >::savecsv (char path[], cv2d &A)
 Save the orientation in a CSV file. More...
 
static void Tools< d >::savevtk (char path[], int N, cv2d &Boundaries, cv2d &X, cv1d &r, vector< TensorInfos > data)
 Save as a vtk file. Dimensions higher than 3 are stored as additional scalars. Additional informations can be passed as a vector of TensorInfos. More...
 
static int Tools< d >::writeinline (initializer_list< v1d >)
 
static int Tools< d >::writeinline_close (void)
 
static void Tools< d >::print (cv1d M)
 

Vector and matrix initialisation and normalisation

static v1d Tools< d >::randomize_vec (cv1d v)
 Produce a random vector. More...
 
static void Tools< d >::unitvec (vector< double > &v, int n)
 Construct a unit vector in place. More...
 
static void Tools< d >::orthonormalise (v1d &A)
 Orthonormalise A using the Gram-Shmidt process, in place. More...
 
static v1d Tools< d >::unitvec (int n)
 Construct & return a unit vector. More...
 
static void Tools< d >::setzero (v2d &a)
 Set a matrix to zero in-place. More...
 
static void Tools< d >::setzero (v1d &a)
 Set a vector to zero in-place. More...
 
static double Tools< d >::norm (const vector< double > &a)
 Norm of a vector. More...
 
static void Tools< d >::norm (v1d &res, cv2d &a)
 Norm of a 2D-matrix, returns a 1D vector with the norms of the individual vectors. More...
 
static double Tools< d >::normdiff (cv1d &a, cv1d &b)
 Norm of a vector difference $|a-b|$. More...
 
static double Tools< d >::normsq (const vector< double > &a)
 Norm squared. More...
 
static double Tools< d >::normdiffsq (cv1d &a, cv1d &b)
 Norm squared of a vector difference $|a-b|^2$. More...
 
static double Tools< d >::skewnorm (cv1d &a)
 Norm of a skew-symetric matrix. More...
 
static double Tools< d >::skewnormsq (cv1d &a)
 Norm squared of a skew-symetrix matrix. More...
 
static double Tools< d >::dot (cv1d &a, cv1d &b)
 Dot product. More...
 
static v1f Tools< d >::vsqrt (cv1f &a)
 Component-wise square root. More...
 
static v1f Tools< d >::vsq (cv1f &a)
 Component-wise squaring. More...
 
static void Tools< d >::surfacevelocity (v1d &res, cv1d &p, double *com, double *vel_com, double *omega_com)
 
static void Tools< d >::setgravity (v2d &a, v1d &g, v1d &m)
 Set the gravity. $\vec a_i = m_i * \vec g $. More...
 

Matrix operations, usually operating on flattened matrices, cf. the description for more information on matrix storage

static v1d Tools< d >::skewmatvecmult (cv1d &M, cv1d &v)
 Multiply the skew symetric matrix M with vector v. More...
 
static v1d Tools< d >::skewmatvecmult (const double *M, cv1d &v)
 Multiply the skew symetric matrix M with vector v. More...
 
static void Tools< d >::skewmatvecmult (v1d &r, cv1d &M, cv1d &v)
 Multiply the skew symetric matrix M with vector v in place. More...
 
static void Tools< d >::skewmatvecmult (v1d &r, const double *M, cv1d &v)
 Multiply the skew symetric matrix M with vector v in place (overload) More...
 
static v1d Tools< d >::skewmatsquare (cv1d &A)
 Square the skew symetric matrix M. More...
 
static void Tools< d >::skewmatsquare (v1d &r, cv1d &A)
 Square the skew symetric matrix M in place. More...
 
static v1d Tools< d >::skewexpand (cv1d &A)
 Return the skew symetrix matrix M stored on d(d-1)/2 component as a full flattened matrix with d^2 components. More...
 
static void Tools< d >::skewexpand (v1d &r, cv1d &A)
 Return the skew symetrix matrix M stored on d(d-1)/2 component as a full flattened matrix with d^2 components in place. More...
 
static v1d Tools< d >::matmult (cv1d &A, cv1d &B)
 Multiply 2 matrix together. More...
 
static void Tools< d >::matmult (v1d &r, cv1d &A, cv1d &B)
 Multiply 2 matrix together in place. More...
 
static void Tools< d >::matvecmult (v1d &res, cv1d &A, cv1d &B)
 Multiply a matrix with a vector, in place. More...
 
static v1d Tools< d >::wedgeproduct (cv1d &a, cv1d &b)
 Wedge product of vectors. More...
 
static void Tools< d >::wedgeproduct (v1d &res, cv1d &a, cv1d &b)
 Wedge product in-place. More...
 
static double Tools< d >::det (cv2d &M)
 compute the matrix determinant (probably quite slow, but doesn't really really matters for the usage) More...
 
static double Tools< d >::det (cv1d &M)
 compute the matrix determinant (probably quite slow, but shouldn't really really matters for the usage) More...
 
static double Tools< d >::det (double M[d][d])
 compute the matrix determinant using array on the stack (avoids malloc/free) More...
 
static v1d Tools< d >::inverse (cv1d &M)
 compute the matrix inverse (very slow and redundant calculation of the determinant for the comatrix, but shouldn't really really matters for the usage) More...
 
static v1d Tools< d >::transpose (cv1d &a)
 Transposition. More...
 
static void Tools< d >::transpose_inplace (v1d &a)
 Transpose in-place. More...
 

Special physics computation

static double Tools< d >::Volume (double R)
 Compute the hypersphere volume. More...
 
static double Tools< d >::InertiaMomentum (double R, double rho)
 Compute the hypersphere moment of inertia. More...
 

Coordinate system change

static double Tools< d >::hyperspherical_xtophi (cv1d &x, v1d &phi)
 Convert from cartesian to hyperspherical coordinates. More...
 
static void Tools< d >::hyperspherical_phitox (double r, cv1d &phi, v1d &x)
 Convert from hyperspherical to cartesian coordinates. More...
 

Detailed Description

This module handles the Discrete Element Simulations.

Macro Definition Documentation

◆ CONTACTLIST

#define CONTACTLIST

◆ MACRO

#define MACRO (   r,
  state 
)     case BOOST_PP_TUPLE_ELEM(2, 0, state): templatedmain<BOOST_PP_TUPLE_ELEM(2, 0, state)>(argv);break;

◆ MAXDEFDIM

#define MAXDEFDIM   30

For larger number of dimension, be taken in particular for periodic boundary conditions.

◆ MAXDIM

#define MAXDIM   4

◆ STR_PROTECT

#define STR_PROTECT (   s)    s

Typedef Documentation

◆ bitdim

using bitdim = unsigned int

◆ cv1d

using cv1d = const vector <double>

◆ cv1f

using cv1f = const vector <float>

◆ cv2d

using cv2d = const vector < vector <double> >

◆ cv3d

using cv3d = const vector<vector<vector<double> >>

◆ json

using json = nddem::json

◆ uint

using uint = unsigned int

◆ v1d

using v1d = vector < double >

◆ v1f

using v1f = vector <float>

◆ v1i

using v1i = vector <int>

◆ v2d

using v2d = vector < vector <double> >

◆ v3d

using v3d = vector<vector<vector<double> >>

Enumeration Type Documentation

◆ ContactModels

Enumerator
HOOKE 
HERTZ 

◆ ContactStrategies

Enumerator
NAIVE 
CELLS 
OCTREE 

◆ DataValue

enum DataValue
Enumerator
radius 
mass 
Imom 
pos 
vel 
omega 
id1 
id2 
pospq 
lpq 
fpq 
mpq 
mqp 
extra_named 
radius 
mass 
Imom 
pos 
vel 
omega 
id1 
id2 
pospq 
lpq 
fpq 
mpq 
mqp 
extra_named 

◆ ExportData

enum ExportData
strong
Enumerator
NONE 
POSITION 
VELOCITY 
OMEGA 
OMEGAMAG 
ORIENTATION 
COORDINATION 
RADIUS 
IDS 
FN 
FT 
TORQUE 
GHOSTMASK 
GHOSTDIR 
BRANCHVECTOR 
FN_EL 
FN_VISC 
FT_EL 
FT_VISC 
FT_FRIC 
FT_FRICTYPE 
CONTACTPOSITION 
MASS 

◆ ExportType

enum ExportType
strong
Enumerator
NONE 
CSV 
VTK 
NETCDFF 
XML 
XMLbase64 
CSVA 
CSVCONTACT 

◆ TensorType

enum TensorType
strong
Enumerator
SCALAR 
VECTOR 
TENSOR 
SYMTENSOR 
SKEWTENSOR 
SCALARMASK 
NONE 

◆ WallType

enum WallType
strong
Enumerator
PBC 
WALL 
MOVINGWALL 
SPHERE 
ROTATINGSPHERE 
PBC_LE 
ELLIPSE 
HEMISPHERE 
AXIALCYLINDER 
UNDEFINED 

Function Documentation

◆ check_ghost_dst()

template<int d>
void ContactList< d >::check_ghost_dst ( uint32_t  gst,
int  n,
double  partialsum,
uint32_t  mask,
const Parameters< d > &  P,
cv1d X1,
cv1d X2,
cp< d > &  contact 
)
Deprecated:
Measure distance between a ghost and a particle

◆ check_ghost_LE()

template<int d>
bool ContactList< d >::check_ghost_LE ( bitdim  gst,
const Parameters< d > &  P,
cv1d X1,
cv1d X2,
double  r1,
double  r2,
cp< d > &  tmpcp,
int  startd = 0,
double  partialsum = 0,
bitdim  mask = 0 
)

◆ check_ghost_regular()

template<int d>
bool ContactList< d >::check_ghost_regular ( bitdim  gst,
const Parameters< d > &  P,
cv1d X1,
cv1d X2,
double  r1,
double  r2,
cp< d > &  tmpcp,
int  startd = 0,
double  partialsum = 0,
bitdim  mask = 0 
)

Find ghost-particle contact, going though pbc recursively. A beautiful piece of optimised algorithm if I may say so myself.

◆ check_initialised()

template<int d>
static bool Tools< d >::check_initialised ( int  dd)
inlinestatic

◆ clear()

template<int d>
void Tools< d >::clear
static

Get the class ready for a different dimension.

◆ Contacts()

template<int d>
Contacts< d >::Contacts ( Parameters< d > &  PP)

◆ contacts2array()

template<int d>
auto Multiproc< d >::contacts2array ( ExportData  exp,
cv2d X,
Parameters< d > &  P 
)

pack the contact data in a 2d array

◆ coordinance()

template<int d>
void ContactList< d >::coordinance ( v1d Z)

Calculate and store coordination number in Z.

◆ delayed_clean()

template<int d>
void Multiproc< d >::delayed_clean

Clean the record list.

◆ delayedwall_clean()

template<int d>
void Multiproc< d >::delayedwall_clean

Clean the record of the force on the wal.

◆ delaying()

template<int d>
void Multiproc< d >::delaying ( int  ID,
int  j,
Action< d > &  act 
)

Record the action to be added later to the relevent atom in sequencial settings, avoid potential race condition if an action was added to an atom that is not owned by the thread. This is for a particle-particle contact.

◆ delayingwall()

template<int d>
void Multiproc< d >::delayingwall ( int  ID,
int  j,
Action< d > &  act 
)

Record the action on the wall. Only usefull if the force on the wall needs to be calculated.

◆ det() [1/3]

template<int d>
double Tools< d >::det ( cv1d M)
static

compute the matrix determinant (probably quite slow, but shouldn't really really matters for the usage)

◆ det() [2/3]

template<int d>
double Tools< d >::det ( cv2d M)
static

compute the matrix determinant (probably quite slow, but doesn't really really matters for the usage)

◆ det() [3/3]

template<int d>
double Tools< d >::det ( double  M[d][d])
static

compute the matrix determinant using array on the stack (avoids malloc/free)

◆ disp_share()

template<int d>
void Multiproc< d >::disp_share

Display the # of particle on each thread.

◆ dot()

template<int d>
static double Tools< d >::dot ( cv1d a,
cv1d b 
)
inlinestatic

Dot product.

◆ hyperspherical_phitox()

template<int d>
void Tools< d >::hyperspherical_phitox ( double  r,
cv1d phi,
v1d x 
)
static

Convert from hyperspherical to cartesian coordinates.

◆ hyperspherical_xtophi()

template<int d>
double Tools< d >::hyperspherical_xtophi ( cv1d x,
v1d phi 
)
static

Convert from cartesian to hyperspherical coordinates.

◆ InertiaMomentum()

template<int d>
double Tools< d >::InertiaMomentum ( double  R,
double  rho 
)
static

Compute the hypersphere moment of inertia.

◆ initialise()

template<int d>
void Tools< d >::initialise
static

Initialise the member variables, in particular the variables to handle skew-symmetric flattened matrix, cf. the class detailed description.

◆ insert() [1/2]

template<int d>
int ContactList< d >::insert ( const cp< d > &  a)

Insert a contact, maintaining sorting with increasing i, and removing missing contacts on traversal.

◆ insert() [2/2]

template<int d>
int ContactListMesh< d >::insert ( const cpm< d > &  a)

Insert a contact, maintaining sorting with increasing i, and removing missing contacts on traversal.

◆ inverse()

template<int d>
vector< double > Tools< d >::inverse ( cv1d M)
static

compute the matrix inverse (very slow and redundant calculation of the determinant for the comatrix, but shouldn't really really matters for the usage)

◆ load_balance()

template<int d>
void Multiproc< d >::load_balance ( ContactStrategies  contactstrategy)

Modify the atom share between threads to achieve better load balance between the threads based on the current speed of each one during the previous iterations.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Calls the appropriate templatedmain() function. Templated function are used to allow compiler optimisation for speed. Only a handful of dimension are compiled on the base code to limit compilation time and memory. If you need dimensions that are not cmpiled by default, have a look at the code it's pretty straightforward to activate the needed dimension. If the compilation failed with low meomry, in particular on older system, head to the code and comment the dimensions which are unused.

◆ matmult() [1/2]

template<int d>
v1d Tools< d >::matmult ( cv1d A,
cv1d B 
)
static

Multiply 2 matrix together.

◆ matmult() [2/2]

template<int d>
void Tools< d >::matmult ( v1d r,
cv1d A,
cv1d B 
)
static

Multiply 2 matrix together in place.

◆ matvecmult()

template<int d>
void Tools< d >::matvecmult ( v1d res,
cv1d A,
cv1d B 
)
static

Multiply a matrix with a vector, in place.

◆ norm() [1/2]

template<int d>
static double Tools< d >::norm ( const vector< double > &  a)
inlinestatic

Norm of a vector.

◆ norm() [2/2]

template<int d>
static void Tools< d >::norm ( v1d res,
cv2d a 
)
inlinestatic

Norm of a 2D-matrix, returns a 1D vector with the norms of the individual vectors.

◆ normdiff()

template<int d>
static double Tools< d >::normdiff ( cv1d a,
cv1d b 
)
inlinestatic

Norm of a vector difference $|a-b|$.

◆ normdiffsq()

template<int d>
static double Tools< d >::normdiffsq ( cv1d a,
cv1d b 
)
inlinestatic

Norm squared of a vector difference $|a-b|^2$.

◆ normsq()

template<int d>
static double Tools< d >::normsq ( const vector< double > &  a)
inlinestatic

Norm squared.

◆ operator&() [1/2]

bool operator& ( ExportData a,
ExportData  b 
)
inline

◆ operator&() [2/2]

bool operator& ( ExportType a,
ExportType  b 
)
inline

◆ operator&=()

ExportData& operator&= ( ExportData a,
const ExportData  b 
)
inline

◆ operator*() [1/4]

v1d operator* ( v1d  a,
cv1d b 
)

◆ operator*() [2/4]

v1d operator* ( v1d  a,
double  b 
)

◆ operator*() [3/4]

v1f operator* ( v1f  a,
cv1f b 
)

◆ operator*() [4/4]

v1f operator* ( v1f  a,
float  b 
)

◆ operator*=() [1/2]

v1d & operator*= ( v1d a,
double  b 
)

◆ operator*=() [2/2]

v1f & operator*= ( v1f a,
double  b 
)

◆ operator+() [1/3]

v1d operator+ ( v1d  a,
cv1d b 
)

◆ operator+() [2/3]

v1d operator+ ( v1d  a,
double  b 
)

◆ operator+() [3/3]

v1f operator+ ( v1f  a,
cv1f b 
)

◆ operator+=() [1/2]

v1d & operator+= ( v1d a,
cv1d b 
)

◆ operator+=() [2/2]

v1f & operator+= ( v1f a,
cv1f b 
)

◆ operator-() [1/7]

v1d operator- ( const double *  a,
v1d  b 
)

◆ operator-() [2/7]

v1d operator- ( v1d  a)

◆ operator-() [3/7]

v1d operator- ( v1d  a,
const double *  b 
)

◆ operator-() [4/7]

v1d operator- ( v1d  a,
cv1d b 
)

◆ operator-() [5/7]

v1d operator- ( v1d  a,
double &  b 
)

◆ operator-() [6/7]

v1d operator- ( v1d  a,
double  b 
)

◆ operator-() [7/7]

v1f operator- ( v1f  a,
cv1f b 
)

◆ operator-=()

v1d & operator-= ( v1d a,
cv1d b 
)

◆ operator/()

v1d operator/ ( v1d  a,
double  b 
)

◆ operator/=() [1/3]

v1d & operator/= ( v1d a,
double  b 
)

◆ operator/=() [2/3]

v1f & operator/= ( v1f a,
cv1f b 
)

◆ operator/=() [3/3]

v1f & operator/= ( v1f a,
double  b 
)

◆ operator<()

template<int d>
bool operator< ( const cp< d > &  a,
const cp< d > &  b 
)
inline

The contact list is order in increasing order of index i, and for two identical i in increasing order of j.

◆ operator<<=()

ExportData& operator<<= ( ExportData w,
int  u 
)
inline

◆ operator==()

template<int d>
bool operator== ( const cp< d > &  a,
const cp< d > &  b 
)
inline

Contact equivalence is based solely on the index of objects in contact i and j.

◆ operator>>()

template<typename T >
std::istream& operator>> ( std::istream &  in,
number_gen< T > &  n 
)

◆ operator>>=()

ExportData& operator>>= ( ExportData w,
int  u 
)
inline

◆ operator|()

ExportData operator| ( ExportData  a,
ExportData  b 
)
inline

◆ operator|=() [1/2]

ExportData& operator|= ( ExportData a,
const ExportData  b 
)
inline

◆ operator|=() [2/2]

ExportType& operator|= ( ExportType a,
const ExportType  b 
)
inline

◆ operator~()

ExportData operator~ ( ExportData  a)
inline

◆ orthonormalise()

template<int d>
void Tools< d >::orthonormalise ( v1d A)
static

Orthonormalise A using the Gram-Shmidt process, in place.

◆ particle_mesh()

template<int d>
void Contacts< d >::particle_mesh ( cv1d Xi,
cv1d Vi,
cv1d Omegai,
double  ri,
double  mi,
cpm< d > &  Contact 
)

Force & torque between particle and mesh.

◆ particle_movingwall()

template<int d>
void Contacts< d >::particle_movingwall ( cv1d Vi,
cv1d Omegai,
double  ri,
double  mi,
cv1d cn,
cv1d Vj,
cp< d > &  Contact 
)

Force & torque between a particle and a moving wall. Vj is the velocity of the wall at the contact point.

◆ particle_particle()

template<int d>
void Contacts< d >::particle_particle ( cv1d Xi,
cv1d Vi,
cv1d Omegai,
double  ri,
double  mi,
cv1d Xj,
cv1d Vj,
cv1d Omegaj,
double  rj,
double  mj,
cp< d > &  Contact,
bool  isdumptime 
)

Force & torque between 2 particles.

◆ particle_wall()

template<int d>
void Contacts< d >::particle_wall ( cv1d Vi,
cv1d Omegai,
double  ri,
double  mi,
cv1d cn,
cp< d > &  Contact 
)

Force & torque between a particle and a wall.

◆ print()

template<int d>
static void Tools< d >::print ( cv1d  M)
inlinestatic

◆ randomize_vec()

template<int d>
v1d Tools< d >::randomize_vec ( cv1d  v)
static

Produce a random vector.

◆ savecsv() [1/3]

template<int d>
void Tools< d >::savecsv ( char  path[],
cv2d A 
)
static

Save the orientation in a CSV file.

◆ savecsv() [2/3]

template<int d>
void Tools< d >::savecsv ( char  path[],
cv2d X,
cv1d r,
const vector< uint32_t > &  PBCFlags,
cv1d Vmag,
cv1d OmegaMag,
[[maybe_unused] ] cv1d Z 
)
static

Save the location and a few more informations in a CSV file.

◆ savecsv() [3/3]

template<int d>
void Tools< d >::savecsv ( char  path[],
cv2d X,
cv2d V,
cv1d r,
const vector< uint32_t > &  PBCFlags,
cv1d Vmag,
cv1d OmegaMag,
[[maybe_unused] ] cv1d Z 
)
static

Save the location and a few more informations in a CSV file.

◆ savetxt()

template<int d>
int Tools< d >::savetxt ( char  path[],
const v2d table,
char const  header[] 
)
static

◆ savevtk()

template<int d>
void Tools< d >::savevtk ( char  path[],
int  N,
cv2d Boundaries,
cv2d X,
cv1d r,
vector< TensorInfos data 
)
static

Save as a vtk file. Dimensions higher than 3 are stored as additional scalars. Additional informations can be passed as a vector of TensorInfos.

◆ setgravity()

template<int d>
static void Tools< d >::setgravity ( v2d a,
v1d g,
v1d m 
)
inlinestatic

Set the gravity. $\vec a_i = m_i * \vec g $.

◆ setzero() [1/2]

template<int d>
static void Tools< d >::setzero ( v1d a)
inlinestatic

Set a vector to zero in-place.

◆ setzero() [2/2]

template<int d>
static void Tools< d >::setzero ( v2d a)
inlinestatic

Set a matrix to zero in-place.

◆ sgn() [1/2]

template<int d>
static int Tools< d >::sgn ( double  a)
inlinestatic

Sign function.

◆ sgn() [2/2]

template<int d>
static int Tools< d >::sgn ( uint8_t  a)
inlinestatic

Sign function.

◆ sig_handler()

void sig_handler ( int  p)

Function handling signal reception for clean closing on SIGINT for example.

◆ skewexpand() [1/2]

template<int d>
v1d Tools< d >::skewexpand ( cv1d A)
static

Return the skew symetrix matrix M stored on d(d-1)/2 component as a full flattened matrix with d^2 components.

◆ skewexpand() [2/2]

template<int d>
void Tools< d >::skewexpand ( v1d r,
cv1d A 
)
static

Return the skew symetrix matrix M stored on d(d-1)/2 component as a full flattened matrix with d^2 components in place.

◆ skewmatsquare() [1/2]

template<int d>
v1d Tools< d >::skewmatsquare ( cv1d A)
static

Square the skew symetric matrix M.

◆ skewmatsquare() [2/2]

template<int d>
void Tools< d >::skewmatsquare ( v1d r,
cv1d A 
)
static

Square the skew symetric matrix M in place.

◆ skewmatvecmult() [1/4]

template<int d>
v1d Tools< d >::skewmatvecmult ( const double *  M,
cv1d v 
)
static

Multiply the skew symetric matrix M with vector v.

◆ skewmatvecmult() [2/4]

template<int d>
v1d Tools< d >::skewmatvecmult ( cv1d M,
cv1d v 
)
static

Multiply the skew symetric matrix M with vector v.

◆ skewmatvecmult() [3/4]

template<int d>
void Tools< d >::skewmatvecmult ( v1d r,
const double *  M,
cv1d v 
)
static

Multiply the skew symetric matrix M with vector v in place (overload)

◆ skewmatvecmult() [4/4]

template<int d>
void Tools< d >::skewmatvecmult ( v1d r,
cv1d M,
cv1d v 
)
static

Multiply the skew symetric matrix M with vector v in place.

◆ skewnorm()

template<int d>
static double Tools< d >::skewnorm ( cv1d a)
inlinestatic

Norm of a skew-symetric matrix.

◆ skewnormsq()

template<int d>
static double Tools< d >::skewnormsq ( cv1d a)
inlinestatic

Norm squared of a skew-symetrix matrix.

◆ split()

template<int d>
void Multiproc< d >::split ( int  N,
int  P 
)
private

Function to allocate the grains to threads taking into account the load balance in the contact detection. load_balance() takes over after a few iteration have run, and is usually more efficient.

◆ splitcells()

template<int d>
void Multiproc< d >::splitcells ( int  C)

◆ surfacevelocity()

template<int d>
static void Tools< d >::surfacevelocity ( v1d res,
cv1d p,
double *  com,
double *  vel_com,
double *  omega_com 
)
inlinestatic

◆ templatedmain()

template<int d>
int templatedmain ( char *  argv[])

Main simulation run. All the simulation is handled by this function.

◆ transpose()

template<int d>
static v1d Tools< d >::transpose ( cv1d a)
inlinestatic

Transposition.

◆ transpose_inplace()

template<int d>
static void Tools< d >::transpose_inplace ( v1d a)
inlinestatic

Transpose in-place.

◆ two_max_element()

template<int d>
std::pair< double, double > Tools< d >::two_max_element ( cv1d v)
static

Return the two largest elements of v.

◆ unitvec() [1/2]

template<int d>
static v1d Tools< d >::unitvec ( int  n)
inlinestatic

Construct & return a unit vector.

◆ unitvec() [2/2]

template<int d>
void Tools< d >::unitvec ( vector< double > &  v,
int  n 
)
static

Construct a unit vector in place.

◆ Volume()

template<int d>
double Tools< d >::Volume ( double  R)
static

Compute the hypersphere volume.

◆ vsq()

template<int d>
static v1f Tools< d >::vsq ( cv1f a)
inlinestatic

Component-wise squaring.

◆ vsqrt()

template<int d>
static v1f Tools< d >::vsqrt ( cv1f a)
inlinestatic

Component-wise square root.

◆ wedgeproduct() [1/2]

template<int d>
v1d Tools< d >::wedgeproduct ( cv1d a,
cv1d b 
)
static

Wedge product of vectors.

◆ wedgeproduct() [2/2]

template<int d>
void Tools< d >::wedgeproduct ( v1d res,
cv1d a,
cv1d b 
)
static

Wedge product in-place.

◆ write1D()

template<int d>
int Tools< d >::write1D ( char  path[],
v1d  table 
)
static

◆ writeinline()

template<int d>
int Tools< d >::writeinline ( initializer_list< v1d list)
static

◆ writeinline_close()

template<int d>
int Tools< d >::writeinline_close ( void  )
static

Variable Documentation

◆ Eye

template<int d>
vector< double > Tools< d >::Eye
static

The identity matrix in dimension <d>

◆ MASIndex

template<int d>
vector< pair< int, int > > Tools< d >::MASIndex
static

For skew symmetric matrix, make the correspondance between linear index and (row,column) index.

◆ MIndexAS

template<int d>
vector< vector< int > > Tools< d >::MIndexAS
staticprivate

For skew symmetric matrix, make the correspondance between linear index of a full matrix with the linear index of the skew-symetric storage.

◆ MSigns

template<int d>
vector< vector< int > > Tools< d >::MSigns
staticprivate

For skew symetric matrix. -1 below the diagonal, 0 on the diagonal, +1 above the diagnal.

◆ outs

template<int d>
vector< FILE * > Tools< d >::outs
staticprivate

Store the output file descriptors.

◆ rand

template<int d>
boost::random::uniform_01< boost::mt19937 > Tools< d >::rand
static

Returns a random number between 0 and 1.

◆ rng

template<int d>
boost::random::mt19937 Tools< d >::rng
static

Random number generator.

◆ toclean [1/2]

vector<std::pair<ExportType,ExportData> >* toclean

◆ toclean [2/2]

vector<std::pair<ExportType,ExportData> >* toclean
extern

◆ xmlout [1/2]

XMLWriter* xmlout

◆ xmlout [2/2]

XMLWriter* xmlout
extern