moab
|
00001 00016 #ifndef EXOII_UTIL 00017 #define EXOII_UTIL 00018 00019 // 00020 // ExoIIUtil class: utility class for functions used by both reader 00021 // and writer 00022 00023 #ifndef IS_BUILDING_MB 00024 #error "ExoIIUtil.hpp isn't supposed to be included into an application" 00025 #endif 00026 00027 #include "moab/Forward.hpp" 00028 #include "moab/ExoIIInterface.hpp" 00029 00030 00031 namespace moab { 00032 00033 class ExoIIUtil : public ExoIIInterface 00034 { 00035 00036 Interface* mMB; 00037 00038 public: 00039 ExoIIUtil(Interface* mdb) : mMB(mdb) {} 00040 ~ExoIIUtil(){} 00041 00043 virtual ExoIIElementType element_name_to_type(const char* name) 00044 { 00045 return static_element_name_to_type(name); 00046 } 00047 00051 virtual ExoIIElementType get_element_type(EntityHandle entity, 00052 Tag mid_nodes_tag, Tag geom_dimension_tag, 00053 EntityType indiv_entity_type = MBMAXTYPE) 00054 { 00055 return static_get_element_type(mMB, entity, mid_nodes_tag, geom_dimension_tag, 00056 indiv_entity_type); 00057 } 00058 00059 virtual void has_mid_nodes(ExoIIElementType elem_type, int* array) 00060 { 00061 array[0] = HasMidNodes[elem_type][0]; 00062 array[1] = HasMidNodes[elem_type][1]; 00063 array[2] = HasMidNodes[elem_type][2]; 00064 array[3] = HasMidNodes[elem_type][3]; 00065 } 00066 00067 virtual int has_mid_nodes(ExoIIElementType elem_type, int dimension ) 00068 { 00069 return HasMidNodes[elem_type][dimension]; 00070 } 00071 00072 virtual int geometric_dimension(const ExoIIElementType elem_type) 00073 { 00074 return ElementGeometricDimension[elem_type]; 00075 } 00076 00077 virtual const char* element_type_name(ExoIIElementType type) 00078 { 00079 return ElementTypeNames[type]; 00080 } 00081 00082 00083 00085 static ExoIIElementType static_element_name_to_type(const char *name); 00086 00091 static ExoIIElementType static_get_element_type(Interface *mdbImpl, 00092 const EntityHandle entity, 00093 const Tag mid_nodes_tag, 00094 const Tag geom_dimension_tag, 00095 const EntityType indiv_entity_type = MBMAXTYPE); 00096 00100 static ExoIIElementType get_element_type_from_num_verts(const int num_verts, 00101 const EntityType entity_type = MBMAXTYPE, 00102 const int dimension = 3); 00103 00105 static const EntityType ExoIIElementMBEntity[]; 00106 00108 static const char* ElementTypeNames[]; 00109 00111 static const int VerticesPerElement[]; 00112 00115 static const int HasMidNodes[][4]; 00116 00118 static const int ElementGeometricDimension[]; 00119 00120 }; 00121 00123 inline ExoIIElementType operator++(ExoIIElementType &type, int) 00124 { 00125 return (ExoIIElementType)(((int&)type)++); 00126 } 00127 00129 inline ExoIIElementType& operator++(ExoIIElementType& type) 00130 { 00131 return (ExoIIElementType&)(++((int&)type)); 00132 } 00133 00134 } // namespace moab 00135 00136 #endif