libMesh
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
libMesh::MeshInput< MT > Class Template Referenceabstract

This class defines an abstract interface for Mesh input. More...

#include <mesh_base.h>

Public Member Functions

virtual ~MeshInput ()
 Destructor. More...
 
virtual void read (const std::string &)=0
 This method implements reading a mesh from a specified file. More...
 

Protected Member Functions

 MeshInput (bool is_parallel_format=false)
 Default constructor. More...
 
 MeshInput (MT &, const bool is_parallel_format=false)
 Constructor. More...
 
MT & 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...
 

Protected Attributes

std::vector< bool > elems_of_dimension
 A vector of bools describing what dimension elements have been encountered when reading a mesh. More...
 

Private Attributes

MT * _obj
 A pointer to a non-const object object. More...
 
const bool _is_parallel_format
 Flag specifying whether this format is parallel-capable. More...
 

Detailed Description

template<class MT>
class libMesh::MeshInput< MT >

This class defines an abstract interface for Mesh input.

Specific classes derived from this class actually implement reading various mesh formats.

Author
Benjamin S. Kirk
Date
2004

Definition at line 50 of file mesh_base.h.

Constructor & Destructor Documentation

template<class MT >
libMesh::MeshInput< MT >::MeshInput ( bool  is_parallel_format = false)
explicitprotected

Default constructor.

Will set the _obj to NULL, effectively rendering this object useless.

Definition at line 130 of file mesh_input.h.

130  :
133  _is_parallel_format(is_parallel_format)
134 {
135 }
const bool _is_parallel_format
Flag specifying whether this format is parallel-capable.
Definition: mesh_input.h:121
std::vector< bool > elems_of_dimension
A vector of bools describing what dimension elements have been encountered when reading a mesh...
Definition: mesh_input.h:97
const class libmesh_nullptr_t libmesh_nullptr
MT * _obj
A pointer to a non-const object object.
Definition: mesh_input.h:114
template<class MT>
libMesh::MeshInput< MT >::MeshInput ( MT &  obj,
const bool  is_parallel_format = false 
)
explicitprotected

Constructor.

Takes a writable reference to an object. This is the constructor required to read an object.

Definition at line 141 of file mesh_input.h.

References libMesh::MeshInput< MT >::_is_parallel_format, libMesh::MeshInput< MT >::mesh(), libMesh::out, and libMesh::processor_id().

141  :
143  _obj (&obj),
144  _is_parallel_format(is_parallel_format)
145 {
146  if (!_is_parallel_format && !this->mesh().is_serial())
147  {
148  if (this->mesh().processor_id() == 0)
149  {
150  libmesh_do_once(libMesh::out <<
151  "Warning: This MeshOutput subclass only supports meshes which have been serialized!"
152  << std::endl;);
153  }
154  }
155 }
const bool _is_parallel_format
Flag specifying whether this format is parallel-capable.
Definition: mesh_input.h:121
std::vector< bool > elems_of_dimension
A vector of bools describing what dimension elements have been encountered when reading a mesh...
Definition: mesh_input.h:97
OStreamProxy out
processor_id_type processor_id()
Definition: libmesh_base.h:96
MT * _obj
A pointer to a non-const object object.
Definition: mesh_input.h:114
template<class MT >
libMesh::MeshInput< MT >::~MeshInput ( )
virtual

Destructor.

Definition at line 161 of file mesh_input.h.

162 {
163 }

Member Function Documentation

template<class MT >
MT & libMesh::MeshInput< MT >::mesh ( )
protected
Returns
The object as a writable reference.

Definition at line 169 of file mesh_input.h.

References libMesh::MeshInput< MT >::_obj, and libmesh_nullptr.

Referenced by libMesh::GMVIO::_read_materials(), libMesh::GMVIO::_read_nodes(), libMesh::GMVIO::_read_one_cell(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::AbaqusIO::assign_subdomain_ids(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::TetGenIO::element_in(), libMesh::UNVIO::elements_in(), libMesh::UNVIO::groups_in(), libMesh::MeshInput< MT >::MeshInput(), libMesh::TetGenIO::node_in(), libMesh::UNVIO::nodes_in(), libMesh::AbaqusIO::read(), libMesh::NameBasedIO::read(), libMesh::TetGenIO::read(), libMesh::GMVIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_bcs(), libMesh::CheckpointIO::read_connectivity(), libMesh::AbaqusIO::read_elements(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::UCDIO::read_implementation(), libMesh::UNVIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::AbaqusIO::read_nodes(), 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::MeshInput< MeshBase >::set_n_partitions(), libMesh::NameBasedIO::write(), and libMesh::NameBasedIO::write_nodal_data().

170 {
171  if (_obj == libmesh_nullptr)
172  libmesh_error_msg("ERROR: _obj should not be NULL!");
173  return *_obj;
174 }
const class libmesh_nullptr_t libmesh_nullptr
MT * _obj
A pointer to a non-const object object.
Definition: mesh_input.h:114
template<class MT>
virtual void libMesh::MeshInput< MT >::read ( const std::string &  )
pure virtual
template<class MT>
void libMesh::MeshInput< MT >::set_n_partitions ( unsigned int  n_parts)
protected

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.

91 { this->mesh().set_n_partitions() = n_parts; }
template<class MT >
void libMesh::MeshInput< MT >::skip_comment_lines ( std::istream &  in,
const char  comment_start 
)
protected

Reads input from in, skipping all the lines that start with the character comment_start.

Definition at line 179 of file mesh_input.h.

181 {
182  char c, line[256];
183 
184  while (in.get(c), c==comment_start)
185  in.getline (line, 255);
186 
187  // put back first character of
188  // first non-comment line
189  in.putback (c);
190 }

Member Data Documentation

template<class MT>
const bool libMesh::MeshInput< MT >::_is_parallel_format
private

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.

Referenced by libMesh::MeshInput< MT >::MeshInput().

template<class MT>
MT* libMesh::MeshInput< MT >::_obj
private

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.

Referenced by libMesh::MeshInput< MT >::mesh().

template<class MT>
std::vector<bool> libMesh::MeshInput< MT >::elems_of_dimension
protected

A vector of bools describing what dimension elements have been encountered when reading a mesh.

Definition at line 97 of file mesh_input.h.


The documentation for this class was generated from the following files: