PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
particle::RefParticle Class Reference

A class to store reference particle related data. Consider a case of multiple hexagon-shaped particle related to each other by affine transformation. In such a case, it is possible to consider a reference hexagon particle and store the mesh and other details of only the reference particle. To get the data relevant to specific hexagon particle, one can apply the appropriate transformation on data for the reference hexagon particle. More...

#include <refParticle.h>

Collaboration diagram for particle::RefParticle:

Public Member Functions

 RefParticle (size_t id, std::shared_ptr< model::ModelData > model_data, std::shared_ptr< util::geometry::GeomObject > geom, std::shared_ptr< fe::Mesh > mesh)
 Constructor.
 
std::string printStr (int nt=0, int lvl=0) const
 Returns the string containing printable information about the object.
 
void print (int nt=0, int lvl=0) const
 Prints the information about the object.
 
Accessors
std::shared_ptr< fe::Mesh > & getMeshP ()
 Get pointer to mesh object.
 
const std::shared_ptr< fe::Mesh > & getMeshP () const
 Get pointer to mesh object.
 
std::shared_ptr< util::geometry::GeomObject > & getGeomP ()
 Get pointer to geometry object.
 
const std::shared_ptr< util::geometry::GeomObject > & getGeomP () const
 Get pointer to geometry object.
 
fe::MeshgetMesh ()
 Get reference to mesh object.
 
const fe::MeshgetMesh () const
 Get reference to mesh object.
 
size_t getDimension () const
 Get the dimension of the domain.
 
size_t getNumNodes () const
 Get the number of nodes.
 
util::Point getNode (const size_t &i) const
 Get reference coordinate of a node.
 
double getNodalVolume (const size_t &i) const
 Get nodal volume.
 
size_t getCenterNodeId () const
 Get id of center node of particle.
 
double getParticleRadius () const
 Get radius of reference particle.
 

Data Fields

size_t d_id
 Id of reference particle in list d_referenceParticles in ModelData.
 
std::shared_ptr< model::ModelDatad_modelData_p
 Reference to model class.
 
std::shared_ptr< fe::Meshd_mesh_p
 Pointer to mesh on reference particle.
 
size_t d_centerNode
 Id of mesh node closest to the particle center.
 
std::shared_ptr< util::geometry::GeomObjectd_geom_p
 Geometrical object defining this particle.
 
double d_pRadius
 Particle radius.
 
std::vector< size_t > d_bNodes
 List of nodes near boundary.
 
std::vector< uint8_t > d_intFlags
 Interior flags. For given node i the flag is d_intFlags[i%8]. We use 1 bit per node.
 

Detailed Description

A class to store reference particle related data. Consider a case of multiple hexagon-shaped particle related to each other by affine transformation. In such a case, it is possible to consider a reference hexagon particle and store the mesh and other details of only the reference particle. To get the data relevant to specific hexagon particle, one can apply the appropriate transformation on data for the reference hexagon particle.

Definition at line 40 of file refParticle.h.

Constructor & Destructor Documentation

◆ RefParticle()

particle::RefParticle::RefParticle ( size_t  id,
std::shared_ptr< model::ModelData model_data,
std::shared_ptr< util::geometry::GeomObject geom,
std::shared_ptr< fe::Mesh mesh 
)

Constructor.

Parameters
idId of this object in list of all reference particles in ModelData
model_dataGlobal model data
geomParticle geometry object
meshPointer to mesh

Definition at line 18 of file refParticle.cpp.

22 : d_id(id),
23 d_modelData_p(model_data),
24 d_geom_p(geom),
25 d_mesh_p(mesh),
26 d_centerNode(0),
27 d_pRadius(geom->boundingRadius()) {
28
29 if (d_pRadius < 1.0E-10) {
30 std::cerr << "Error: Reference particle radius is too small.\n";
31 exit(1);
32 }
33
34 // find the node which is closest to the particle center
35 // also add node near boundary to list
36 auto center = d_geom_p->center();
37 auto dx = util::Point();
38 double dist = d_geom_p->boundingRadius();
39 for (size_t i = 0; i < mesh->getNumNodes(); i++) {
40 dx = center - mesh->getNode(i);
41 if (util::isLess(dx.length(), dist)) {
42 dist = dx.length();
43 d_centerNode = i;
44 }
45 }
46}
std::shared_ptr< model::ModelData > d_modelData_p
Reference to model class.
size_t d_id
Id of reference particle in list d_referenceParticles in ModelData.
size_t d_centerNode
Id of mesh node closest to the particle center.
double d_pRadius
Particle radius.
std::shared_ptr< fe::Mesh > d_mesh_p
Pointer to mesh on reference particle.
std::shared_ptr< util::geometry::GeomObject > d_geom_p
Geometrical object defining this particle.
list center
origin (this center is used to discretize the particle and later discretization is translated and rot...
bool isLess(const double &a, const double &b)
Returns true if a < b.
Definition function.cpp:20
A structure to represent 3d vectors.
Definition point.h:30

References d_centerNode, d_geom_p, d_pRadius, and util::isLess().

Here is the call graph for this function:

Member Function Documentation

◆ getCenterNodeId()

size_t particle::RefParticle::getCenterNodeId ( ) const
inline

Get id of center node of particle.

Returns
Id Id of center node

Definition at line 124 of file refParticle.h.

124{ return d_centerNode; };

References d_centerNode.

◆ getDimension()

size_t particle::RefParticle::getDimension ( ) const
inline

Get the dimension of the domain.

Returns
N Dimension

Definition at line 90 of file refParticle.h.

90 {
91 return d_mesh_p->getDimension();
92 };

References d_mesh_p.

◆ getGeomP() [1/2]

std::shared_ptr< util::geometry::GeomObject > & particle::RefParticle::getGeomP ( )
inline

Get pointer to geometry object.

Returns
pointer Pointer

Definition at line 72 of file refParticle.h.

72{ return d_geom_p; };

References d_geom_p.

◆ getGeomP() [2/2]

const std::shared_ptr< util::geometry::GeomObject > & particle::RefParticle::getGeomP ( ) const
inline

Get pointer to geometry object.

Returns
pointer Pointer

Definition at line 75 of file refParticle.h.

75{ return d_geom_p; };

References d_geom_p.

◆ getMesh() [1/2]

fe::Mesh & particle::RefParticle::getMesh ( )
inline

Get reference to mesh object.

Returns
mesh Reference to mesh

Definition at line 81 of file refParticle.h.

81{ return *d_mesh_p; };

References d_mesh_p.

◆ getMesh() [2/2]

const fe::Mesh & particle::RefParticle::getMesh ( ) const
inline

Get reference to mesh object.

Returns
mesh Reference to mesh

Definition at line 84 of file refParticle.h.

84{ return *d_mesh_p; };

References d_mesh_p.

◆ getMeshP() [1/2]

std::shared_ptr< fe::Mesh > & particle::RefParticle::getMeshP ( )
inline

Get pointer to mesh object.

Returns
mesh Pointer to mesh

Definition at line 63 of file refParticle.h.

63{ return d_mesh_p; };

References d_mesh_p.

◆ getMeshP() [2/2]

const std::shared_ptr< fe::Mesh > & particle::RefParticle::getMeshP ( ) const
inline

Get pointer to mesh object.

Returns
mesh Pointer to mesh

Definition at line 66 of file refParticle.h.

66{ return d_mesh_p; };

References d_mesh_p.

◆ getNodalVolume()

double particle::RefParticle::getNodalVolume ( const size_t &  i) const
inline

Get nodal volume.

Parameters
iIndex of node
Returns
volume Nodal volume

Definition at line 116 of file refParticle.h.

116 {
117 return d_mesh_p->getNodalVolume(i);
118 };

References d_mesh_p.

◆ getNode()

util::Point particle::RefParticle::getNode ( const size_t &  i) const
inline

Get reference coordinate of a node.

Parameters
iIndex of node
Returns
x Reference coordinate

Definition at line 107 of file refParticle.h.

107 {
108 return d_mesh_p->getNode(i);
109 };

References d_mesh_p.

◆ getNumNodes()

size_t particle::RefParticle::getNumNodes ( ) const
inline

Get the number of nodes.

Returns
N number of nodes

Definition at line 98 of file refParticle.h.

98 {
99 return d_mesh_p->getNumNodes();
100 };

References d_mesh_p.

◆ getParticleRadius()

double particle::RefParticle::getParticleRadius ( ) const
inline

Get radius of reference particle.

Returns
Radius Radius of reference particle

Definition at line 130 of file refParticle.h.

130{ return d_pRadius; };

References d_pRadius.

◆ print()

void particle::RefParticle::print ( int  nt = 0,
int  lvl = 0 
) const
inline

Prints the information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)

Definition at line 149 of file refParticle.h.

149{ std::cout << printStr(nt, lvl); }
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.

References printStr().

Here is the call graph for this function:

◆ printStr()

std::string particle::RefParticle::printStr ( int  nt = 0,
int  lvl = 0 
) const

Returns the string containing printable information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)
Returns
string String containing printable information about the object

Definition at line 48 of file refParticle.cpp.

48 {
49
50 auto tabS = util::io::getTabS(nt);
51 std::ostringstream oss;
52 oss << tabS << "------- Reference particle --------" << std::endl
53 << std::endl;
54
55 oss << tabS << "Mesh pointer = " << d_mesh_p.get() << std::endl;
56 oss << tabS << "Mesh info: " << std::endl;
57 oss << d_mesh_p->printStr(nt + 1, lvl);
58 oss << tabS << "Center node = " << d_centerNode << std::endl;
59 oss << tabS << "Center node location = " << getNode(d_centerNode).printStr()
60 << std::endl;
61 oss << tabS << "Geometry info: " << std::endl;
62 oss << d_geom_p->printStr(nt + 1, lvl);
63 oss << tabS << "Radius = " << d_pRadius << std::endl;
64 oss << tabS << "Num interior flag data = " << d_intFlags.size() << std::endl;
65
66 oss << tabS << std::endl;
67
68 return oss.str();
69}
util::Point getNode(const size_t &i) const
Get reference coordinate of a node.
std::vector< uint8_t > d_intFlags
Interior flags. For given node i the flag is d_intFlags[i%8]. We use 1 bit per node.
std::string getTabS(int nt)
Returns tab spaces of given size.
Definition io.h:40
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
Definition point.h:94

References util::io::getTabS().

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ d_bNodes

std::vector<size_t> particle::RefParticle::d_bNodes

List of nodes near boundary.

Definition at line 171 of file refParticle.h.

◆ d_centerNode

size_t particle::RefParticle::d_centerNode

Id of mesh node closest to the particle center.

Definition at line 162 of file refParticle.h.

Referenced by getCenterNodeId(), and RefParticle().

◆ d_geom_p

std::shared_ptr<util::geometry::GeomObject> particle::RefParticle::d_geom_p

Geometrical object defining this particle.

Definition at line 165 of file refParticle.h.

Referenced by getGeomP(), getGeomP(), and RefParticle().

◆ d_id

size_t particle::RefParticle::d_id

Id of reference particle in list d_referenceParticles in ModelData.

Definition at line 153 of file refParticle.h.

◆ d_intFlags

std::vector<uint8_t> particle::RefParticle::d_intFlags

Interior flags. For given node i the flag is d_intFlags[i%8]. We use 1 bit per node.

Definition at line 177 of file refParticle.h.

◆ d_mesh_p

std::shared_ptr<fe::Mesh> particle::RefParticle::d_mesh_p

Pointer to mesh on reference particle.

Definition at line 159 of file refParticle.h.

Referenced by getDimension(), getMesh(), getMesh(), getMeshP(), getMeshP(), getNodalVolume(), getNode(), and getNumNodes().

◆ d_modelData_p

std::shared_ptr<model::ModelData> particle::RefParticle::d_modelData_p

Reference to model class.

Definition at line 156 of file refParticle.h.

◆ d_pRadius

double particle::RefParticle::d_pRadius

Particle radius.

Definition at line 168 of file refParticle.h.

Referenced by getParticleRadius(), and RefParticle().


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