Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
ReadIDEAS.hpp
Go to the documentation of this file.
1 #ifndef READIDEAS_HPP
2 #define READIDEAS_HPP
3 
4 #ifndef IS_BUILDING_MB
5 #error "ReadIDEAS.hpp isn't supposed to be included into an application"
6 #endif
7 
8 #include <iostream>
9 #include <fstream>
10 #include <vector>
11 
12 #include "moab/ReaderIface.hpp"
13 #include "moab/Interface.hpp"
14 #include "moab/RangeMap.hpp"
15 
16 #define MAT_PROP_TABLE_TAG "mat_prop_table"
17 #define PHYS_PROP_TABLE_TAG "phys_prop_table"
18 
19 namespace moab
20 {
21 
22 class ReadUtilIface;
23 
24 class ReadIDEAS : public ReaderIface
25 {
26 
27  public:
28  static ReaderIface* factory( Interface* );
29 
30  ErrorCode load_file( const char* file_name,
31  const EntityHandle* file_set,
32  const FileOptions& opts,
33  const SubsetList* subset_list = 0,
34  const Tag* file_id_tag = 0 );
35 
36  ErrorCode read_tag_values( const char* file_name,
37  const char* tag_name,
38  const FileOptions& opts,
39  std::vector< int >& tag_values_out,
40  const SubsetList* subset_list = 0 );
41 
42  //! Constructor
43  ReadIDEAS( Interface* impl = NULL );
44 
45  //! Destructor
46  virtual ~ReadIDEAS() {}
47 
48  protected:
50  ErrorCode create_vertices( EntityHandle& first_vertex, const Tag* file_id_tag );
51  ErrorCode create_elements( EntityHandle first_vertex, const Tag* file_id_tag );
52 
53  private:
54  std::ifstream file;
56 
57  // Read mesh interface
59 
60  // MOAB Interface
62 
63  /* Universal dataset numbers
64  An integer describes a chunk of information. These chunks include headers,
65  units, nodes, elements, patches, etc... described in the OpenFOAM IDEAS
66  reader.
67 
68  1) http://amira.zib.de/usersguide31/hxideas/HxFileFormat_IDEAS.html
69  55,2414 data at nodes
70 
71  2) http://www.sdrl.uc.edu/universal-file-formats-for-modal-analysis-testing-1
72  /file-format-storehouse/unv_0015.htm/
73  15 nodes with single precision coordinates
74  line1 (4I10,1P3E13.5): node_label coord_sys_num displacement_sys_num
75  color x y z */
76  static const unsigned SINGLE_PRECISION_NODES = 15;
77 
78  /* 3) http://www.sdrl.uc.edu/pdf/test_universal_file_formats.pdf
79  781,2411 nodes with double precision coordinates
80  line1 (4I10): node_label coord_sys_num displacement_sys_num color
81  line2 (1P3D25.16): x y z */
82  static const unsigned DOUBLE_PRECISION_NODES0 = 781;
83  static const unsigned DOUBLE_PRECISION_NODES1 = 2411;
84 
85  /* 4) http://www.sdrl.uc.edu/universal-file-formats-for-modal-analysis-testing-1
86  /file-format-storehouse/unv_0780.htm/
87  71, 780, 2412 element definitions
88  line1 (8I10): element_label fe_id phys_prop_bin_num phys_prop_num
89  mat_prop_bin_num mat_prop_num color num_of_nodes
90  line2 (8I10): connectivity_node_labels */
91  static const unsigned ELEMENTS0 = 71;
92  static const unsigned ELEMENTS1 = 780;
93  static const unsigned ELEMENTS2 = 2412;
94 
95  /* Mesh elements exist inside chunks 71, 780, and 2412. Each element definition
96  includes the finite element id that describes the element type. These are
97  used in the OpenFOAM IDEAS reader. The canonical node ordering matches that
98  of MBCN, as suggested by the Gmsh 2.2.3 source code.*/
99  static const int ROD0 = 11;
100  static const int ROD1 = 171;
101  static const int TRI0 = 41;
102  static const int TRI1 = 91;
103  static const int QUAD0 = 44;
104  static const int QUAD1 = 94;
105  static const int TET = 111;
106  static const int WEDGE = 112;
107  static const int HEX = 115;
108 };
109 
110 } // namespace moab
111 #endif