libMesh::OFFIO Class Reference
#include <off_io.h>

Public Member Functions | |
| OFFIO (MeshBase &) | |
| virtual void | read (const std::string &name) |
Protected Member Functions | |
| MeshBase & | mesh () |
| void | skip_comment_lines (std::istream &in, const char comment_start) |
Protected Attributes | |
| std::vector< bool > | elems_of_dimension |
Private Member Functions | |
| virtual void | read_stream (std::istream &in) |
Detailed Description
This class is repsonsible for reading an unstructured, triangulated surface in the standard OFF OOGL format.
Definition at line 43 of file off_io.h.
Constructor & Destructor Documentation
| libMesh::OFFIO::OFFIO | ( | MeshBase & | mesh_in | ) | [inline, explicit] |
Member Function Documentation
| MeshBase & libMesh::MeshInput< MeshBase >::mesh | ( | ) | [protected, inherited] |
Returns the object as a writeable reference.
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::VTKIO::cells_to_vtk(), libMesh::GMVIO::copy_nodal_solution(), libMesh::UNVIO::element_in(), libMesh::TetGenIO::element_in(), libMesh::UNVIO::element_out(), libMesh::UNVIO::node_in(), libMesh::TetGenIO::node_in(), libMesh::UNVIO::node_out(), libMesh::VTKIO::nodes_to_vtk(), libMesh::XdrIO::read(), libMesh::VTKIO::read(), libMesh::TetGenIO::read(), libMesh::Nemesis_IO::read(), libMesh::GMVIO::read(), libMesh::ExodusII_IO::read(), libMesh::AbaqusIO::read(), libMesh::LegacyXdrIO::read_ascii(), libMesh::AbaqusIO::read_elements(), libMesh::UNVIO::read_implementation(), libMesh::UCDIO::read_implementation(), libMesh::LegacyXdrIO::read_mesh(), libMesh::GmshIO::read_mesh(), libMesh::AbaqusIO::read_nodes(), libMesh::XdrIO::read_serialized_bcs(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), read_stream(), libMesh::MatlabIO::read_stream(), libMesh::XdrIO::write(), libMesh::TetGenIO::write(), libMesh::Nemesis_IO::write(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::UNVIO::write_implementation(), libMesh::UCDIO::write_implementation(), libMesh::LegacyXdrIO::write_mesh(), libMesh::GmshIO::write_mesh(), libMesh::UCDIO::write_nodal_data(), libMesh::Nemesis_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::XdrIO::write_parallel(), libMesh::GmshIO::write_post(), libMesh::XdrIO::write_serialized_bcs(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::LegacyXdrIO::write_soln().
| void libMesh::OFFIO::read | ( | const std::string & | name | ) | [virtual] |
Reads in an OFF OOGL data file based on the string you pass it.
Implements libMesh::MeshInput< MeshBase >.
Definition at line 35 of file off_io.C.
References read_stream().
00036 { 00037 std::ifstream in (name.c_str()); 00038 00039 read_stream(in); 00040 }
| void libMesh::OFFIO::read_stream | ( | std::istream & | in | ) | [private, virtual] |
Implementation of the read() function. This function is called by the public interface function and implements reading the file.
Definition at line 44 of file off_io.C.
References libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::MeshBase::clear(), libMesh::err, libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshBase::node_ptr(), libMesh::processor_id(), libMesh::Real, libMesh::DofObject::set_id(), libMesh::MeshBase::set_mesh_dimension(), and libMesh::Elem::set_node().
Referenced by read().
00045 { 00046 // This is a serial-only process for now; 00047 // the Mesh should be read on processor 0 and 00048 // broadcast later 00049 libmesh_assert_equal_to (libMesh::processor_id(), 0); 00050 00051 // Get a reference to the mesh 00052 MeshBase& the_mesh = MeshInput<MeshBase>::mesh(); 00053 00054 // Clear any existing mesh data 00055 the_mesh.clear(); 00056 00057 // Check the input buffer 00058 libmesh_assert (in.good()); 00059 00060 unsigned int nn, ne, nf; 00061 00062 std::string label; 00063 00064 // Read the first string. It should say "OFF" 00065 in >> label; 00066 00067 libmesh_assert_equal_to (label, "OFF"); 00068 00069 // read the number of nodes, faces, and edges 00070 in >> nn >> nf >> ne; 00071 00072 00073 Real x=0., y=0., z=0.; 00074 00075 // Read the nodes 00076 for (unsigned int n=0; n<nn; n++) 00077 { 00078 libmesh_assert (in.good()); 00079 00080 in >> x 00081 >> y 00082 >> z; 00083 00084 the_mesh.add_point ( Point(x,y,z), n ); 00085 } 00086 00087 unsigned int nv, nid; 00088 00089 // Read the elements 00090 for (unsigned int e=0; e<nf; e++) 00091 { 00092 libmesh_assert (in.good()); 00093 00094 // The number of vertices in the element 00095 in >> nv; 00096 00097 libmesh_assert(nv == 2 || nv == 3); 00098 if (e == 0) 00099 { 00100 the_mesh.set_mesh_dimension(nv-1); 00101 if (nv == 3) 00102 { 00103 #if LIBMESH_DIM < 2 00104 libMesh::err << "Cannot open dimension 2 mesh file when configured without 2D support." << 00105 std::endl; 00106 libmesh_error(); 00107 #endif 00108 } 00109 } 00110 00111 Elem* elem; 00112 switch (nv) 00113 { 00114 case 2: elem = new Edge2; break; 00115 case 3: elem = new Tri3 ; break; 00116 default: libmesh_error(); 00117 } 00118 00119 elem->set_id(e); 00120 the_mesh.add_elem (elem); 00121 00122 for (unsigned int i=0; i<nv; i++) 00123 { 00124 in >> nid; 00125 elem->set_node(i) = the_mesh.node_ptr(nid); 00126 } 00127 } 00128 }
| void libMesh::MeshInput< MeshBase >::skip_comment_lines | ( | std::istream & | in, | |
| const char | comment_start | |||
| ) | [protected, inherited] |
Reads input from in, skipping all the lines that start with the character comment_start.
Referenced by libMesh::TetGenIO::read(), and libMesh::UCDIO::read_implementation().
Member Data Documentation
std::vector<bool> libMesh::MeshInput< MeshBase >::elems_of_dimension [protected, inherited] |
A vector of bools describing what dimension elements have been encountered when reading a mesh.
Definition at line 93 of file mesh_input.h.
Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::UNVIO::element_in(), libMesh::VTKIO::read(), libMesh::Nemesis_IO::read(), libMesh::GMVIO::read(), libMesh::ExodusII_IO::read(), libMesh::UNVIO::read_implementation(), libMesh::UCDIO::read_implementation(), libMesh::LegacyXdrIO::read_mesh(), and libMesh::XdrIO::read_serialized_connectivity().
The documentation for this class was generated from the following files:
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:32 UTC
Hosted By: