28#define mkdir(dir, mode) _mkdir(dir)
36 const Mesh *mesh,
int myid)
39 const char path_delim =
'/';
40 std::string::size_type pos = 0;
48 bool node_root =
true;
52 MPI_Comm_split_type(pmesh->
GetComm(), MPI_COMM_TYPE_SHARED,
myid,
53 MPI_INFO_NULL, &node_comm);
55 MPI_Comm_rank(node_comm, &node_rank);
56 node_root = (node_rank == 0);
57 MPI_Comm_free(&node_comm);
63 pos = dir_name.find(path_delim, pos+1);
64 std::string subdir = dir_name.substr(0, pos);
67 err_flag = mkdir(subdir.c_str(), 0777);
68 err_flag = (err_flag && (errno != EEXIST)) ? 1 : 0;
70 if (node_root || pmesh == NULL)
72 err_flag = mkdir(subdir.c_str(), 0777);
73 err_flag = (err_flag && (errno != EEXIST)) ? 1 : 0;
77 while ( pos != std::string::npos );
82 MPI_Allreduce(MPI_IN_PLACE, &err_flag, 1, MPI_INT, MPI_MAX,
94 std::string::size_type pos = collection_name.find_last_of(
'/');
95 if (pos == std::string::npos)
97 name = collection_name;
103 name = collection_name.substr(pos+1);
166 MPI_Comm_rank(comm, &
myid);
179 default: MFEM_ABORT(
"unknown format: " << fmt);
188 MFEM_VERIFY(!
compression,
"ZLib not enabled in MFEM build.");
210 MFEM_ABORT(
"this method is not implemented");
217 if (
error) {
return; }
243 MFEM_WARNING(
"Error creating directory: " << dir_name);
264 MFEM_WARNING(
"Error writing mesh to file: " << mesh_name);
286 std::string file_name = dir_name +
"/" + field_name;
299 (it->second)->
Save(field_file);
303 MFEM_WARNING(
"Error writing field to file: " << it->first);
312 (it->second)->
Save(q_field_file);
316 MFEM_WARNING(
"Error writing q-field to file: " << it->first);
397 const std::string& collection_name,
402 MPI_Comm_rank(comm, &
myid);
427 MPI_Comm_rank(comm, &
myid);
442 for (
int e=0; e<gf->
FESpace()->GetNE(); e++)
460 for (
int e=0; e<qf->
GetSpace()->GetNE(); e++)
466 LOD = std::max(LOD,locLOD);
474 std::ostringstream oss;
475 oss <<
"QF_" << qf_order <<
"_" << qf_vdim;
477 oss.str(), qf_order);
505 if (
myid != 0) {
return; }
510 std::ofstream root_file(root_name);
511 MFEM_VERIFY(root_file.is_open(),
512 "Failed to open ofstream " << root_name);
517 MFEM_WARNING(
"Error writing VisIt root file: " << root_name);
534 MFEM_WARNING(
"Cannot load parallel VisIt root file in serial.");
537 if (
m_comm == MPI_COMM_NULL)
539 MFEM_WARNING(
"Cannot load parallel VisIt root file without MPI"
548 MPI_Comm_size(
m_comm, &comm_size);
551 MFEM_WARNING(
"Processor number mismatch: VisIt root file: "
552 <<
num_procs <<
", MPI_comm: " << comm_size);
578 std::ifstream root_file(root_name);
579 std::stringstream buffer;
580 buffer << root_file.rdbuf();
584 MFEM_WARNING(
"Error reading the VisIt root file: " << root_name);
602 MFEM_WARNING(
"Unable to open mesh file: " << mesh_fname);
618 MFEM_WARNING(
"Reading parallel format in serial is not supported");
637 std::string fname = path_left + it->first + path_right;
643 MFEM_WARNING(
"Unable to open field file: " << fname);
649 if ((it->second).association ==
"nodes")
653 else if ((it->second).association ==
"elements" ||
654 (it->second).association ==
"quadrature")
662 if ((it->second).association ==
"nodes")
668 else if ((it->second).association ==
"elements" ||
669 (it->second).association ==
"quadrature")
675 MFEM_WARNING(
"Reading parallel format in serial is not supported");
685 std::string path_str =
689 picojson::object top, dsets,
main,
mesh, fields, field, mtags, ftags;
692 std::string file_ext_format =
".%0" + to_string(
pad_digits_rank) +
"d";
693 mtags[
"spatial_dim"] = picojson::value(to_string(
spatial_dim));
694 mtags[
"topo_dim"] = picojson::value(to_string(
topo_dim));
698 mesh[
"tags"] = picojson::value(mtags);
699 mesh[
"format"] = picojson::value(to_string(
format));
705 ftags[
"assoc"] = picojson::value((it->second).association);
706 ftags[
"comps"] = picojson::value(to_string((it->second).num_components));
707 ftags[
"lod"] = picojson::value(to_string((it->second).lod));
708 ftags[
"basis"] = picojson::value((it->second).basis);
709 ftags[
"order"] = picojson::value(to_string((it->second).order));
710 field[
"path"] = picojson::value(path_str + it->first + file_ext_format);
711 field[
"tags"] = picojson::value(ftags);
712 fields[it->first] = picojson::value(field);
715 main[
"cycle"] = picojson::value(
double(
cycle));
716 main[
"time"] = picojson::value(
time);
719 main[
"mesh"] = picojson::value(
mesh);
722 main[
"fields"] = picojson::value(fields);
725 dsets[
"main"] = picojson::value(
main);
726 top[
"dsets"] = picojson::value(dsets);
728 return picojson::value(top).serialize(
true);
733 picojson::value top, dsets,
main,
mesh, fields;
734 std::string parse_err = picojson::parse(top, json);
735 if (!parse_err.empty())
738 MFEM_WARNING(
"Unable to parse VisIt root data.");
743 dsets = top.get(
"dsets");
744 main = dsets.get(
"main");
745 cycle = int(
main.get(
"cycle").get<
double>());
746 time =
main.get(
"time").get<
double>();
747 if (
main.contains(
"time_step"))
753 fields =
main.get(
"fields");
758 std::string path =
mesh.get(
"path").get<std::string>();
759 size_t right_sep = path.rfind(
'_');
760 if (right_sep == std::string::npos)
763 MFEM_WARNING(
"Unable to parse VisIt root data.");
766 name = path.substr(0, right_sep);
768 if (
mesh.contains(
"format"))
775 to_int(
mesh.get(
"tags").get(
"max_lods").get<std::string>());
779 if (fields.is<picojson::object>())
781 picojson::object fields_obj = fields.get<picojson::object>();
782 for (picojson::object::iterator it = fields_obj.begin();
783 it != fields_obj.end(); ++it)
785 picojson::value tags = it->second.get(
"tags");
789 std::string basis =
"";
792 if (tags.contains(
"lod"))
794 lod =
to_int(tags.get(
"lod").get<std::string>());
797 if (tags.contains(
"basis"))
799 basis = tags.get(
"comps").get<std::string>();
802 if (tags.contains(
"order"))
804 order =
to_int(tags.get(
"comps").get<std::string>());
809 to_int(tags.get(
"comps").get<std::string>()),
843 MFEM_ASSERT(compression_level_ >= -1 && compression_level_ <= 9,
844 "Compression level must be between -1 and 9 (inclusive).");
870 const std::string& collection_name,
Mesh *mesh_)
894 const std::string &prefix)
896 return prefix +
".pvtu";
900 const std::string &prefix,
int rank)
917 MFEM_WARNING(
"Error creating directory: " << path);
927 if (
myid == 0 && !pvd_stream.is_open())
931 bool write_header =
true;
932 std::ifstream pvd_in;
933 if (
restart_mode && (pvd_in.open(pvdname,std::ios::binary),pvd_in.good()))
937 std::fstream::pos_type pos_begin = pvd_in.tellg();
938 std::fstream::pos_type pos_end = pos_begin;
940 std::regex regexp(
"timestep=\"([^[:space:]]+)\".*file=\"Cycle(\\d+)");
944 while (getline(pvd_in,line))
946 if (regex_search(line,match,regexp))
948 MFEM_ASSERT(match.size() == 3,
"Unable to parse DataSet");
949 double tvalue = std::stod(match[1]);
950 if (tvalue >=
GetTime()) {
break; }
951 int cvalue = std::stoi(match[2]);
953 " is too small for restart mode: trying to overwrite"
955 pos_end = pvd_in.tellg();
961 size_t count = pos_end - pos_begin;
964 write_header =
false;
965 std::vector<char> buf(count);
969 pvd_in.seekg(pos_begin);
970 pvd_in.read(buf.data(), count);
975 pvd_stream.open(pvdname,std::ios::out|std::ios::trunc|std::ios::binary);
976 pvd_stream.write(buf.data(), count);
979 pvd_stream.open(pvdname,std::ios::in|std::ios::out|std::ios::ate);
985 pvd_stream.open(pvdname,std::ios::out|std::ios::trunc);
986 pvd_stream <<
"<?xml version=\"1.0\"?>\n";
987 pvd_stream <<
"<VTKFile type=\"Collection\" version=\"2.2\"";
988 pvd_stream <<
" byte_order=\"" <<
VTKByteOrder() <<
"\">\n";
989 pvd_stream <<
"<Collection>" << std::endl;
999 std::ofstream os(os_str);
1000 MFEM_VERIFY(os.is_open(),
1001 "Failed to open ofstream " << os_str);
1010 "QuadratureFunction output is not supported for "
1011 "ParaViewDataCollection on domain boundary!");
1012 const std::string &field_name = qfield.first;
1014 std::ofstream os(os_str);
1015 MFEM_VERIFY(os.is_open(),
1016 "Failed to open ofstream " << os_str);
1028 std::ofstream pvtu_out(os_str);
1029 MFEM_VERIFY(pvtu_out.is_open(),
1030 "Failed to open ofstream " << os_str);
1034 pvtu_out <<
"<PPointData>\n";
1037 int vec_dim = field_it.second->VectorDim();
1039 <<
"\" Name=\"" << field_it.first
1040 <<
"\" NumberOfComponents=\"" << vec_dim <<
"\" "
1044 for (
auto &field_it : coeff_field_map)
1048 <<
"\" Name=\"" << field_it.first
1049 <<
"\" NumberOfComponents=\"" << vec_dim <<
"\" "
1052 for (
auto &field_it : vcoeff_field_map)
1054 int vec_dim = field_it.second->GetVDim();
1056 <<
"\" Name=\"" << field_it.first
1057 <<
"\" NumberOfComponents=\"" << vec_dim <<
"\" "
1060 pvtu_out <<
"</PPointData>\n";
1063 pvtu_out <<
"<PCellData>\n";
1064 pvtu_out <<
"\t<PDataArray type=\"Int32\" Name=\"" <<
"attribute"
1065 <<
"\" NumberOfComponents=\"1\""
1067 pvtu_out <<
"</PCellData>\n";
1073 pvd_stream <<
"<DataSet timestep=\"" <<
GetTime()
1074 <<
"\" group=\"\" part=\"" << 0 <<
"\" file=\""
1076 <<
"\" name=\"mesh\"/>\n";
1082 const std::string &q_field_name = q_field.first;
1085 std::string os_str = col_path +
"/" + q_fname;
1086 std::ofstream pvtu_out(os_str);
1087 MFEM_VERIFY(pvtu_out.is_open(),
1088 "Failed to open ofstream " << os_str);
1090 int vec_dim = q_field.second->GetVDim();
1091 pvtu_out <<
"<PPointData>\n";
1093 <<
"\" Name=\"" << q_field_name
1094 <<
"\" NumberOfComponents=\"" << vec_dim <<
"\" "
1097 pvtu_out <<
"</PPointData>\n";
1100 pvd_stream <<
"<DataSet timestep=\"" <<
GetTime()
1101 <<
"\" group=\"\" part=\"" << 0 <<
"\" file=\""
1102 << q_fname <<
"\" name=\"" << q_field_name <<
"\"/>\n";
1107 std::fstream::pos_type pos = pvd_stream.tellp();
1108 pvd_stream <<
"</Collection>\n";
1109 pvd_stream <<
"</VTKFile>" << std::endl;
1110 pvd_stream.seekp(pos);
1116 os <<
"<?xml version=\"1.0\"?>\n";
1117 os <<
"<VTKFile type=\"PUnstructuredGrid\"";
1118 os <<
" version =\"2.2\" byte_order=\"" <<
VTKByteOrder() <<
"\">\n";
1119 os <<
"<PUnstructuredGrid GhostLevel=\"0\">\n";
1121 os <<
"<PPoints>\n";
1123 os <<
" Name=\"Points\" NumberOfComponents=\"3\""
1125 os <<
"</PPoints>\n";
1128 os <<
"\t<PDataArray type=\"Int32\" ";
1129 os <<
" Name=\"connectivity\" NumberOfComponents=\"1\""
1131 os <<
"\t<PDataArray type=\"Int32\" ";
1132 os <<
" Name=\"offsets\" NumberOfComponents=\"1\""
1134 os <<
"\t<PDataArray type=\"UInt8\" ";
1135 os <<
" Name=\"types\" NumberOfComponents=\"1\""
1137 os <<
"</PCells>\n";
1141 const std::string &vtu_prefix)
1146 os <<
"<Piece Source=\"" << vtu_filename <<
"\"/>\n";
1148 os <<
"</PUnstructuredGrid>\n";
1149 os <<
"</VTKFile>\n";
1154 os <<
"<VTKFile type=\"UnstructuredGrid\"";
1157 os <<
" compressor=\"vtkZLibDataCompressor\"";
1159 os <<
" version=\"2.2\" byte_order=\"" <<
VTKByteOrder() <<
"\">\n";
1160 os <<
"<UnstructuredGrid>\n";
1165 os <<
"<PointData >\n";
1171 "GridFunction output is not supported for "
1172 "ParaViewDataCollection on domain boundary!");
1177 for (
const auto &kv : coeff_field_map)
1181 for (
const auto &kv : vcoeff_field_map)
1185 os <<
"</PointData>\n";
1188 os <<
"</UnstructuredGrid>\n";
1189 os <<
"</VTKFile>" << std::endl;
1198 std::vector<char> buf;
1199 int vec_dim = it->second->VectorDim();
1200 int map_type = it->second->FESpace()->GetTypicalFE()->GetMapType();
1202 <<
"\" Name=\"" << it->first
1203 <<
"\" NumberOfComponents=\"" << vec_dim <<
"\" "
1213 it->second->GetValues(i, RefG->
RefPts, val, pmat);
1214 for (
int j = 0; j < val.
Size(); j++)
1227 it->second->GetVectorValues(i, RefG->
RefPts, vval, pmat);
1228 for (
int jj = 0; jj < vval.
Width(); jj++)
1230 for (
int ii = 0; ii < vval.
Height(); ii++)
1242 os <<
"</DataArray>" << std::endl;
1250 std::vector<char> buf;
1253 <<
"\" Name=\"" <<
name
1254 <<
"\" NumberOfComponents=\"" << vec_dim <<
"\""
1271 val = coeff.
Eval(*eltrans, ip);
1289 val = coeff.
Eval(*eltrans, ip);
1299 os <<
"</DataArray>" << std::endl;
1307 std::vector<char> buf;
1308 int vec_dim = coeff.
GetVDim();
1310 <<
"\" Name=\"" <<
name
1311 <<
"\" NumberOfComponents=\"" << vec_dim <<
"\""
1328 coeff.
Eval(val, *eltrans, ip);
1329 for (
int jj = 0; jj < val.
Size(); jj++)
1350 coeff.
Eval(val, *eltrans, ip);
1351 for (
int jj = 0; jj < val.
Size(); jj++)
1364 os <<
"</DataArray>" << std::endl;
1394 const std::string &collection_name,
Mesh *mesh)
1405void ParaViewHDFDataCollection::EnsureVTKHDF()
1412 MFEM_VERIFY(error_code == 0,
"Error creating directory " <<
prefix_path);
1416 bool use_mpi =
false;
1421#ifdef MFEM_PARALLEL_HDF5
1422 vtkhdf.reset(
new VTKHDF(fname, pmesh->GetComm(), {restart_mode, time}));
1424 MFEM_ABORT(
"Requires HDF5 library with parallel support enabled");
1435template <
typename FP_T>
1436void ParaViewHDFDataCollection::TSave()
1446 vtkhdf->DisableCompression();
1452 vtkhdf->SaveGridFunction<FP_T>(*field.second, field.first);
1454 vtkhdf->UpdateSteps(
time);
1464 default: MFEM_ABORT(
"Unsupported VTK format.");
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
int cycle
Time cycle; for time-dependent simulations cycle >= 0, otherwise = -1.
real_t time
Physical time (for time-dependent simulations)
virtual void RegisterQField(const std::string &field_name, QuadratureFunction *qf)
Add a QuadratureFunction to the collection.
QFieldMap::iterator QFieldMapIterator
virtual void SetMesh(Mesh *new_mesh)
Set/change the mesh associated with the collection.
void SaveOneQField(const QFieldMapIterator &it)
Save one q-field to disk, assuming the collection directory exists.
const std::string & GetCollectionName() const
Get the name of the collection.
bool own_data
Should the collection delete its mesh and fields.
DataCollection(const std::string &collection_name, Mesh *mesh_=NULL)
Initialize the collection with its name and Mesh.
static int create_directory(const std::string &dir_name, const Mesh *mesh, int myid)
int GetCycle() const
Get time cycle (for time-dependent simulations)
GFieldMap::iterator FieldMapIterator
void SaveOneField(const FieldMapIterator &it)
Save one field to disk, assuming the collection directory exists.
void DeleteAll()
Delete data owned by the DataCollection including field information.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
static const int precision_default
Default value for precision.
virtual void SaveQField(const std::string &field_name)
Save one q-field, assuming the collection directory already exists.
int pad_digits_cycle
Number of digits used for the cycle and MPI rank in filenames.
bool serial
Serial or parallel run? False iff mesh is a ParMesh.
virtual void SetCompression(bool comp)
Set the flag for use of gz compressed files.
std::string prefix_path
A path where the directory with results is saved. If not empty, it has '/' at the end.
std::string GetFieldFileName(const std::string &field_name) const
int myid
MPI rank (in parallel)
static const int pad_digits_default
Default value for pad_digits_*.
real_t time_step
Time step i.e. delta_t (for time-dependent simulations)
int num_procs
Number of MPI ranks (in parallel)
std::string GetMeshShortFileName() const
virtual void Load(int cycle_=0)
Load the collection. Not implemented in the base class DataCollection.
virtual void SetFormat(int fmt)
Set the desired output mesh and data format.
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.
virtual ~DataCollection()
Delete the mesh and fields if owned by the collection.
std::string GetMeshFileName() const
void DeleteData()
Delete data owned by the DataCollection keeping field information.
bool appendRankToFileName
Append rank to any output file names.
std::string name
Name of the collection, used as a directory name when saving.
virtual void Save()
Save the collection to disk.
virtual void SaveField(const std::string &field_name)
Save one field, assuming the collection directory already exists.
MPI_Comm m_comm
Associated MPI communicator.
Mesh * mesh
The (common) mesh for the collected fields.
virtual void SaveMesh()
Save the mesh, creating the collection directory.
int precision
Precision (number of digits) used for the text output of doubles.
int format
Output mesh format: see the Format enumeration.
real_t GetTime() const
Get physical time (for time-dependent simulations)
Data type dense matrix using column-major storage.
int GetOrder() const
Return the order (polynomial degree) of the FE collection, corresponding to the order/degree returned...
virtual const char * Name() const
const NURBSExtension * GetNURBSext() const
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
const FiniteElementCollection * FEColl() const
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
RefinedGeometry * Refine(Geometry::Type Geom, int Times, int ETimes=1)
static int GetRefinementLevelFromElems(Geometry::Type geom, int Npts)
Get the Refinement level based on number of elements.
Class for grid function - Vector with associated FE space.
FiniteElementSpace * FESpace()
int VectorDim() const
Shortcut for calling FiniteElementSpace::GetVectorDim() on the underlying fes.
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
Print the mesh to the given stream using the default MFEM mesh format.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
void GetElementTransformation(int i, IsoparametricTransformation *ElTr) const
Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and wi...
ElementTransformation * GetBdrElementTransformation(int i)
Returns a pointer to the transformation defining the i-th boundary element.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
void PrintVTU(std::ostream &os, int ref=1, VTKFormat format=VTKFormat::ASCII, bool high_order_output=false, int compression_level=0, bool bdr_elements=false)
int GetNBE() const
Returns number of boundary elements.
Geometry::Type GetElementBaseGeometry(int i) const
Geometry::Type GetBdrElementBaseGeometry(int i) const
int GetOrder() const
If all KnotVector orders are identical, return that number. Otherwise, return NURBSFECollection::Vari...
void Register(const std::string &fname, T *field, bool own_data)
Register field field with name fname.
iterator end()
Returns an end iterator to the registered fields.
iterator begin()
Returns a begin iterator to the registered fields.
void DeleteData(bool own_data)
Clear all associations between names and fields.
void clear()
Clears the map of registered fields without reclaiming memory.
iterator find(const std::string &fname)
Returns an iterator to the field fname.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Class for parallel grid function.
Class for parallel meshes.
void ParPrint(std::ostream &out, const std::string &comments="") const
Abstract base class for ParaViewDataCollection and ParaViewHDFDataCollection.
bool IsBinaryFormat() const
Returns true if the output format is BINARY or BINARY32, false if ASCII.
ParaViewDataCollectionBase(const std::string &name, Mesh *mesh)
void SetLevelsOfDetail(int levels_of_detail_)
Set the refinement level.
void UseRestartMode(bool restart_mode_)
Enable or disable restart mode.
void SetBoundaryOutput(bool bdr_output_)
Configures collection to save only fields evaluated on boundaries of the mesh.
void SetHighOrderOutput(bool high_order_output_)
Sets whether or not to output the data as high-order elements (false by default).
void SetDataFormat(VTKFormat fmt)
Set the data format for the ParaView output files.
void SetCompressionLevel(int compression_level_)
Set the zlib compression level.
int GetCompressionLevel() const
If compression is enabled, return the compression level, else return 0.
void SaveVCoeffFieldVTU(std::ostream &out, int ref_, const std::string &name, VectorCoefficient &coeff)
std::string GenerateCollectionPath()
void WritePVTUHeader(std::ostream &out)
std::string GeneratePVDFileName()
std::string GenerateVTUPath()
void SaveGFieldVTU(std::ostream &out, int ref_, const FieldMapIterator &it)
const char * GetDataFormatString() const
void WritePVTUFooter(std::ostream &out, const std::string &vtu_prefix)
void SaveDataVTU(std::ostream &out, int ref)
std::string GeneratePVTUPath()
ParaViewDataCollection(const std::string &collection_name, Mesh *mesh_=nullptr)
Constructor. The collection name is used when saving the data.
void SaveCoeffFieldVTU(std::ostream &out, int ref_, const std::string &name, Coefficient &coeff)
std::string GenerateVTUFileName(const std::string &prefix, int rank)
const char * GetDataTypeString() const
std::string GeneratePVTUFileName(const std::string &prefix)
void Save() override
Save the collection.
ParaViewHDFDataCollection(const std::string &collection_name, Mesh *mesh_=nullptr)
Constructor. The collection name is used when saving the data.
~ParaViewHDFDataCollection()
Destructor.
void SetCompression(bool compression_) override
Enable or disable compression.
Represents values or vectors of values at quadrature points on a mesh.
QuadratureSpaceBase * GetSpace()
Get the associated QuadratureSpaceBase object.
int GetVDim() const
Get the vector dimension.
const IntegrationRule & GetIntRule(int idx) const
Get the IntegrationRule associated with entity (element or face) idx.
int GetOrder() const
Return the order of the quadrature rule(s) used by all elements.
Mesh * GetMesh() const
Returns the mesh.
Base class for vector Coefficients that optionally depend on time and space.
int GetVDim()
Returns dimension of the vector.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
int Size() const
Returns the size of the vector.
void SaveRootFile()
Save a VisIt root file for the collection.
std::string GetVisItRootString()
Prepare the VisIt root file in JSON format for the current collection.
int visit_levels_of_detail
void RegisterQField(const std::string &q_field_name, QuadratureFunction *qf) override
Add a quadrature function to the collection and update the root file.
void LoadVisItRootFile(const std::string &root_name)
VisItDataCollection(const std::string &collection_name, Mesh *mesh_=NULL)
Constructor. The collection name is used when saving the data.
void Load(int cycle_=0) override
Load the collection based on its VisIt data (described in its root file)
void SetLevelsOfDetail(int levels_of_detail)
Set VisIt parameter: default levels of detail for the MultiresControl.
void Save() override
Save the collection and a VisIt root file.
void SetMaxLevelsOfDetail(int max_levels_of_detail)
Set VisIt parameter: maximum levels of detail for the MultiresControl.
std::map< std::string, VisItFieldInfo >::iterator FieldInfoMapIterator
void SetMesh(Mesh *new_mesh) override
Set/change the mesh associated with the collection.
void RegisterField(const std::string &field_name, GridFunction *gf) override
Add a grid function to the collection and update the root file.
std::map< std::string, VisItFieldInfo > field_info_map
void DeleteAll()
Delete all data owned by VisItDataCollection including field data information.
void ParseVisItRootString(const std::string &json)
Read in a VisIt root file in JSON format.
int visit_max_levels_of_detail
Helper class for VisIt visualization data.
GeometryRefiner GlobGeometryRefiner
std::string to_padded_string(int i, int digits)
Convert an integer to a 0-padded string with the given number of digits.
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...
VTKFormat
Data array format for VTK and VTU files.
@ ASCII
Data arrays will be written in ASCII format.
int to_int(const std::string &str)
Convert a string to an int.
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 char * VTKByteOrder()
Determine the byte order and return either "BigEndian" or "LittleEndian".
std::string VTKComponentLabels(int vdim)
Returns a string defining the component labels for vector-valued data arrays for use in XML VTU files...