libMesh
|
This class implements writing meshes and solutions in Ensight's Gold format. More...
#include <ensight_io.h>
Classes | |
struct | Scalars |
struct | SystemVars |
struct | Vectors |
Public Member Functions | |
EnsightIO (const std::string &filename, const EquationSystems &eq) | |
Constructor. More... | |
~EnsightIO () | |
Empty destructor. More... | |
void | add_scalar (const std::string &system, const std::string &scalar_description, const std::string &s) |
Tell the EnsightIO interface to output the finite element (not SCALAR) variable named "s". More... | |
void | add_vector (const std::string &system, const std::string &vec_description, const std::string &u, const std::string &v) |
Tell the EnsightIO interface that the variables (u,v) constitute a vector. More... | |
void | add_vector (const std::string &system, const std::string &vec_description, const std::string &u, const std::string &v, const std::string &w) |
Tell the EnsightIO interface that the variables (u, v, w) constitute a vector. More... | |
void | write (Real time=0) |
Calls write_ascii() and write_case(). More... | |
virtual void | write (const std::string &name) override |
Calls this->write(0);. More... | |
virtual void | write_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr) |
This method implements writing a mesh with data to a specified file where the data is taken from the EquationSystems object. More... | |
virtual void | write_discontinuous_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr) |
This method implements writing a mesh with discontinuous data to a specified file where the data is taken from the EquationSystems object. More... | |
virtual void | write_nodal_data (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) |
This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are provided. More... | |
virtual void | write_nodal_data (const std::string &, const NumericVector< Number > &, const std::vector< std::string > &) |
This method may be overridden by "parallel" output formats for writing nodal data. More... | |
virtual void | write_nodal_data (const std::string &, const EquationSystems &, const std::set< std::string > *) |
This method should be overridden by "parallel" output formats for writing nodal data. More... | |
virtual void | write_nodal_data_discontinuous (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) |
This method implements writing a mesh with discontinuous data to a specified file where the nodal data and variables names are provided. More... | |
unsigned int & | ascii_precision () |
Return/set the precision to use when writing ASCII files. More... | |
Protected Member Functions | |
const MeshBase & | mesh () const |
Protected Attributes | |
const bool | _is_parallel_format |
Flag specifying whether this format is parallel-capable. More... | |
const bool | _serial_only_needed_on_proc_0 |
Flag specifying whether this format can be written by only serializing the mesh to processor zero. More... | |
Private Member Functions | |
void | write_ascii (Real time=0) |
void | write_scalar_ascii (const std::string &sys, const std::string &var) |
void | write_vector_ascii (const std::string &sys, const std::vector< std::string > &vec, const std::string &var_name) |
void | write_solution_ascii () |
void | write_geometry_ascii () |
void | write_case () |
Static Private Member Functions | |
static std::map< ElemType, std::string > | build_element_map () |
Private Attributes | |
std::string | _ensight_file_name |
std::vector< Real > | _time_steps |
std::map< std::string, SystemVars > | _system_vars_map |
const EquationSystems & | _equation_systems |
const MeshBase *const | _obj |
A pointer to a constant object. More... | |
unsigned int | _ascii_precision |
Precision to use when writing ASCII files. More... | |
Static Private Attributes | |
static std::map< ElemType, std::string > | _element_map = EnsightIO::build_element_map() |
This class implements writing meshes and solutions in Ensight's Gold format.
Definition at line 55 of file ensight_io.h.
libMesh::EnsightIO::EnsightIO | ( | const std::string & | filename, |
const EquationSystems & | eq | ||
) |
Constructor.
Definition at line 65 of file ensight_io.C.
References _ensight_file_name, _equation_systems, libMesh::ParallelObject::n_processors(), and libMesh::ParallelObject::processor_id().
|
inline |
void libMesh::EnsightIO::add_scalar | ( | const std::string & | system, |
const std::string & | scalar_description, | ||
const std::string & | s | ||
) |
Tell the EnsightIO interface to output the finite element (not SCALAR) variable named "s".
Definition at line 122 of file ensight_io.C.
References _equation_systems, _system_vars_map, libMesh::EnsightIO::Scalars::description, libMesh::EquationSystems::get_system(), libMesh::EquationSystems::has_system(), and libMesh::libmesh_assert().
void libMesh::EnsightIO::add_vector | ( | const std::string & | system, |
const std::string & | vec_description, | ||
const std::string & | u, | ||
const std::string & | v | ||
) |
Tell the EnsightIO interface that the variables (u,v) constitute a vector.
u
and v
must have the same FEType, and be defined in the same system. Definition at line 82 of file ensight_io.C.
References _equation_systems, _system_vars_map, libMesh::EnsightIO::Vectors::description, libMesh::EquationSystems::get_system(), libMesh::EquationSystems::has_system(), and libMesh::libmesh_assert().
void libMesh::EnsightIO::add_vector | ( | const std::string & | system, |
const std::string & | vec_description, | ||
const std::string & | u, | ||
const std::string & | v, | ||
const std::string & | w | ||
) |
Tell the EnsightIO interface that the variables (u, v, w) constitute a vector.
u
, v
, and w
must have the same FEType, and must be defined in the same system. Definition at line 101 of file ensight_io.C.
References _equation_systems, _system_vars_map, libMesh::EnsightIO::Vectors::description, libMesh::EquationSystems::get_system(), libMesh::EquationSystems::has_system(), and libMesh::libmesh_assert().
|
inlineinherited |
Return/set the precision to use when writing ASCII files.
By default we use numeric_limits<Real>::max_digits10, which should be enough to write out to ASCII and get the exact same Real back when reading in.
Definition at line 257 of file mesh_output.h.
|
staticprivate |
Definition at line 45 of file ensight_io.C.
References libMesh::EDGE2, libMesh::EDGE3, libMesh::HEX20, libMesh::HEX8, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::TET10, libMesh::TET4, libMesh::TRI3, and libMesh::TRI6.
|
inlineprotectedinherited |
Definition at line 247 of file mesh_output.h.
|
overridevirtual |
Calls this->write(0);.
Implements libMesh::MeshOutput< MeshBase >.
Definition at line 140 of file ensight_io.C.
References _ensight_file_name, libMesh::MeshOutput< MeshBase >::_is_parallel_format, libMesh::MeshOutput< MeshBase >::mesh(), libMesh::Quality::name(), and write().
void libMesh::EnsightIO::write | ( | Real | time = 0 | ) |
Calls write_ascii() and write_case().
Writes case, mesh, and solution files named: name.case (contains a description of other files) name.geo000 (mesh) name_{varname}.scl000 (one file per scalar variable) name_{vecname}.vec000 (one file per vector variable)
Definition at line 152 of file ensight_io.C.
References write_ascii(), and write_case().
Referenced by write().
|
private |
Definition at line 160 of file ensight_io.C.
References _time_steps, write_geometry_ascii(), and write_solution_ascii().
Referenced by write().
|
private |
Definition at line 274 of file ensight_io.C.
References _ensight_file_name, _system_vars_map, and _time_steps.
Referenced by write().
|
virtualinherited |
This method implements writing a mesh with discontinuous data to a specified file where the data is taken from the EquationSystems
object.
Definition at line 87 of file mesh_output.C.
|
virtualinherited |
This method implements writing a mesh with data to a specified file where the data is taken from the EquationSystems
object.
Reimplemented in libMesh::NameBasedIO.
Definition at line 31 of file mesh_output.C.
|
private |
Definition at line 170 of file ensight_io.C.
References _element_map, _ensight_file_name, _time_steps, libMesh::MeshBase::active_local_element_ptr_range(), libMesh::HEX27, libMesh::index_range(), libMesh::MeshOutput< MT >::mesh(), libMesh::Quality::name(), and libMesh::QUAD9.
Referenced by write_ascii().
|
virtualinherited |
This method should be overridden by "parallel" output formats for writing nodal data.
Instead of getting a localized copy of the nodal solution vector, it directly uses EquationSystems current_local_solution vectors to look up nodal values.
If not implemented, reorders the solutions into a nodal-only NumericVector and calls the above version of this function.
Reimplemented in libMesh::Nemesis_IO.
Definition at line 158 of file mesh_output.C.
|
virtualinherited |
This method may be overridden by "parallel" output formats for writing nodal data.
Instead of getting a localized copy of the nodal solution vector, it is passed a NumericVector of type=PARALLEL which is in node-major order i.e. (u0,v0,w0, u1,v1,w1, u2,v2,w2, u3,v3,w3, ...) and contains n_nodes*n_vars total entries. Then, it is up to the individual I/O class to extract the required solution values from this vector and write them in parallel.
If not implemented, localizes the parallel vector into a std::vector and calls the other version of this function.
Reimplemented in libMesh::Nemesis_IO.
Definition at line 145 of file mesh_output.C.
|
inlinevirtualinherited |
This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are provided.
Reimplemented in libMesh::Nemesis_IO, libMesh::UCDIO, libMesh::ExodusII_IO, libMesh::GmshIO, libMesh::NameBasedIO, libMesh::GMVIO, libMesh::VTKIO, libMesh::MEDITIO, libMesh::GnuPlotIO, and libMesh::TecplotIO.
Definition at line 105 of file mesh_output.h.
|
inlinevirtualinherited |
This method implements writing a mesh with discontinuous data to a specified file where the nodal data and variables names are provided.
Reimplemented in libMesh::ExodusII_IO.
Definition at line 114 of file mesh_output.h.
|
private |
Definition at line 336 of file ensight_io.C.
References _ensight_file_name, _equation_systems, _time_steps, libMesh::MeshBase::active_local_element_ptr_range(), libMesh::System::current_solution(), dim, libMesh::DofMap::dof_indices(), libMesh::System::get_dof_map(), libMesh::EquationSystems::get_system(), libMesh::index_range(), libMesh::libmesh_real(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::FEInterface::nodal_soln(), libMesh::System::variable_number(), and libMesh::System::variable_type().
Referenced by write_solution_ascii().
|
private |
Definition at line 320 of file ensight_io.C.
References _system_vars_map, write_scalar_ascii(), and write_vector_ascii().
Referenced by write_ascii().
|
private |
Definition at line 407 of file ensight_io.C.
References _ensight_file_name, _equation_systems, _time_steps, libMesh::MeshBase::active_local_element_ptr_range(), libMesh::System::current_solution(), dim, libMesh::DofMap::dof_indices(), libMesh::System::get_dof_map(), libMesh::EquationSystems::get_system(), libMesh::index_range(), libMesh::libmesh_real(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::FEInterface::nodal_soln(), libMesh::System::variable_number(), and libMesh::System::variable_type().
Referenced by write_solution_ascii().
|
privateinherited |
Precision to use when writing ASCII files.
Definition at line 195 of file mesh_output.h.
|
staticprivate |
Definition at line 162 of file ensight_io.h.
Referenced by write_geometry_ascii().
|
private |
Definition at line 152 of file ensight_io.h.
Referenced by EnsightIO(), write(), write_case(), write_geometry_ascii(), write_scalar_ascii(), and write_vector_ascii().
|
private |
Definition at line 159 of file ensight_io.h.
Referenced by add_scalar(), add_vector(), EnsightIO(), write_scalar_ascii(), and write_vector_ascii().
|
protectedinherited |
Flag specifying whether this format is parallel-capable.
If this is false (default) I/O is only permitted when the mesh has been serialized.
Definition at line 172 of file mesh_output.h.
|
privateinherited |
A pointer to a constant object.
This allows us to write the object to file.
Definition at line 190 of file mesh_output.h.
|
protectedinherited |
Flag specifying whether this format can be written by only serializing the mesh to processor zero.
If this is false (default) the mesh will be serialized to all processors
Definition at line 181 of file mesh_output.h.
|
private |
Definition at line 156 of file ensight_io.h.
Referenced by add_scalar(), add_vector(), write_case(), and write_solution_ascii().
|
private |
Definition at line 153 of file ensight_io.h.
Referenced by write_ascii(), write_case(), write_geometry_ascii(), write_scalar_ascii(), and write_vector_ascii().