![]() |
MFEM v4.9.0
Finite element discretization library
|
Container for data associated with a single particle. More...
#include <particleset.hpp>
Public Member Functions | |
| Particle (int dim, const Array< int > &field_vdims, int num_tags) | |
| Construct a Particle instance. | |
| Particle (const Particle &)=default | |
| Particle & | operator= (const Particle &)=default |
| Particle (Particle &&)=default | |
| Particle & | operator= (Particle &&)=default |
| ~Particle ()=default | |
| int | GetDim () const |
| Get the spatial dimension of this particle. | |
| int | GetNFields () const |
| Get the number of fields associated with this particle. | |
| int | GetFieldVDim (int f) const |
Get the vector dimension of field f . | |
| int | GetNTags () const |
| Get the number of tags associated with this particle. | |
| Vector & | Coords () |
| Get reference to particle coordinates Vector. | |
| const Vector & | Coords () const |
| Get const reference to particle coordinates Vector. | |
| real_t & | FieldValue (int f, int c=0) |
Get reference to field f , component c value. | |
| const real_t & | FieldValue (int f, int c=0) const |
Get const reference to field f , component c value. | |
| Vector & | Field (int f) |
Get reference to field f Vector. | |
| const Vector & | Field (int f) const |
Get const reference to field f Vector. | |
| int & | Tag (int t) |
Get reference to tag t . | |
| const int & | Tag (int t) const |
Get const reference to tag t . | |
| void | SetTagRef (int t, int *tag_data) |
Set tag t to reference external data. | |
| void | SetFieldRef (int f, real_t *field_data) |
Set field f to reference external data. | |
| bool | operator== (const Particle &rhs) const |
| Particle equality operator. | |
| bool | operator!= (const Particle &rhs) const |
| Particle inequality operator. | |
| void | Print (std::ostream &os=mfem::out) const |
Print all particle data to os. | |
Protected Attributes | |
| Vector | coords |
| Spatial coordinates. | |
| std::vector< Vector > | fields |
| A std::vector of Vector where each Vector holds data for a given field (e.g., mass, momentum or velocity) associated with the particle. | |
| std::vector< Array< int > > | tags |
| A std::vector of Array<int> where each Array<int> holds data for a given tag. | |
Container for data associated with a single particle.
As described in ParticleSet documentation, each particle has a position (coords), arbitrary number of scalar or vector real_t data (fields), and arbitrary number of integers (tags) associated with it.
fields can thus hold data such as mass, momentum, and velocity, while tags can hold integer data such as particle type, color, etc.
Each particle also has a unique global ID, but that is managed by the ParticleSet class and not stored in this Particle class. Simiarly, the names of the fields and tags, typically useful for output purposes, are managed by the ParticleSet class.
For clarity, we will use the particles below to illustrate the data layout for coords, fields, and tags
Definition at line 59 of file particleset.hpp.
| mfem::Particle::Particle | ( | int | dim, |
| const Array< int > & | field_vdims, | ||
| int | num_tags ) |
Construct a Particle instance.
| [in] | dim | Spatial dimension (size of coords). |
| [in] | field_vdims | Vector dimensions of particle fields. |
| [in] | num_tags | Number of integer tags. |
Definition at line 40 of file particleset.cpp.
|
default |
|
default |
|
default |
|
inline |
Get reference to particle coordinates Vector.
Definition at line 115 of file particleset.hpp.
|
inline |
Get const reference to particle coordinates Vector.
Definition at line 118 of file particleset.hpp.
|
inline |
Get reference to field f Vector.
Definition at line 141 of file particleset.hpp.
|
inline |
Get const reference to field f Vector.
Definition at line 149 of file particleset.hpp.
|
inline |
Get reference to field f , component c value.
Definition at line 121 of file particleset.hpp.
|
inline |
Get const reference to field f , component c value.
Definition at line 131 of file particleset.hpp.
|
inline |
Get the spatial dimension of this particle.
Definition at line 103 of file particleset.hpp.
|
inline |
Get the vector dimension of field f .
Definition at line 109 of file particleset.hpp.
|
inline |
Get the number of fields associated with this particle.
Definition at line 106 of file particleset.hpp.
|
inline |
Get the number of tags associated with this particle.
Definition at line 112 of file particleset.hpp.
|
inline |
Particle inequality operator.
Definition at line 182 of file particleset.hpp.
| bool mfem::Particle::operator== | ( | const Particle & | rhs | ) | const |
Particle equality operator.
Definition at line 76 of file particleset.cpp.
| void mfem::Particle::Print | ( | std::ostream & | os = mfem::out | ) | const |
Print all particle data to os.
Definition at line 125 of file particleset.cpp.
| void mfem::Particle::SetFieldRef | ( | int | f, |
| real_t * | field_data ) |
Set field f to reference external data.
Definition at line 67 of file particleset.cpp.
| void mfem::Particle::SetTagRef | ( | int | t, |
| int * | tag_data ) |
Set tag t to reference external data.
Definition at line 60 of file particleset.cpp.
|
inline |
Get reference to tag t .
Definition at line 157 of file particleset.hpp.
|
inline |
Get const reference to tag t .
Definition at line 165 of file particleset.hpp.
|
protected |
Spatial coordinates.
For the sample_particle_data, coords would hold (x_i, y_i) for each particle i.
Definition at line 67 of file particleset.hpp.
|
protected |
A std::vector of Vector where each Vector holds data for a given field (e.g., mass, momentum or velocity) associated with the particle.
For the sample_particle_data, fields would be fields[0]=(m_i), fields[1]=(vx_i,vy_i) for each particle i.
Definition at line 75 of file particleset.hpp.
|
protected |
A std::vector of Array<int> where each Array<int> holds data for a given tag.
For the sample_particle_data, tags would be tags[0]=(type_i), tags[1]=(color_i) for each particle i.
Definition at line 86 of file particleset.hpp.