libMesh
|
This class implements reading & writing meshes in the AVS's UCD format. More...
#include <ucd_io.h>
Public Member Functions | |
UCDIO (MeshBase &mesh) | |
Constructor. More... | |
UCDIO (const MeshBase &mesh) | |
Constructor. More... | |
virtual void | read (const std::string &) override |
This method implements reading a mesh from a specified file in UCD format. More... | |
virtual void | write (const std::string &) override |
This method implements writing a mesh to a specified file in UCD format. More... | |
virtual void | write_nodal_data (const std::string &fname, const std::vector< Number > &soln, const std::vector< std::string > &names) override |
This method implements writing a mesh and solution to a specified file in UCD format. 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 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 | |
MeshBase & | mesh () |
void | set_n_partitions (unsigned int n_parts) |
Sets the number of partitions in the mesh. More... | |
void | skip_comment_lines (std::istream &in, const char comment_start) |
Reads input from in , skipping all the lines that start with the character comment_start . More... | |
const MeshBase & | mesh () const |
Protected Attributes | |
std::vector< bool > | elems_of_dimension |
A vector of bools describing what dimension elements have been encountered when reading a mesh. More... | |
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 | read_implementation (std::istream &in_stream) |
The actual implementation of the read function. More... | |
void | write_implementation (std::ostream &out_stream) |
The actual implementation of the write function. More... | |
void | write_header (std::ostream &out, const MeshBase &mesh, dof_id_type n_elems, unsigned int n_vars) |
Write UCD format header. More... | |
void | write_nodes (std::ostream &out, const MeshBase &mesh) |
Write node information. More... | |
void | write_interior_elems (std::ostream &out, const MeshBase &mesh) |
Write element information. More... | |
void | write_soln (std::ostream &out, const MeshBase &mesh, const std::vector< std::string > &names, const std::vector< Number > &soln) |
Writes all nodal solution variables. More... | |
Static Private Member Functions | |
static std::map< ElemType, std::string > | build_writing_element_map () |
static std::map< std::string, ElemType > | build_reading_element_map () |
Private Attributes | |
MeshBase * | _obj |
A pointer to a non-const object object. More... | |
const bool | _is_parallel_format |
Flag specifying whether this format is parallel-capable. More... | |
unsigned int | _ascii_precision |
Precision to use when writing ASCII files. More... | |
Static Private Attributes | |
static std::map< ElemType, std::string > | _writing_element_map = UCDIO::build_writing_element_map() |
static std::map< std::string, ElemType > | _reading_element_map = UCDIO::build_reading_element_map() |
This class implements reading & writing meshes in the AVS's UCD format.
|
inlineexplicit |
|
inlineexplicit |
|
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 70 of file ucd_io.C.
References libMesh::EDGE2, libMesh::HEX8, libMesh::PRISM6, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::TET4, and libMesh::TRI3.
|
staticprivate |
Definition at line 54 of file ucd_io.C.
References libMesh::EDGE2, libMesh::HEX8, libMesh::PRISM6, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::TET4, and libMesh::TRI3.
|
inlineprotectedinherited |
Definition at line 169 of file mesh_input.h.
|
inlineprotectedinherited |
Definition at line 247 of file mesh_output.h.
|
overridevirtual |
This method implements reading a mesh from a specified file in UCD format.
Implements libMesh::MeshInput< MeshBase >.
Definition at line 84 of file ucd_io.C.
References read_implementation().
Referenced by libMesh::NameBasedIO::read().
|
private |
The actual implementation of the read function.
The public read interface simply decides which type of stream to pass the implementation.
Definition at line 126 of file ucd_io.C.
References _reading_element_map, libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::Elem::build(), libMesh::Elem::dim(), libMesh::MeshInput< MeshBase >::elems_of_dimension, libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_nodes(), libMesh::Elem::node_index_range(), libMesh::MeshBase::node_ptr(), libMesh::DofObject::set_id(), libMesh::MeshBase::set_mesh_dimension(), libMesh::Elem::set_node(), libMesh::MeshInput< MeshBase >::skip_comment_lines(), and libMesh::Elem::subdomain_id().
Referenced by read().
|
inlineprotectedinherited |
Sets the number of partitions in the mesh.
Typically this gets done by the partitioner, but some parallel file formats begin "pre-partitioned".
Definition at line 91 of file mesh_input.h.
|
protectedinherited |
Reads input from in
, skipping all the lines that start with the character comment_start
.
Definition at line 179 of file mesh_input.h.
|
overridevirtual |
This method implements writing a mesh to a specified file in UCD format.
Implements libMesh::MeshOutput< MeshBase >.
Definition at line 105 of file ucd_io.C.
References write_implementation().
Referenced by libMesh::NameBasedIO::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 |
Write UCD format header.
Definition at line 274 of file ucd_io.C.
References libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshBase::n_nodes(), and n_vars.
Referenced by write_implementation(), and write_nodal_data().
|
private |
The actual implementation of the write function.
The public write interface simply decides which type of stream to pass the implementation.
Definition at line 251 of file ucd_io.C.
References libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_elem(), write_header(), write_interior_elems(), and write_nodes().
Referenced by write().
|
private |
Write element information.
Definition at line 311 of file ucd_io.C.
References _writing_element_map, libMesh::MeshBase::element_ptr_range(), libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), and libMesh::UCD.
Referenced by write_implementation(), and write_nodal_data().
|
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.
|
overridevirtual |
This method implements writing a mesh and solution to a specified file in UCD format.
This is internally called by MeshOutput::write_equation_systems
Reimplemented from libMesh::MeshOutput< MeshBase >.
Definition at line 333 of file ucd_io.C.
References libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_elem(), libMesh::MeshTools::n_elem(), libMesh::ParallelObject::processor_id(), write_header(), write_interior_elems(), write_nodes(), and write_soln().
Referenced by libMesh::NameBasedIO::write_nodal_data().
|
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 |
Write node information.
Definition at line 293 of file ucd_io.C.
References libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), and libMesh::MeshBase::node_ptr_range().
Referenced by write_implementation(), and write_nodal_data().
|
private |
Writes all nodal solution variables.
Definition at line 366 of file ucd_io.C.
References libMesh::MeshTools::Generation::Private::idx(), libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshBase::n_nodes(), and libMesh::Quality::name().
Referenced by write_nodal_data().
|
privateinherited |
Precision to use when writing ASCII files.
Definition at line 195 of file mesh_output.h.
|
privateinherited |
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 121 of file mesh_input.h.
|
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 non-const object object.
This allows us to read the object from file.
Definition at line 114 of file mesh_input.h.
|
staticprivate |
Definition at line 153 of file ucd_io.h.
Referenced by read_implementation().
|
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.
|
staticprivate |
Definition at line 149 of file ucd_io.h.
Referenced by write_interior_elems().
|
protectedinherited |
A vector of bools describing what dimension elements have been encountered when reading a mesh.
Definition at line 97 of file mesh_input.h.