moab
|
00001 00017 #ifndef MB_WRITE_UTIL_HPP 00018 #define MB_WRITE_UTIL_HPP 00019 00020 #ifndef IS_BUILDING_MB 00021 #error "WriteUtil.hpp isn't supposed to be included into an application" 00022 #endif 00023 00024 #include "moab/WriteUtilIface.hpp" 00025 00026 namespace moab { 00027 00028 class Core; 00029 class Error; 00030 00031 class WriteUtil : public WriteUtilIface 00032 { 00033 private: 00035 Core* mMB; 00036 Error* mError; 00037 public: 00038 00040 WriteUtil(Core* mdb, Error* error_handler); 00041 00043 ~WriteUtil(){} 00044 00048 virtual ErrorCode check_doesnt_exist( const char* file_name ); 00049 00051 virtual ErrorCode gather_entities(Range &all_ents, 00053 const EntityHandle *ent_sets = NULL, 00055 const int num_sets = 0 00057 ); 00058 00060 ErrorCode get_node_coords( 00061 const int num_arrays, 00062 const int num_nodes, 00063 const Range& entities, 00064 Tag node_id_tag, 00065 const int start_node_id, 00066 std::vector<double*>& arrays 00067 ); 00068 00087 ErrorCode get_node_coords( 00088 const int which_array, 00089 Range::const_iterator begin, 00090 const Range::const_iterator end, 00091 const size_t output_size, 00092 double* const output_array 00093 ); 00094 00108 ErrorCode get_element_connect( 00109 const int num_elements, 00110 const int verts_per_element, 00111 Tag node_id_tag, 00112 const Range& entities, 00113 Tag element_id_tag, 00114 int start_element_id, 00115 int* array, 00116 bool add_sizes = false 00117 ); 00118 00147 ErrorCode get_element_connect( 00148 Range::const_iterator begin, 00149 const Range::const_iterator end, 00150 const int vertices_per_elem, 00151 Tag node_id_tag, 00152 const size_t array_size, 00153 int *const element_array, 00154 bool add_sizes = false 00155 ); 00156 00182 virtual ErrorCode get_element_connect( 00183 Range::const_iterator begin, 00184 const Range::const_iterator end, 00185 const int vertices_per_elem, 00186 const size_t array_size, 00187 EntityHandle *const element_array 00188 ); 00189 00197 virtual ErrorCode get_poly_connect_size( 00198 Range::const_iterator begin, 00199 const Range::const_iterator end, 00200 int& connectivity_size 00201 ); 00202 00203 00231 virtual ErrorCode get_poly_connect( 00232 Range::const_iterator& iter, 00233 const Range::const_iterator end, 00234 const Tag node_id_tag, 00235 size_t& handle_array_len, 00236 int *const handle_array, 00237 size_t& index_array_len, 00238 int *const index_array, 00239 int& index_offset 00240 ); 00241 00243 ErrorCode gather_nodes_from_elements( 00244 const Range& elements, 00245 const Tag node_bit_mark_tag, 00246 Range& nodes 00247 ); 00248 00251 ErrorCode assign_ids(Range &elements, 00252 Tag id_tag, 00253 const int start_id); 00254 00255 00266 ErrorCode get_adjacencies( 00267 EntityHandle entity, 00268 Tag id_tag, 00269 std::vector<int>& adj 00270 ); 00271 00272 ErrorCode get_adjacencies( EntityHandle entity, 00273 const EntityHandle*& adj_array, 00274 int& num_adj ); 00275 00276 00296 virtual ErrorCode 00297 get_tag_list( std::vector<Tag>& result_list, 00298 const Tag* user_tag_list = 0, 00299 int user_tag_list_length = 0, 00300 bool include_variable_length_tags = true ); 00301 00302 /*\brief Get pointers to internal storage of entity data 00303 * 00304 * Get pointers to element connectivity or set content storage. 00305 *\param query_begin Start of range of entities for which to return results 00306 *\param query_end End of range of entities for which to return results. 00307 *\param output_pointer_array Result list of pointers. Points to either 00308 * element connectivity or set contents. Note: set contents 00309 * may be in range-compacted format. 00310 *\param lengths Optional per-entity length of list. If passed, then 00311 * always set, for each entity, to the number of values in the 00312 * array passed back in \c output_pointer_array 00313 *\param relation If entity is entity set, which set data to return 00314 * (contents array, parent array, or child array). If 00315 * entity is an element, then CONTENTS for complete connectivity 00316 * or TOPOLOGICAL for only corner vertices. 00317 *\param flags Optional per-entity flag values. If passed, then 00318 * always set to zero for elements and set to set creation 00319 * flags for entity sets. 00320 *\return MB_STRUCTURED_MESH if one or more input elements are stored as 00321 * structured mesh and therefore do not have explicit storage. 00322 * MB_TYPE_OUT_OF_RANGE if called for vertices. 00323 */ 00324 virtual ErrorCode 00325 get_entity_list_pointers( Range::const_iterator query_begin, 00326 Range::const_iterator query_end, 00327 EntityHandle const* * output_pointer_array, 00328 EntityListType relation = CONTENTS, 00329 int* lengths = 0, 00330 unsigned char* flags = 0 ); 00331 00332 /*\brief Get pointers to internal storage of entity data 00333 * 00334 * Get pointers to element connectivity or set content storage. 00335 *\param entities Pointer to list of entities for which to return results 00336 *\param num_entities Number of entities in list 00337 *\param output_pointer_array Result list of pointers. Points to either 00338 * element connectivity or set contents. Note: set contents 00339 * may be in range-compacted format. 00340 *\param lengths Optional per-entity length of list. If passed, then 00341 * always set, for each entity, to the number of values in the 00342 * array passed back in \c output_pointer_array 00343 *\param relation If entity is entity set, which set data to return 00344 * (contents array, parent array, or child array). If 00345 * entity is an element, then CONTENTS for complete connectivity 00346 * or TOPOLOGICAL for only corner vertices. 00347 *\param flags Optional per-entity flag values. If passed, then 00348 * always set to zero for elements and set to set creation 00349 * flags for entity sets. 00350 *\return MB_STRUCTURED_MESH if one or more input elements are stored as 00351 * structured mesh and therefore do not have explicit storage. 00352 * MB_TYPE_OUT_OF_RANGE if called for vertices. 00353 */ 00354 virtual ErrorCode 00355 get_entity_list_pointers( EntityHandle const* entities, 00356 int num_entities, 00357 EntityHandle const* * output_pointer_array, 00358 EntityListType relation = CONTENTS, 00359 int* lengths = 0, 00360 unsigned char* flags = 0 ); 00361 00364 ErrorCode report_error( const std::string& error ); 00365 00366 ErrorCode report_error( const char* error, ... ) MB_PRINTF(1); 00367 }; 00368 00369 } // namespace moab 00370 00371 #endif 00372 00373