35 const char *msg =
"invalid input stream";
41 in >> ident; MFEM_VERIFY(ident ==
"VDim:", msg);
50 os <<
"VDim: " <<
vdim <<
'\n' 60 if (
auto *qs_elem = dynamic_cast<QuadratureSpace*>(
qspace))
80 else if (
auto *qs_face = dynamic_cast<FaceQuadratureSpace*>(
qspace))
88 const FaceType face_type = qs_face->GetFaceType();
106 MFEM_ABORT(
"Unsupported case.");
117 int compression_level)
const 119 os << R
"(<VTKFile type="UnstructuredGrid" version="0.1")"; 120 if (compression_level != 0)
122 os << R
"( compressor="vtkZLibDataCompressor")"; 125 os <<
"<UnstructuredGrid>\n";
129 std::vector<char> buf;
134 int ne = mesh.
GetNE();
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=\"u\" format=\"" 208 << fmt_str <<
"\" NumberOfComponents=\"" <<
vdim <<
"\">\n";
209 for (
int i = 0; i < ne; i++)
213 for (
int j = 0; j < vals.
Size(); ++j)
215 for (
int vd = 0; vd <
vdim; ++vd)
226 os <<
"</DataArray>\n";
227 os <<
"</PointData>\n";
230 os <<
"</UnstructuredGrid>\n";
231 os <<
"</VTKFile>" << std::endl;
235 int compression_level)
const 237 std::ofstream
f(filename +
".vtu");
238 SaveVTU(
f, format, compression_level);
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...
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.
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...
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
Vector & operator=(const double *v)
Copy Size() entries from v.
void SaveVTU(std::ostream &out, VTKFormat format=VTKFormat::ASCII, int compression_level=0) const
Write the QuadratureFunction to out in VTU (ParaView) format.
void Load(std::istream **in, int np, int *dim)
Reads a vector from multiple files.
double f(const Vector &xvec)
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
int GetNE() const
Returns number of elements.
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...
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
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.
virtual const FaceRestriction * GetFaceRestriction(ElementDofOrdering e_ordering, FaceType, L2FaceValues mul=L2FaceValues::DoubleValued) const
Return an Operator that converts L-vectors to E-vectors on each face.
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)