1 #ifndef IMESH_REC_CBIND_H__ 2 #define IMESH_REC_CBIND_H__ 3 4 #include "moab/MOABConfig.h" 5 #include "iMesh.h" 6 #include "iMesh_protos.h" 7 #ifdef MOAB_HAVE_MPI 8 #include "iMeshP.h" 9 #include "moab_mpi.h" 10 #endif 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /**\brief Get entities of specific type and/or topology in set or instance, recursive 17 * 18 * Get entities of specific type and/or topology in set or instance. If recursive 19 * is passed in non-zero, includes entities in owned sets. All 20 * entities of a given type or topology are requested by specifying 21 * iBase_ALL_TOPOLOGIES or iBase_ALL_TYPES, respectively. Specified type 22 * or topology must be a value in the iBase_EntityType or iMesh_EntityTopology 23 * enumeration, respectively. 24 * \param instance iMesh instance handle 25 * \param entity_set_handle Entity set being queried 26 * \param entity_type Type of entities being requested 27 * \param entity_topology Topology of entities being requested 28 * \param recursive If non-zero, gets entities in owned sets too 29 * \param *entity_handles Pointer to array of entity handles returned 30 * from function 31 * \param *entity_handles_allocated Pointer to allocated size of 32 * entity_handles array 33 * \param *entity_handles_size Pointer to occupied size of entity_handles array 34 * \param *err Pointer to error type returned from function 35 */ 36 void iMesh_getEntitiesRec(iMesh_Instance instance, 37 /*in*/ const iBase_EntitySetHandle entity_set_handle, 38 /*in*/ const int entity_type, 39 /*in*/ const int entity_topology, 40 /*in*/ const int recursive, 41 /*out*/ iBase_EntityHandle** entity_handles, 42 /*out*/ int* entity_handles_allocated, 43 /*out*/ int* entity_handles_size, 44 /*out*/ int *err); 45 46 /**\brief Get the number of entities with the specified type in the instance or set, recursive 47 * 48 * Get the number of entities with the specified type in the instance 49 * or set. If recursive is passed in non-zero, includes entities in owned sets. 50 * If entity set handle is zero, return information for instance, 51 * otherwise for set. Value of entity type must be from the 52 * iBase_EntityType enumeration. If iBase_ALL_TYPES is specified, 53 * total number of entities (excluding entity sets) is returned. 54 * \param instance iMesh instance handle 55 * \param entity_set_handle Entity set being queried 56 * \param entity_type Type of entity requested 57 * \param recursive If non-zero, includes entities in owned sets too 58 * \param num_type Pointer to number of entities, returned from function 59 * \param *err Pointer to error type returned from function 60 */ 61 void iMesh_getNumOfTypeRec(iMesh_Instance instance, 62 /*in*/ const iBase_EntitySetHandle entity_set_handle, 63 /*in*/ const int entity_type, 64 /*in*/ const int recursive, 65 /*out*/ int *num_type, 66 /*out*/ int *err); 67 68 /**\brief Get the number of entities with the specified topology in the instance or set 69 * 70 * Get the number of entities with the specified topology in the instance 71 * or set. If recursive is passed in non-zero, includes entities in owned sets. 72 * If entity set handle is zero, return information for instance, 73 * otherwise for set. Value of entity topology must be from the 74 * iMesh_EntityTopology enumeration. If iMesh_ALL_TOPOLOGIES is specified, 75 * total number of entities (excluding entity sets) is returned. 76 * \param instance iMesh instance handle 77 * \param entity_set_handle Entity set being queried 78 * \param entity_topology Topology of entity requested 79 * \param recursive If non-zero, includes entities in owned sets too 80 * \param num_topo Pointer to number of entities, returned from function 81 * \param *err Pointer to error type returned from function 82 */ 83 void iMesh_getNumOfTopoRec(iMesh_Instance instance, 84 /*in*/ const iBase_EntitySetHandle entity_set_handle, 85 /*in*/ const int entity_topology, 86 /*in*/ const int recursive, 87 /*out*/ int *num_topo, 88 /*out*/ int *err); 89 90 91 /**\brief Get entities with specified type, topology, tag(s) and (optionally) tag value(s) 92 * 93 * Get entities with the specified type, topology, tag(s), and optionally tag value(s). 94 * If tag values pointer is input as zero, entities with specified tag(s) are returned, 95 * regardless of their value. 96 * \param instance iMesh instance handle 97 * \param entity_set_handle Entity set being queried 98 * \param entity_type Type of entities being requested 99 * \param entity_topology Topology of entities being requested 100 * \param tag_handles Array of tag handles 101 * \param tag_vals Array of tag values (zero if values not requested) 102 * \param num_tags_vals Number of tags and optionally values 103 * \param recursive If non-zero, gets entities in owned sets too 104 * \param *entity_handles Pointer to array of entity handles returned 105 * from function 106 * \param *entity_handles_allocated Pointer to allocated size of 107 * entity_handles array 108 * \param *entity_handles_size Pointer to occupied size of entity_handles array 109 * \param *err Pointer to error type returned from function 110 */ 111 void iMesh_getEntsByTagsRec(iMesh_Instance instance, 112 /*in*/ const iBase_EntitySetHandle entity_set_handle, 113 /*in*/ const int entity_type, 114 /*in*/ const int entity_topology, 115 /*in*/ const iBase_TagHandle *tag_handles, 116 /*in*/ const char * const *tag_vals, 117 /*in*/ const int num_tags_vals, 118 /*in*/ const int recursive, 119 /*out*/ iBase_EntityHandle** entity_handles, 120 /*out*/ int* entity_handles_allocated, 121 /*out*/ int* entity_handles_size, 122 /*out*/ int *err); 123 124 /**\brief Get entity sets with specified tag(s) and (optionally) tag value(s) 125 * 126 * Get entity sets with the specified tag(s) and optionally tag value(s). 127 * If tag values pointer is input as zero, entities with specified tag(s) are returned, 128 * regardless of their value. 129 * \param instance iMesh instance handle 130 * \param entity_set_handle Entity set being queried 131 * \param tag_handles Array of tag handles 132 * \param tag_vals Array of tag values (zero if values not requested) 133 * \param num_tags_vals Number of tags and optionally values 134 * \param recursive If non-zero, gets entities in owned sets too 135 * \param *set_handles Pointer to array of entity handles returned 136 * from function 137 * \param *set_handles_allocated Pointer to allocated size of 138 * set_handles array 139 * \param *set_handles_size Pointer to occupied size of entity_handles array 140 * \param *err Pointer to error type returned from function 141 */ 142 void iMesh_getEntSetsByTagsRec(iMesh_Instance instance, 143 /*in*/ const iBase_EntitySetHandle entity_set_handle, 144 /*in*/ const iBase_TagHandle *tag_handles, 145 /*in*/ const char * const *tag_vals, 146 /*in*/ const int num_tags_vals, 147 /*in*/ const int recursive, 148 /*out*/ iBase_EntitySetHandle** set_handles, 149 /*out*/ int* set_handles_allocated, 150 /*out*/ int* set_handles_size, 151 /*out*/ int *err); 152 153 /**\brief Get MBCN type corresponding to iMesh topology value 154 * 155 * Get MBCN type corresponding to iMesh topology value. Required for input 156 * to MBCN canonical numbering functions, which are written in terms of 157 * MBCN entity types. Returns -1 for type if entity topology is out of 158 * bounds, or MBMAXTYPE if no corresponding MBCN type exists. 159 * \param imesh_entity_topology iMesh_EntityTopology value 160 * \param mbcn_type MBEntityType corresponding to entity topology 161 */ 162 void iMesh_MBCNType(/*in*/ const int imesh_entity_topology, 163 /*out*/ int *mbcn_type); 164 165 166 /**\brief Access tag data via direct pointer into contiguous blocks 167 * 168 * Iteratively obtain direct access to contiguous blocks of tag 169 * storage. This function cannot be used with bit tags because 170 * of the compressed bit storage. This function cannot be used 171 * with variable length tags because it does not provide a mechanism 172 * to determine the length of the value for each entity. This 173 * function may be used with sparse tags, but if it is used, it 174 * will return data for a single entity at a time. 175 * 176 *\Note If this function is called for entities for which no tag value 177 * has been set, but for which a default value exists, it will 178 * force the allocation of explicit storage for each such entity 179 * even though MOAB would normally not explicitly store tag values 180 * for such entities. 181 * 182 *\Example: 183 *\code 184 *\endcode 185 */ 186 void iMesh_tagIterate(iMesh_Instance instance, 187 /**< [in] iMesh instance */ 188 const iBase_TagHandle tag_handle, 189 /**< [in] Tag being queried */ 190 iBase_EntityArrIterator entArr_iterator, 191 /**< [in] Iterator being queried */ 192 void* tag_value, 193 /**< [out] Pointer to pointer that will be set to tag data memory */ 194 int* count, 195 /**< [out] Number of contiguous entities in this subrange */ 196 int* err 197 /**< [out] Returned Error status (see iBase_ErrorType) */ 198 ); 199 200 /**\brief Access connectivity data via direct pointer into contiguous blocks 201 * 202 * Iteratively obtain direct access to contiguous blocks of connectivity 203 * storage. 204 * 205 */ 206 void iMesh_connectIterate(iMesh_Instance instance, 207 /**< [in] iMesh instance */ 208 iBase_EntityArrIterator entArr_iterator, 209 /**< [in] Iterator being queried */ 210 iBase_EntityHandle **connect, 211 /**< [out] Pointer to pointer that will be set to connectivity data memory */ 212 int* verts_per_entity, 213 /**< [out] Number of vertices per entity in this subrange */ 214 int* count, 215 /**< [out] Number of contiguous entities in this subrange */ 216 int* err 217 /**< [out] Returned Error status (see iBase_ErrorType) */ 218 ); 219 220 /**\brief Access coordinates data via direct pointer into contiguous blocks 221 * 222 * Iteratively obtain direct access to contiguous blocks of coordinate 223 * storage. 224 * 225 */ 226 void iMesh_coordsIterate(iMesh_Instance instance, 227 /**< [in] iMesh instance */ 228 iBase_EntityArrIterator entArr_iterator, 229 /**< [in] Iterator being queried */ 230 double **coordsx, 231 /**< [out] Pointer to pointer x coordinates */ 232 double **coordsy, 233 /**< [out] Pointer to pointer y coordinates */ 234 double **coordsz, 235 /**< [out] Pointer to pointer z coordinates */ 236 int* count, 237 /**< [out] Number of contiguous entities in this subrange */ 238 int* err 239 /**< [out] Returned Error status (see iBase_ErrorType) */ 240 ); 241 242 /***************************************************************************//** 243 * \ingroup EntityIterators 244 * \brief Step the iterator a specified number of entities 245 * 246 * Step the iterator a specified number of entities. If this number is greater 247 * than the number of entities left in the iterator, the iterator is placed 248 * at the end and at_end is returned non-zero; otherwise at_end is returned zero. 249 ******************************************************************************/ 250 251 void iMesh_stepEntIter( 252 iMesh_Instance instance, 253 /**< [in] iMesh instance handle */ 254 iBase_EntityIterator ent_iterator, 255 /**< [in] Iterator being queried */ 256 int step_length, 257 /**< [in] Number of entities to step the iterator */ 258 int* at_end, 259 /**< [out] Non-zero if iterator is at the end of the iteration */ 260 int* err 261 /**< [out] Returned Error status (see iBase_ErrorType) */ 262 ); 263 264 void iMesh_stepEntArrIter( 265 iMesh_Instance instance, 266 /**< [in] iMesh instance handle */ 267 iBase_EntityArrIterator entArr_iterator, 268 /**< [in] Iterator being queried */ 269 int step_length, 270 /**< [in] Number of entities to step the iterator */ 271 int* at_end, 272 /**< [out] Non-zero if iterator is at the end of the iteration */ 273 int* err 274 /**< [out] Returned Error status (see iBase_ErrorType) */ 275 ); 276 277 /***************************************************************************//** 278 * \ingroup EntityIterators 279 * \brief Initialize an array iterator over specified entity type, topology, 280 * and size, with an optional recursive flag. 281 * 282 * Initialize an array iterator over specified entity type, topology, and 283 * size, for a specified set or instance. Iterator returned can be used 284 * as input to functions returning entities for the iterator. If all 285 * entities of a specified type and/or topology are to be iterated, 286 * specify iBase_ALL_TYPES or iMesh_ALL_TOPOLOGIES, respectively. 287 * Specified type or topology must be a value in the iBase_EntityType or 288 * iMesh_EntityTopology enumerations, respectively. If recursive is true, 289 * entities are retrieved recursively through contained (but not child) sets. 290 ******************************************************************************/ 291 292 void iMesh_initEntArrIterRec( 293 iMesh_Instance instance, 294 /**< [in] iMesh instance handle */ 295 const iBase_EntitySetHandle entity_set_handle, 296 /**< [in] Entity set being iterated */ 297 const int requested_entity_type, 298 /**< [in] Type of entity to iterate */ 299 const int requested_entity_topology, 300 /**< [in] Topology of entity to iterate */ 301 const int requested_array_size, 302 /**< [in] Size of chunks of handles returned for each value of the 303 iterator */ 304 const int resilient, 305 /**< [in] If zero, return a non-resilient iterator. 306 Otherwise, a resilient iterator (\ref resilient) */ 307 const int recursive, 308 /**< [in] If non-zero, entities retrieved recursively */ 309 iBase_EntityArrIterator* entArr_iterator, 310 /**< [out] Pointer to iterator returned from function */ 311 int* err 312 /**< [out] Returned Error status (see iBase_ErrorType) */ 313 ); 314 315 /***************************************************************************//** 316 * \ingroup Tags 317 * \brief Get all the tags associated with the entire interface 318 * 319 * Get all the tags associated with the entire interface 320 ******************************************************************************/ 321 322 void iMesh_getAllIfaceTags(iMesh_Instance instance, 323 /*inout*/ iBase_TagHandle **tag_handles, 324 /*inout*/ int *tag_handles_allocated, 325 /*out*/ int *tag_handles_size, 326 /*out*/ int *err 327 ); 328 329 /***************************************************************************//** 330 * \ingroup Tags 331 * \brief Create a tag with options 332 * 333 * Create a tag with options; allows creation of Dense and Bit tags through iMesh 334 * Allowable options are: 335 * TAG_STORAGE_TYPE={DENSE | SPARSE | BIT | MESH} 336 * TAG_DEFAULT_VALUE=<value> (data type of value should match tag data type) 337 ******************************************************************************/ 338 339 void iMesh_createTagWithOptions(iMesh_Instance instance, 340 /**< [in] iMesh instance handle */ 341 /*in*/ const char* tag_name, 342 /**< [in] tag name*/ 343 /*in*/ const char* tmp_tag_options, 344 /**< [in] options string */ 345 /*in*/ const int tag_size, 346 /**< [in] tag size, in number of values */ 347 /*in*/ const int tag_type, 348 /**< [in] tag data type (int, double, etc.) */ 349 /*out*/ iBase_TagHandle* tag_handle, 350 /**< [out] handle of new tag */ 351 /*out*/ int *err, 352 /**< [out] error */ 353 /*in*/ const int tag_name_len, 354 /**< [in] length of tag name string */ 355 /*in*/ const int tag_options_len); 356 /**< [in] length of options string */ 357 358 /***************************************************************************//** 359 * \ingroup ScdMesh 360 * \brief Create a structured mesh 361 * 362 * Create a structured mesh, with local and (optionally) global ijk parameters and 363 * optional physical positions. If running in parallel, can request shared vertex resolution 364 * and optional number and type of ghost layers of elements. Global parameters are used to compute 365 * global ids, which are used in shared vertex resolution. 366 ******************************************************************************/ 367 368 void iMesh_createStructuredMesh( 369 iMesh_Instance instance, 370 /**< [in] iMesh instance handle */ 371 int *local_dims, 372 /**< [in] Min/max corners of local ijk parameters, -1 for unused dimensions; specified as 373 ilo, jlo, klo, ihi, jhi, khi. */ 374 int *global_dims, 375 /**< [in] Min/max corners of global ijk parameters, -1 for unused dimensions; NULL if running in serial. 376 Order similar to local_dims. */ 377 double *i_vals, 378 /**< [in] Physical positions of i values, NULL if not placed in physical space. */ 379 double *j_vals, 380 /**< [in] Physical positions of j values, NULL if not placed in physical space. */ 381 double *k_vals, 382 /**< [in] Physical positions of k values, NULL if not placed in physical space. */ 383 int resolve_shared, 384 /**< [in] Non-zero if running in parallel and resolution of shared vertices is desired, zero otherwise. */ 385 int ghost_dim, 386 /**< [in] Dimension of entities to ghost, -1 if none desired. */ 387 int bridge_dim, 388 /**< [in] Dimension of bridge entities used to compute ghosts, -1 if no ghosts desired. */ 389 int num_layers, 390 /**< [in] Number of layers of ghosts desired, -1 if no ghosts desired. */ 391 int addl_ents, 392 /**< [in] Dimension of addition entities adjacent to ghosts to exchange. */ 393 int vert_gids, 394 /**< [in] If non-zero, assigns global ids to vertices, according to global parameterization. */ 395 int elem_gids, 396 /**< [in] If non-zero, assigns global ids to elements, according to global parameterization. */ 397 iBase_EntitySetHandle* set_handle, 398 /**< [inout] A set to which the underlying ScdBox set will be added. NULL if not desired. 399 * If *NULL, will be set directly to the underlying ScdBox's set. */ 400 int *err 401 /**< [out] Error flag. */ 402 ); 403 /***************************************************************************//** 404 * \brief Free memory allocated with malloc 405 * 406 ******************************************************************************/ 407 408 void iMesh_freeMemory( 409 iMesh_Instance instance, 410 /**< [in] iMesh instance handle */ 411 void ** ptrToMem); 412 413 /***************************************************************************//** 414 * \defgroup ScdMesh Structured Mesh 415 * \ingroup iMeshExtensions 416 ******************************************************************************/ 417 418 /***************************************************************************//** 419 * \defgroup iMeshExtensions iMesh Extensions 420 * \ingroup iMesh 421 ******************************************************************************/ 422 423 #ifdef __cplusplus 424 } 425 #endif 426 427 #endif 428