Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
ReadVtk.hpp
Go to the documentation of this file.
00001 /**
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  *
00005  * Copyright 2004 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007  * retains certain rights in this software.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  */
00015 
00016 #ifndef READ_VTK_HPP
00017 #define READ_VTK_HPP
00018 
00019 #include "moab/Forward.hpp"
00020 #include "moab/ReaderIface.hpp"
00021 
00022 #include <string>
00023 
00024 namespace moab
00025 {
00026 
00027 class ReadUtilIface;
00028 class FileTokenizer;
00029 
00030 class ReadVtk : public ReaderIface
00031 {
00032 
00033   public:
00034     static ReaderIface* factory( Interface* );
00035 
00036     //! load a file
00037     ErrorCode load_file( const char* file_name,
00038                          const EntityHandle* file_set,
00039                          const FileOptions& opts,
00040                          const SubsetList* subset_list = 0,
00041                          const Tag* file_id_tag        = 0 );
00042 
00043     ErrorCode read_tag_values( const char* file_name,
00044                                const char* tag_name,
00045                                const FileOptions& opts,
00046                                std::vector< int >& tag_values_out,
00047                                const SubsetList* subset_list = 0 );
00048 
00049     //! Constructor
00050     ReadVtk( Interface* impl = NULL );
00051 
00052     //! Destructor
00053     virtual ~ReadVtk();
00054 
00055   protected:
00056     ErrorCode allocate_vertices( long num_vtx,
00057                                  EntityHandle& start_handle_out,
00058                                  double*& x_coord_array_out,
00059                                  double*& y_coord_array_out,
00060                                  double*& z_coord_array_out );
00061 
00062     ErrorCode read_vertices( FileTokenizer& tokens, long num_verts, EntityHandle& start_handle_out );
00063 
00064     ErrorCode allocate_elements( long num_elements,
00065                                  int vert_per_element,
00066                                  EntityType type,
00067                                  EntityHandle& start_handle_out,
00068                                  EntityHandle*& conn_array_out,
00069                                  std::vector< Range >& append_to_this );
00070 
00071     ErrorCode vtk_read_dataset( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& element_list );
00072 
00073     ErrorCode vtk_read_structured_points( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00074 
00075     ErrorCode vtk_read_structured_grid( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00076 
00077     ErrorCode vtk_read_rectilinear_grid( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00078 
00079     ErrorCode vtk_read_polydata( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00080 
00081     ErrorCode vtk_read_polygons( FileTokenizer& tokens, EntityHandle first_vtx, std::vector< Range >& elem_list );
00082 
00083     ErrorCode vtk_read_unstructured_grid( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00084 
00085     ErrorCode vtk_create_structured_elems( const long* dims, EntityHandle first_vtx, std::vector< Range >& elem_list );
00086 
00087     ErrorCode vtk_read_field( FileTokenizer& tokens );
00088 
00089     ErrorCode vtk_read_attrib_data( FileTokenizer& tokens, std::vector< Range >& entities );
00090 
00091     ErrorCode vtk_read_tag_data( FileTokenizer& tokens,
00092                                  int type,
00093                                  size_t per_elem,
00094                                  std::vector< Range >& entities,
00095                                  const char* name );
00096 
00097     ErrorCode vtk_read_scalar_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00098 
00099     ErrorCode vtk_read_color_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00100 
00101     ErrorCode vtk_read_vector_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00102 
00103     ErrorCode vtk_read_texture_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00104 
00105     ErrorCode vtk_read_tensor_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00106 
00107     ErrorCode vtk_read_field_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00108 
00109     ErrorCode store_file_ids( Tag tag, const Range& vertices, const std::vector< Range >& elements );
00110 
00111   private:
00112     ReadUtilIface* readMeshIface;
00113 
00114     //------------member variables ------------//
00115 
00116     //! interface instance
00117     Interface* mdbImpl;
00118 
00119     //! A field which, if present and having a single integer for storage, should be used to
00120     //! partition the mesh by range. Defaults to MATERIAL_SET_TAG_NAME
00121     std::string mPartitionTagName;
00122 };
00123 
00124 }  // namespace moab
00125 
00126 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines