#include <off_io.h>
Inherits MeshInput< MeshBase >.
OFFIO (MeshBase &)
virtual void read (const std::string &name)
MeshBase & mesh ()
void skip_comment_lines (std::istream &in, const char comment_start)
virtual void read_stream (std::istream &in)
This class is repsonsible for reading an unstructured, triangulated surface in the standard OFF OOGL format.
Definition at line 40 of file off_io.h.
Definition at line 68 of file off_io.h.
:
MeshInput<MeshBase> (mesh)
{}
Referenced by GMVIO::_read_materials(), GMVIO::_read_nodes(), GMVIO::_read_one_cell(), GMVIO::add_cell_centered_data(), GMVIO::copy_nodal_solution(), UNVIO::element_in(), TetGenIO::element_in(), UNVIO::element_out(), UNVIO::node_in(), TetGenIO::node_in(), UNVIO::node_out(), XdrIO::read(), VTKIO::read(), GMVIO::read(), ExodusII_IO::read(), LegacyXdrIO::read_ascii(), LegacyXdrIO::read_binary(), UCDIO::read_implementation(), LegacyXdrIO::read_mesh(), GmshIO::read_mesh(), XdrIO::read_serialized_bcs(), XdrIO::read_serialized_connectivity(), XdrIO::read_serialized_nodes(), read_stream(), MatlabIO::read_stream(), VTKIO::solution_to_vtk(), XdrIO::write(), VTKIO::write(), TetGenIO::write(), GMVIO::write_ascii_new_impl(), GMVIO::write_ascii_old_impl(), GMVIO::write_binary(), GMVIO::write_discontinuous_gmv(), UNVIO::write_implementation(), UCDIO::write_implementation(), LegacyXdrIO::write_mesh(), GmshIO::write_mesh(), GmshIO::write_post(), XdrIO::write_serialized_bcs(), XdrIO::write_serialized_connectivity(), XdrIO::write_serialized_nodes(), and LegacyXdrIO::write_soln().
Implements MeshInput< MeshBase >.
Definition at line 33 of file off_io.C.
References read_stream().
Referenced by UnstructuredMesh::read().
{
std::ifstream in (name.c_str());
read_stream(in);
}
Definition at line 42 of file off_io.C.
References MeshBase::add_elem(), MeshBase::add_point(), MeshBase::clear(), MeshInput< MeshBase >::mesh(), MeshBase::mesh_dimension(), MeshBase::node_ptr(), libMesh::processor_id(), and DofObject::set_id().
Referenced by read().
{
// This is a serial-only process for now;
// the Mesh should be read on processor 0 and
// broadcast later
libmesh_assert(libMesh::processor_id() == 0);
// Get a reference to the mesh
MeshBase& mesh = MeshInput<MeshBase>::mesh();
// Clear any existing mesh data
mesh.clear();
// STL only works in 2D
libmesh_assert (mesh.mesh_dimension() == 2);
// Check the input buffer
libmesh_assert (in.good());
unsigned int nn, ne, nf;
std::string label;
// Read the first string. It should say 'OFF'
in >> label;
libmesh_assert (label == 'OFF');
// read the number of nodes, faces, and edges
in >> nn >> nf >> ne;
// resize local vectors.
// _nodes.resize(nn);
//_elements.resize(nf);
Real x=0., y=0., z=0.;
// Read the nodes
for (unsigned int n=0; n<nn; n++)
{
libmesh_assert (in.good());
in >> x
>> y
>> z;
mesh.add_point ( Point(x,y,z), n );
}
unsigned int dummy, n0, n1, n2;
// Read the triangles
for (unsigned int e=0; e<nf; e++)
{
libmesh_assert (in.good());
// _elements[e] = new Tri3;
// _elements[e]->set_id (e);
Elem* elem = new Tri3;
elem->set_id(e);
mesh.add_elem (elem);
// The number of nodes in the object
in >> dummy;
libmesh_assert (dummy == 3);
in >> n0
>> n1
>> n2;
elem->set_node(0) = mesh.node_ptr(n0);
elem->set_node(1) = mesh.node_ptr(n1);
elem->set_node(2) = mesh.node_ptr(n2);
}
}
Referenced by TetGenIO::read(), and UCDIO::read_implementation().
Generated automatically by Doxygen for libMesh from the source code.