MOAB: Mesh Oriented datABase  (version 5.3.1)
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, const EntityHandle* file_set, const FileOptions& opts,
00038                          const SubsetList* subset_list = 0, const Tag* file_id_tag = 0 );
00039 
00040     ErrorCode read_tag_values( const char* file_name, const char* tag_name, const FileOptions& opts,
00041                                std::vector< int >& tag_values_out, const SubsetList* subset_list = 0 );
00042 
00043     //! Constructor
00044     ReadVtk( Interface* impl = NULL );
00045 
00046     //! Destructor
00047     virtual ~ReadVtk();
00048 
00049   protected:
00050     ErrorCode allocate_vertices( long num_vtx, EntityHandle& start_handle_out, double*& x_coord_array_out,
00051                                  double*& y_coord_array_out, double*& z_coord_array_out );
00052 
00053     ErrorCode read_vertices( FileTokenizer& tokens, long num_verts, EntityHandle& start_handle_out );
00054 
00055     ErrorCode allocate_elements( long num_elements, int vert_per_element, EntityType type,
00056                                  EntityHandle& start_handle_out, EntityHandle*& conn_array_out,
00057                                  std::vector< Range >& append_to_this );
00058 
00059     ErrorCode vtk_read_dataset( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& element_list );
00060 
00061     ErrorCode vtk_read_structured_points( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00062 
00063     ErrorCode vtk_read_structured_grid( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00064 
00065     ErrorCode vtk_read_rectilinear_grid( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00066 
00067     ErrorCode vtk_read_polydata( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00068 
00069     ErrorCode vtk_read_polygons( FileTokenizer& tokens, EntityHandle first_vtx, std::vector< Range >& elem_list );
00070 
00071     ErrorCode vtk_read_unstructured_grid( FileTokenizer& tokens, Range& vertex_list, std::vector< Range >& elem_list );
00072 
00073     ErrorCode vtk_create_structured_elems( const long* dims, EntityHandle first_vtx, std::vector< Range >& elem_list );
00074 
00075     ErrorCode vtk_read_field( FileTokenizer& tokens );
00076 
00077     ErrorCode vtk_read_attrib_data( FileTokenizer& tokens, std::vector< Range >& entities );
00078 
00079     ErrorCode vtk_read_tag_data( FileTokenizer& tokens, int type, size_t per_elem, std::vector< Range >& entities,
00080                                  const char* name );
00081 
00082     ErrorCode vtk_read_scalar_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00083 
00084     ErrorCode vtk_read_color_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00085 
00086     ErrorCode vtk_read_vector_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00087 
00088     ErrorCode vtk_read_texture_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00089 
00090     ErrorCode vtk_read_tensor_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00091 
00092     ErrorCode vtk_read_field_attrib( FileTokenizer& tokens, std::vector< Range >& entities, const char* name );
00093 
00094     ErrorCode store_file_ids( Tag tag, const Range& vertices, const std::vector< Range >& elements );
00095 
00096   private:
00097     ReadUtilIface* readMeshIface;
00098 
00099     //------------member variables ------------//
00100 
00101     //! interface instance
00102     Interface* mdbImpl;
00103 
00104     //! A field which, if present and having a single integer for storage, should be used to
00105     //! partition the mesh by range. Defaults to MATERIAL_SET_TAG_NAME
00106     std::string mPartitionTagName;
00107 };
00108 
00109 }  // namespace moab
00110 
00111 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines