PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
baseParticle.h
Go to the documentation of this file.
1/*
2 * -------------------------------------------
3 * Copyright (c) 2021 - 2024 Prashant K. Jha
4 * -------------------------------------------
5 * PeriDEM https://github.com/prashjha/PeriDEM
6 *
7 * Distributed under the Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE)
9 */
10
11#ifndef PARTICLE_BASEPARTICLE_H
12#define PARTICLE_BASEPARTICLE_H
13
14#include "refParticle.h"
16#include "model/modelData.h"
17
18#include <cstdint> // uint8_t type
19#include <cstring> // string and size_t type
20#include <vector>
21
23namespace particle {
24
32
33public:
39 BaseParticle(std::string particle_type = "none");
40
61 BaseParticle(std::string particle_type,
62 size_t id,
63 size_t particle_type_id,
64 size_t zone_id,
65 size_t dim,
66 std::string particle_description,
69 size_t num_nodes,
70 double h,
71 std::shared_ptr<model::ModelData> model_data,
72 std::shared_ptr<particle::RefParticle> ref_particle,
73 std::shared_ptr<util::geometry::GeomObject> geom,
75 std::shared_ptr<fe::Mesh> mesh,
77 bool populate_data = true);
78
88 std::string getType() const { return d_type; };
89
94 int getTypeIndex() const { return d_typeIndex; };
95
100 size_t getId() const { return d_id; };
101
106 //size_t getTypeId() const { return d_typeId; };
107
112 size_t getDimension() const { return d_dim; };
113
118 std::shared_ptr<fe::Mesh> &getMeshP() { return d_mesh_p; };
119
121 const std::shared_ptr<fe::Mesh> &getMeshP() const { return d_mesh_p; };
122
127 fe::Mesh &getMesh() { return *d_mesh_p; };
128
130 const fe::Mesh &getMesh() const { return *d_mesh_p; };
131
136 double getMeshSize() const { return d_h; };
137
142 double getDensity() const { return d_density; };
143
148 double getHorizon() const { return d_horizon; };
149
155 const material::Material * getMaterial() const { return d_material_p.get(); };
156
161 size_t getNumNodes() const { return d_numNodes; };
162
168 size_t getNodeId(size_t i_loc) const { return i_loc + d_globStart; };
169
180 util::Point &getXRef(size_t i) { return d_modelData_p->getXRef(i); };
181 const util::Point &getXRef(size_t i) const { return d_modelData_p->getXRef(i); };
182
188 void setXRef(size_t i, const util::Point &x) { d_modelData_p->setXRef(i, x); };
189
195 void addXRef(size_t i, const util::Point &x) { d_modelData_p->addXRef(i, x); };
196
203 void setXRef(size_t i, int dof, double x) {
204 d_modelData_p->setXRef(i, dof, x);
205 };
206
213 void addXRef(size_t i, int dof, double x) {
214 d_modelData_p->addXRef(i, dof, x);
215 };
216
222 util::Point &getXRefLocal(size_t i) { return d_modelData_p->getXRef(i+d_globStart); };
223 const util::Point &getXRefLocal(size_t i) const { return d_modelData_p->getXRef(i+d_globStart); };
224
230 void setXRefLocal(size_t i, const util::Point &x) { d_modelData_p->setXRef(i+d_globStart, x); };
231
237 void addXRefLocal(size_t i, const util::Point &x) { d_modelData_p->addXRef(i+d_globStart, x); };
238
245 void setXRefLocal(size_t i, int dof, double x) { d_modelData_p->setXRef
246 (i+d_globStart, dof, x); };
247
255 void addXRefLocal(size_t i, int dof, double x) { d_modelData_p->addXRef
256 (i+d_globStart, dof, x); };
257
270 util::Point &getX(size_t i) { return d_modelData_p->getX(i); };
271 const util::Point &getX(size_t i) const { return d_modelData_p->getX(i); };
272
278 void setX(size_t i, const util::Point &x) { d_modelData_p->setX(i, x); };
279
285 void addX(size_t i, const util::Point &x) { d_modelData_p->addX(i, x); };
286
293 void setX(size_t i, int dof, double x) { d_modelData_p->setX(i, dof, x); };
294
301 void addX(size_t i, int dof, double x) { d_modelData_p->addX(i, dof, x); };
302
308 util::Point &getXLocal(size_t i) { return d_modelData_p->getX(i+d_globStart); };
309 const util::Point &getXLocal(size_t i) const { return d_modelData_p->getX(i+d_globStart); };
310
316 void setXLocal(size_t i, const util::Point &x) { d_modelData_p->setX(i+d_globStart, x); };
317
323 void addXLocal(size_t i, const util::Point &x) { d_modelData_p->addX(i+d_globStart, x); };
324
331 void setXLocal(size_t i, int dof, double x) { d_modelData_p->setX
332 (i+d_globStart, dof, x); };
333
340 void addXLocal(size_t i, int dof, double x) { d_modelData_p->addX
341 (i+d_globStart, dof, x); };
342
355 util::Point &getU(size_t i) { return d_modelData_p->getU(i); };
356 const util::Point &getU(size_t i) const { return d_modelData_p->getU(i); };
357
363 void setU(size_t i, const util::Point &u) { d_modelData_p->setU(i, u); };
364
370 void addU(size_t i, const util::Point &u) { d_modelData_p->addU(i, u); };
371
378 void setU(size_t i, int dof, double u) { d_modelData_p->setU(i, dof, u); };
379
386 void addU(size_t i, int dof, double u) { d_modelData_p->addU(i, dof, u); };
387
393 util::Point &getULocal(size_t i) { return d_modelData_p->getU(i+d_globStart); };
394
396 const util::Point &getULocal(size_t i) const { return d_modelData_p->getU(i+d_globStart); };
397
403 void setULocal(size_t i, const util::Point &u) { d_modelData_p->setU(i+d_globStart, u); };
404
410 void addULocal(size_t i, const util::Point &u) { d_modelData_p->addU(i+d_globStart, u); };
411
418 void setULocal(size_t i, int dof, double u) { d_modelData_p->setU
419 (i+d_globStart, dof, u); };
420
427 void addULocal(size_t i, int dof, double u) { d_modelData_p->addU
428 (i+d_globStart, dof, u); };
429
442 util::Point &getV(size_t i) { return d_modelData_p->getV(i); };
443 const util::Point &getV(size_t i) const { return d_modelData_p->getV(i); };
444
450 void setV(size_t i, const util::Point &v) { d_modelData_p->setV(i, v); };
451
457 void addV(size_t i, const util::Point &v) { d_modelData_p->addV(i, v); };
458
465 void setV(size_t i, int dof, double v) { d_modelData_p->setV(i, dof, v); };
466
473 void addV(size_t i, int dof, double v) { d_modelData_p->addV(i, dof, v); };
474
480 util::Point &getVLocal(size_t i) { return d_modelData_p->getV(i+d_globStart); };
481 const util::Point &getVLocal(size_t i) const { return d_modelData_p->getV(i+d_globStart); };
482
488 void setVLocal(size_t i, const util::Point &v) { d_modelData_p->setV(i+d_globStart, v); };
489
495 void addVLocal(size_t i, const util::Point &v) { d_modelData_p->addV(i+d_globStart, v); };
496
503 void setVLocal(size_t i, int dof, double v) { d_modelData_p->setV
504 (i+d_globStart, dof, v); };
505
512 void addVLocal(size_t i, int dof, double v) { d_modelData_p->addV
513 (i+d_globStart, dof, v); };
514
527 util::Point &getF(size_t i) { return d_modelData_p->getF(i); };
528 const util::Point &getF(size_t i) const { return d_modelData_p->getF(i); };
529
535 void setF(size_t i, const util::Point &f) { d_modelData_p->setF(i, f); };
536
542 void addF(size_t i, const util::Point &f) { d_modelData_p->addF(i, f); };
543
550 void setF(size_t i, int dof, double f) { d_modelData_p->setF(i, dof, f); };
551
558 void addF(size_t i, int dof, double f) { d_modelData_p->addF(i, dof, f); };
559
565 util::Point &getFLocal(size_t i) { return d_modelData_p->getF(i+d_globStart); };
566 const util::Point &getFLocal(size_t i) const { return d_modelData_p->getF(i+d_globStart); };
567
573 void setFLocal(size_t i, const util::Point &f) { d_modelData_p->setF(i+d_globStart, f); };
574
580 void addFLocal(size_t i, const util::Point &f) { d_modelData_p->addF(i+d_globStart, f); };
581
588 void setFLocal(size_t i, int dof, double f) { d_modelData_p->setF
589 (i+d_globStart, dof, f); };
590
597 void addFLocal(size_t i, int dof, double f) { d_modelData_p->addF
598 (i+d_globStart, dof, f); };
599
612 double &getVol(size_t i) { return d_modelData_p->getVol(i); };
613 const double &getVol(size_t i) const { return d_modelData_p->getVol(i); };
614
620 void setVol(size_t i, const double &vol) { d_modelData_p->setVol(i, vol); };
621
627 void addVol(size_t i, const double &vol) { d_modelData_p->addVol(i, vol); };
628
634 double &getVolLocal(size_t i) { return d_modelData_p->getVol(i+d_globStart); };
635 const double &getVolLocal(size_t i) const { return d_modelData_p->getVol(i+d_globStart); };
636
642 void setVolLocal(size_t i, const double &vol) { d_modelData_p->setVol(i+d_globStart, vol); };
643
649 void addVolLocal(size_t i, const double &vol) { d_modelData_p->addVol(i+d_globStart, vol); };
650
663 uint8_t &getFix(size_t i) { return d_modelData_p->getFix(i); };
664 const uint8_t &getFix(size_t i) const { return d_modelData_p->getFix(i); };
665
672 void setFix(size_t i, const unsigned int &dof, const bool &flag) {
673 d_modelData_p->setFix(i, dof, flag);
674 };
675
681 uint8_t &getFixLocal(size_t i) { return d_modelData_p->getFix(i+d_globStart); };
682 const uint8_t &getFixLocal(size_t i) const { return d_modelData_p->getFix(i+d_globStart); };
683
690 void setFixLocal(size_t i, const unsigned int &dof, const bool &flag) {
692 };
693
706 double &getMx(size_t i) { return d_modelData_p->getMx(i); };
707 const double &getMx(size_t i) const { return d_modelData_p->getMx(i); };
708
714 void setMx(size_t i, const double &mx) { d_modelData_p->setMx(i, mx); };
715
721 void addMx(size_t i, const double &mx) { d_modelData_p->addMx(i, mx); };
722
728 double &getMxLocal(size_t i) { return d_modelData_p->getMx(i+d_globStart); };
729 const double &getMxLocal(size_t i) const { return d_modelData_p->getMx(i+d_globStart); };
730
736 void setMxLocal(size_t i, const double &mx) { d_modelData_p->setMx(i+d_globStart, mx); };
737
743 void addMxLocal(size_t i, const double &mx) { d_modelData_p->addMx(i+d_globStart, mx); };
744
757 double &getThetax(size_t i) { return d_modelData_p->getThetax(i); };
758 const double &getThetax(size_t i) const { return d_modelData_p->getThetax(i)
759 ; };
760
766 void setThetax(size_t i, const double &thetax) { d_modelData_p->setThetax
767 (i, thetax); };
768
774 void addThetax(size_t i, const double &thetax) { d_modelData_p->addThetax
775 (i, thetax); };
776
782 double &getThetaxLocal(size_t i) { return d_modelData_p->getThetax(i+d_globStart); };
783 const double &getThetaxLocal(size_t i) const { return d_modelData_p->getThetax(i+d_globStart)
784 ; };
785
791 void setThetaxLocal(size_t i, const double &thetax) { d_modelData_p->setThetax
792 (i+d_globStart, thetax); };
793
799 void addThetaxLocal(size_t i, const double &thetax) { d_modelData_p->addThetax
800 (i+d_globStart, thetax); };
801
813 size_t getCenterNodeId() const { return d_rp_p->getCenterNodeId(); };
814
819 double getParticleRadius() const { return d_pRadius; };
820
826 return d_modelData_p->getX(d_globStart + d_rp_p->getCenterNodeId());
827 };
828
830 const util::Point &getXCenter() const {
831 return d_modelData_p->getX(d_globStart + d_rp_p->getCenterNodeId());
832 };
833
839 return d_modelData_p->getU(d_globStart + d_rp_p->getCenterNodeId());
840 };
841
843 const util::Point &getUCenter() const {
844 return d_modelData_p->getU(d_globStart + d_rp_p->getCenterNodeId());
845 };
846
852 return d_modelData_p->getV(d_globStart + d_rp_p->getCenterNodeId());
853 };
854
856 const util::Point &getVCenter() const {
857 return d_modelData_p->getV(d_globStart + d_rp_p->getCenterNodeId());
858 };
868 std::string printStr(int nt = 0, int lvl = 0) const;
869
876 void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); }
877
878public:
879
881 std::string d_type;
882
888
890 int d_typeIndex; // string - int map
891
894
896 size_t d_id;
897
900 size_t d_typeId;
901
903 size_t d_zoneId;
904
906 size_t d_dim;
907
910
912 double d_pRadius;
913
915 double d_h;
916
922
925
927 double d_horizon;
928
930 double d_density;
931
933 std::unique_ptr<material::Material> d_material_p;
934
936 double d_Rc;
937
939 double d_Kn;
940
943
945 size_t d_globEnd;
946
950
954
956 std::shared_ptr<model::ModelData> d_modelData_p;
957
959 std::shared_ptr<particle::RefParticle> d_rp_p;
960
962 std::shared_ptr<util::geometry::GeomObject> d_geom_p;
963
966
968 std::shared_ptr<fe::Mesh> d_mesh_p;
969};
970
971} // namespace particle
972
973#endif // PARTICLE_BASEPARTICLE_H
A class for mesh data.
Definition mesh.h:51
Collection of methods and database related to peridynamic material.
Definition material.h:76
A class to store particle geometry, nodal discretization, and methods.
void setX(size_t i, int dof, double x)
Set specific current coordinate of the node.
void addMx(size_t i, const double &mx)
Add to weighted-volume (mx) of the node.
const util::Point & getXRef(size_t i) const
Get reference coordinate of the node.
void addU(size_t i, int dof, double u)
Add to displacement of the node.
void setFixLocal(size_t i, const unsigned int &dof, const bool &flag)
Set fixity of the node given node's local id.
void setThetax(size_t i, const double &thetax)
Set volumetric deformation (thetax) of the node.
double getHorizon() const
Get horizon.
const util::Point & getXRefLocal(size_t i) const
Get reference coordinate of the node.
double & getMxLocal(size_t i)
Get weighted-volume (mx) of the node given node's local id.
util::Point & getXRef(size_t i)
Get reference coordinate of the node.
double getMeshSize() const
Get mesh size.
particle::ParticleTransform d_tform
Transformation related data.
double d_Rc
Contact radius for contact between internal nodes of particle.
const double & getThetax(size_t i) const
Get volumetric deformation (thetax) of the node.
void addF(size_t i, int dof, double f)
Add to force of the node.
void addULocal(size_t i, const util::Point &u)
Add to displacement of the node given node's local id.
void setVol(size_t i, const double &vol)
Set volume of the node.
util::Point & getVLocal(size_t i)
Get velocity of the node given node's local id.
void addFLocal(size_t i, const util::Point &f)
Add to force of the node given node's local id.
void addMxLocal(size_t i, const double &mx)
Add to weighted-volume (mx) of the node given node's local id.
const double & getThetaxLocal(size_t i) const
Get volumetric deformation (thetax) of the node.
const util::Point & getUCenter() const
Get displacement of center node.
std::shared_ptr< util::geometry::GeomObject > d_geom_p
Geometrical object defining this particle.
bool d_allDofsConstrained
Specify if all dofs are constrained so we do not update displacement, velocity, and force data.
bool d_computeForce
Specify if we compute force.
double getParticleRadius() const
Get radius of reference particle.
void setVLocal(size_t i, const util::Point &v)
Set velocity of the node given node's local id.
double & getThetaxLocal(size_t i)
Get volumetric deformation (thetax) of the node given node's local id.
std::string getType() const
Get type of this object.
size_t d_globQuadEnd
Id of last node of this object in global quadrature data list, e.g., strain in elements at quadrature...
util::Point & getVCenter()
Get velocity of center node.
double d_horizon
horizon
void addThetax(size_t i, const double &thetax)
Add to volumetric deformation (thetax) of the node.
void addXRefLocal(size_t i, int dof, double x)
Add to specific reference coordinate of the node given node's local id.
void setXRef(size_t i, const util::Point &x)
Set reference coordinate of the node.
const util::Point & getU(size_t i) const
Get displacement of the node.
void setFLocal(size_t i, int dof, double f)
Set force of the node given node's local id.
size_t getId() const
Get id.
void addVol(size_t i, const double &vol)
Add to volume of the node.
double d_pRadius
Particle radius.
void addThetaxLocal(size_t i, const double &thetax)
Add to volumetric deformation (thetax) of the node given node's local id.
double & getThetax(size_t i)
Get volumetric deformation (thetax) of the node.
void setFLocal(size_t i, const util::Point &f)
Set force of the node given node's local id.
double & getVol(size_t i)
Get volume of the node.
void setF(size_t i, int dof, double f)
Set force of the node.
size_t getNumNodes() const
Get the number of nodes.
void setXRefLocal(size_t i, int dof, double x)
Set specific reference coordinate of the node given node's local id.
void setMxLocal(size_t i, const double &mx)
Set weighted-volume (mx) of the node given node's local id.
void setF(size_t i, const util::Point &f)
Set force of the node.
void addULocal(size_t i, int dof, double u)
Add to displacement of the node given node's local id.
void setMx(size_t i, const double &mx)
Set weighted-volume (mx) of the node.
double d_h
mesh size
double getDensity() const
Get density.
const fe::Mesh & getMesh() const
Get reference to mesh object.
util::Point & getU(size_t i)
Get displacement of the node.
size_t d_numNodes
Number of nodes in this particle.
const util::Point & getX(size_t i) const
Get current coordinate of the node.
void addX(size_t i, int dof, double x)
Add to specific current coordinate of the node.
const util::Point & getF(size_t i) const
Get force of the node.
void print(int nt=0, int lvl=0) const
Prints the information about the object.
size_t d_typeId
Id of this particle in the category (for example if this is a wall, what is its id in vector of walls...
void addXRefLocal(size_t i, const util::Point &x)
Add to reference coordinate of the node given node's local id.
const std::shared_ptr< fe::Mesh > & getMeshP() const
Get pointer to mesh object.
const util::Point & getVCenter() const
Get velocity of center node.
size_t d_globStart
Id of first node of this object in global node list.
double d_density
density
void addVLocal(size_t i, const util::Point &v)
Add to velocity of the node given node's local id.
util::Point & getULocal(size_t i)
Get displacement of the node given node's local id.
void addXLocal(size_t i, int dof, double x)
Add to specific current coordinate of the node given node's local id.
const double & getMx(size_t i) const
Get weighted-volume (mx) of the node.
double & getMx(size_t i)
Get weighted-volume (mx) of the node.
size_t getCenterNodeId() const
Get id of center node of particle.
std::shared_ptr< model::ModelData > d_modelData_p
Reference to model class.
const util::Point & getFLocal(size_t i) const
Get force of the node.
uint8_t & getFix(size_t i)
Get fixity of the node.
void setX(size_t i, const util::Point &x)
Set current coordinate of the node.
void setXLocal(size_t i, const util::Point &x)
Set current coordinate of the node given node's local id.
void addF(size_t i, const util::Point &f)
Add to force of the node.
void setULocal(size_t i, const util::Point &u)
Set displacement of the node given node's local id.
void setXLocal(size_t i, int dof, double x)
Set specific current coordinate of the node given node's local id.
const double & getVolLocal(size_t i) const
Get volume of the node.
void setVolLocal(size_t i, const double &vol)
Set volume of the node given node's local id.
void addFLocal(size_t i, int dof, double f)
Add to force of the node given node's local id.
bool d_isWall
Is this particle actually a wall?
size_t d_globQuadStart
Id of first node of this object in global quadrature data list, e.g., strain in elements at quadratur...
void setULocal(size_t i, int dof, double u)
Set displacement of the node given node's local id.
void addV(size_t i, int dof, double v)
Add to velocity of the node.
void setU(size_t i, int dof, double u)
Set displacement of the node.
size_t getNodeId(size_t i_loc) const
Get global id of node given the local id of node in this object.
const material::Material * getMaterial() const
Get type of this object.
util::Point & getX(size_t i)
Get current coordinate of the node.
size_t d_id
Id of this particle in all particles list.
util::Point & getF(size_t i)
Get force of the node.
double & getVolLocal(size_t i)
Get volume of the node given node's local id.
std::string d_particleDescription
Particle information. E.g., "rigid". If nothing specific is available, value will be empty string.
util::Point & getUCenter()
Get displacement of center node.
void setV(size_t i, int dof, double v)
Set velocity of the node.
const util::Point & getV(size_t i) const
Get velocity of the node.
util::Point & getXCenter()
Get current coordinate of center node.
material::Material * getMaterial()
Get pointer to material object.
const util::Point & getXCenter() const
Get current coordinate of center node.
size_t d_dim
Dimension of this particle.
void setFix(size_t i, const unsigned int &dof, const bool &flag)
Set fixity of the node.
const util::Point & getULocal(size_t i) const
Get displacement of the node given node's local id.
void setThetaxLocal(size_t i, const double &thetax)
Set volumetric deformation (thetax) of the node given node's local id.
void addXLocal(size_t i, const util::Point &x)
Add to current coordinate of the node given node's local id.
size_t d_zoneId
Specify zone to which this particle belongs to.
std::shared_ptr< fe::Mesh > d_mesh_p
Pointer to mesh on reference particle.
const uint8_t & getFixLocal(size_t i) const
Get fixity of the node.
void setV(size_t i, const util::Point &v)
Set velocity of the node.
void addXRef(size_t i, const util::Point &x)
Add reference coordinate of the node.
void addVolLocal(size_t i, const double &vol)
Add to volume of the node given node's local id.
util::Point & getV(size_t i)
Get velocity of the node.
std::shared_ptr< fe::Mesh > & getMeshP()
Get pointer to mesh object.
void addX(size_t i, const util::Point &x)
Add current coordinate of the node.
util::Point & getXLocal(size_t i)
Get current coordinate of the node given node's local id.
int getTypeIndex() const
Get type (in integer format) of this object.
size_t getDimension() const
Get id among the group of object in the same type as this.
util::Point & getXRefLocal(size_t i)
Get reference coordinate of the node given node's local id.
const util::Point & getXLocal(size_t i) const
Get current coordinate of the node.
uint8_t & getFixLocal(size_t i)
Get fixity of the node given node's local id.
void setXRef(size_t i, int dof, double x)
Set specific reference coordinate of the node.
void setU(size_t i, const util::Point &u)
Set displacement of the node.
void addVLocal(size_t i, int dof, double v)
Add to velocity of the node given node's local id.
void setVLocal(size_t i, int dof, double v)
Set velocity of the node given node's local id.
util::Point & getFLocal(size_t i)
Get force of the node given node's local id.
fe::Mesh & getMesh()
Get reference to mesh object.
const double & getMxLocal(size_t i) const
Get weighted-volume (mx) of the node.
void addXRef(size_t i, int dof, double x)
Add specific reference coordinate of the node.
std::string d_type
particle type, e.g., particle or wall
const uint8_t & getFix(size_t i) const
Get fixity of the node.
void addV(size_t i, const util::Point &v)
Add to velocity of the node.
size_t d_globEnd
Id of last node of this object in global node list.
const util::Point & getVLocal(size_t i) const
Get velocity of the node.
void setXRefLocal(size_t i, const util::Point &x)
Set reference coordinate of the node given node's local id.
void addU(size_t i, const util::Point &u)
Add to displacement of the node.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
std::unique_ptr< material::Material > d_material_p
Pointer to peridynamic material object.
double d_Kn
Normal contact coefficient for internal contact.
const double & getVol(size_t i) const
Get volume of the node.
std::shared_ptr< particle::RefParticle > d_rp_p
Pointer to reference particle.
Collection of methods and data related to particle object.
Structure to read and store material related data.
A struct that stores transformation parameters and provides method to transform the particle....
A structure to represent 3d vectors.
Definition point.h:30