vtk_io.h
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 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 #ifndef LIBMESH_VTK_IO_H 00020 #define LIBMESH_VTK_IO_H 00021 00022 // Local includes 00023 #include "libmesh/libmesh_common.h" 00024 #include "libmesh/mesh_input.h" 00025 #include "libmesh/mesh_output.h" 00026 00027 #ifdef LIBMESH_HAVE_VTK 00028 #include "vtkType.h" 00029 #endif 00030 00031 // C++ includes 00032 #include <cstddef> 00033 #include <map> 00034 00035 // Forward declarations 00036 00037 class vtkUnstructuredGrid; 00038 class vtkPoints; 00039 class vtkCellArray; 00040 00041 namespace libMesh 00042 { 00043 00044 class MeshBase; 00045 class MeshData; 00046 00059 // ------------------------------------------------------------ 00060 // VTKIO class definition 00061 class VTKIO : public MeshInput<MeshBase>, 00062 public MeshOutput<MeshBase> 00063 { 00064 public: 00069 explicit 00070 VTKIO (MeshBase& mesh, MeshData* mesh_data=NULL); 00071 00076 explicit 00077 VTKIO (const MeshBase& mesh, MeshData* mesh_data=NULL); 00078 00083 virtual void write_nodal_data (const std::string&, 00084 const std::vector<Number>&, 00085 const std::vector<std::string>&); 00086 00092 /* 00093 virtual void write_equation_systems(const std::string& fname, 00094 const EquationSystems& es, 00095 const std::set<std::string>* system_names=NULL); 00096 */ 00097 00102 virtual void read (const std::string& ); 00103 00107 virtual void write (const std::string& ); 00108 00112 vtkUnstructuredGrid* get_vtk_grid() { 00113 return _vtk_grid; 00114 } 00115 00116 void set_compression(bool b) { 00117 this->_compress = b; 00118 } 00119 00120 private: 00121 #ifdef LIBMESH_HAVE_VTK 00122 00125 vtkIdType get_elem_type(ElemType type); 00126 #endif 00127 00131 void nodes_to_vtk(); 00132 00136 void cells_to_vtk(); 00137 00141 void system_vectors_to_vtk(const EquationSystems& es,vtkUnstructuredGrid*& grid); 00142 00146 vtkUnstructuredGrid* _vtk_grid; 00147 00152 MeshData* _mesh_data; 00153 00157 bool _compress; 00158 00162 std::map<dof_id_type, dof_id_type> _local_node_map; 00163 }; 00164 00165 00166 00167 // ------------------------------------------------------------ 00168 // VTKIO inline members 00169 inline 00170 VTKIO::VTKIO (MeshBase& mesh, MeshData* mesh_data) : 00171 MeshInput<MeshBase> (mesh), 00172 MeshOutput<MeshBase>(mesh), 00173 _mesh_data(mesh_data), 00174 _compress(false), 00175 _local_node_map() 00176 { 00177 _vtk_grid = NULL; 00178 libmesh_experimental(); 00179 } 00180 00181 00182 00183 inline 00184 VTKIO::VTKIO (const MeshBase& mesh, MeshData* mesh_data) : 00185 MeshOutput<MeshBase>(mesh), 00186 _mesh_data(mesh_data), 00187 _compress(false), 00188 _local_node_map() 00189 { 00190 _vtk_grid = NULL; 00191 libmesh_experimental(); 00192 } 00193 00194 00195 } // namespace libMesh 00196 00197 00198 #endif // LIBMESH_VTK_IO_H
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:49 UTC
Hosted By: