MOAB: Mesh Oriented datABase  (version 5.5.0)
iMesh_extensions.h
Go to the documentation of this file.
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  */
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  */
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  */
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 /**\brief Get entities with specified type, topology, tag(s) and (optionally) tag value(s)
91  *
92  * Get entities with the specified type, topology, tag(s), and optionally tag value(s).
93  * If tag values pointer is input as zero, entities with specified tag(s) are returned,
94  * regardless of their value.
95  * \param instance iMesh instance handle
96  * \param entity_set_handle Entity set being queried
97  * \param entity_type Type of entities being requested
98  * \param entity_topology Topology of entities being requested
99  * \param tag_handles Array of tag handles
100  * \param tag_vals Array of tag values (zero if values not requested)
101  * \param num_tags_vals Number of tags and optionally values
102  * \param recursive If non-zero, gets entities in owned sets too
103  * \param *entity_handles Pointer to array of entity handles returned
104  * from function
105  * \param *entity_handles_allocated Pointer to allocated size of
106  * entity_handles array
107  * \param *entity_handles_size Pointer to occupied size of entity_handles array
108  * \param *err Pointer to error type returned from function
109  */
111  /*in*/ const iBase_EntitySetHandle entity_set_handle,
112  /*in*/ const int entity_type,
113  /*in*/ const int entity_topology,
114  /*in*/ const iBase_TagHandle* tag_handles,
115  /*in*/ const char* const* tag_vals,
116  /*in*/ const int num_tags_vals,
117  /*in*/ const int recursive,
118  /*out*/ iBase_EntityHandle** entity_handles,
119  /*out*/ int* entity_handles_allocated,
120  /*out*/ int* entity_handles_size,
121  /*out*/ int* err );
122 
123 /**\brief Get entity sets with specified tag(s) and (optionally) tag value(s)
124  *
125  * Get entity sets with the specified tag(s) and optionally tag value(s).
126  * If tag values pointer is input as zero, entities with specified tag(s) are returned,
127  * regardless of their value.
128  * \param instance iMesh instance handle
129  * \param entity_set_handle Entity set being queried
130  * \param tag_handles Array of tag handles
131  * \param tag_vals Array of tag values (zero if values not requested)
132  * \param num_tags_vals Number of tags and optionally values
133  * \param recursive If non-zero, gets entities in owned sets too
134  * \param *set_handles Pointer to array of entity handles returned
135  * from function
136  * \param *set_handles_allocated Pointer to allocated size of
137  * set_handles array
138  * \param *set_handles_size Pointer to occupied size of entity_handles array
139  * \param *err Pointer to error type returned from function
140  */
142  /*in*/ const iBase_EntitySetHandle entity_set_handle,
143  /*in*/ const iBase_TagHandle* tag_handles,
144  /*in*/ const char* const* tag_vals,
145  /*in*/ const int num_tags_vals,
146  /*in*/ const int recursive,
147  /*out*/ iBase_EntitySetHandle** set_handles,
148  /*out*/ int* set_handles_allocated,
149  /*out*/ int* set_handles_size,
150  /*out*/ int* err );
151 
152 /**\brief Get MBCN type corresponding to iMesh topology value
153  *
154  * Get MBCN type corresponding to iMesh topology value. Required for input
155  * to MBCN canonical numbering functions, which are written in terms of
156  * MBCN entity types. Returns -1 for type if entity topology is out of
157  * bounds, or MBMAXTYPE if no corresponding MBCN type exists.
158  * \param imesh_entity_topology iMesh_EntityTopology value
159  * \param mbcn_type MBEntityType corresponding to entity topology
160  */
161 void iMesh_MBCNType( /*in*/ const int imesh_entity_topology,
162  /*out*/ int* mbcn_type );
163 
164 /**\brief Access tag data via direct pointer into contiguous blocks
165  *
166  * Iteratively obtain direct access to contiguous blocks of tag
167  * storage. This function cannot be used with bit tags because
168  * of the compressed bit storage. This function cannot be used
169  * with variable length tags because it does not provide a mechanism
170  * to determine the length of the value for each entity. This
171  * function may be used with sparse tags, but if it is used, it
172  * will return data for a single entity at a time.
173  *
174  *\Note If this function is called for entities for which no tag value
175  * has been set, but for which a default value exists, it will
176  * force the allocation of explicit storage for each such entity
177  * even though MOAB would normally not explicitly store tag values
178  * for such entities.
179  *
180  *\Example:
181  *\code
182  *\endcode
183  */
184 void iMesh_tagIterate( iMesh_Instance instance,
185  /**< [in] iMesh instance */
186  const iBase_TagHandle tag_handle,
187  /**< [in] Tag being queried */
188  iBase_EntityArrIterator entArr_iterator,
189  /**< [in] Iterator being queried */
190  void* tag_value,
191  /**< [out] Pointer to pointer that will be set to tag data memory */
192  int* count,
193  /**< [out] Number of contiguous entities in this subrange */
194  int* err
195  /**< [out] Returned Error status (see iBase_ErrorType) */
196 );
197 
198 /**\brief Access connectivity data via direct pointer into contiguous blocks
199  *
200  * Iteratively obtain direct access to contiguous blocks of connectivity
201  * storage.
202  *
203  */
204 void iMesh_connectIterate( iMesh_Instance instance,
205  /**< [in] iMesh instance */
206  iBase_EntityArrIterator entArr_iterator,
207  /**< [in] Iterator being queried */
208  iBase_EntityHandle** connect,
209  /**< [out] Pointer to pointer that will be set to connectivity data memory */
210  int* verts_per_entity,
211  /**< [out] Number of vertices per entity in this subrange */
212  int* count,
213  /**< [out] Number of contiguous entities in this subrange */
214  int* err
215  /**< [out] Returned Error status (see iBase_ErrorType) */
216 );
217 
218 /**\brief Access coordinates data via direct pointer into contiguous blocks
219  *
220  * Iteratively obtain direct access to contiguous blocks of coordinate
221  * storage.
222  *
223  */
224 void iMesh_coordsIterate( iMesh_Instance instance,
225  /**< [in] iMesh instance */
226  iBase_EntityArrIterator entArr_iterator,
227  /**< [in] Iterator being queried */
228  double** coordsx,
229  /**< [out] Pointer to pointer x coordinates */
230  double** coordsy,
231  /**< [out] Pointer to pointer y coordinates */
232  double** coordsz,
233  /**< [out] Pointer to pointer z coordinates */
234  int* count,
235  /**< [out] Number of contiguous entities in this subrange */
236  int* err
237  /**< [out] Returned Error status (see iBase_ErrorType) */
238 );
239 
240 /***************************************************************************/ /**
241  * \ingroup
242  *EntityIterators
243  * \brief Step the
244  *iterator a specified
245  *number of entities
246  *
247  * Step the iterator a
248  *specified number of
249  *entities. If this
250  *number is greater
251  * than the number of
252  *entities left in the
253  *iterator, the
254  *iterator is placed
255  * at the end and
256  *at_end is returned
257  *non-zero; otherwise
258  *at_end is returned
259  *zero.
260  ******************************************************************************/
261 
262 void iMesh_stepEntIter( iMesh_Instance instance,
263  /**< [in] iMesh instance handle */
264  iBase_EntityIterator ent_iterator,
265  /**< [in] Iterator being queried */
266  int step_length,
267  /**< [in] Number of entities to step the iterator */
268  int* at_end,
269  /**< [out] Non-zero if iterator is at the end of the iteration */
270  int* err
271  /**< [out] Returned Error status (see iBase_ErrorType) */
272 );
273 
274 void iMesh_stepEntArrIter( iMesh_Instance instance,
275  /**< [in] iMesh instance handle */
276  iBase_EntityArrIterator entArr_iterator,
277  /**< [in] Iterator being queried */
278  int step_length,
279  /**< [in] Number of entities to step the iterator */
280  int* at_end,
281  /**< [out] Non-zero if iterator is at the end of the iteration */
282  int* err
283  /**< [out] Returned Error status (see iBase_ErrorType) */
284 );
285 
286 /***************************************************************************/ /**
287  * \ingroup
288  *EntityIterators
289  * \brief Initialize
290  *an array iterator
291  *over specified
292  *entity type,
293  *topology, and size,
294  *with an optional
295  *recursive flag.
296  *
297  * Initialize an array
298  *iterator over
299  *specified entity
300  *type, topology, and
301  * size, for a
302  *specified set or
303  *instance. Iterator
304  *returned can be used
305  * as input to
306  *functions returning
307  *entities for the
308  *iterator. If all
309  * entities of a
310  *specified type
311  *and/or topology are
312  *to be iterated,
313  * specify
314  *iBase_ALL_TYPES or
315  *iMesh_ALL_TOPOLOGIES,
316  *respectively.
317  * Specified type or
318  *topology must be a
319  *value in the
320  *iBase_EntityType or
321  * iMesh_EntityTopology
322  *enumerations,
323  *respectively. If
324  *recursive is true,
325  * entities are
326  *retrieved
327  *recursively through
328  *contained (but not
329  *child) sets.
330  ******************************************************************************/
331 
333  /**< [in] iMesh instance handle */
334  const iBase_EntitySetHandle entity_set_handle,
335  /**< [in] Entity set being iterated */
336  const int requested_entity_type,
337  /**< [in] Type of entity to iterate */
338  const int requested_entity_topology,
339  /**< [in] Topology of entity to iterate */
340  const int requested_array_size,
341  /**< [in] Size of chunks of handles returned for each value of the
342  iterator */
343  const int resilient,
344  /**< [in] If zero, return a non-resilient iterator.
345  Otherwise, a resilient iterator (\ref resilient) */
346  const int recursive,
347  /**< [in] If non-zero, entities retrieved recursively */
348  iBase_EntityArrIterator* entArr_iterator,
349  /**< [out] Pointer to iterator returned from function */
350  int* err
351  /**< [out] Returned Error status (see iBase_ErrorType) */
352 );
353 
354 /***************************************************************************/ /**
355  * \ingroup Tags
356  * \brief Get all the
357  *tags associated with
358  *the entire interface
359  *
360  * Get all the tags
361  *associated with the
362  *entire interface
363  ******************************************************************************/
364 
366  /*inout*/ iBase_TagHandle** tag_handles,
367  /*inout*/ int* tag_handles_allocated,
368  /*out*/ int* tag_handles_size,
369  /*out*/ int* err );
370 
371 /***************************************************************************/ /**
372  * \ingroup Tags
373  * \brief Create a
374  *tag with options
375  *
376  * Create a tag with
377  *options; allows
378  *creation of Dense
379  *and Bit tags through
380  *iMesh Allowable
381  *options are:
382  * TAG_STORAGE_TYPE={DENSE
383  *| SPARSE | BIT |
384  *MESH}
385  * TAG_DEFAULT_VALUE=<value>
386  *(data type of value
387  *should match tag
388  *data type)
389  ******************************************************************************/
390 
392  /**< [in] iMesh instance handle */
393  /*in*/ const char* tag_name,
394  /**< [in] tag name*/
395  /*in*/ const char* tmp_tag_options,
396  /**< [in] options string */
397  /*in*/ const int tag_size,
398  /**< [in] tag size, in number of values */
399  /*in*/ const int tag_type,
400  /**< [in] tag data type (int, double, etc.) */
401  /*out*/ iBase_TagHandle* tag_handle,
402  /**< [out] handle of new tag */
403  /*out*/ int* err,
404  /**< [out] error */
405  /*in*/ const int tag_name_len,
406  /**< [in] length of tag name string */
407  /*in*/ const int tag_options_len );
408 /**< [in] length of options string */
409 
410 /***************************************************************************/ /**
411  * \ingroup ScdMesh
412  * \brief Create a
413  *structured mesh
414  *
415  * Create a structured
416  *mesh, with local and
417  *(optionally) global
418  *ijk parameters and
419  * optional physical
420  *positions. If
421  *running in parallel,
422  *can request shared
423  *vertex resolution
424  * and optional number
425  *and type of ghost
426  *layers of elements.
427  *Global parameters
428  *are used to compute
429  * global ids, which
430  *are used in shared
431  *vertex resolution.
432  ******************************************************************************/
433 
435  iMesh_Instance instance,
436  /**< [in] iMesh instance handle */
437  int* local_dims,
438  /**< [in] Min/max corners of local ijk parameters, -1 for unused dimensions; specified as
439  ilo, jlo, klo, ihi, jhi, khi. */
440  int* global_dims,
441  /**< [in] Min/max corners of global ijk parameters, -1 for unused dimensions; NULL if running in
442  serial. Order similar to local_dims. */
443  double* i_vals,
444  /**< [in] Physical positions of i values, NULL if not placed in physical space. */
445  double* j_vals,
446  /**< [in] Physical positions of j values, NULL if not placed in physical space. */
447  double* k_vals,
448  /**< [in] Physical positions of k values, NULL if not placed in physical space. */
449  int resolve_shared,
450  /**< [in] Non-zero if running in parallel and resolution of shared vertices is desired, zero
451  otherwise. */
452  int ghost_dim,
453  /**< [in] Dimension of entities to ghost, -1 if none desired. */
454  int bridge_dim,
455  /**< [in] Dimension of bridge entities used to compute ghosts, -1 if no ghosts desired. */
456  int num_layers,
457  /**< [in] Number of layers of ghosts desired, -1 if no ghosts desired. */
458  int addl_ents,
459  /**< [in] Dimension of addition entities adjacent to ghosts to exchange. */
460  int vert_gids,
461  /**< [in] If non-zero, assigns global ids to vertices, according to global parameterization. */
462  int elem_gids,
463  /**< [in] If non-zero, assigns global ids to elements, according to global parameterization. */
464  iBase_EntitySetHandle* set_handle,
465  /**< [inout] A set to which the underlying ScdBox set will be added. NULL if not desired.
466  * If *NULL, will be set directly to the underlying ScdBox's set. */
467  int* err
468  /**< [out] Error flag. */
469 );
470 /***************************************************************************/ /**
471  * \brief Free memory
472  *allocated with
473  *malloc
474  *
475  ******************************************************************************/
476 
477 void iMesh_freeMemory( iMesh_Instance instance,
478  /**< [in] iMesh instance handle */
479  void** ptrToMem );
480 
481 /***************************************************************************/ /**
482  * \defgroup ScdMesh
483  *Structured Mesh
484  * \ingroup
485  *iMeshExtensions
486  ******************************************************************************/
487 
488 /***************************************************************************/ /**
489  * \defgroup
490  *iMeshExtensions
491  *iMesh Extensions
492  * \ingroup iMesh
493  ******************************************************************************/
494 
495 #ifdef __cplusplus
496 }
497 #endif
498 
499 #endif