46 const std::string &dc_type)
50 if (dc_type ==
"visit")
58 else if ( dc_type ==
"sidre" || dc_type ==
"sidre_hdf5")
63 MFEM_ABORT(
"Must build with MFEM_USE_SIDRE=YES for sidre support.");
66 else if ( dc_type ==
"json" ||
67 dc_type ==
"conduit_json" ||
68 dc_type ==
"conduit_bin" ||
71 #ifdef MFEM_USE_CONDUIT
81 MFEM_ABORT(
"Must build with MFEM_USE_CONDUIT=YES for conduit support.");
84 else if ( dc_type.substr(0,3) ==
"fms")
88 std::string::size_type pos = dc_type.find(
"_");
89 if (pos != std::string::npos)
91 std::string fms_protocol(dc_type.substr(pos+1, dc_type.size()-pos-1));
92 fms_dc->SetProtocol(fms_protocol);
96 MFEM_ABORT(
"Must build with MFEM_USE_FMS=YES for FMS support.");
101 MFEM_ABORT(
"Unsupported Data Collection type:" << dc_type);
107 int main(
int argc,
char *argv[])
116 const char *src_coll_name = NULL;
117 const char *src_coll_type =
"visit";
119 const char *out_coll_name = NULL;
120 const char *out_coll_type =
"visit";
123 args.
AddOption(&src_coll_name,
"-s",
"--source-root-prefix",
124 "Set the source data collection root file prefix.",
true);
125 args.
AddOption(&out_coll_name,
"-o",
"--output-root-prefix",
126 "Set the source data collection root file prefix.",
true);
127 args.
AddOption(&src_cycle,
"-c",
"--cycle",
128 "Set the source cycle index to read.");
129 args.
AddOption(&src_coll_type,
"-st",
"--source-type",
130 "Set the source data collection type. Options:\n"
131 "\t visit: VisItDataCollection (default)\n"
132 "\t sidre or sidre_hdf5: SidreDataCollection\n"
133 "\t json: ConduitDataCollection w/ protocol json\n"
134 "\t conduit_json: ConduitDataCollection w/ protocol conduit_json\n"
135 "\t conduit_bin: ConduitDataCollection w/ protocol conduit_bin\n"
136 "\t hdf5: ConduitDataCollection w/ protocol hdf5\n"
137 "\t fms: FMSDataCollection w/ protocol ascii\n"
138 "\t fms_json: FMSDataCollection w/ protocol json\n"
139 "\t fms_yaml: FMSDataCollection w/ protocol yaml\n"
140 "\t fms_hdf5: FMSDataCollection w/ protocol hdf5");
141 args.
AddOption(&out_coll_type,
"-ot",
"--output-type",
142 "Set the output data collection type. Options:\n"
143 "\t visit: VisItDataCollection (default)\n"
144 "\t sidre or sidre_hdf5: SidreDataCollection\n"
145 "\t json: ConduitDataCollection w/ protocol json\n"
146 "\t conduit_json: ConduitDataCollection w/ protocol conduit_json\n"
147 "\t conduit_bin: ConduitDataCollection w/ protocol conduit_bin\n"
148 "\t hdf5: ConduitDataCollection w/ protocol hdf5\n"
149 "\t fms: FMSDataCollection w/ protocol ascii\n"
150 "\t fms_json: FMSDataCollection w/ protocol json\n"
151 "\t fms_yaml: FMSDataCollection w/ protocol yaml\n"
152 "\t fms_hdf5: FMSDataCollection w/ protocol hdf5");
162 std::string(src_coll_type));
165 std::string(out_coll_type));
167 src_dc->
Load(src_cycle);
169 if (src_dc->
Error() != DataCollection::NO_ERROR)
171 mfem::out <<
"Error loading data collection: "
197 for (DataCollection::FieldMapType::const_iterator it = src_fields.begin();
198 it != src_fields.end();
206 if (out_dc->
Error() != DataCollection::NO_ERROR)
208 mfem::out <<
"Error saving data collection: "
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
double GetTime() const
Get physical time (for time-dependent simulations)
Data collection that uses the Conduit Mesh Blueprint specification.
int Error() const
Get the current error state.
Data collection that uses FMS.
double GetTimeStep() const
Get the simulation time step (for time-dependent simulations)
Data collection with Sidre routines following the Conduit mesh blueprint specification.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
virtual void Save()
Save the collection to disk.
const FieldMapType & GetFieldMap() const
Get a const reference to the internal field map.
int GetCycle() const
Get time cycle (for time-dependent simulations)
Data collection with VisIt I/O routines.
DataCollection * create_data_collection(const std::string &dc_name, const std::string &dc_type)
void PrintUsage(std::ostream &out) const
Print the usage message.
void SetTime(double t)
Set physical time (for time-dependent simulations)
void SetOwnData(bool o)
Set the ownership of collection data.
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
void Disable()
Disable output.
GFieldMap::MapType FieldMapType
void SetTimeStep(double ts)
Set the simulation time step (for time-dependent simulations)
void PrintOptions(std::ostream &out) const
Print the options.
virtual void Load(int cycle_=0)
Load the collection. Not implemented in the base class DataCollection.
Mesh * GetMesh()
Get a pointer to the mesh in the collection.
virtual void SetMesh(Mesh *new_mesh)
Set/change the mesh associated with the collection.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void SetProtocol(const std::string &protocol)
Set the Conduit relay i/o protocol to use.
bool Good() const
Return true if the command line options were parsed successfully.