libMesh
|
This class implements reading and writing meshes in the TetGen format. More...
#include <tetgen_io.h>
Public Member Functions | |
TetGenIO (MeshBase &mesh) | |
Constructor. More... | |
TetGenIO (const MeshBase &mesh) | |
Constructor. More... | |
virtual void | read (const std::string &) override |
This method implements reading a mesh from a specified file in TetGen format. More... | |
virtual void | write (const std::string &) override |
This method implements writing a mesh to a specified ".poly" file. 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... | |
Public Attributes | |
std::vector< std::vector< Real > > | node_attributes |
Data structure to hold node attributes read in from file. More... | |
std::vector< std::vector< Real > > | element_attributes |
Data structure to hold element attributes read in from file. 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_nodes_and_elem (std::istream &node_stream, std::istream &ele_stream) |
Reads a mesh (nodes & elements) from the file provided through node_stream and ele_stream. More... | |
void | node_in (std::istream &node_stream) |
Method reads nodes from node_stream and stores them in vector<Node *> nodes in the order they come in. More... | |
void | element_in (std::istream &ele_stream) |
Method reads elements and stores them in vector<Elem *> elements in the same order as they come in. More... | |
Private Attributes | |
std::map< dof_id_type, dof_id_type > | _assign_nodes |
stores new positions of nodes. More... | |
dof_id_type | _num_nodes |
total number of nodes. More... | |
dof_id_type | _num_elements |
total number of elements. More... | |
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... | |
This class implements reading and writing meshes in the TetGen format.
Format description: cf. TetGen home page.
Definition at line 47 of file tetgen_io.h.
|
inlineexplicit |
Constructor.
Takes a writable reference to a mesh object. This is the constructor required to read a mesh.
Definition at line 151 of file tetgen_io.h.
|
inlineexplicit |
Constructor.
Takes a read-only reference to a mesh object. This is the constructor required to write a mesh.
Definition at line 160 of file tetgen_io.h.
|
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.
|
private |
Method reads elements and stores them in vector<Elem *> elements
in the same order as they come in.
Within TetGenMeshInterface
, element labels are ignored.
Definition at line 184 of file tetgen_io.C.
References _assign_nodes, _num_elements, libMesh::MeshBase::add_elem(), libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshInput< MT >::mesh(), n_nodes, and libMesh::MeshBase::node_ptr().
Referenced by read_nodes_and_elem().
|
inlineprotectedinherited |
Definition at line 169 of file mesh_input.h.
|
inlineprotectedinherited |
Definition at line 247 of file mesh_output.h.
|
private |
Method reads nodes from node_stream
and stores them in vector<Node *> nodes
in the order they come in.
The original node labels are being stored in the map _assign_nodes
in order to assign the elements to the right nodes later.
Definition at line 113 of file tetgen_io.C.
References _assign_nodes, _num_nodes, libMesh::MeshBase::add_point(), libMesh::libmesh_assert(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshInput< MeshBase >::mesh(), node_attributes, and libMesh::Real.
Referenced by read_nodes_and_elem().
|
overridevirtual |
This method implements reading a mesh from a specified file in TetGen format.
Implements libMesh::MeshInput< MeshBase >.
Definition at line 34 of file tetgen_io.C.
References libMesh::MeshInput< MT >::mesh(), libMesh::Quality::name(), libMesh::out, read_nodes_and_elem(), and libMesh::MeshInput< MeshBase >::skip_comment_lines().
Referenced by libMesh::NameBasedIO::read().
|
private |
Reads a mesh (nodes & elements) from the file provided through node_stream
and ele_stream.
Definition at line 95 of file tetgen_io.C.
References _assign_nodes, _num_elements, _num_nodes, element_in(), and node_in().
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 ".poly" file.
".poly" files defines so called Piecewise Linear Complex (PLC).
Implements libMesh::MeshOutput< MeshBase >.
Definition at line 273 of file tetgen_io.C.
References libMesh::MeshBase::active_element_ptr_range(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), and libMesh::MeshBase::point().
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.
|
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.
|
privateinherited |
Precision to use when writing ASCII files.
Definition at line 195 of file mesh_output.h.
|
private |
stores new positions of nodes.
Used when reading.
Definition at line 133 of file tetgen_io.h.
Referenced by element_in(), node_in(), and read_nodes_and_elem().
|
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.
|
private |
total number of elements.
Primarily used when reading.
Definition at line 143 of file tetgen_io.h.
Referenced by element_in(), and read_nodes_and_elem().
|
private |
total number of nodes.
Primarily used when reading.
Definition at line 138 of file tetgen_io.h.
Referenced by node_in(), and read_nodes_and_elem().
|
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.
|
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.
std::vector<std::vector<Real> > libMesh::TetGenIO::element_attributes |
Data structure to hold element attributes read in from file.
Definition at line 95 of file tetgen_io.h.
|
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.
std::vector<std::vector<Real> > libMesh::TetGenIO::node_attributes |
Data structure to hold node attributes read in from file.
What you do with these is up to you!
Definition at line 82 of file tetgen_io.h.
Referenced by node_in().