NDDEM
|
Classes | |
class | CGPoint |
Data computed for a single coarse graining point. More... | |
struct | Field |
Contains Field informations. More... | |
struct | Data |
Data structure handling point data and contact data. More... | |
class | Coarsing |
Main Coarse graining class. More... | |
Enumerations | |
enum | TensorOrder { NONE =-1 , SCALAR =0 , VECTOR =1 , TENSOR =2 } |
enum | FieldType { Defined , Particle , Fluctuation , Contact } |
enum | AverageType { None , Final , Intermediate , Both } |
enum | Pass { Pass1 =1 , Pass2 =2 , Pass3 =4 , Pass4 =8 , Pass5 =16 , VelFluct =256 , RotFluct =512 } |
Functions | |
double | Volume (int d, double R) |
Compute a sphere volume in dimension D. More... | |
Pass | operator| (Pass a, Pass b) |
bool | operator& (Pass a, Pass b) |
CGPoint::CGPoint (int dd, v1d loc) | |
Data::Data () | |
int | Data::random_test (int N, int Ncf, int d, v2d box) |
Randomly fill the data structure. More... | |
int | Data::compute_lpq (int d) |
Compute lpq from contact id's and atom locations. More... | |
int | Data::periodic_atoms (int d, v2d bounds, int pbc, v1d Delta, bool omegainclude) |
Copy particles through the periodic boundary conditions. Should call clean_periodic_atoms() after the full coarse-graining computation has been performed to clean the added atoms. More... | |
int | Data::clean_periodic_atoms () |
Clean periodic atoms. More... | |
bool | Data::check_field_availability (string name) |
int | Data::add_extra_field (int length, std::string name) |
Coarsing::Coarsing (int dd, v1i nnpt, v2d bbox, int T) | |
Coarsing::~Coarsing () | |
int | Coarsing::get_id (string nm) |
Find field ID from field name. More... | |
struct Field * | Coarsing::get_field (string nm) |
Find Field from name. More... | |
Pass | Coarsing::set_flags (vector< string > s) |
Set the fields which are requested from the coarse-graining. More... | |
int | Coarsing::set_field_struct () |
Set the FIELDS structure, with all the different CG properties that can be computed. More... | |
int | Coarsing::add_extra_field (string name, TensorOrder order, FieldType type) |
Used to add extra user-defined fields. More... | |
int | Coarsing::setWindow (Windows win, double w, vector< bool > per={}, vector< int > boxes={}, vector< double > deltas={}) |
Set the windowing function, calling the templated version. More... | |
template<Windows W> | |
int | Coarsing::setWindow () |
Set the windowing function. More... | |
template<Windows W> | |
int | Coarsing::setWindow (double w) |
Set the windowing function. More... | |
template<Windows W> | |
int | Coarsing::setWindow (double w, vector< bool > per, vector< int > boxes, vector< double > deltas) |
Set the windowing function for the LibLucyND_Periodic (special one...) More... | |
int | Coarsing::grid_generate () |
Generate the coarse-graining grid. More... | |
int | Coarsing::grid_neighbour () |
Generated neighbors in the coarse-graining grid. More... | |
std::map< std::string, size_t > | Coarsing::grid_setfields () |
Set the fields at each CG point. More... | |
vector< FieldType > | Coarsing::grid_getfields () |
Extract fields from each CG point. More... | |
v2d | Coarsing::get_bounds () |
Extract the simulation boundaries. More... | |
CGPoint * | Coarsing::reverseloop (string type) |
go through the table in reverse order of the dimensions (for the writing phase essentially) More... | |
int | Coarsing::find_closest (int id) |
Find the closest CG point to a particle. More... | |
int | Coarsing::find_closest_pq (int id) |
Find the closest CG point to a contact. More... | |
v1d | Coarsing::interpolate_vel (int id, bool usetimeavg=false) |
Interpolate the velocity. More... | |
v1d | Coarsing::interpolate_rot (int id, bool usetimeavg=false) |
Interpolate the angular velocity. More... | |
v1d | Coarsing::interpolate_vel_nearest (int id, bool usetimeavg=false) |
Nearest neighbor interpolation for the velocity. More... | |
v1d | Coarsing::interpolate_rot_nearest (int id, bool usetimeavg=false) |
Nearest neighbor interpolation for the angular velocity. More... | |
v1d | Coarsing::interpolate_vel_trilinear (int id, bool usetimeavg) |
Tri-linear interpolation (only implemented in 3D, probably not too hard to implement in ND but annoying ...) More... | |
template<int D> | |
v1d | Coarsing::interpolate_vel_multilinear (int id, bool usetimeavg) |
int | Coarsing::idx_FastFirst2SlowFirst (int n) |
Change array traversing order. More... | |
double | Coarsing::normdiff (v1d a, v1d b) |
int | Coarsing::pass_1 () |
convenience function to to the difference of 2 vectors. More... | |
int | Coarsing::pass_2 (bool usetimeavg=false) |
Coarse-grain anything based on particles (not contacts) which needs fluctuating quantities (call the compute_fluc_ functions before) More... | |
int | Coarsing::pass_3 () |
Coarse-grain anything based on contact informations (no fluctuations). More... | |
int | Coarsing::pass_4 () |
Coarse-grain anything based on contact informations & fluctuations. More... | |
int | Coarsing::pass_5 () |
Calculation of derived quantities. More... | |
int | Coarsing::compute_fluc_vel (bool usetimeavg=false) |
Velocity fluctuation computation. More... | |
int | Coarsing::compute_fluc_rot (bool usetimeavg=false) |
Angular velocity fluctuation computation. More... | |
int | Coarsing::mean_time (bool temporary=false) |
Perform a time average of the coarse-grained data. More... | |
int | Coarsing::write_vtk (string sout) |
Write CG data as VTK. More... | |
int | Coarsing::write_netCDF (string sout) |
int | Coarsing::write_NrrdIO (string path) |
Write CG data as NrrdIO file format. More... | |
int | Coarsing::write_matlab (string path, bool squeeze=false) |
Write CG data as Matlab file. More... | |
int | Coarsing::write_numpy (string path, bool squeeze=false) |
Write CG data as numpy files (.npy) ;. More... | |
int | Coarsing::write_numpy_npy (string path, bool squeeze) |
std::pair< size_t, uint8_t * > | Coarsing::write_numpy_locbuffer (bool squeeze) |
std::pair< size_t, uint8_t * > | Coarsing::write_numpy_buffer (int id, bool squeeze) |
Variables | |
v2d | CGPoint::fields |
1st dimension is time, second are fields More... | |
v1d | CGPoint::location |
Location of the coarse graining point. More... | |
vector< int > | CGPoint::neighbors |
All the neighbors of the point given the window. 1st index is the point itself. More... | |
int | CGPoint::d |
Dimension. More... | |
uint64_t | Field::flag |
Flag for the given field. More... | |
string | Field::name |
Name for the given field. More... | |
TensorOrder | Field::type |
Tensorial order of the field: SCALAR, VECTOR or TENSOR. More... | |
FieldType | Field::ftype |
Mainly used to identified the type of user defined fields. More... | |
Pass | Field::passlevel |
Identify at which moment the field gets calculated. More... | |
int | Field::datalocation = -1 |
For extra fields, identify the location in the vector of extra data. More... | |
int | Data::N = 0 |
Number of particles. More... | |
double * | Data::radius |
Particle radius. More... | |
double * | Data::mass |
Particle masses. More... | |
double * | Data::Imom |
Particle moment of inertia. More... | |
vector< double * > | Data::pos |
Particle positions. More... | |
vector< double * > | Data::vel |
Particle velocity. More... | |
vector< double * > | Data::omega |
Particle angular velocity. More... | |
v2d | Data::vel_fluc |
Fluctuating velocity. Should not be externally provided but calculated, using the function Coarsing::compute_fluc_vel() More... | |
v2d | Data::rot_fluc |
Fluctuating angular velocity. Should not be externally provided but calculated, using the function Coarsing::compute_fluc_vel() More... | |
int | Data::Ncf |
Number of contacts. More... | |
double * | Data::id1 |
Index of first particle in contact. More... | |
double * | Data::id2 |
Index of the second particle in contact. More... | |
vector< double * > | Data::pospq |
Location of contact point. More... | |
vector< double * > | Data::lpq |
Branch vector of the contact, use compute_lpq() to populate this. More... | |
vector< double * > | Data::fpq |
Force at contact. More... | |
vector< double * > | Data::mpq |
Moment of particle 1 on 2. More... | |
vector< double * > | Data::mqp |
Moment of particle 2 on 1. More... | |
vector< double * > | Data::extra |
vector< std::tuple< std::string, int, int > > | Data::extrafields |
int | Data::Nnonper =-1 |
Used if additional particles are added as images through the periodic boundary conditions. More... | |
int | Coarsing::d |
Number of dimensions. More... | |
int | Coarsing::Npt |
Number of coarse graining points. More... | |
int | Coarsing::Time |
Total timesteps. More... | |
int | Coarsing::cT |
Current timestep. More... | |
double | Coarsing::cutoff |
CG width, and cutoff. More... | |
vector< CGPoint > | Coarsing::CGP |
List of Coarse Graining points. More... | |
vector< CGPoint > * | Coarsing::CGPtemp = nullptr |
Temporary cgpoint list that can store temporal averages if needed. More... | |
vector< int > | Coarsing::npt |
Number of points per dimension. More... | |
vector< int > | Coarsing::nptcum |
Cumulated number of points per dimensions (usefull for quick finding of the closest CG for a grain) More... | |
v1d | Coarsing::dx |
Distances between CG points. More... | |
v2d | Coarsing::box |
CG point location. More... | |
LibBase * | Coarsing::Window = nullptr |
unsigned int | Coarsing::flags |
More... | |
vector< string > | Coarsing::Fields |
vector< string > | Coarsing::Fname |
Flagged field names. More... | |
vector< int > | Coarsing::Fidx |
Where the fields is referenced in the fields vector in the CGPoint. -1 if not flagged. More... | |
vector< TensorOrder > | Coarsing::Ftype |
Flagged field types. More... | |
vector< struct Field > | Coarsing::FIELDS |
All allowed fields (initialized in grid_getfields) More... | |
bool | Coarsing::hasvelfluct =false |
bool | Coarsing::hasrotfluct =false |
struct Data | Coarsing::data |
Data storage. More... | |
This modules handles the coarse graining in any number of dimensions, and has some neat features that are not that common even for 3D coarse graining.
In particular, the following fields can be requested, equation numbering is from Babic, Marijan. "Average balance equations for granular materials." International journal of engineering science 35.5 (1997): 523-548.:
"RHO" "SCALAR" Eq 36 Density
"I" "SCALAR" Eq 65 Moment of Inertia
"VAVG" "VECTOR" Eq 38 Average Velocity
"TC" "TENSOR" Eq 63 Contact stress
"TK" "TENSOR" Eq 62 Kinetic stress
"ROT" "VECTOR" Eq 64 Internal spin density
"MC" "TENSOR" Eq 67 Contact couple stress tensor
"MK" "TENSOR" Eq 66 Kinetic couple stress tensor
"mC" "VECTOR" Eq 68 spin supply from contacts
"EKT" "SCALAR" VAVG^2/2 Kinetic energy density of average velocity
"eKT" "SCALAR" Eq 69 Kinetic energy density of fluctuating motion
"EKR" "SCALAR" (W.K.W)/2, kin energy of avg rotational motion, W angular velocity vector, K moment of inertia tensor
"eKR" "SCALAR" Eq 70 Kin energy of fluctuating rotational motion
"qTC" "VECTOR" Eq 72
"qTK" "VECTOR" Eq 71
"qRC" "VECTOR" Eq 74
"qRK" "VECTOR" Eq 73
"zT" "SCALAR" Eq 75
"zR" "SCALAR" Eq 76
enum AverageType |
enum FieldType |
enum Pass |
enum TensorOrder |
|
inline |
int Coarsing::add_extra_field | ( | string | name, |
TensorOrder | order, | ||
FieldType | type | ||
) |
Used to add extra user-defined fields.
|
inline |
bool Data::check_field_availability | ( | string | name | ) |
|
inline |
Clean periodic atoms.
int Coarsing::compute_fluc_rot | ( | bool | usetimeavg = false | ) |
Angular velocity fluctuation computation.
int Coarsing::compute_fluc_vel | ( | bool | usetimeavg = false | ) |
Velocity fluctuation computation.
int Data::compute_lpq | ( | int | d | ) |
Compute lpq from contact id's and atom locations.
|
inline |
int Coarsing::find_closest | ( | int | id | ) |
Find the closest CG point to a particle.
int Coarsing::find_closest_pq | ( | int | id | ) |
Find the closest CG point to a contact.
v2d Coarsing::get_bounds | ( | ) |
Extract the simulation boundaries.
int Coarsing::get_id | ( | string | nm | ) |
Find field ID from field name.
int Coarsing::grid_generate | ( | ) |
Generate the coarse-graining grid.
vector< FieldType > Coarsing::grid_getfields | ( | ) |
Extract fields from each CG point.
int Coarsing::grid_neighbour | ( | ) |
Generated neighbors in the coarse-graining grid.
std::map< std::string, size_t > Coarsing::grid_setfields | ( | ) |
Set the fields at each CG point.
int Coarsing::idx_FastFirst2SlowFirst | ( | int | n | ) |
Change array traversing order.
|
inline |
Interpolate the angular velocity.
v1d Coarsing::interpolate_rot_nearest | ( | int | id, |
bool | usetimeavg = false |
||
) |
Nearest neighbor interpolation for the angular velocity.
|
inline |
Interpolate the velocity.
v1d Coarsing::interpolate_vel_multilinear | ( | int | id, |
bool | usetimeavg | ||
) |
v1d Coarsing::interpolate_vel_nearest | ( | int | id, |
bool | usetimeavg = false |
||
) |
Nearest neighbor interpolation for the velocity.
v1d Coarsing::interpolate_vel_trilinear | ( | int | id, |
bool | usetimeavg | ||
) |
Tri-linear interpolation (only implemented in 3D, probably not too hard to implement in ND but annoying ...)
int Coarsing::mean_time | ( | bool | temporary = false | ) |
Perform a time average of the coarse-grained data.
int Coarsing::pass_1 | ( | ) |
convenience function to to the difference of 2 vectors.
Coarse-grain anything based on particles (not contacts) which does not need fluctuating quantities
int Coarsing::pass_2 | ( | bool | usetimeavg = false | ) |
Coarse-grain anything based on particles (not contacts) which needs fluctuating quantities (call the compute_fluc_ functions before)
int Coarsing::pass_3 | ( | ) |
Coarse-grain anything based on contact informations (no fluctuations).
int Coarsing::pass_4 | ( | ) |
Coarse-grain anything based on contact informations & fluctuations.
int Coarsing::pass_5 | ( | ) |
Calculation of derived quantities.
Copy particles through the periodic boundary conditions. Should call clean_periodic_atoms() after the full coarse-graining computation has been performed to clean the added atoms.
int Data::random_test | ( | int | N, |
int | Ncf, | ||
int | d, | ||
v2d | box | ||
) |
Randomly fill the data structure.
CGPoint * Coarsing::reverseloop | ( | string | type | ) |
go through the table in reverse order of the dimensions (for the writing phase essentially)
int Coarsing::set_field_struct | ( | ) |
Set the FIELDS structure, with all the different CG properties that can be computed.
Pass Coarsing::set_flags | ( | vector< string > | s | ) |
Set the fields which are requested from the coarse-graining.
int Coarsing::setWindow |
Set the windowing function.
int Coarsing::setWindow | ( | double | w | ) |
Set the windowing function.
int Coarsing::setWindow | ( | double | w, |
vector< bool > | per, | ||
vector< int > | boxes, | ||
vector< double > | deltas | ||
) |
Set the windowing function for the LibLucyND_Periodic (special one...)
int Coarsing::setWindow | ( | Windows | win, |
double | w, | ||
vector< bool > | per = {} , |
||
vector< int > | boxes = {} , |
||
vector< double > | deltas = {} |
||
) |
Set the windowing function, calling the templated version.
double Volume | ( | int | d, |
double | R | ||
) |
Compute a sphere volume in dimension D.
int Coarsing::write_matlab | ( | string | path, |
bool | squeeze = false |
||
) |
Write CG data as Matlab file.
int Coarsing::write_netCDF | ( | string | sout | ) |
int Coarsing::write_NrrdIO | ( | string | path | ) |
Write CG data as NrrdIO file format.
int Coarsing::write_numpy | ( | string | path, |
bool | squeeze = false |
||
) |
Write CG data as numpy files (.npy) ;.
std::pair< size_t, uint8_t * > Coarsing::write_numpy_buffer | ( | int | id, |
bool | squeeze | ||
) |
|
inline |
int Coarsing::write_numpy_npy | ( | string | path, |
bool | squeeze | ||
) |
int Coarsing::write_vtk | ( | string | sout | ) |
Write CG data as VTK.
|
inline |
v2d Coarsing::box |
CG point location.
vector<CGPoint> Coarsing::CGP |
List of Coarse Graining points.
vector<CGPoint>* Coarsing::CGPtemp = nullptr |
Temporary cgpoint list that can store temporal averages if needed.
int Coarsing::cT |
Current timestep.
double Coarsing::cutoff |
CG width, and cutoff.
int CGPoint::d |
Dimension.
int Coarsing::d |
Number of dimensions.
int Field::datalocation = -1 |
For extra fields, identify the location in the vector of extra data.
v1d Coarsing::dx |
Distances between CG points.
vector<double*> Data::extra |
vector<std::tuple<std::string, int, int> > Data::extrafields |
vector<int> Coarsing::Fidx |
Where the fields is referenced in the fields vector in the CGPoint. -1 if not flagged.
v2d CGPoint::fields |
1st dimension is time, second are fields
vector<string> Coarsing::Fields |
vector<struct Field > Coarsing::FIELDS |
All allowed fields (initialized in grid_getfields)
uint64_t Field::flag |
Flag for the given field.
unsigned int Coarsing::flags |
Pointer to the averaging window
Flags deciding which fields to coarse-grain
vector<string> Coarsing::Fname |
Flagged field names.
vector<double *> Data::fpq |
Force at contact.
FieldType Field::ftype |
Mainly used to identified the type of user defined fields.
vector<TensorOrder> Coarsing::Ftype |
Flagged field types.
bool Coarsing::hasrotfluct =false |
bool Coarsing::hasvelfluct =false |
double* Data::id1 |
Index of first particle in contact.
double* Data::id2 |
Index of the second particle in contact.
double* Data::Imom |
Particle moment of inertia.
v1d CGPoint::location |
Location of the coarse graining point.
vector<double *> Data::lpq |
Branch vector of the contact, use compute_lpq() to populate this.
double* Data::mass |
Particle masses.
vector<double *> Data::mpq |
Moment of particle 1 on 2.
vector<double *> Data::mqp |
Moment of particle 2 on 1.
int Data::N = 0 |
Number of particles.
string Field::name |
Name for the given field.
int Data::Ncf |
Number of contacts.
vector<int> CGPoint::neighbors |
All the neighbors of the point given the window. 1st index is the point itself.
int Data::Nnonper =-1 |
Used if additional particles are added as images through the periodic boundary conditions.
int Coarsing::Npt |
Number of coarse graining points.
vector<int> Coarsing::npt |
Number of points per dimension.
vector<int> Coarsing::nptcum |
Cumulated number of points per dimensions (usefull for quick finding of the closest CG for a grain)
vector<double *> Data::omega |
Particle angular velocity.
Pass Field::passlevel |
Identify at which moment the field gets calculated.
vector<double *> Data::pos |
Particle positions.
vector<double *> Data::pospq |
Location of contact point.
double* Data::radius |
Particle radius.
v2d Data::rot_fluc |
Fluctuating angular velocity. Should not be externally provided but calculated, using the function Coarsing::compute_fluc_vel()
int Coarsing::Time |
Total timesteps.
TensorOrder Field::type |
Tensorial order of the field: SCALAR, VECTOR or TENSOR.
vector<double *> Data::vel |
Particle velocity.
v2d Data::vel_fluc |
Fluctuating velocity. Should not be externally provided but calculated, using the function Coarsing::compute_fluc_vel()
LibBase* Coarsing::Window = nullptr |