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"
37class ExodusII_IO_Helper;
62 bool single_precision=
false);
70 bool single_precision=
false);
99 virtual void read (
const std::string & name)
override;
127 virtual void write (
const std::string & fname)
override;
132 void verbose (
bool set_verbosity);
220 std::string system_var_name,
221 std::string exodus_var_name,
222 unsigned int timestep=1);
234 std::string system_var_name,
235 std::string exodus_var_name,
236 unsigned int timestep=1);
242 std::vector<std::string> system_var_names,
243 std::vector<std::string> exodus_var_names,
244 unsigned int timestep=1);
258 unsigned int timestep,
259 std::map<unsigned int, Real> & unique_id_to_value_map);
269 unsigned int timestep,
270 std::vector<Real> & global_values);
277 const std::set<std::string> * system_names=
nullptr);
291 const std::set<std::string> * system_names=
nullptr);
322 const std::set<std::string> * system_names =
nullptr,
323 const std::string & var_suffix =
"_elem_node_");
336 const std::vector<Number> &,
337 const std::vector<std::string> &)
override;
343 const std::vector<Number> &,
344 const std::vector<std::string> &)
override;
350 const std::vector<std::string> &);
369 const std::set<std::string> * system_names=
nullptr);
379 const std::set<std::string> * system_names=
nullptr)
override;
408 const std::vector<std::string> & var_names,
409 const std::vector<std::set<boundary_id_type>> & side_ids,
410 const std::vector<std::map<BoundaryInfo::BCTuple, Real>> & bc_vals);
420 std::vector<std::string> & var_names,
421 std::vector<std::set<boundary_id_type>> & side_ids,
422 std::vector<std::map<BoundaryInfo::BCTuple, Real>> & bc_vals);
454 const std::vector<std::string> & var_names,
455 const std::vector<std::set<boundary_id_type>> & node_boundary_ids,
456 const std::vector<std::map<BoundaryInfo::NodeBCTuple, Real>> & bc_vals);
465 std::vector<std::string> & var_names,
466 std::vector<std::set<boundary_id_type>> & node_boundary_ids,
467 std::vector<std::map<BoundaryInfo::NodeBCTuple, Real>> & bc_vals);
497 const std::vector<std::string> & var_names,
498 const std::vector<std::set<elemset_id_type>> & elemset_ids_in,
499 const std::vector<std::map<std::pair<dof_id_type, elemset_id_type>,
Real>> & elemset_vals);
506 std::vector<std::string> & var_names,
507 std::vector<std::set<elemset_id_type>> & elemset_ids_in,
508 std::vector<std::map<std::pair<dof_id_type, elemset_id_type>,
Real>> & elemset_vals);
540 bool allow_empty =
true);
635#ifdef LIBMESH_HAVE_EXODUS_API
666 const std::vector<std::string> & names,
667 bool continuous=
true);
675#ifdef LIBMESH_HAVE_EXODUS_API
This is the EquationSystems class.
This is the ExodusII_IO_Helper class.
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
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.
void set_max_name_length(unsigned int max_length)
For backwards compatibility, libMesh currently truncates names in ExodusII output to the old default ...
std::unique_ptr< ExodusII_IO_Helper > exio_helper
Only attempt to instantiate an ExodusII helper class if the Exodus API is defined.
virtual void write(const std::string &fname) override
This method implements writing a mesh to a specified file.
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 _set_unique_ids_from_maps
Set Elem/Node unique_ids based on the elem_num_map and node_num_map contents during reading,...
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.
virtual bool get_add_sides() override
ExodusHeaderInfo read_header(const std::string &name)
Read only the header information, instead of the entire mesh.
void append(bool val)
If true, this flag will cause the ExodusII_IO object to attempt to open an existing file for writing,...
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.
void set_coordinate_offset(Point p)
Allows you to set a vector that is added to the coordinates of all of the nodes.
ExodusII_IO(ExodusII_IO &&)=default
ExodusII_IO special functions:
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.
int _timestep
Stores the current value of the timestep when calling ExodusII_IO::write_timestep().
const std::vector< Real > & get_time_steps()
bool _verbose
should we be verbose?
bool _write_complex_abs
By default, when complex numbers are enabled, for each variable we write out three values: the real p...
const std::vector< std::string > & get_global_var_names()
Return list of the global variable names.
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 verbose(bool set_verbosity)
Set the flag indicating if we should be verbose.
static int get_exodus_version()
void write_complex_magnitude(bool val)
Set the flag indicating whether the complex modulus should be written when complex numbers are enable...
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.
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...
ExodusII_IO & operator=(const ExodusII_IO &)=delete
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...
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 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.
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),...
std::vector< std::string > _output_variables
The names of the variables to be output.
void write_as_dimension(unsigned dim)
Directly control the num_dim which is written to the Exodus file.
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 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_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,...
void write_information_records(const std::vector< std::string > &)
Write out information records.
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,...
ExodusII_IO(const ExodusII_IO &)=delete
const std::vector< std::string > & get_elem_var_names()
Return list of the elemental variable names.
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.
void set_unique_ids_from_maps(bool val)
If true, this flag enforces the following behaviors:
ExodusII_IO_Helper & get_exio_helper()
Return a reference to the ExodusII_IO_Helper object.
bool _disc_bex
Set to true (false is the default) to generate independent nodes for every Bezier Extraction element.
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...
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,...
void write_elemsets()
Write elemsets stored on the Mesh to file.
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 write_global_data(const std::vector< Number > &, const std::vector< std::string > &)
Write out global variables.
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...
bool _append
Default false.
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 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 write_element_data(const EquationSystems &es)
Write out element solution.
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,...
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.
const std::vector< std::string > & get_nodal_var_names()
Return list of the nodal variable names.
virtual void read(const std::string &name) override
This method implements reading a mesh from a specified file.
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
Write out a nodal solution.
bool _allow_empty_variables
Flag which controls the behavior of _output_variables: .) If true, _output_variables is allowed to re...
void write_added_sides(bool val)
By default, we only write out the elements physically stored in the mesh.
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_discontinuous_bex(bool disc_bex)
Set to true (false is the default) to generate independent nodes for every Bezier Extraction element ...
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 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.
This is the MeshBase class.
This class defines an abstract interface for Mesh output.
An object whose state is distributed along a set of processors.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Manages consistently variables, degrees of freedom, and coefficient vectors.
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real