$extrastylesheet
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 #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 00091 // virtual void write_equation_systems(const std::string& fname, 00092 // const EquationSystems& es, 00093 // const std::set<std::string>* system_names=NULL); 00094 00099 virtual void read (const std::string&); 00100 00104 virtual void write (const std::string&); 00105 00109 vtkUnstructuredGrid* get_vtk_grid(); 00110 00114 void set_compression(bool b); 00115 00116 private: 00117 #ifdef LIBMESH_HAVE_VTK 00118 00121 vtkIdType get_elem_type(ElemType type); 00122 #endif 00123 00127 void nodes_to_vtk(); 00128 00132 void cells_to_vtk(); 00133 00137 void system_vectors_to_vtk(const EquationSystems& es, vtkUnstructuredGrid*& grid); 00138 00142 vtkUnstructuredGrid* _vtk_grid; 00143 00148 MeshData* _mesh_data; 00149 00153 bool _compress; 00154 00158 std::map<dof_id_type, dof_id_type> _local_node_map; 00159 }; 00160 00161 00162 00163 } // namespace libMesh 00164 00165 00166 #endif // LIBMESH_VTK_IO_H