20 #ifndef LIBMESH_EXODUSII_IO_H 21 #define LIBMESH_EXODUSII_IO_H 25 #include "libmesh/libmesh_common.h" 26 #include "libmesh/mesh_input.h" 27 #include "libmesh/mesh_output.h" 28 #include "libmesh/parallel_object.h" 29 #include "libmesh/boundary_info.h" 30 #include "libmesh/exodus_header_info.h" 36 class EquationSystems;
37 class ExodusII_IO_Helper;
64 bool single_precision=
false);
72 bool single_precision=
false);
101 virtual void read (
const std::string &
name)
override;
129 virtual void write (
const std::string & fname)
override;
134 void verbose (
bool set_verbosity);
178 std::string system_var_name,
179 std::string exodus_var_name,
180 unsigned int timestep=1);
187 std::string system_var_name,
188 std::string exodus_var_name,
189 unsigned int timestep=1);
195 std::vector<std::string> system_var_names,
196 std::vector<std::string> exodus_var_names,
197 unsigned int timestep=1);
211 unsigned int timestep,
212 std::map<unsigned int, Real> & unique_id_to_value_map);
222 unsigned int timestep,
223 std::vector<Real> & global_values);
230 const std::set<std::string> * system_names=
nullptr);
244 const std::set<std::string> * system_names=
nullptr);
275 const std::set<std::string> * system_names =
nullptr,
276 const std::string & var_suffix =
"_elem_node_");
289 const std::vector<Number> &,
290 const std::vector<std::string> &)
override;
296 const std::vector<Number> &,
297 const std::vector<std::string> &)
override;
303 const std::vector<std::string> &);
322 const std::set<std::string> * system_names=
nullptr);
332 const std::set<std::string> * system_names=
nullptr)
override;
361 const std::vector<std::string> & var_names,
362 const std::vector<std::set<boundary_id_type>> & side_ids,
363 const std::vector<std::map<BoundaryInfo::BCTuple, Real>> & bc_vals);
373 std::vector<std::string> & var_names,
374 std::vector<std::set<boundary_id_type>> & side_ids,
375 std::vector<std::map<BoundaryInfo::BCTuple, Real>> & bc_vals);
407 const std::vector<std::string> & var_names,
408 const std::vector<std::set<boundary_id_type>> & node_boundary_ids,
409 const std::vector<std::map<BoundaryInfo::NodeBCTuple, Real>> & bc_vals);
418 std::vector<std::string> & var_names,
419 std::vector<std::set<boundary_id_type>> & node_boundary_ids,
420 std::vector<std::map<BoundaryInfo::NodeBCTuple, Real>> & bc_vals);
450 const std::vector<std::string> & var_names,
451 const std::vector<std::set<elemset_id_type>> & elemset_ids_in,
452 const std::vector<std::map<std::pair<dof_id_type, elemset_id_type>,
Real>> & elemset_vals);
459 std::vector<std::string> & var_names,
460 std::vector<std::set<elemset_id_type>> & elemset_ids_in,
461 std::vector<std::map<std::pair<dof_id_type, elemset_id_type>,
Real>> & elemset_vals);
493 bool allow_empty =
true);
578 #ifdef LIBMESH_HAVE_EXODUS_API 609 const std::vector<std::string> & names,
610 bool continuous=
true);
618 #ifdef LIBMESH_HAVE_EXODUS_API 684 #endif // LIBMESH_EXODUSII_IO_H std::string name(const ElemQuality q)
This function returns a string containing some name for q.
const std::vector< std::string > & get_global_var_names()
Return list of the global variable names.
void use_mesh_dimension_instead_of_spatial_dimension(bool val)
In the general case, meshes containing 2D elements can be manifolds living in 3D space, thus by default we write all meshes with the Exodus dimension set to LIBMESH_DIM = mesh.spatial_dimension().
This is the EquationSystems class.
void write_as_dimension(unsigned dim)
Directly control the num_dim which is written to the Exodus file.
ExodusII_IO_Helper & get_exio_helper()
Return a reference to the ExodusII_IO_Helper object.
void write_elemset_data(int timestep, const std::vector< std::string > &var_names, const std::vector< std::set< elemset_id_type >> &elemset_ids_in, const std::vector< std::map< std::pair< dof_id_type, elemset_id_type >, Real >> &elemset_vals)
The Exodus format can also store values on elemsets.
std::vector< std::string > _extra_integer_vars
An optional list of variables in the EXODUS file that are to be used to set extra integers when loadi...
void write_sideset_data(int timestep, const std::vector< std::string > &var_names, const std::vector< std::set< boundary_id_type >> &side_ids, const std::vector< std::map< BoundaryInfo::BCTuple, Real >> &bc_vals)
The Exodus format can also store values on sidesets.
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
void read_elemset_data(int timestep, std::vector< std::string > &var_names, std::vector< std::set< elemset_id_type >> &elemset_ids_in, std::vector< std::map< std::pair< dof_id_type, elemset_id_type >, Real >> &elemset_vals)
Read all the elemset data at a particular timestep.
const std::vector< int > & get_node_num_map() const
Identical to the behavior of get_elem_num_map(), but for the node_num_map instead.
This class defines an abstract interface for Mesh output.
void get_sideset_data_indices(std::map< BoundaryInfo::BCTuple, unsigned int > &bc_array_indices)
Similar to read_sideset_data(), but instead of creating one std::map per sideset per variable...
The libMesh namespace provides an interface to certain functionality in the library.
ExodusII_IO(MeshBase &mesh, bool single_precision=false)
Constructor.
void append(bool val)
If true, this flag will cause the ExodusII_IO object to attempt to open an existing file for writing...
void get_nodeset_data_indices(std::map< BoundaryInfo::NodeBCTuple, unsigned int > &bc_array_indices)
Similar to read_nodeset_data(), but instead of creating one std::map per nodeset per variable...
This is the MeshBase class.
int _timestep
Stores the current value of the timestep when calling ExodusII_IO::write_timestep().
void write_timestep_discontinuous(const std::string &fname, const EquationSystems &es, const int timestep, const Real time, const std::set< std::string > *system_names=nullptr)
Writes a discontinuous solution at a specific timestep.
void write_nodeset_data(int timestep, const std::vector< std::string > &var_names, const std::vector< std::set< boundary_id_type >> &node_boundary_ids, const std::vector< std::map< BoundaryInfo::NodeBCTuple, Real >> &bc_vals)
The Exodus format can also store values on nodesets.
void read_nodeset_data(int timestep, std::vector< std::string > &var_names, std::vector< std::set< boundary_id_type >> &node_boundary_ids, std::vector< std::map< BoundaryInfo::NodeBCTuple, Real >> &bc_vals)
Read all the nodeset data at a particular timestep.
virtual bool get_add_sides() override
void set_extra_integer_vars(const std::vector< std::string > &extra_integer_vars)
Set the elemental variables in the Exodus file to be read into extra element integers.
void set_output_variables(const std::vector< std::string > &output_variables, bool allow_empty=true)
Sets the list of variable names to be included in the output.
bool _verbose
should we be verbose?
virtual void write_equation_systems(const std::string &fname, const EquationSystems &es, const std::set< std::string > *system_names=nullptr) override
Writes out the solution for no specific time or timestep.
bool _append
Default false.
Manages consistently variables, degrees of freedom, and coefficient vectors.
void copy_nodal_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
If we read in a nodal solution while reading in a mesh, we can attempt to copy that nodal solution in...
void copy_elemental_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
If we read in a elemental solution while reading in a mesh, we can attempt to copy that elemental sol...
const std::vector< Real > & get_time_steps()
std::vector< std::string > _output_variables
The names of the variables to be output.
This is the ExodusII_IO_Helper class.
void write_information_records(const std::vector< std::string > &)
Write out information records.
void read_elemental_variable(std::string elemental_var_name, unsigned int timestep, std::map< unsigned int, Real > &unique_id_to_value_map)
Given an elemental variable and a time step, returns a mapping from the elements (top parent) unique ...
void verbose(bool set_verbosity)
Set the flag indicating if we should be verbose.
void write_elemsets()
Write elemsets stored on the Mesh to file.
void write_nodal_data_common(std::string fname, const std::vector< std::string > &names, bool continuous=true)
This function factors out a bunch of code which is common to the write_nodal_data() and write_nodal_d...
An object whose state is distributed along a set of processors.
virtual void read(const std::string &name) override
This method implements reading a mesh from a specified file.
bool _disc_bex
Set to true (false is the default) to generate independent nodes for every Bezier Extraction element...
void read_global_variable(std::vector< std::string > global_var_names, unsigned int timestep, std::vector< Real > &global_values)
Given a vector of global variables and a time step, returns the values of the global variable at the ...
void write_global_data(const std::vector< Number > &, const std::vector< std::string > &)
Write out global variables.
void write_nodal_data_discontinuous(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
Write out a discontinuous nodal solution.
void copy_scalar_solution(System &system, std::vector< std::string > system_var_names, std::vector< std::string > exodus_var_names, unsigned int timestep=1)
Copy global variables into scalar variables of a System object.
bool _write_complex_abs
By default, when complex numbers are enabled, for each variable we write out three values: the real p...
std::unique_ptr< ExodusII_IO_Helper > exio_helper
Only attempt to instantiate an ExodusII helper class if the Exodus API is defined.
const std::vector< int > & get_elem_num_map() const
Returns a const reference to the elem_num_map, which is a vector that is created when a Mesh is read ...
void write_discontinuous_exodusII(const std::string &name, const EquationSystems &es, const std::set< std::string > *system_names=nullptr)
Writes a exodusII file with discontinuous data.
static int get_exodus_version()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void write_complex_magnitude(bool val)
Set the flag indicating whether the complex modulus should be written when complex numbers are enable...
ExodusII_IO & operator=(const ExodusII_IO &)=delete
virtual void write(const std::string &fname) override
This method implements writing a mesh to a specified file.
void write_timestep(const std::string &fname, const EquationSystems &es, const int timestep, const Real time, const std::set< std::string > *system_names=nullptr)
Writes out the solution at a specific timestep.
const std::vector< std::string > & get_elem_var_names()
Return list of the elemental variable names.
void write_element_data(const EquationSystems &es)
Write out element solution.
ExodusHeaderInfo read_header(const std::string &name)
Read only the header information, instead of the entire mesh.
bool _allow_empty_variables
Flag which controls the behavior of _output_variables: .) If true, _output_variables is allowed to re...
void write_element_data_from_discontinuous_nodal_data(const EquationSystems &es, const std::set< std::string > *system_names=nullptr, const std::string &var_suffix="_elem_node_")
Similar to the function above, but instead of only handling (CONSTANT, MONOMIAL) data, writes out a general discontinuous solution field, e.g.
void set_discontinuous_bex(bool disc_bex)
Set to true (false is the default) to generate independent nodes for every Bezier Extraction element ...
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
Write out a nodal solution.
void write_added_sides(bool val)
By default, we only write out the elements physically stored in the mesh.
void set_hdf5_writing(bool write_hdf5)
Set to true (the default) to write files in an HDF5-based file format (when HDF5 is available)...
const std::vector< std::string > & get_nodal_var_names()
Return list of the nodal variable names.
A Point defines a location in LIBMESH_DIM dimensional Real space.
void read_sideset_data(int timestep, std::vector< std::string > &var_names, std::vector< std::set< boundary_id_type >> &side_ids, std::vector< std::map< BoundaryInfo::BCTuple, Real >> &bc_vals)
Similar to write_sideset_data(), this function is used to read the data at a particular timestep...
void get_elemset_data_indices(std::map< std::pair< dof_id_type, elemset_id_type >, unsigned int > &elemset_array_indices)
Similar to read_elemset_data(), but instead of creating one std::map per nodeset per variable...
void set_coordinate_offset(Point p)
Allows you to set a vector that is added to the coordinates of all of the nodes.