36 const char *msg =
"invalid input stream";
42 in >> ident; MFEM_VERIFY(ident ==
"VDim:", msg);
51 os <<
"VDim: " <<
vdim <<
'\n' 61 if (
auto *qs_elem = dynamic_cast<QuadratureSpace*>(
qspace))
81 else if (
auto *qs_face = dynamic_cast<FaceQuadratureSpace*>(
qspace))
89 const FaceType face_type = qs_face->GetFaceType();
107 MFEM_ABORT(
"Unsupported case.");
118 int compression_level,
119 const std::string &field_name)
const 121 os << R
"(<VTKFile type="UnstructuredGrid" version="0.1")"; 122 if (compression_level != 0)
124 os << R
"( compressor="vtkZLibDataCompressor")"; 127 os <<
"<UnstructuredGrid>\n";
131 std::vector<char> buf;
139 os <<
"<Piece NumberOfPoints=\"" << np
140 <<
"\" NumberOfCells=\"" << np <<
"\">\n";
144 os <<
"<DataArray type=\"" << type_str
145 <<
"\" NumberOfComponents=\"3\" format=\"" << fmt_str <<
"\">\n";
148 for (
int i = 0; i < ne; i++)
152 for (
int j = 0; j < ir.
Size(); j++)
154 T.Transform(ir[j], pt);
167 os <<
"</DataArray>\n";
173 os << R
"(<DataArray type="Int32" Name="connectivity" format=")" 174 << fmt_str << "\">\n";
181 os <<
"</DataArray>\n";
183 os << R
"(<DataArray type="Int32" Name="offsets" format=")" 184 << fmt_str << "\">\n";
190 os <<
"</DataArray>\n";
192 os << R
"(<DataArray type="UInt8" Name="types" format=")" 193 << fmt_str << "\">\n";
194 for (
int i = 0; i < np; i++)
203 os <<
"</DataArray>\n";
206 os <<
"<PointData>\n";
207 os <<
"<DataArray type=\"" << type_str <<
"\" Name=\"" << field_name
208 <<
"\" format=\"" << fmt_str <<
"\" NumberOfComponents=\"" <<
vdim 210 for (
int i = 0; i < ne; i++)
214 for (
int j = 0; j < vals.
Size(); ++j)
216 for (
int vd = 0; vd <
vdim; ++vd)
227 os <<
"</DataArray>\n";
228 os <<
"</PointData>\n";
231 os <<
"</UnstructuredGrid>\n";
232 os <<
"</VTKFile>" << std::endl;
236 int compression_level,
237 const std::string &field_name)
const 239 std::ofstream
f(filename +
".vtu");
240 SaveVTU(
f, format, compression_level, field_name);
int GetNE() const
Return the number of entities.
Class for an integration rule - an Array of IntegrationPoint.
Class for grid function - Vector with associated FE space.
void ProjectGridFunction(const GridFunction &gf)
Evaluate a grid function at each quadrature point.
QuadratureSpaceBase * qspace
Associated QuadratureSpaceBase object.
bool own_qspace
Does this own the associated QuadratureSpaceBase?
void Print(std::ostream &out=mfem::out, int width=8) const
Prints vector to stream out.
void DisableTensorProducts(bool disable=true) const
Disable the use of tensor product evaluations, for tensor-product elements, e.g. quads and hexes...
virtual const FaceRestriction * GetFaceRestriction(ElementDofOrdering f_ordering, FaceType, L2FaceValues mul=L2FaceValues::DoubleValued) const
Return an Operator that converts L-vectors to E-vectors on each face.
int Size() const
Returns the size of the vector.
Data type dense matrix using column-major storage.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
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.
bool UsesTensorBasis(const FiniteElementSpace &fes)
Return true if the mesh contains only one topology and the elements are tensor elements.
Data arrays will be written in ASCII format.
void WriteBinaryOrASCII(std::ostream &os, std::vector< char > &buf, const T &val, const char *suffix, VTKFormat format)
Write either ASCII data to the stream or binary data to the buffer depending on the given format...
virtual ElementTransformation * GetTransformation(int idx)=0
Get the (element or face) transformation of entity idx.
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
std::function< double(const Vector &)> f(double mass_coeff)
Vector & operator=(const double *v)
Copy Size() entries from v.
void Load(std::istream **in, int np, int *dim)
Reads a vector from multiple files.
Native ordering as defined by the FiniteElement.
int Size() const
For backward compatibility define Size to be synonym of Width()
A class that performs interpolation from an E-vector to quadrature point values and/or derivatives (Q...
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.
const FaceQuadratureInterpolator * GetFaceQuadratureInterpolator(const IntegrationRule &ir, FaceType type) const
Return a FaceQuadratureInterpolator that interpolates E-vectors to quadrature point values and/or der...
Mesh * GetMesh() const
Returns the mesh.
void SetVDim(int vdim_)
Set the vector dimension, updating the size by calling Vector::SetSize().
FiniteElementSpace * FESpace()
A class that performs interpolation from a face E-vector to quadrature point values and/or derivative...
void DisableTensorProducts(bool disable=true) const
Disable the use of tensor product evaluations, for tensor-product elements, e.g. quads and hexes...
QuadratureFunction & operator=(double value)
Set this equal to a constant value.
virtual void Save(std::ostream &out) const =0
Write the QuadratureSpace to the stream out.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void Values(const Vector &e_vec, Vector &q_val) const
Interpolate the values of the E-vector e_vec at quadrature points.
void Save(std::ostream &out) const
Write the QuadratureFunction to the stream out.
void Values(const Vector &e_vec, Vector &q_val) const
Interpolate the values of the E-vector e_vec at quadrature points.
const IntegrationRule & GetIntRule(int idx) const
Return the IntegrationRule associated with entity idx.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void GetValues(int idx, Vector &values)
Return all values associated with mesh element idx in a Vector.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
QuadratureSpaceBase * GetSpace()
Get the associated QuadratureSpaceBase object.
void SetOutputLayout(QVectorLayout layout) const
Set the desired output Q-vector layout. The default value is QVectorLayout::byNODES.
const QuadratureInterpolator * GetQuadratureInterpolator(const IntegrationRule &ir) const
Return a QuadratureInterpolator that interpolates E-vectors to quadrature point values and/or derivat...
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
const char * VTKByteOrder()
Determine the byte order and return either "BigEndian" or "LittleEndian".
Lexicographic ordering for tensor-product FiniteElements.
std::ostream & operator<<(std::ostream &os, SparseMatrix const &mat)
int Size() const
Return the logical size of the array.
void SetOutputLayout(QVectorLayout layout) const
Set the desired output Q-vector layout. The default value is QVectorLayout::byNODES.
Class representing the storage layout of a QuadratureFunction.
int GetSize() const
Return the total number of quadrature points.
void WriteBase64WithSizeAndClear(std::ostream &os, std::vector< char > &buf, int compression_level)
Encode in base 64 (and potentially compress) the given data, write it to the output stream (with a he...
Represents values or vectors of values at quadrature points on a mesh.
VDIM x NQPT x NE (values) / VDIM x DIM x NQPT x NE (grads)