12 #ifndef MFEM_QFUNCTION 13 #define MFEM_QFUNCTION 15 #include "../config/config.hpp" 40 :
Vector(vdim_*qspace_.GetSize()),
59 :
Vector(qf_data, vdim_*qspace_->GetSize()),
155 inline void GetValues(
int idx,
const int ip_num,
Vector &values)
const;
180 void Save(std::ostream &
out)
const;
188 int compression_level=0,
const std::string &field_name=
"u")
const;
196 int compression_level=0,
const std::string &field_name=
"u")
const;
215 int idx,
Vector &values)
const 222 for (
int i = 0; i<values.
Size(); i++)
229 int idx,
const int ip_num,
Vector &values)
236 int idx,
const int ip_num,
Vector &values)
const 241 const double *q =
HostRead() + s_offset;
242 for (
int i = 0; i < values.
Size(); i++)
268 for (
int j = 0; j<sl_size; j++)
270 for (
int i = 0; i<
vdim; i++)
272 values(i,j) = *(q++);
Class for an integration rule - an Array of IntegrationPoint.
void NewDataAndSize(double *d, int s)
Set the Vector data and size, deleting the old data, if owned.
Class for grid function - Vector with associated FE space.
void ProjectGridFunction(const GridFunction &gf)
Evaluate a grid function at each quadrature point.
double * HostWrite()
Shortcut for mfem::Write(GetMemory(), TotalSize(), false).
Memory< double > & GetMemory()
QuadratureFunction(QuadratureSpaceBase *qspace_, double *qf_data, int vdim_=1)
Create a QuadratureFunction based on the given QuadratureSpaceBase, using the external (host) data...
void SetSize(int s)
Resize the vector to size s.
void Delete()
Delete the owned pointers and reset the Memory object.
QuadratureSpaceBase * qspace
Associated QuadratureSpaceBase object.
virtual const double * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
bool own_qspace
Does this own the associated QuadratureSpaceBase?
int Size() const
Returns the size of the vector.
virtual ~QuadratureFunction()
Data type dense matrix using column-major storage.
virtual double * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
int vdim
Vector dimension.
void SaveVTU(std::ostream &out, VTKFormat format=VTKFormat::ASCII, int compression_level=0, const std::string &field_name="u") const
Write the QuadratureFunction to out in VTU (ParaView) format.
Data arrays will be written in ASCII format.
bool OwnsSpace()
Get the QuadratureSpaceBase ownership flag.
Memory< double > & GetMemory()
Return a reference to the Memory object used by the Vector.
Vector & operator=(const double *v)
Copy Size() entries from v.
void SetOwnsSpace(bool own)
Set the QuadratureSpaceBase ownership flag.
QuadratureFunction(QuadratureSpaceBase &qspace_, int vdim_=1)
Create a QuadratureFunction based on the given QuadratureSpaceBase.
int GetVDim() const
Get the vector dimension.
const IntegrationRule & GetIntRule(int idx) const
Get the IntegrationRule associated with entity (element or face) idx.
QuadratureFunction()
Default constructor, results in an empty vector.
VTKFormat
Data array format for VTK and VTU files.
void SetVDim(int vdim_)
Set the vector dimension, updating the size by calling Vector::SetSize().
QuadratureFunction & operator=(double value)
Set this equal to a constant value.
Array< int > offsets
Entity quadrature point offset array, of size num_entities + 1.
Abstract base class for QuadratureSpace and FaceQuadratureSpace.
void Save(std::ostream &out) const
Write the QuadratureFunction to the stream out.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
const IntegrationRule & GetIntRule(int idx) const
Return the IntegrationRule associated with entity idx.
void GetValues(int idx, Vector &values)
Return all values associated with mesh element idx in a Vector.
void MakeAlias(const Memory &base, int offset, int size)
Create a memory object that points inside the memory object base.
QuadratureSpaceBase * GetSpace()
Get the associated QuadratureSpaceBase object.
void SetSpace(QuadratureSpaceBase *qspace_, int vdim_=-1)
Change the QuadratureSpaceBase and optionally the vector dimension.
QuadratureFunction(const QuadratureFunction &orig)
Copy constructor. The QuadratureSpace ownership flag, own_qspace, in the new object is set to false...
virtual bool UseDevice() const
Return the device flag of the Memory object used by the Vector.
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
QuadratureFunction(QuadratureSpaceBase *qspace_, int vdim_=1)
Create a QuadratureFunction based on the given QuadratureSpaceBase.
int GetSize() const
Return the total number of quadrature points.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
const QuadratureSpaceBase * GetSpace() const
Get the associated QuadratureSpaceBase object (const version).
Represents values or vectors of values at quadrature points on a mesh.