25 for (
int i = 0; i < 8; i++)
31 for (
int i = 0; i < center.
Size(); i++)
51 for (
int i = 4; i < 8; i++)
53 add(1.0, v[i-4], 2.0, v_s_z, v[i]);
56 for (
int i = 0; i < 8; i++)
62 for (
int i = 0; i < 8; i++)
64 vi[i] = i + (m.
GetNE())*8;
74 for (
int i = 0; i < 4; i++)
80 for (
int i = 0; i < center.
Size(); i++)
97 for (
int i = 0; i < 4; i++)
103 for (
int i = 0; i < 4; i++)
105 vi[i] = i + (m.
GetNE())*4;
114 const char* title,
int x,
int y,
int w,
int h,
const char* keys)
117 MFEM_VERIFY(
dim == 2 ||
dim == 3,
118 "ParticleSet dimension must be 2 or 3 for visualization.");
119 const int nv =
dim == 2 ? 4 : 8;
147 for (
int j = 0; j < nv; j++)
149 gf[j+i*nv] = scalar_field[i];
155 x, y, w, h, keys,
false);
157 VisualizeField(sock,
vishost, visport, gf, title, x, y, w, h, keys,
false);
163 int tail_size_,
const char *vishost_,
164 int visport_,
const char *title_,
165 int x_,
int y_,
int w_,
int h_,
167 : pset(particles), tail_size(tail_size_),
168 x(x_), y(y_), w(w_), h(h_), title(title_), keys(keys_),
169 vishost(vishost_), visport(visport_)
171 ,comm(particles.GetComm())
210 for (
int i = 0; i < num_start; i++)
237 std::vector<Mesh*> all_meshes;
240 all_meshes.push_back(&m);
244 all_meshes.push_back(
mesh);
251 Mesh trajectories(all_meshes.data(), all_meshes.size());
252 bool vis = trajectories.
GetNE() > 0;
254 MPI_Allreduce(MPI_IN_PLACE, &vis, 1, MFEM_MPI_CXX_BOOL,
280 "Bounding box dimension must match ParticleSet dimension.");
298 v2[0] = xmax[0]; v2[1] = xmin[1];
299 v3[0] = xmin[0]; v3[1] = xmax[1];
308 vi[0] = 1; vi[1] = 2;
310 vi[0] = 2; vi[1] = 3;
312 vi[0] = 3; vi[1] = 0;
325 v[0] = xmin[0]; v[1] = xmin[1]; v[2] = xmin[2];
327 v[0] = xmax[0]; v[1] = xmin[1]; v[2] = xmin[2];
329 v[0] = xmax[0]; v[1] = xmax[1]; v[2] = xmin[2];
331 v[0] = xmin[0]; v[1] = xmax[1]; v[2] = xmin[2];
334 v[0] = xmin[0]; v[1] = xmin[1]; v[2] = xmax[2];
336 v[0] = xmax[0]; v[1] = xmin[1]; v[2] = xmax[2];
338 v[0] = xmax[0]; v[1] = xmax[1]; v[2] = xmax[2];
340 v[0] = xmin[0]; v[1] = xmax[1]; v[2] = xmax[2];
int Size() const
Return the logical size of the array.
int Find(const T &el) const
Return the first index where 'el' is found; return -1 if not found.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Class for grid function - Vector with associated FE space.
Arbitrary order "L2-conforming" discontinuous finite elements.
int AddSegment(int v1, int v2, int attr=1)
Adds a segment to the mesh given by 2 vertices v1 and v2.
void FinalizeMesh(int refine=0, bool fix_orientation=true)
Finalize the construction of any type of Mesh.
int AddQuad(int v1, int v2, int v3, int v4, int attr=1)
Adds a quadrilateral to the mesh given by 4 vertices v1 through v4.
int AddVertex(real_t x, real_t y=0.0, real_t z=0.0)
int GetNE() const
Returns number of elements.
int AddHex(int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int attr=1)
Adds a hexahedron to the mesh given by 8 vertices v1 through v8.
ParticleSet initializes and manages data associated with particles.
MPI_Comm GetComm() const
Get the MPI communicator for this ParticleSet.
ParticleVector & Coords()
Get a reference to the coordinates ParticleVector.
const Array< IDType > & GetIDs() const
Get the global IDs of the active particles owned by this ParticleSet.
int GetDim() const
Get the spatial dimension.
int GetNParticles() const
Get the number of active particles currently held by this ParticleSet.
void GetValues(int i, Vector &nvals) const
Get a copy of particle i 's data.
virtual const real_t * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
virtual real_t * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
void Visualize()
Visualize the particle trajectories (and mesh if provided).
void SetVisualizationBoundingBox(const Vector &xmin, const Vector &xmax)
Set the bounding box for visualization.
std::list< Array< ParticleSet::IDType > > segment_ids
Track particle IDs that exist at the segment start.
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.
std::list< Mesh > segment_meshes
Each segment is stored as a Mesh snapshot.
void Add2DPoint(const Vector ¢er, Mesh &m, real_t scale)
Add a point to a given Mesh, represented as a quad sized scale.
void VisualizeMesh(socketstream &sock, const char *vishost, int visport, Mesh &mesh, const char *title, int x, int y, int w, int h, const char *keys)
void Add3DPoint(const Vector ¢er, Mesh &m, real_t scale)
Add a point to a given Mesh, represented as a hex sized scale.
void VisualizeParticles(socketstream &sock, const char *vishost, int visport, const ParticleSet &pset, const Vector &scalar_field, real_t psize, const char *title, int x, int y, int w, int h, const char *keys)
Plot particles in ParticleSet pset, represented as quads/hexes of size psize and colored by scalar_fi...
void VisualizeField(socketstream &sock, const char *vishost, int visport, GridFunction &gf, const char *title, int x, int y, int w, int h, const char *keys, bool vec)
void add(const Vector &v1, const Vector &v2, Vector &v)