MPM-Geomechanics
Material Point Method for simulating geo-materials under large deformation conditions
Loading...
Searching...
No Matches
Body.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2021-2025 MPM-Geomechanics Development Team
3
4#ifndef BODY_H_
5#define BODY_H_
6
7#include<vector>
8using std::vector;
9
10#include "Particle/Particle.h"
11#include "Materials/Material.h"
12
15class Body {
16
17public:
18
21 Body();
22
25 virtual ~Body();
26
30 virtual void create(Mesh& mesh, Material* material) = 0;
31
34 virtual void setMaterialId(int material_id) = 0;
35
38 virtual int getMaterialId() const = 0;
39
42 inline int getId() const { return this->id; }
43
46 inline Vector3d getInitialVelocity() const { return this->initial_velocity; }
47
50 inline vector<Particle*>* getParticles() { return &(this->particles); }
51
54 inline void setId(int body_id) { this->id=body_id; }
55
58 inline void setInitialVelocity(Vector3d initial_velocity) { this->initial_velocity=initial_velocity; }
59
62 inline void setParticles(const vector<Particle*>& particle_list) { this->particles=particle_list; }
63
66 inline void insertParticles(const vector<Particle*>& particle_list) { this->particles.insert(this->particles.end(),particle_list.begin(),particle_list.end()); }
67
68protected:
69
70 int id;
72 vector<Particle*> particles;
73};
74
75inline Body::Body():id(-1),initial_velocity(0,0,0) { }
76inline Body::~Body() { }
77
78#endif /* BODY_H_ */
Represents a body in the space forming by a group of materials points and identified by a number.
Definition Body.h:15
Vector3d getInitialVelocity() const
Return the initial velocity of the body.
Definition Body.h:46
vector< Particle * > * getParticles()
Return the particles forming the body.
Definition Body.h:50
void setId(int body_id)
Configure the id of the body.
Definition Body.h:54
virtual int getMaterialId() const =0
Return the material id.
Vector3d initial_velocity
initial velocity of the body
Definition Body.h:71
Body()
Default constructor.
Definition Body.h:75
int id
body identification
Definition Body.h:70
void setInitialVelocity(Vector3d initial_velocity)
Configure the initial velocity of the body.
Definition Body.h:58
void setParticles(const vector< Particle * > &particle_list)
Configure the particles in the body.
Definition Body.h:62
void insertParticles(const vector< Particle * > &particle_list)
Add particles to the current particle list.
Definition Body.h:66
int getId() const
Return the body identification.
Definition Body.h:42
virtual ~Body()
Default destructor.
Definition Body.h:76
virtual void setMaterialId(int material_id)=0
Configure the material id.
vector< Particle * > particles
material points forming the body
Definition Body.h:72
virtual void create(Mesh &mesh, Material *material)=0
Create a body with particles and material.
Represents a material.
Definition Material.h:14
Class representing a rectangular grid mesh.
Definition Mesh.h:26