moab
|
00001 00016 #ifndef MOAB_READ_UTIL_IFACE_HPP 00017 #define MOAB_READ_UTIL_IFACE_HPP 00018 00019 #include <vector> 00020 #include <string> 00021 #include "moab/Types.hpp" 00022 #include "moab/Compiler.hpp" 00023 00024 namespace moab { 00025 00026 class Range; 00027 00029 class MB_DLL_EXPORT ReadUtilIface 00030 { 00031 public: 00032 00034 ReadUtilIface(){} 00035 00037 virtual ~ReadUtilIface(){} 00038 00052 virtual ErrorCode get_node_coords( 00053 const int num_arrays, 00054 const int num_nodes, 00055 const int preferred_start_id, 00056 EntityHandle& actual_start_handle, 00057 std::vector<double*>& arrays, 00058 const int sequence_size = -1 00059 ) = 0; 00060 00073 virtual ErrorCode get_element_connect( 00074 const int num_elements, 00075 const int verts_per_element, 00076 const EntityType mdb_type, 00077 const int preferred_start_id, 00078 EntityHandle& actual_start_handle, 00079 EntityHandle*& array, 00080 int sequence_size = -1 00081 ) = 0; 00082 00092 virtual ErrorCode gather_related_ents(Range &partition, 00093 Range &related_ents, 00094 EntityHandle *file_set = NULL) = 0; 00095 00096 virtual ErrorCode create_entity_sets( 00097 EntityID num_sets, 00098 const unsigned* set_flags, 00099 EntityID preffered_start_id, 00100 EntityHandle& actual_start_handle 00101 ) = 0; 00102 00112 virtual ErrorCode update_adjacencies( 00113 const EntityHandle start_handle, 00114 const int number_elements, 00115 const int number_vertices_per_element, 00116 const EntityHandle* conn_array 00117 ) = 0; 00118 00131 static inline 00132 void reorder( const int* order, EntityHandle* conn, 00133 int num_elem, int node_per_elem ); 00134 00137 virtual ErrorCode report_error( const std::string& error ) = 0; 00138 00140 virtual ErrorCode report_error( const char* error, ... ) MB_PRINTF(1) = 0; 00141 00144 virtual ErrorCode get_ordered_vertices(EntityHandle *bound_ents, 00145 int *sense, 00146 int num_bound, 00147 int dim, 00148 EntityHandle *bound_verts, 00149 EntityType &etype) = 0; 00150 00152 virtual ErrorCode assign_ids( Tag id_tag, const Range& ents, 00153 int start = 0 ) = 0; 00154 00158 virtual ErrorCode assign_ids( Tag id_tag, const EntityHandle* ents, 00159 size_t num_ents, int start = 0 ) = 0; 00160 00162 virtual ErrorCode create_gather_set(EntityHandle& gather_set) = 0; 00163 00165 virtual ErrorCode get_gather_set(EntityHandle& gather_set) = 0; 00166 }; 00167 00168 inline 00169 void ReadUtilIface::reorder( const int* order, EntityHandle* conn, 00170 int num_elem, int node_per_elem ) 00171 { 00172 std::vector<EntityHandle> elem(node_per_elem); 00173 EntityHandle* const end = conn + num_elem*node_per_elem; 00174 while (conn != end) { 00175 std::copy( conn, conn+node_per_elem, elem.begin() ); 00176 for (int j = 0; j < node_per_elem; ++j) 00177 conn[order[j]] = elem[j]; 00178 conn += node_per_elem; 00179 } 00180 } 00181 00182 } // namespace moab 00183 00184 #endif 00185 00186