MOAB: Mesh Oriented datABase  (version 5.4.1)
ReadIDEAS.hpp
Go to the documentation of this file.
00001 #ifndef READIDEAS_HPP
00002 #define READIDEAS_HPP
00003 
00004 #ifndef IS_BUILDING_MB
00005 #error "ReadIDEAS.hpp isn't supposed to be included into an application"
00006 #endif
00007 
00008 #include <iostream>
00009 #include <fstream>
00010 #include <vector>
00011 
00012 #include "moab/ReaderIface.hpp"
00013 #include "moab/Interface.hpp"
00014 #include "moab/RangeMap.hpp"
00015 
00016 #define MAT_PROP_TABLE_TAG  "mat_prop_table"
00017 #define PHYS_PROP_TABLE_TAG "phys_prop_table"
00018 
00019 namespace moab
00020 {
00021 
00022 class ReadUtilIface;
00023 
00024 class ReadIDEAS : public ReaderIface
00025 {
00026 
00027   public:
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     ReadIDEAS( Interface* impl = NULL );
00044 
00045     //! Destructor
00046     virtual ~ReadIDEAS() {}
00047 
00048   protected:
00049     ErrorCode skip_header();
00050     ErrorCode create_vertices( EntityHandle& first_vertex, const Tag* file_id_tag );
00051     ErrorCode create_elements( EntityHandle first_vertex, const Tag* file_id_tag );
00052 
00053   private:
00054     std::ifstream file;
00055     RangeMap< int, EntityHandle > nodeIdMap;
00056 
00057     // Read mesh interface
00058     ReadUtilIface* readMeshIface;
00059 
00060     // MOAB Interface
00061     Interface* MBI;
00062 
00063     /* Universal dataset numbers
00064        An integer describes a chunk of information. These chunks include headers,
00065        units, nodes, elements, patches, etc... described in the OpenFOAM IDEAS
00066        reader.
00067 
00068        1) http://amira.zib.de/usersguide31/hxideas/HxFileFormat_IDEAS.html
00069        55,2414 data at nodes
00070 
00071        2) http://www.sdrl.uc.edu/universal-file-formats-for-modal-analysis-testing-1
00072        /file-format-storehouse/unv_0015.htm/
00073        15 nodes with single precision coordinates
00074        line1 (4I10,1P3E13.5): node_label coord_sys_num displacement_sys_num
00075        color x y z */
00076     static const unsigned SINGLE_PRECISION_NODES = 15;
00077 
00078     /* 3) http://www.sdrl.uc.edu/pdf/test_universal_file_formats.pdf
00079        781,2411 nodes with double precision coordinates
00080        line1 (4I10):       node_label coord_sys_num displacement_sys_num color
00081        line2 (1P3D25.16):  x y z */
00082     static const unsigned DOUBLE_PRECISION_NODES0 = 781;
00083     static const unsigned DOUBLE_PRECISION_NODES1 = 2411;
00084 
00085     /* 4) http://www.sdrl.uc.edu/universal-file-formats-for-modal-analysis-testing-1
00086        /file-format-storehouse/unv_0780.htm/
00087        71, 780, 2412 element definitions
00088        line1 (8I10): element_label fe_id phys_prop_bin_num phys_prop_num
00089        mat_prop_bin_num mat_prop_num color num_of_nodes
00090        line2 (8I10): connectivity_node_labels */
00091     static const unsigned ELEMENTS0 = 71;
00092     static const unsigned ELEMENTS1 = 780;
00093     static const unsigned ELEMENTS2 = 2412;
00094 
00095     /* Mesh elements exist inside chunks 71, 780, and 2412. Each element definition
00096        includes the finite element id that describes the element type. These are
00097        used in the OpenFOAM IDEAS reader. The canonical node ordering matches that
00098        of MBCN, as suggested by the Gmsh 2.2.3 source code.*/
00099     static const int ROD0  = 11;
00100     static const int ROD1  = 171;
00101     static const int TRI0  = 41;
00102     static const int TRI1  = 91;
00103     static const int QUAD0 = 44;
00104     static const int QUAD1 = 94;
00105     static const int TET   = 111;
00106     static const int WEDGE = 112;
00107     static const int HEX   = 115;
00108 };
00109 
00110 }  // namespace moab
00111 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines