MFEM v4.10.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::common::ParticleTrajectories Class Reference

Helper class for easily visualizing particle trajectories using GLVis. More...

#include <particles_extras.hpp>

Collaboration diagram for mfem::common::ParticleTrajectories:
[legend]

Public Member Functions

 ParticleTrajectories (const ParticleSet &particles, int tail_size_, const char *vishost_, int visport_, const char *title_, int x_=0, int y_=0, int w_=400, int h_=400, const char *keys_=nullptr)
 Setup up the particle trajectory for visualization.
 
void AddMeshForVisualization (Mesh *mesh_)
 Add a mesh to be visualized along with the particle trajectories.
 
void Visualize ()
 Visualize the particle trajectories (and mesh if provided).
 
void SetVisualizationBoundingBox (const Vector &xmin, const Vector &xmax)
 Set the bounding box for visualization.
 
 ~ParticleTrajectories ()
 Destructor.
 

Protected Member Functions

void AddSegmentStart ()
 
void SetSegmentEnd ()
 

Protected Attributes

const ParticleSetpset
 
Meshmesh = nullptr
 
Meshmesh_bb = nullptr
 
socketstream sock
 
std::list< Array< ParticleSet::IDType > > segment_ids
 Track particle IDs that exist at the segment start.
 
std::list< Meshsegment_meshes
 Each segment is stored as a Mesh snapshot.
 
int tail_size
 
int x
 
int y
 
int w
 
int h
 
const char * title
 
const char * keys
 
const char * vishost
 
int visport
 
MPI_Comm comm
 

Detailed Description

Helper class for easily visualizing particle trajectories using GLVis.

Definition at line 45 of file particles_extras.hpp.

Constructor & Destructor Documentation

◆ ParticleTrajectories()

mfem::common::ParticleTrajectories::ParticleTrajectories ( const ParticleSet & particles,
int tail_size_,
const char * vishost_,
int visport_,
const char * title_,
int x_ = 0,
int y_ = 0,
int w_ = 400,
int h_ = 400,
const char * keys_ = nullptr )

Setup up the particle trajectory for visualization.

Visualize particle trajectory by connecting their positions at each timestep with line segments. The trajectory "tail" length is controlled by tail_size_. If tail_size_ = 0, entire particle trajectory is visualized. Optionally, the mesh can also be visualized along the particles by calling AddMeshForVisualization().

Note this is a helper utility for quick visualization with GLVis and not necessarily optimized for large number of particles or long tails. Consider using the output from ParticleSet::PrintCSV() with ParaView for more complex visualization needs.

Definition at line 162 of file particles_extras.cpp.

◆ ~ParticleTrajectories()

mfem::common::ParticleTrajectories::~ParticleTrajectories ( )
inline

Destructor.

Definition at line 108 of file particles_extras.hpp.

Member Function Documentation

◆ AddMeshForVisualization()

void mfem::common::ParticleTrajectories::AddMeshForVisualization ( Mesh * mesh_)
inline

Add a mesh to be visualized along with the particle trajectories.

Definition at line 94 of file particles_extras.hpp.

◆ AddSegmentStart()

void mfem::common::ParticleTrajectories::AddSegmentStart ( )
protected

Definition at line 177 of file particles_extras.cpp.

◆ SetSegmentEnd()

void mfem::common::ParticleTrajectories::SetSegmentEnd ( )
protected

Definition at line 203 of file particles_extras.cpp.

◆ SetVisualizationBoundingBox()

void mfem::common::ParticleTrajectories::SetVisualizationBoundingBox ( const Vector & xmin,
const Vector & xmax )

Set the bounding box for visualization.

Definition at line 275 of file particles_extras.cpp.

◆ Visualize()

void mfem::common::ParticleTrajectories::Visualize ( )

Visualize the particle trajectories (and mesh if provided).

Definition at line 232 of file particles_extras.cpp.

Member Data Documentation

◆ comm

MPI_Comm mfem::common::ParticleTrajectories::comm
protected

Definition at line 65 of file particles_extras.hpp.

◆ h

int mfem::common::ParticleTrajectories::h
protected

Definition at line 59 of file particles_extras.hpp.

◆ keys

const char * mfem::common::ParticleTrajectories::keys
protected

Definition at line 60 of file particles_extras.hpp.

◆ mesh

Mesh* mfem::common::ParticleTrajectories::mesh = nullptr
protected

Definition at line 49 of file particles_extras.hpp.

◆ mesh_bb

Mesh* mfem::common::ParticleTrajectories::mesh_bb = nullptr
protected

Definition at line 50 of file particles_extras.hpp.

◆ pset

const ParticleSet& mfem::common::ParticleTrajectories::pset
protected

Definition at line 48 of file particles_extras.hpp.

◆ segment_ids

std::list<Array<ParticleSet::IDType> > mfem::common::ParticleTrajectories::segment_ids
protected

Track particle IDs that exist at the segment start.

Definition at line 54 of file particles_extras.hpp.

◆ segment_meshes

std::list<Mesh> mfem::common::ParticleTrajectories::segment_meshes
protected

Each segment is stored as a Mesh snapshot.

Definition at line 56 of file particles_extras.hpp.

◆ sock

socketstream mfem::common::ParticleTrajectories::sock
protected

Definition at line 52 of file particles_extras.hpp.

◆ tail_size

int mfem::common::ParticleTrajectories::tail_size
protected

Definition at line 58 of file particles_extras.hpp.

◆ title

const char* mfem::common::ParticleTrajectories::title
protected

Definition at line 60 of file particles_extras.hpp.

◆ vishost

const char* mfem::common::ParticleTrajectories::vishost
protected

Definition at line 61 of file particles_extras.hpp.

◆ visport

int mfem::common::ParticleTrajectories::visport
protected

Definition at line 62 of file particles_extras.hpp.

◆ w

int mfem::common::ParticleTrajectories::w
protected

Definition at line 59 of file particles_extras.hpp.

◆ x

int mfem::common::ParticleTrajectories::x
protected

Definition at line 59 of file particles_extras.hpp.

◆ y

int mfem::common::ParticleTrajectories::y
protected

Definition at line 59 of file particles_extras.hpp.


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