#include <gmv_io.h>
Public Member Functions | |
GMVIO (const MeshBase &) | |
GMVIO (MeshBase &) | |
virtual void | write (const std::string &) override |
virtual void | read (const std::string &mesh_file) override |
virtual void | write_nodal_data (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override |
bool & | binary () |
bool & | discontinuous () |
bool & | partitioning () |
bool & | write_subdomain_id_as_material () |
bool & | subdivide_second_order () |
bool & | p_levels () |
void | write_discontinuous_gmv (const std::string &name, const EquationSystems &es, const bool write_partitioning, const std::set< std::string > *system_names=nullptr) const |
void | write_ascii_new_impl (const std::string &, const std::vector< Number > *=nullptr, const std::vector< std::string > *=nullptr) |
void | add_cell_centered_data (const std::string &cell_centered_data_name, const std::vector< Real > *cell_centered_data_vals) |
void | copy_nodal_solution (EquationSystems &es) |
virtual void | write_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr) |
virtual void | write_discontinuous_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr) |
virtual void | write_nodal_data (const std::string &, const NumericVector< Number > &, const std::vector< std::string > &) |
virtual void | write_nodal_data_discontinuous (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) |
unsigned int & | ascii_precision () |
Protected Member Functions | |
MeshBase & | mesh () |
void | set_n_partitions (unsigned int n_parts) |
void | skip_comment_lines (std::istream &in, const char comment_start) |
const MeshBase & | mesh () const |
Protected Attributes | |
std::vector< bool > | elems_of_dimension |
const bool | _is_parallel_format |
const bool | _serial_only_needed_on_proc_0 |
Private Member Functions | |
void | write_ascii_old_impl (const std::string &, const std::vector< Number > *=nullptr, const std::vector< std::string > *=nullptr) |
void | write_binary (const std::string &, const std::vector< Number > *=nullptr, const std::vector< std::string > *=nullptr) |
void | _read_nodes () |
void | _read_one_cell () |
ElemType | gmv_elem_to_libmesh_elem (std::string elemname) |
void | _read_materials () |
void | _read_var () |
Static Private Member Functions | |
static std::map< std::string, ElemType > | build_reading_element_map () |
Private Attributes | |
bool | _binary |
bool | _discontinuous |
bool | _partitioning |
bool | _write_subdomain_id_as_material |
bool | _subdivide_second_order |
bool | _p_levels |
std::map< std::string, const std::vector< Real > *> | _cell_centered_data |
unsigned int | _next_elem_id |
std::map< std::string, std::vector< Number > > | _nodal_data |
Static Private Attributes | |
static std::map< std::string, ElemType > | _reading_element_map = GMVIO::build_reading_element_map() |
This class implements writing meshes in the GMV format. For a full description of the GMV format and to obtain the GMV software see http://www.generalmeshviewer.com
|
explicit |
Constructor. Takes a reference to a constant mesh object. This constructor will only allow us to write the mesh.
Definition at line 240 of file gmv_io.C.
|
explicit |
Constructor. Takes a writable reference to a mesh object. This constructor is required to let us read in a mesh.
Definition at line 254 of file gmv_io.C.
|
private |
|
private |
Helper functions for reading nodes/cells from a GMV file
Definition at line 2068 of file gmv_io.C.
References libMesh::MeshInput< MT >::mesh().
Referenced by read().
|
private |
Definition at line 2087 of file gmv_io.C.
References _next_elem_id, libMesh::MeshBase::add_elem(), libMesh::Elem::build(), libMesh::Elem::dim(), libMesh::MeshInput< MeshBase >::elems_of_dimension, gmv_elem_to_libmesh_elem(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshBase::node_ptr(), libMesh::DofObject::set_id(), and libMesh::Elem::set_node().
Referenced by read().
|
private |
Definition at line 2032 of file gmv_io.C.
References _nodal_data.
Referenced by read().
void libMesh::GMVIO::add_cell_centered_data | ( | const std::string & | cell_centered_data_name, |
const std::vector< Real > * | cell_centered_data_vals | ||
) |
Takes a vector of cell-centered data to be plotted. You must ensure that for every active element e, v[e->id()] is a valid number. You can add an arbitrary number of different cell-centered data sets by calling this function multiple times.
.) GMV does not like spaces in the cell_centered_data_name .) No matter what order you add cell-centered data, it will be output alphabetically.
Definition at line 1864 of file gmv_io.C.
References _cell_centered_data.
|
inlineinherited |
Return/set the precision to use when writing ASCII files.
By default we use numeric_limits<Real>::digits10 + 2, which should be enough to write out to ASCII and get the exact same Real back when reading in.
Definition at line 244 of file mesh_output.h.
Referenced by libMesh::TecplotIO::write_ascii(), write_ascii_new_impl(), and write_ascii_old_impl().
|
inline |
Flag indicating whether or not to write a binary file. While binary files may end up being smaller than equivalent ASCII files, they are harder to debug if anything goes wrong, since they are not human-readable.
Definition at line 103 of file gmv_io.h.
References _binary.
Referenced by write(), and write_nodal_data().
|
staticprivate |
Static function used to build the _reading_element_map.
Definition at line 207 of file gmv_io.C.
References libMesh::EDGE2, libMesh::EDGE3, libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::PRISM15, libMesh::PRISM6, libMesh::QUAD4, libMesh::QUAD8, libMesh::TET10, libMesh::TET4, libMesh::TRI3, and libMesh::TRI6.
void libMesh::GMVIO::copy_nodal_solution | ( | EquationSystems & | es | ) |
If we read in a nodal solution while reading in a mesh, we can attempt to copy that nodal solution into an EquationSystems object.
Definition at line 2168 of file gmv_io.C.
References _nodal_data, libMesh::err, libMesh::FEType::family, libMesh::FIRST, libMesh::OrderWrapper::get_order(), libMesh::EquationSystems::get_system(), libMesh::System::has_variable(), libMesh::LAGRANGE, libMesh::MeshInput< MT >::mesh(), libMesh::EquationSystems::n_systems(), libMesh::FEType::order, libMesh::System::solution, libMesh::System::update(), libMesh::System::variable_number(), and libMesh::System::variable_type().
|
inline |
Flag indicating whether or not to write the mesh as discontinuous cell patches
Definition at line 109 of file gmv_io.h.
References _discontinuous.
|
private |
Definition at line 2151 of file gmv_io.C.
References _reading_element_map.
Referenced by _read_one_cell().
|
inlineprotectedinherited |
Definition at line 169 of file mesh_input.h.
Referenced by _read_one_cell(), libMesh::VTKIO::cells_to_vtk(), libMesh::TetGenIO::element_in(), libMesh::UNVIO::elements_in(), libMesh::UNVIO::elements_out(), libMesh::UNVIO::groups_in(), libMesh::TetGenIO::node_in(), libMesh::UNVIO::nodes_in(), libMesh::UNVIO::nodes_out(), libMesh::VTKIO::nodes_to_vtk(), libMesh::Nemesis_IO::prepare_to_write_nodal_data(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_bcs(), libMesh::CheckpointIO::read_connectivity(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::UCDIO::read_implementation(), libMesh::UNVIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::CheckpointIO::read_nodes(), libMesh::CheckpointIO::read_nodesets(), libMesh::CheckpointIO::read_remote_elem(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::CheckpointIO::read_subdomain_names(), libMesh::TetGenIO::write(), libMesh::Nemesis_IO::write(), libMesh::ExodusII_IO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), write_ascii_new_impl(), write_ascii_old_impl(), write_binary(), write_discontinuous_gmv(), libMesh::Nemesis_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data(), libMesh::UCDIO::write_header(), libMesh::UCDIO::write_implementation(), libMesh::UCDIO::write_interior_elems(), libMesh::GmshIO::write_mesh(), libMesh::VTKIO::write_nodal_data(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::UCDIO::write_nodes(), libMesh::CheckpointIO::write_nodesets(), libMesh::XdrIO::write_parallel(), libMesh::GmshIO::write_post(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::UCDIO::write_soln(), and libMesh::CheckpointIO::write_subdomain_names().
|
inlineprotectedinherited |
Definition at line 234 of file mesh_output.h.
Referenced by libMesh::FroIO::write(), libMesh::TecplotIO::write(), libMesh::MEDITIO::write(), libMesh::PostscriptIO::write(), libMesh::EnsightIO::write(), libMesh::TecplotIO::write_ascii(), libMesh::TecplotIO::write_binary(), libMesh::TecplotIO::write_nodal_data(), libMesh::MEDITIO::write_nodal_data(), and libMesh::GnuPlotIO::write_solution().
|
inline |
Flag indicating whether or not to write p level information for p refined meshes
Definition at line 134 of file gmv_io.h.
References _p_levels.
Referenced by write_ascii_new_impl(), write_ascii_old_impl(), and write_binary().
|
inline |
Flag indicating whether or not to write the partitioning information for the mesh.
Definition at line 115 of file gmv_io.h.
References _partitioning.
Referenced by libMesh::NameBasedIO::write(), write_ascii_new_impl(), write_ascii_old_impl(), write_binary(), and libMesh::NameBasedIO::write_nodal_data().
|
overridevirtual |
This method implements reading a mesh from a specified file.
Implements libMesh::MeshInput< MeshBase >.
Definition at line 1881 of file gmv_io.C.
References _next_elem_id, _read_materials(), _read_nodes(), _read_one_cell(), _read_var(), libMesh::MeshBase::allow_renumbering(), libMesh::MeshBase::clear(), libMesh::MeshInput< MeshBase >::elems_of_dimension, libMesh::err, ierr, libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::Quality::name(), libMesh::Trees::NODES, libMesh::MeshBase::prepare_for_use(), and libMesh::MeshBase::set_mesh_dimension().
Referenced by libMesh::NameBasedIO::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.
References libMesh::MeshInput< MT >::mesh().
Referenced by libMesh::Nemesis_IO::read(), and libMesh::XdrIO::read_header().
|
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.
Referenced by libMesh::TetGenIO::read(), and libMesh::UCDIO::read_implementation().
|
inline |
Flag indicating whether or not to subdivide second order elements
Definition at line 128 of file gmv_io.h.
References _subdivide_second_order.
Referenced by write_ascii_new_impl(), and write_ascii_old_impl().
|
overridevirtual |
This method implements writing a mesh to a specified file.
Implements libMesh::MeshOutput< MeshBase >.
Definition at line 269 of file gmv_io.C.
References binary(), write_ascii_old_impl(), and write_binary().
Referenced by libMesh::NameBasedIO::write().
void libMesh::GMVIO::write_ascii_new_impl | ( | const std::string & | fname, |
const std::vector< Number > * | v = nullptr , |
||
const std::vector< std::string > * | solution_names = nullptr |
||
) |
This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are optionally provided. This will write an ASCII file. This is the new implementation (without subcells).
Definition at line 293 of file gmv_io.C.
References _cell_centered_data, std::abs(), libMesh::MeshBase::active_element_ptr_range(), libMesh::MeshOutput< MeshBase >::ascii_precision(), libMesh::err, std::max(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::n_active_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::n_partitions(), n_vars, p_levels(), partitioning(), libMesh::MeshBase::point(), libMesh::Real, subdivide_second_order(), write_ascii_old_impl(), and write_subdomain_id_as_material().
|
private |
This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are optionally provided. This will write an ASCII file. This is the old implementation (using subcells) which was the default in libMesh-0.4.3-rc2.
Definition at line 568 of file gmv_io.C.
References _cell_centered_data, std::abs(), libMesh::MeshBase::active_element_ptr_range(), libMesh::MeshOutput< MeshBase >::ascii_precision(), libMesh::Elem::build(), libMesh::Utility::enum_to_string(), libMesh::err, libMesh::FIRST, libMesh::Elem::first_order_equivalent_type(), libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::INFHEX16, libMesh::INFHEX18, libMesh::INFHEX8, libMesh::INFPRISM12, libMesh::INFPRISM6, libMesh::INFQUAD4, libMesh::INFQUAD6, std::max(), libMesh::MeshBase::max_node_id(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::n_active_elem(), libMesh::MeshBase::n_active_sub_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::n_partitions(), n_vars, p_levels(), partitioning(), libMesh::MeshBase::point(), libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM6, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::Real, subdivide_second_order(), libMesh::TECPLOT, libMesh::TET10, libMesh::TET4, libMesh::TRI3, libMesh::TRI6, and write_subdomain_id_as_material().
Referenced by write(), write_ascii_new_impl(), and write_nodal_data().
|
private |
This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are optionally provided.
Definition at line 1230 of file gmv_io.C.
References _cell_centered_data, std::abs(), libMesh::MeshBase::active_element_ptr_range(), libMesh::err, std::max(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_active_elem(), libMesh::MeshBase::n_nodes(), libMesh::ParallelObject::n_processors(), n_vars, p_levels(), partitioning(), libMesh::MeshBase::point(), and write_subdomain_id_as_material().
Referenced by write(), and write_nodal_data().
|
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 92 of file mesh_output.C.
References libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::EquationSystems::get_mesh(), and libMesh::out.
Referenced by libMesh::ExodusII_IO::write_timestep_discontinuous().
void libMesh::GMVIO::write_discontinuous_gmv | ( | const std::string & | name, |
const EquationSystems & | es, | ||
const bool | write_partitioning, | ||
const std::set< std::string > * | system_names = nullptr |
||
) | const |
Writes a GMV file with discontinuous data
Definition at line 1551 of file gmv_io.C.
References _cell_centered_data, _write_subdomain_id_as_material, std::abs(), libMesh::MeshBase::active_element_ptr_range(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::Utility::enum_to_string(), libMesh::err, libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::INFEDGE2, libMesh::INFHEX16, libMesh::INFHEX18, libMesh::INFHEX8, libMesh::INFPRISM12, libMesh::INFPRISM6, libMesh::INFQUAD4, libMesh::INFQUAD6, libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_active_elem(), libMesh::ParallelObject::n_processors(), n_vars, libMesh::Quality::name(), libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM6, libMesh::ParallelObject::processor_id(), libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::TET10, libMesh::TET4, libMesh::TRI3, and libMesh::TRI6.
Referenced by libMesh::ErrorVector::plot_error().
|
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.
References libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::EquationSystems::build_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::EquationSystems::get_mesh(), and libMesh::out.
Referenced by libMesh::Nemesis_IO::write_timestep(), and libMesh::ExodusII_IO::write_timestep().
|
overridevirtual |
This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are provided.
Reimplemented from libMesh::MeshOutput< MeshBase >.
Definition at line 279 of file gmv_io.C.
References binary(), write_ascii_old_impl(), and write_binary().
Referenced by libMesh::NameBasedIO::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 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 150 of file mesh_output.C.
References libMesh::NumericVector< T >::localize().
|
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.
|
inline |
Flag to write element subdomain_id's as GMV "materials" instead of element processor_id's. Allows you to generate exploded views on user-defined subdomains, potentially creating a pretty picture.
Definition at line 122 of file gmv_io.h.
References _write_subdomain_id_as_material.
Referenced by write_ascii_new_impl(), write_ascii_old_impl(), and write_binary().
|
private |
|
private |
Storage for arbitrary cell-centered data. Ex: You can use this to plot the effectivity index for a given cell. The map is between the string representing the variable name and a pointer to a vector containing the data.
Definition at line 233 of file gmv_io.h.
Referenced by add_cell_centered_data(), write_ascii_new_impl(), write_ascii_old_impl(), write_binary(), and write_discontinuous_gmv().
|
private |
Flag to write the mesh as discontinuous patches.
Definition at line 204 of file gmv_io.h.
Referenced by discontinuous().
|
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 159 of file mesh_output.h.
Referenced by libMesh::FroIO::write(), libMesh::PostscriptIO::write(), and libMesh::EnsightIO::write().
|
private |
Definition at line 239 of file gmv_io.h.
Referenced by _read_one_cell(), and read().
|
private |
Definition at line 244 of file gmv_io.h.
Referenced by _read_var(), and copy_nodal_solution().
|
private |
Flag to write the mesh p refinement levels.
Definition at line 225 of file gmv_io.h.
Referenced by p_levels().
|
private |
Flag to write the mesh partitioning.
Definition at line 209 of file gmv_io.h.
Referenced by partitioning().
|
staticprivate |
Static map from string -> ElementType for use during reading.
Definition at line 250 of file gmv_io.h.
Referenced by gmv_elem_to_libmesh_elem().
|
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 168 of file mesh_output.h.
|
private |
Flag to subdivide second order elements
Definition at line 220 of file gmv_io.h.
Referenced by subdivide_second_order().
|
private |
Flag to write element subdomain_id's as GMV "materials" instead of element processor_id's.
Definition at line 215 of file gmv_io.h.
Referenced by write_discontinuous_gmv(), and write_subdomain_id_as_material().
|
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.
Referenced by _read_one_cell(), libMesh::UNVIO::elements_in(), libMesh::UNVIO::max_elem_dimension_seen(), libMesh::AbaqusIO::max_elem_dimension_seen(), libMesh::AbaqusIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), read(), libMesh::VTKIO::read(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::UNVIO::read_implementation(), and libMesh::XdrIO::read_serialized_connectivity().