moab
|
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 class ReadUtilIface; 00022 00023 class ReadIDEAS : public ReaderIface 00024 { 00025 00026 public: 00027 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 00043 ReadIDEAS(Interface* impl = NULL); 00044 00046 virtual ~ReadIDEAS() {} 00047 00048 protected: 00049 00050 ErrorCode skip_header(); 00051 ErrorCode create_vertices(EntityHandle& first_vertex, const Tag* file_id_tag); 00052 ErrorCode create_elements(EntityHandle first_vertex, const Tag* file_id_tag); 00053 00054 private: 00055 00056 std::ifstream file; 00057 RangeMap<int, EntityHandle> nodeIdMap; 00058 00059 // Read mesh interface 00060 ReadUtilIface* readMeshIface; 00061 00062 // MOAB Interface 00063 Interface* MBI; 00064 00065 00066 /* Universal dataset numbers 00067 An integer describes a chunk of information. These chunks include headers, 00068 units, nodes, elements, patches, etc... described in the OpenFOAM IDEAS 00069 reader. 00070 00071 1) http://amira.zib.de/usersguide31/hxideas/HxFileFormat_IDEAS.html 00072 55,2414 data at nodes 00073 00074 2) http://www.sdrl.uc.edu/universal-file-formats-for-modal-analysis-testing-1 00075 /file-format-storehouse/unv_0015.htm/ 00076 15 nodes with single precision coordinates 00077 line1 (4I10,1P3E13.5): node_label coord_sys_num displacement_sys_num 00078 color x y z */ 00079 static const unsigned SINGLE_PRECISION_NODES = 15; 00080 00081 /* 3) http://www.sdrl.uc.edu/pdf/test_universal_file_formats.pdf 00082 781,2411 nodes with double precision coordinates 00083 line1 (4I10): node_label coord_sys_num displacement_sys_num color 00084 line2 (1P3D25.16): x y z */ 00085 static const unsigned DOUBLE_PRECISION_NODES0 = 781; 00086 static const unsigned DOUBLE_PRECISION_NODES1 = 2411; 00087 00088 /* 4) http://www.sdrl.uc.edu/universal-file-formats-for-modal-analysis-testing-1 00089 /file-format-storehouse/unv_0780.htm/ 00090 71, 780, 2412 element definitions 00091 line1 (8I10): element_label fe_id phys_prop_bin_num phys_prop_num 00092 mat_prop_bin_num mat_prop_num color num_of_nodes 00093 line2 (8I10): connectivity_node_labels */ 00094 static const unsigned ELEMENTS0 = 71; 00095 static const unsigned ELEMENTS1 = 780; 00096 static const unsigned ELEMENTS2 = 2412; 00097 00098 /* Mesh elements exist inside chunks 71, 780, and 2412. Each element definition 00099 includes the finite element id that describes the element type. These are 00100 used in the OpenFOAM IDEAS reader. The canonical node ordering matches that 00101 of MBCN, as suggested by the Gmsh 2.2.3 source code.*/ 00102 static const int ROD0 = 11; 00103 static const int ROD1 = 171; 00104 static const int TRI0 = 41; 00105 static const int TRI1 = 91; 00106 static const int QUAD0 = 44; 00107 static const int QUAD1 = 94; 00108 static const int TET = 111; 00109 static const int WEDGE = 112; 00110 static const int HEX = 115; 00111 00112 }; 00113 00114 } // namespace moab 00115 #endif