21 if (keep_data) {
p.CopyFrom(
data,
size); }
32 :
Vector(num_nodes*vdim_), vdim(vdim_), ordering(ordering_)
39 :
Vector(vec), vdim(vdim_), ordering(ordering_)
42 "Incompatible Vector size of " << vec.
Size() <<
" given vdim " <<
vdim);
52 for (
int c = 0; c <
vdim; c++)
59 for (
int c = 0; c <
vdim; c++)
69 "GetValuesRef only valid when ordering byVDIM.");
96 "GetComponentsRef only valid when ordering byNODES.");
105 for (
int c = 0; c <
vdim; c++)
112 for (
int c = 0; c <
vdim; c++)
121 int vdim_temp =
vdim;
141 "Particle index " << i <<
143 MFEM_ASSERT(comp <
vdim,
144 "Component index " << comp <<
145 " is invalid for vector dimension " <<
vdim);
160 "Particle index " << i <<
162 MFEM_ASSERT(comp <
vdim,
163 "Component index " << comp <<
164 " is invalid for vector dimension " <<
vdim);
178 if (indices.
Size() == 0) {
return; }
183 "Particle index " << indices.
Max() <<
184 " is out-of-range for number of particles " <<
188 for (
int l = 0; l < indices.
Size(); l++)
190 for (
int vd = 0; vd <
vdim; vd++)
200 for (
int l = 0; l < indices.
Size(); l++)
202 for (
int vd = 0; vd <
vdim; vd++)
254 if (num_vectors == old_nv)
260 if (num_vectors > old_nv)
271 if (!keep_data) {
return; }
276 for (
int c =
vdim-1; c > 0; c--)
278 for (
int i = old_nv-1; i >= 0; i--)
285 for (
int c = 0; c <
vdim; c++)
287 for (
int i = old_nv; i < num_vectors; i++)
295 for (
int i = old_nv*
vdim; i < num_vectors*
vdim; i++)
305 for (
int i = 0; i < rm_indices.
Size(); i++)
307 rm_indices[i] = old_nv - rm_indices.
Size() + i;
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void Reserve(int capacity)
Ensures that the allocated size is at least the given size.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Class used by MFEM to store pointers to host and/or device memory.
int Capacity() const
Return the size of the allocated memory.
bool UseDevice() const
Read the internal device flag.
MemoryType GetMemoryType() const
Return a MemoryType that is currently valid. If both the host and the device pointers are currently v...
void Delete()
Delete the owned pointers and reset the Memory object.
static void Reorder(Vector &v, int vdim, Type in_ord, Type out_ord)
Reorder Vector v from its current ordering in_ord to out_ord.
ParticleVector carries vector data (of a given vector dimension) for an arbitrary number of particles...
Ordering::Type ordering
Ordering of Vector data in ParticleVector.
void SetValues(int i, const Vector &nvals)
Set particle i 's data to nvals .
real_t & operator()(int i, int comp)
Reference to particle i component comp value.
void GetValues(int i, Vector &nvals) const
Get a copy of particle i 's data.
int vdim
Vector dimension.
int GetNumParticles() const
Get the number of particle data in the ParticleVector.
void DeleteParticles(const Array< int > &indices)
Remove particle data at indices.
void SetNumParticles(int num_vectors, bool keep_data=true)
Set the number of particle Vector data to be held by the ParticleVector, keeping existing data.
void SetOrdering(Ordering::Type ordering_, bool keep_data=true)
Set the ordering of the particle Vector data in ParticleVector.
void GetComponents(int vd, Vector &comp)
Get a copy of component vd for all particle vector data.
void SetVDim(int vdim_, bool keep_data=true)
Set the vector dimension of the ParticleVector.
void GetValuesRef(int i, Vector &nref)
For GetOrdering == Ordering::byVDIM, set nref to refer to particle i 's data.
void SetComponents(int vd, const Vector &comp)
Set component vd values for all particle data to comp .
void GetComponentsRef(int vd, Vector &nref)
For GetOrdering == Ordering::byNODES, set nref to refer to component vd 's data.
void GrowSize(int min_num_vectors, bool keep_data)
Re-allocate + copy memory. See Array::GrowSize.
real_t & operator[](int i)
Access Vector entries using [] for 0-based indexing.
void DeleteAt(const Array< int > &indices)
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
int Capacity() const
Return the size of the currently allocated data array.
Vector & operator=(const real_t *v)
Copy Size() entries from v.
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
real_t p(const Vector &x, real_t t)