$extrastylesheet
tetgen_io.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 
00020 #ifndef LIBMESH_TETGEN_IO_H
00021 #define LIBMESH_TETGEN_IO_H
00022 
00023 // Local includes
00024 #include "libmesh/libmesh_common.h"
00025 #include "libmesh/mesh_input.h"
00026 #include "libmesh/mesh_output.h"
00027 
00028 // C++ includes
00029 #include <cstddef>
00030 #include <map>
00031 
00032 namespace libMesh
00033 {
00034 
00035 // Forward declarations
00036 class MeshBase;
00037 class MeshData;
00038 
00039 
00048 // ------------------------------------------------------------
00049 // TetGenIO class definition
00050 class TetGenIO : public MeshInput<MeshBase>,
00051                  public MeshOutput<MeshBase>
00052 {
00053 public:
00054 
00059   explicit
00060   TetGenIO (MeshBase& mesh, MeshData* mesh_data=NULL);
00061 
00066   explicit
00067   TetGenIO (const MeshBase& mesh, MeshData* mesh_data=NULL);
00068 
00073   virtual void read (const std::string& );
00074 
00079   virtual void write (const std::string& );
00080 
00085   std::vector<std::vector<Real> > node_attributes;
00086 
00091   std::vector<std::vector<Real> > element_attributes;
00092 
00093 private:
00094 
00095 
00096   //-------------------------------------------------------------
00097   // read support methods
00098 
00103   void read_nodes_and_elem (std::istream& node_stream,
00104                             std::istream& ele_stream);
00105 
00115   void node_in (std::istream& node_stream);
00116 
00124   void element_in (std::istream& ele_stream);
00125 
00126   //-------------------------------------------------------------
00127   // local data
00128 
00132   std::map<dof_id_type,dof_id_type> _assign_nodes;
00133 
00137   dof_id_type _num_nodes;
00138 
00142   dof_id_type _num_elements;
00143 
00148   MeshData* _mesh_data;
00149 };
00150 
00151 
00152 
00153 // ------------------------------------------------------------
00154 // TetGenIO inline members
00155 inline
00156 TetGenIO::TetGenIO (MeshBase& mesh, MeshData* mesh_data) :
00157   MeshInput<MeshBase> (mesh),
00158   MeshOutput<MeshBase>(mesh),
00159   _mesh_data(mesh_data)
00160 {
00161 }
00162 
00163 
00164 
00165 inline
00166 TetGenIO::TetGenIO (const MeshBase& mesh, MeshData* mesh_data) :
00167   MeshOutput<MeshBase>(mesh),
00168   _mesh_data(mesh_data)
00169 {
00170 }
00171 
00172 
00173 } // namespace libMesh
00174 
00175 
00176 #endif // LIBMESH_TETGEN_IO_H