Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 #ifndef READ_TEMPLATE_HPP 00002 #define READ_TEMPLATE_HPP 00003 00004 #include "moab/ReaderIface.hpp" 00005 #include "moab/Range.hpp" 00006 00007 namespace moab 00008 { 00009 00010 class ReadUtilIface; 00011 class Interface; 00012 00013 /** 00014 * \brief Template for implementing new file readers in MOAB 00015 * This class is a template for writing new file readers in MOAB. This shows how to efficiently 00016 * create vertices and elements using the ReadUtilIface class, and to translate indices in 00017 * connectivity lists into vertex handles created during the read. 00018 * 00019 * After writing the new reader class, you should also modify src/ReaderWriterSet.cpp, to register 00020 * the new reader along with the file extensions that it reads. This will turn on automatic 00021 * creating of this reader based on file extension, which is done in Core::serial_load_file. 00022 */ 00023 class ReadTemplate : public ReaderIface 00024 { 00025 00026 public: 00027 //! factory method 00028 static ReaderIface* factory( Interface* ); 00029 00030 ErrorCode load_file( const char* file_name, 00031 const EntityHandle* file_set, 00032 const FileOptions& opts, 00033 const SubsetList* subset_list = 0, 00034 const Tag* file_id_tag = 0 ); 00035 00036 ErrorCode read_tag_values( const char* file_name, 00037 const char* tag_name, 00038 const FileOptions& opts, 00039 std::vector< int >& tag_values_out, 00040 const SubsetList* subset_list = 0 ); 00041 00042 //! Constructor 00043 ReadTemplate( Interface* impl = NULL ); 00044 00045 //! Destructor 00046 virtual ~ReadTemplate(); 00047 00048 private: 00049 /** \brief Read vertex data and create vertices in MOAB database 00050 * \param num_verts Number of vertices to be read 00051 * \param start_vertex Starting vertex handle; used later to offset connectivity indices 00052 * \param read_ents Range storing all entities read from this file 00053 */ 00054 ErrorCode read_vertices( int num_verts, EntityHandle& start_vertex, Range& read_ents ); 00055 00056 /** \brief Read element data and create elements in MOAB database 00057 * \param num_elems Number of elements to be read 00058 * \param start_vertex Starting vertex handle; used to offset connectivity indices 00059 * \param start_elem Starting element handle; may be used later to offset set entities 00060 * \param read_ents Range storing all entities read from this file 00061 */ 00062 ErrorCode read_elements( int num_elems, EntityHandle start_vertex, EntityHandle& start_elem, Range& read_ents ); 00063 00064 /** \brief Read entity set data and create/populate sets in MOAB database 00065 * \param num_sets Number of sets to be read 00066 * \param start_vertex Starting vertex handle 00067 * \param num_verts Total number of vertices read from file 00068 * \param start_elem Starting element handle 00069 * \param num_elems Total number of elements read from file 00070 * \param read_ents Range storing all entities read from this file 00071 */ 00072 ErrorCode create_sets( int num_sets, 00073 EntityHandle start_vertex, 00074 int num_verts, 00075 EntityHandle start_elem, 00076 int num_elems, 00077 Range& read_ents ); 00078 00079 /** \brief Process options passed into the reader 00080 * \param opts Options passed into this read 00081 */ 00082 ErrorCode process_options( const FileOptions& opts ); 00083 00084 ReadUtilIface* readMeshIface; 00085 00086 //! interface instance 00087 Interface* mbImpl; 00088 00089 const char* fileName; 00090 }; 00091 00092 } // namespace moab 00093 00094 #endif