MOAB: Mesh Oriented datABase  (version 5.5.0)
iMeshP.h
Go to the documentation of this file.
1 #ifndef _ITAPS_iMeshP
2 #define _ITAPS_iMeshP
3 
4 #include "iMesh.h"
5 #include "iMeshP_protos.h"
6 #include "moab_mpi.h"
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /** Handles needed in iMeshP */
13 typedef struct iMeshP_PartitionHandle_Private* iMeshP_PartitionHandle;
14 typedef struct iMeshP_RequestHandle_Private* iMeshP_RequestHandle;
15 
16 /* Since we allow overloading of iMesh functions' entity set handles with
17  * part handles, iMeshP_PartHandle must be defined the same as
18  * iBase_EntitySetHandle. */
20 
21 typedef unsigned iMeshP_Part;
22 
23 /** Types for classifying entities within a part. */
25 {
26  iMeshP_INTERNAL, /**< An owned entity that is not on a part boundary. */
27  iMeshP_BOUNDARY, /**< A shared entity on a part boundary. */
28  iMeshP_GHOST /**< An entity copy that is not a shared boundary entity. */
29 };
30 
31 /** Part ID number indicating information should be returned about all parts. */
32 #define iMeshP_ALL_PARTS ( -1 )
33 
34 /** \page imeshp iMeshP: ITAPS Parallel Mesh Interface
35 iMeshP.h -- ITAPS Parallel Mesh Interface
36 
37 Release 0.1; October 2008
38 
39 \section ADM Abstract Data Model
40 - The term "mesh" refers to an abstraction in the data model;
41  it does not imply a serial or parallel distribution.
42 - The term "partition" refers to an assignment of a set of entities to
43  subsets; like a "mesh," it does not imply a serial or parallel
44  implementation.
45 - An application may use one or more meshes.
46 - Partitions can create subsets of entities from one or more meshes.
47 - Meshes can be subdivided by one or more partitions.
48 - Partitions contain parts. Parts contain the subsets of entities in the
49  partition.
50 
51 \section PAR Parallelism
52 - A "process" can be thought of as an MPI process. The
53  number of processes can be considered to be the result of MPI_Comm_size.
54  The rank of a process can be thought of as the result of MPI_Comm_rank.
55  We will think in terms of processes rather than processors. Initial
56  implementations of the parallel interface will likely use MPI terminology
57  directly; future implementations may accommodate other communication
58  paradigms and libraries.
59 - Partitions have communicators associated with them. These communicators
60  can be thought of as MPI communicators.
61 - "Global" operations are operations performed with respect to a
62  partition's communicator.
63 - "Local" operations are operations performed with respect to a part or
64  a mesh instance within a process.
65 - Part A "neighbors" Part B if Part A has copies of entities owned by Part B
66  and/or if Part B has copies of entities owned by Part A.
67 
68 \section INT Interfaces
69 - Each process has one or more "mesh instances." A mesh instance can be
70  thought of as a mesh database. An implementation should support the
71  existence of more than one mesh instance per process (e.g., it should
72  always associate mesh data with a mesh instance). However, we expect
73  applications would most often use only one mesh instance per process.
74 - There is one root set per mesh instance.
75 - Each process may have one or more partition handles.
76 - A partition assigns entities from one mesh instance to parts.
77 - Entities in a mesh instance can be partitioned by one or more partitions.
78  Mesh instances know which partitions they contain.
79 - Parts are uniquely identified globally by part IDs of type iMeshP_Part.
80  Local parts can also be accessed by part handles that provide more
81  direct access to a part.
82  Functions accepting part handles operate correctly on only local
83  parts (parts on the calling process); they will return an error
84  for remote (off-process) parts.
85 - Generation and management of global IDs for entities
86  is not included in the iMeshP interface. It can
87  be provided as a service above the iMeshP interface.
88  Uniqueness of global IDs is managed at the partition level.
89 
90 \section PRT Using Parts
91 - Each part is wholly contained within a process.
92 - A process may have zero, one or multiple parts.
93 - For each entity that is copied onto remote parts, the owning part knows
94  both the remote part ID and remote entity handle of all copies.
95 - All parts with copies of a boundary entity know the remote part ID
96  and remote entity handle of all copies of the entity.
97 - All parts with copies of any entity know the part ID and
98  entity handle corresponding to the owner of the entity.
99 - Functions that return entity information for a part, set or mesh
100  instance return the information for all entities (including copies and
101  ghosts) in that part, set or mesh instance. Applications can check
102  whether an entity is owned or a ghost using iMeshP_isEntOwner or
103  iMeshP_getEntStatus.
104 - Many iMesh functions that accept an iBase_EntitySetHandle
105  are also useful in the context of a iMeshP_PartHandle.
106  These functions are reinterpreted so that they can accept either an
107  iBase_EntitySetHandle or an iMeshP_PartHandle.
108 - In particular, entities are added to and removed from local parts via
109  the same functions that are used to manipulate entity sets.
110  That is, given a mesh instance, an entity handle, and a part handle,
111  the entity is added to or removed from the part via calls to
112  the following functions with the part handle passed as the entity set handle:
113  - Add entity to part --> iMesh_addEntToSet
114  - Remove entity from part --> iMesh_rmvEntFromSet
115  - Add array of entities to part --> iMesh_addEntArrToSet
116  - Remove array of entities from part --> iMesh_rmvEntArrFromSet
117 
118 \section CMM Communication
119 - Each function description includes its communication requirements. The
120  options are described here:
121  - COMMUNICATION: Collective -- the function must be called by all
122  processes in the partition's communicator. (These functions have the
123  suffix "All" to indicate collective communication is done.)
124  - COMMUNICATION: Point-to-Point -- communication is used, but the
125  communication is from one process to only one other process. The
126  receiving process must issue an appropriate receive call to receive
127  the message.
128  - COMMUNICATION: None -- the function does not use communication; only
129  local operations are performed.
130  - COMMUNICATION: None++ -- no communication is done; the values
131  are precomputed by iMeshP_syncPartitionAll or iMeshP_syncMeshAll.
132 - Non-blocking calls for off-processor mesh-modification return a request
133  that indicates whether or not the operation has completed. The request
134  is more than an MPI request; it encapsulates both the MPI information and
135  the mesh operations that were requested. If non-blocking calls are used,
136  appropriate calls to iMeshP "wait" or "poll" functions must be used to
137  handle and satisfy requests.
138 */
139 
140 /*------------------------------------------------------------------------*/
141 /*------------------------------------------------------------------------*/
142 /* Partition Functionality */
143 /*------------------------------------------------------------------------*/
144 /*------------------------------------------------------------------------*/
145 
146 /** \brief Create a partition; return its handle.
147  *
148  * Given a mesh instance and a communicator,
149  * return a partition handle for a new partition within the mesh instance
150  * that uses the communicator.
151  * In the future, we may have different creation routines for different
152  * communication systems; once the partition is created, the application
153  * would not have to worry about the communication system again.
154  * For now, implementations are MPI based, so MPI communicators are provided.
155  * For serial use, the communicator may be MPI_COMM_SELF or communicator may
156  * be NULL.
157  *
158  * COMMUNICATION: Collective.
159  *
160  * \param instance (In) Mesh instance to contain the partition.
161  * \param communicator (In) Communicator to be used for parallel
162  * communication.
163  * \param partition (Out) The newly created partition.
164  * \param err (Out) Error code.
165  */
167  MPI_Comm communicator,
168  iMeshP_PartitionHandle* partition,
169  int* err );
170 
171 /** \brief Destroy a partition.
172  *
173  * Given a partition handle,
174  * destroy the partition associated with the handle.
175  * Note that the partition handle is not invalidated upon return.
176  *
177  * COMMUNICATION: Collective.
178  *
179  * \param instance (In) Mesh instance containing the partition.
180  * \param partition (In) The partition to be destroyed.
181  * \param err (Out) Error code.
182  */
183 void iMeshP_destroyPartitionAll( iMesh_Instance instance, iMeshP_PartitionHandle partition, int* err );
184 
185 /** \brief Return communicator associated with a partition.
186  *
187  * Given a partition handle, return the communicator associated with
188  * it during its creation by iMeshP_createPartitionAll.
189  *
190  * COMMUNICATION: None
191  *
192  * \param instance (In) Mesh instance containing the partition.
193  * \param partition (In) The partition being queried.
194  * \param communicator (Out) Communicator associated with the partition.
195  * \param err (Out) Error code.
196  */
198  iMeshP_PartitionHandle partition,
199  MPI_Comm* communicator,
200  int* err );
201 
202 /** \brief Update a partition after parts have been added.
203  *
204  * This function gives the implementation an opportunity to locally store info
205  * about the partition so that queries on the partition can be
206  * performed without synchronous communication.
207  * This function must be called after all parts have been added to the
208  * partition and after changes to the partition (e.g., due to load balancing).
209  * Values that are precomputed by syncPartitionAll include:
210  * - the total number of parts in a partition;
211  * - the mapping between part IDs and processes; and
212  * - updated remote entity handle information.
213  *
214  * COMMUNICATION: Collective.
215  *
216  * \param instance (In) Mesh instance containing the partition.
217  * \param partition (In) The partition being updated.
218  * \param err (Out) Error code.
219  */
220 void iMeshP_syncPartitionAll( iMesh_Instance instance, iMeshP_PartitionHandle partition, int* err );
221 
222 /** \brief Return the number of partitions associated with a mesh instance.
223  *
224  * Given a mesh instance, return the number of partition handles
225  * associated with the mesh instance.
226  *
227  * COMMUNICATION: None.
228  *
229  * \param instance (In) Mesh instance containing the partitions.
230  * \param num_partitions (Out) Number of partitions associated with the
231  * mesh instance.
232  * \param err (Out) Error code.
233  */
234 void iMeshP_getNumPartitions( iMesh_Instance instance, int* num_partitions, int* err );
235 
236 /** \brief Return the partition handles associated with a mesh instance.
237  *
238  * Given a mesh instance, return all partition handles
239  * associated with the mesh instance.
240  *
241  * COMMUNICATION: None.
242  *
243  * \param instance (In) Mesh instance containing the
244  * partitions.
245  * \param partitions (In/Out) Array of partition handles
246  * associated with the mesh
247  * instance.
248  * \param partitions_allocated (In/Out) Allocated size of
249  * partitions array.
250  * \param partitions_size (Out) Occupied size of
251  * partitions array.
252  * \param err (Out) Error code.
253  */
254 void iMeshP_getPartitions( iMesh_Instance instance,
255  iMeshP_PartitionHandle** partitions,
256  int* partitions_allocated,
257  int* partitions_size,
258  int* err );
259 
260 /** \brief Return the global number of parts in a partition.
261  *
262  * Given a partition handle, return the total number of parts
263  * in the partition across all processes in the partition's communicator.
264  *
265  * COMMUNICATION: None++.
266  *
267  * \param instance (In) Mesh instance containing the partition.
268  * \param partition (In) The partition being queried.
269  * \param num_global_part (Out) Global number of parts in the partition.
270  * \param err (Out) Error code.
271  */
273  const iMeshP_PartitionHandle partition,
274  int* num_global_part,
275  int* err );
276 
277 /** \brief Return the local number of parts in a partition.
278  *
279  * Given a partition handle, return the number of local (on-process) parts
280  * in the partition.
281  *
282  * COMMUNICATION: None.
283  *
284  * \param instance (In) Mesh instance containing the partition.
285  * \param partition (In) The partition being queried.
286  * \param num_local_part (Out) Local (on-process) number of parts in
287  * the partition.
288  * \param err (Out) Error code.
289  */
291  const iMeshP_PartitionHandle partition,
292  int* num_local_part,
293  int* err );
294 
295 /** \brief Return the part handles of local parts in a partition.
296  *
297  * Given a partition handle, return the
298  * part handles for the local (on-process) parts in the partition.
299  *
300  * COMMUNICATION: None.
301  *
302  * \param instance (In) Mesh instance containing the
303  * partition.
304  * \param partition (In) The partition being queried.
305  * \param parts (In/Out) Array of part handles
306  * for local parts in the partition.
307  * \param parts_allocated (In/Out) Allocated size of
308  * parts array.
309  * \param parts_size (Out) Occupied size of
310  * parts array.
311  * \param err (Out) Error code.
312  */
313 void iMeshP_getLocalParts( iMesh_Instance instance,
314  const iMeshP_PartitionHandle partition,
315  iMeshP_PartHandle** parts,
316  int* parts_allocated,
317  int* parts_size,
318  int* err );
319 
320 /** \brief Return the process rank of a given part.
321  *
322  * Given a partition handle and a part ID, return the process rank
323  * (with respect to the partition's communicator) of the
324  * process that owns the part. The part may be local or remote.
325  *
326  * COMMUNICATION: None++.
327  *
328  * \param instance (In) Mesh instance containing the partition.
329  * \param partition (In) The partition being queried.
330  * \param part_id (In) Part ID for the part being queried.
331  * \param rank (Out) Process rank of part_id.
332  * \param err (Out) Error code.
333  */
334 void iMeshP_getRankOfPart( iMesh_Instance instance,
335  const iMeshP_PartitionHandle partition,
336  const iMeshP_Part part_id,
337  int* rank,
338  int* err );
339 
340 /** \brief Return the process ranks of given parts.
341  *
342  * Given a partition handle and an array of part IDs, return the process ranks
343  * (with respect to the partition's communicator) of the
344  * process that owns each part. The parts may be local or remote.
345  *
346  * COMMUNICATION: None++.
347  *
348  * \param instance (In) Mesh instance containing the partition.
349  * \param partition (In) The partition being queried.
350  * \param part_ids (In) Array of Part IDs for the parts being
351  * queried.
352  * \param part_ids_size (In) The number of Part IDs in part_ids.
353  * \param ranks (In/Out) Array of ranks for the Part Ids in
354  * part_ids.
355  * \param ranks_allocated (In/Out) Allocated size of ranks array.
356  * \param ranks_size (Out) Occupied size of ranks array.
357  * \param err (Out) Error code.
358  */
360  const iMeshP_PartitionHandle partition,
361  const iMeshP_Part* part_ids,
362  const int part_ids_size,
363  int** ranks,
364  int* ranks_allocated,
365  int* ranks_size,
366  int* err );
367 
368 /** \brief Return the number of entities of a given type in a partition.
369  *
370  * Given a partition handle and an entity set (possibly the root set),
371  * return the global number of entities of a
372  * given entity type in the partition and set. This function may require
373  * communication and, thus, must be called by all processes in the partition's
374  * communicator.
375  *
376  * COMMUNICATION: Collective.
377  *
378  * \param instance (In) Mesh instance containing the partition.
379  * \param partition (In) The partition being queried.
380  * \param entity_set (In) Entity set handle for the entity set
381  * being queried.
382  * \param entity_type (In) Requested entity type;
383  * may be iBase_ALL_TYPES.
384  * \param num_type (Out) Number of entities of entity_type in
385  * the partition and entity set.
386  * \param err (Out) Error code.
387  */
389  const iMeshP_PartitionHandle partition,
390  const iBase_EntitySetHandle entity_set,
391  int entity_type,
392  int* num_type,
393  int* err );
394 
395 /** \brief Return the number of entities of a given topology in a partition.
396  *
397  * Given a partition handle and an entity set (possibly the root set),
398  * return the global number of entities of a
399  * given entity topology in the partition and set. This function may require
400  * communication and, thus, must be called by all processes in the partition's
401  * communicator.
402  *
403  * COMMUNICATION: Collective.
404  *
405  * \param instance (In) Mesh instance containing the partition.
406  * \param partition (In) The partition being queried.
407  * \param entity_set (In) Entity set handle for the entity set
408  * being queried; may be the root set.
409  * \param entity_topology (In) Requested entity topology;
410  * may be iMesh_ALL_TOPOLOGIES.
411  * \param num_topo (Out) Number of entities with entity_topology in
412  * the partition and entity set.
413  * \param err (Out) Error code.
414  */
416  const iMeshP_PartitionHandle partition,
417  const iBase_EntitySetHandle entity_set,
418  int entity_topology,
419  int* num_topo,
420  int* err );
421 
422 /*------------------------------------------------------------------------*/
423 /*------------------------------------------------------------------------*/
424 /* Part Functionality */
425 /*------------------------------------------------------------------------*/
426 /*------------------------------------------------------------------------*/
427 
428 /** \brief Create a new part in a partition.
429  *
430  * Given a partition handle, create a new part and add it to the
431  * partition on the process invoking the creation. Return the part handle
432  * for the new part.
433  *
434  * COMMUNICATION: None.
435  *
436  * \param instance (In) Mesh instance containing the partition.
437  * \param partition (In) The partition being updated.
438  * \param part (Out) The newly created part.
439  * \param err (Out) Error code.
440  */
441 void iMeshP_createPart( iMesh_Instance instance, iMeshP_PartitionHandle partition, iMeshP_PartHandle* part, int* err );
442 
443 /** \brief Remove a part from a partition.
444  *
445  * Given a partition handle and a part handle, remove the part
446  * from the partition and destroy the part. Note that the part handle
447  * is not invalidated by this function.
448  *
449  * COMMUNICATION: None.
450  *
451  * \param instance (In) Mesh instance containing the partition.
452  * \param partition (In) The partition being updated.
453  * \param part (In) The part to be removed.
454  * \param err (Out) Error code.
455  */
456 void iMeshP_destroyPart( iMesh_Instance instance, iMeshP_PartitionHandle partition, iMeshP_PartHandle part, int* err );
457 
458 /** \brief Obtain a part ID from a part handle.
459  *
460  * Given a partition handle and a local part handle, return the part ID.
461  * If the part handle is not a valid part handle for a local part,
462  * an error is returned.
463  *
464  * COMMUNICATION: None.
465  *
466  * \param instance (In) Mesh instance containing the partition.
467  * \param partition (In) The partition being queried.
468  * \param part (In) The part being queried.
469  * \param part_id (Out) Part ID for part.
470  * \param err (Out) Error code.
471  */
473  const iMeshP_PartitionHandle partition,
474  const iMeshP_PartHandle part,
475  iMeshP_Part* part_id,
476  int* err );
477 
478 /** \brief Obtain part IDs from part handles.
479  *
480  * Given a partition handle and an array of local part handles,
481  * return the part ID for each part handle.
482  * If any part handle is not a valid part handle for a local part,
483  * an error is returned.
484  *
485  * COMMUNICATION: None.
486  *
487  * \param instance (In) Mesh instance containing the partition.
488  * \param partition (In) The partition being queried.
489  * \param parts (In) Array of part handles for the parts
490  * being queried.
491  * \param parts_size (In) Number of part handles being queried.
492  * \param part_ids (In/Out) Array of part IDs associated with the
493  * parts.
494  * \param part_ids_allocated (In/Out) Allocated size of part_ids array.
495  * \param part_ids_size (Out) Occupied size of part_ids array.
496  * \param err (Out) Error code.
497  */
499  const iMeshP_PartitionHandle partition,
500  const iMeshP_PartHandle* parts,
501  const int parts_size,
502  iMeshP_Part** part_ids,
503  int* part_ids_allocated,
504  int* part_ids_size,
505  int* err );
506 
507 /** \brief Obtain a part handle from a part ID.
508  *
509  * Given a partition handle and a part ID, return the part handle
510  * associated with the part
511  * if the part is local; otherwise, return an error code.
512  *
513  * COMMUNICATION: None.
514  *
515  * \param instance (In) Mesh instance containing the partition.
516  * \param partition (In) The partition being queried.
517  * \param part_id (In) Part ID for the part being queried.
518  * \param part (Out) Part handle associated with part_id.
519  * \param err (Out) Error code.
520  */
522  const iMeshP_PartitionHandle partition,
523  iMeshP_Part part_id,
524  iMeshP_PartHandle* part,
525  int* err );
526 
527 /** \brief Obtain part handles from part IDs.
528  *
529  * Given a partition handle and an array of local part IDs,
530  * return the part handle for each part ID.
531  * If any part ID is not a valid part ID for a local part,
532  * an error is returned.
533  *
534  * COMMUNICATION: None.
535  *
536  * \param instance (In) Mesh instance containing the
537  * partition.
538  * \param partition (In) The partition being queried.
539  * \param part_ids (In) Array of part IDs for the parts
540  * being queried.
541  * \param part_ids_size (In) Number of part IDs being queried.
542  * \param parts (In/Out) Array of part handles associated
543  * with the part_ids.
544  * \param parts_allocated (In/Out) Allocated size of parts
545  * array.
546  * \param parts_size (Out) Occupied size of parts
547  * array.
548  * \param err (Out) Error code.
549  */
551  const iMeshP_PartitionHandle partition,
552  const iMeshP_Part* part_ids,
553  const int part_ids_size,
554  iMeshP_PartHandle** parts,
555  int* parts_allocated,
556  int* parts_size,
557  int* err );
558 
559 /*------------------------------------------------------------------------*/
560 /* Part Boundaries */
561 /*------------------------------------------------------------------------*/
562 
563 /** \brief Return the number of parts that neighbor a given part.
564  *
565  * Given a partition handle, a part handle, and an entity type,
566  * return the number of parts in the partition that neighbor the given part
567  * (i.e., that (1) have copies of entities of the given entity type owned by
568  * the given part or (2) own entities of the given entity type that are
569  * copied on the given part).
570  *
571  * COMMUNICATION: None++.
572  *
573  * \param instance (In) Mesh instance containing the partition.
574  * \param partition (In) The partition being queried.
575  * \param part (In) The part being queried.
576  * \param entity_type (In) Entity type of the copied entities;
577  * may be iBase_ALL_TYPES.
578  * \param num_part_nbors (Out) Number of parts neighboring the given part.
579  * \param err (Out) Error code.
580  */
582  const iMeshP_PartitionHandle partition,
583  const iMeshP_PartHandle part,
584  int entity_type,
585  int* num_part_nbors,
586  int* err );
587 
588 /** \brief Return the number of parts that neighbor given parts.
589  *
590  * Given a partition handle, an array of part handles, and an entity type,
591  * return the number of parts in the partition that neighbor each of the
592  * given parts
593  * (i.e., that (1) have copies of entities of the given entity type owned by
594  * the given part or (2) own entities of the given entity type that are
595  * copied on the given part).
596  *
597  * COMMUNICATION: None++.
598  *
599  * \param instance (In) Mesh instance containing the
600  * partition.
601  * \param partition (In) The partition being queried.
602  * \param parts (In) Array of part handles for the
603  * parts being queried.
604  * \param parts_size (In) Number of part handles in
605  * parts.
606  * \param entity_type (In) Entity type of the copied
607  * entities;
608  * may be iBase_ALL_TYPES.
609  * \param num_part_nbors (In/Out) Array of values specifying the
610  * number of part neighbors for
611  * each part in parts.
612  * \param num_part_nbors_allocated (In/Out) Allocated size of num_part_nbors
613  * array.
614  * \param num_part_nbors_size (Out) Occupied size of num_part_nbors
615  * array.
616  * \param err (Out) Error code.
617  */
619  const iMeshP_PartitionHandle partition,
620  const iMeshP_PartHandle* parts,
621  int parts_size,
622  int entity_type,
623  int** num_part_nbors,
624  int* num_part_nbors_allocated,
625  int* num_part_nbors_size,
626  int* err );
627 
628 /** \brief Return the parts that neighbor a given part.
629  *
630  * Given a partition handle, a part handle, and an entity type,
631  * return the part IDs of parts that neighbor the given part
632  * (i.e., that (1) have copies of entities of the given entity type owned by
633  * the given part or (2) own entities of the given entity type that are
634  * copied on the given part).
635  *
636  * COMMUNICATION: None++.
637  *
638  * \param instance (In) Mesh instance containing the
639  * partition.
640  * \param partition (In) The partition being queried.
641  * \param part (In) The part being queried.
642  * \param entity_type (In) Entity type of the copied
643  * entities;
644  * may be iBase_ALL_TYPES.
645  * \param num_part_nbors (Out) Number of parts neighboring
646  * the given part.
647  * \param nbor_part_ids (In/Out) Array of part IDs for
648  * part neighbors of part.
649  * \param nbor_part_ids_allocated (In/Out) Allocated size of nbor_part_ids
650  * array.
651  * \param nbor_part_ids_size (Out) Occupied size of nbor_part_ids
652  * array.
653  * \param err (Out) Error code.
654  */
655 void iMeshP_getPartNbors( iMesh_Instance instance,
656  const iMeshP_PartitionHandle partition,
657  const iMeshP_PartHandle part,
658  int entity_type,
659  int* num_part_nbors,
660  iMeshP_Part** nbor_part_ids,
661  int* nbor_part_ids_allocated,
662  int* nbor_part_ids_size,
663  int* err );
664 
665 /** \brief Return the parts that neighbor given parts.
666  *
667  * Given a partition handle, an array of part handles, and an entity type,
668  * return the part IDs of parts that neighbor the given parts
669  * (i.e., that (1) have copies of entities of the given entity type owned by
670  * the given part or (2) own entities of the given entity type that are
671  * copied on the given part).
672  *
673  * COMMUNICATION: None++.
674  *
675  * \param instance (In) Mesh instance containing the
676  * partition.
677  * \param partition (In) The partition being queried.
678  * \param parts (In) The parts being queried.
679  * \param parts_size (In) The number of parts being queried.
680  * \param entity_type (In) Entity type of the copied
681  * entities;
682  * may be iBase_ALL_TYPES.
683  * \param num_part_nbors (In/Out) Array of values specifying the
684  * number of part neighbors for
685  * each part in parts.
686  * \param num_part_nbors_allocated (In/Out) Allocated size of num_part_nbors
687  * array.
688  * \param num_part_nbors_size (Out) Occupied size of num_part_nbors
689  * array.
690  * \param nbor_part_ids (In/Out) Array of part IDs for
691  * part neighbors of part.
692  * \param nbor_part_ids_allocated (In/Out) Allocated size of nbor_part_ids
693  * array.
694  * \param nbor_part_ids_size (Out) Occupied size of nbor_part_ids
695  * array.
696  * \param err (Out) Error code.
697  */
699  const iMeshP_PartitionHandle partition,
700  const iMeshP_PartHandle* parts,
701  const int parts_size,
702  int entity_type,
703  int** num_part_nbors,
704  int* num_part_nbors_allocated,
705  int* num_part_nbors_size,
706  iMeshP_Part** nbor_part_ids,
707  int* nbor_part_ids_allocated,
708  int* nbor_part_ids_size,
709  int* err );
710 
711 /** \brief Return the number of entities on a part boundary.
712  *
713  * Given a partition handle, a part handle, an entity type and topology, and a
714  * target part ID, return the number of entities of the given type and/or
715  * topology on the part boundary shared with the target part.
716  *
717  * COMMUNICATION: None.
718  *
719  * \param instance (In) Mesh instance containing the partition.
720  * \param partition (In) The partition being queried.
721  * \param part (In) The part being queried.
722  * \param entity_type (In) Entity type of the boundary entities;
723  * may be iBase_ALL_TYPES.
724  * \param entity_topology (In) Entity topology of the boundary entities;
725  * may be iMesh_ALL_TOPOLOGIES.
726  * \param target_part_id (In) Part ID with which part is sharing
727  * the boundary entities; may be
728  * iMeshP_ALL_PARTS.
729  * \param num_entities (Out) Number of part boundary entities shared
730  * by part and target_part_id.
731  * \param err (Out) Error code.
732  */
734  const iMeshP_PartitionHandle partition,
735  const iMeshP_PartHandle part,
736  int entity_type,
737  int entity_topology,
738  iMeshP_Part target_part_id,
739  int* num_entities,
740  int* err );
741 
742 /** \brief Return the entity handles of entities on a part boundary.
743  *
744  * Given a partition handle, a part handle, an entity type and topology, and a
745  * target part ID, return the entity handles of entities of the given type
746  * and/or topology on the part boundary shared with the target part.
747  *
748  * COMMUNICATION: None.
749  *
750  * \param instance (In) Mesh instance containing the
751  * partition.
752  * \param partition (In) The partition being queried.
753  * \param part (In) The part being queried.
754  * \param entity_type (In) Entity type of the boundary
755  * entities;
756  * may be iBase_ALL_TYPES.
757  * \param entity_topology (In) Entity topology of the boundary
758  * entities;
759  * may be iMesh_ALL_TOPOLOGIES.
760  * \param target_part_id (In) Part ID with which part
761  * is sharing the boundary entities;
762  * may be iMeshP_ALL_PARTS.
763  * \param entities (In/Out) Array of entity handles for
764  * entities on the part boundary
765  * between part and
766  * target_part_id.
767  * \param entities_allocated (In/Out) Allocated size of entities
768  * array.
769  * \param entities_size (Out) Occupied size of entities
770  * array.
771  * \param err (Out) Error code.
772  */
774  const iMeshP_PartitionHandle partition,
775  const iMeshP_PartHandle part,
776  int entity_type,
777  int entity_topology,
778  iMeshP_Part target_part_id,
780  int* entities_allocated,
781  int* entities_size,
782  int* err );
783 
784 /** \brief Initialize an iterator over a specified part boundary.
785  *
786  * Given a partition handle, a part handle, and a
787  * target part ID, return an iterator over all entities of a given
788  * entity type and topology along
789  * the part boundary shared with the target part.
790  * Iterator functionality for getNext, reset, and end is
791  * provided through the regular iMesh iterator functions
792  * iMesh_getNextEntIter, iMesh_resetEntIter, and iMesh_endEntIter,
793  * respectively.
794  *
795  * COMMUNICATION: None.
796  *
797  * \param instance (In) Mesh instance containing the partition.
798  * \param partition (In) The partition being queried.
799  * \param part (In) The part being queried.
800  * \param entity_type (In) Entity type of the boundary entities;
801  * may be iBase_ALL_TYPES.
802  * \param entity_topology (In) Entity topology of the boundary entities;
803  * may be iMesh_ALL_TOPOLOGIES.
804  * \param target_part_id (In) Part ID with which part is sharing
805  * the boundary entities; may be
806  * iMeshP_ALL_PARTS.
807  * \param entity_iterator (Out) Iterator returned by the function.
808  * \param err (Out) Error code.
809  */
811  const iMeshP_PartitionHandle partition,
812  const iMeshP_PartHandle part,
813  int entity_type,
814  int entity_topology,
815  iMeshP_Part target_part_id,
816  iBase_EntityIterator* entity_iterator,
817  int* err );
818 
819 /** \brief Initialize an array iterator over a specified part boundary.
820  *
821  * Given a partition handle, a part handle, and a
822  * target part ID, return an array iterator over all entities of a given
823  * entity type and topology along
824  * the part boundary shared with the target part.
825  * Iterator functionality for getNext, reset, and end is
826  * provided through the regular iMesh iterator functions
827  * iMesh_getNextEntArrIter, iMesh_resetEntArrIter, and iMesh_endEntArrIter,
828  * respectively.
829  *
830  * COMMUNICATION: None.
831  *
832  * \param instance (In) Mesh instance containing the partition.
833  * \param partition (In) The partition being queried.
834  * \param part (In) The part being queried.
835  * \param entity_type (In) Entity type of the boundary entities;
836  * may be iBase_ALL_TYPES.
837  * \param entity_topology (In) Entity topology of the boundary entities;
838  * may be iMesh_ALL_TOPOLOGIES.
839  * \param array_size (In) Size of chunks of handles returned for
840  * each value of the iterator.
841  * \param target_part_id (In) Part ID with which part is sharing
842  * the boundary entities; may be
843  * iMeshP_ALL_PARTS.
844  * \param entity_iterator (Out) Iterator returned by the function.
845  * \param err (Out) Error code.
846  */
848  const iMeshP_PartitionHandle partition,
849  const iMeshP_PartHandle part,
850  int entity_type,
851  int entity_topology,
852  int array_size,
853  iMeshP_Part target_part_id,
854  iBase_EntityArrIterator* entity_iterator,
855  int* err );
856 
857 /*------------------------------------------------------------------------*/
858 /* Parts and Sets */
859 /*------------------------------------------------------------------------*/
860 
861 /** \brief Return the number of entities of a given type in both a part and an entity set.
862  *
863  * Given a part handle, an entity set handle, and an entity type, return
864  * the number of entities of the given type that are in BOTH the given
865  * part AND the given entity set.
866  * This function is similar to iMesh_getNumOfType, but it also restricts
867  * the returned data with respect to its existence in the given part.
868  *
869  * COMMUNICATION: None.
870  *
871  * \param instance (In) Mesh instance containing the partition.
872  * \param partition (In) The partition being queried.
873  * \param part (In) The part being queried.
874  * \param entity_set (In) Entity set handle for the entity set
875  * being queried; may be the root set.
876  * \param entity_type (In) Entity type of the boundary entities;
877  * may be iBase_ALL_TYPES.
878  * \param num_type (Out) Number of entities of entity_type in
879  * both part and entity_set.
880  * \param err (Out) Error code.
881  */
882 void iMeshP_getNumOfType( iMesh_Instance instance,
883  const iMeshP_PartitionHandle partition,
884  const iMeshP_PartHandle part,
885  const iBase_EntitySetHandle entity_set,
886  int entity_type,
887  int* num_type,
888  int* err );
889 
890 /** \brief Return the number of entities of a given topology in both a part and an entity set.
891  *
892  * Given a part handle, an entity set handle, and an entity topology, return
893  * the number of entities of the given topology that are in BOTH the given
894  * part AND the given entity set.
895  * This function is similar to iMesh_getNumOfTopo, but it also restricts
896  * the returned data with respect to its existence in the given part.
897  *
898  * COMMUNICATION: None.
899  *
900  * \param instance (In) Mesh instance containing the partition.
901  * \param partition (In) The partition being queried.
902  * \param part (In) The part being queried.
903  * \param entity_set (In) Entity set handle for the entity set
904  * being queried; may be the root set.
905  * \param entity_topology (In) Entity topology of the boundary entities;
906  * may be iMesh_ALL_TOPOLOGIES.
907  * \param num_topo (Out) Number of entities of entity_topology in
908  * both part and entity_set.
909  * \param err (Out) Error code.
910  */
911 void iMeshP_getNumOfTopo( iMesh_Instance instance,
912  const iMeshP_PartitionHandle partition,
913  const iMeshP_PartHandle part,
914  const iBase_EntitySetHandle entity_set,
915  int entity_topology,
916  int* num_topo,
917  int* err );
918 
919 /**\brief Get indexed representation of mesh or subset of mesh
920  *
921  * Given part handle and an entity set and optionally a type or topology,
922  * for all entities that are in BOTH the part and the entity set, return:
923  * - The entities in the part and set of the specified type or topology
924  * - The entities adjacent to those entities with a specified
925  * type, as a list of unique handles.
926  * - For each entity in the first list, the adjacent entities,
927  * specified as indices into the second list.
928  *
929  * COMMUNICATION: None.
930  *
931  *\param instance (In) Mesh instance containing the
932  * partition.
933  *\param partition (In) The partition being queried.
934  *\param part (In) The part being queried.
935  *\param entity_set_handle (In) The set being queried
936  *\param entity_type_requestor (In) If not iBase_ALL_TYPES, act only
937  * on the subset of entities with
938  * the specified type.
939  *\param entity_topology_requestor (In) If not iMesh_ALL_TOPOLOGIES, act
940  * only on the subset of entities with
941  * the specified topology.
942  *\param entity_type_requested (In) The type of the adjacent entities
943  * to return.
944  *\param entity_handles (In/Out) The handles of the (non-strict)
945  * subset of the union of the part
946  * and entity set, and the optional
947  * type and topology filtering
948  * arguments.
949  *\param adj_entity_handles (In/Out) The union of the entities of type
950  * 'requested_entity_type' adjacent
951  * to each entity in 'entity_handles'.
952  *\param adj_entity_indices (In/Out) For each entity in 'entity_handles',
953  * the adjacent entities of type
954  * 'entity_type_requested', specified as
955  * indices into 'adj_entity_handles'.
956  * The indices are concatenated into a
957  * single array in the order of the
958  * entity handles in 'entity_handles'.
959  *\param offset (In/Out) For each entity in the
960  * corresponding position in
961  * 'entity_handles', the position
962  * in 'adj_entity_indices' at which
963  * values for that entity are stored.
964  */
966  iMeshP_PartitionHandle partition,
967  iMeshP_PartHandle part,
968  iBase_EntitySetHandle entity_set_handle,
969  int entity_type_requestor,
970  int entity_topology_requestor,
971  int entity_type_requested,
972  iBase_EntityHandle** entity_handles,
973  int* entity_handles_allocated,
974  int* entity_handles_size,
975  iBase_EntityHandle** adj_entity_handles,
976  int* adj_entity_handles_allocated,
977  int* adj_entity_handles_size,
978  int** adj_entity_indices,
979  int* adj_entity_indices_allocated,
980  int* adj_entity_indices_size,
981  int** offset,
982  int* offset_allocated,
983  int* offset_size,
984  int* err );
985 
986 /** \brief Return entities in a both given part and entity set.
987  *
988  * Given an entity set handle
989  * and a part handle, return entity handles for entities
990  * that are in both the part and the entity set.
991  * This function is similar to iMesh_getEntities, but it also restricts
992  * the returned data with respect to its existence in the given part.
993  *
994  * COMMUNICATION: None.
995  *
996  * \param instance (In) Mesh instance containing the
997  * partition.
998  * \param partition (In) The partition being queried.
999  * \param part (In) The part being queried.
1000  * \param entity_set (In) Entity set handle for the
1001  * entity set being queried;
1002  * may be the root set.
1003  * \param entity_type (In) Entity type of the
1004  * entities;
1005  * may be iBase_ALL_TYPES.
1006  * \param entity_topology (In) Entity topology of the
1007  * entities;
1008  * may be iMesh_ALL_TOPOLOGIES.
1009  * \param entities (In/Out) Array of entity handles for
1010  * entities in both part
1011  * and entity_set.
1012  * \param entities_allocated (In/Out) Allocated size of entities.
1013  * \param entities_size (Out) Occupied size of entities.
1014  * \param err (Out) Error code.
1015  */
1016 void iMeshP_getEntities( iMesh_Instance instance,
1017  const iMeshP_PartitionHandle partition,
1018  const iMeshP_PartHandle part,
1019  const iBase_EntitySetHandle entity_set,
1020  int entity_type,
1021  int entity_topology,
1023  int* entities_allocated,
1024  int* entities_size,
1025  int* err );
1026 
1027 /** \brief Return entities adjacent to entities in a given part and entity set.
1028  *
1029  * Given an entity set handle
1030  * and a part handle, return entities adjacent (with respect to a given
1031  * entity type and/or topology) to entities
1032  * that are in both the part and the entity set.
1033  * This function is similar to iMesh_getAdjEntities, but it also restricts
1034  * the returned data with respect to its existence in the given part.
1035  * If a non-root entity set is specified, the function also returns
1036  * flags indicating whether each adjacent entity
1037  * is in the entity set; (*in_entity_set)[i]=1 indicates that adjacent entity
1038  * (*adj_entities)[i] is in the specified entity set.
1039  * Array entry offset[i] stores the index of first adjacent entity to
1040  * entity i.
1041  *
1042  * COMMUNICATION: None.
1043  *
1044  * \param instance (In) Mesh instance containing the
1045  * partition.
1046  * \param partition (In) The partition being queried.
1047  * \param part (In) The part being queried.
1048  * \param entity_set (In) Entity set handle for the
1049  * entity set being queried;
1050  * may be the root set.
1051  * \param entity_type_requestor (In) Return entities adjacent to
1052  * entities of this type;
1053  * may be iBase_ALL_TYPES.
1054  * \param entity_topology_requestor (In) Return entities adjacent to
1055  * entities of this topology;
1056  * may be iMesh_ALL_TOPOLOGIES.
1057  * \param entity_type_requested (In) Return adjacent entities of
1058  * this type;
1059  * may be iBase_ALL_TYPES.
1060  * \param adj_entities (In/Out) Array of adjacent entity
1061  * handles returned.
1062  * \param adj_entities_allocated (In/Out) Allocated size of
1063  * adj_entities.
1064  * \param adj_entities_size (Out) Occupied size of
1065  * adj_entities.
1066  * \param offset (In/Out) Array of offsets returned.
1067  * \param offset_allocated (In/Out) Allocated size of offset.
1068  * \param offset_size (Out) Occupied size of offset.
1069  * \param in_entity_set (In/Out) Array of flags returned if
1070  * non-root entity set was input;
1071  * (*in_entity_set)[i]=1
1072  * indicates
1073  * (*adj_entities)[i]
1074  * is in the entity set.
1075  * \param in_entity_set_allocated (In/Out) Allocated size of
1076  * in_entity_set.
1077  * \param in_entity_set_size (Out) Occupied size of
1078  * in_entity_set.
1079  * \param err (Out) Error code.
1080  */
1081 void iMeshP_getAdjEntities( iMesh_Instance instance,
1082  const iMeshP_PartitionHandle partition,
1083  const iMeshP_PartHandle part,
1084  const iBase_EntitySetHandle entity_set,
1085  int entity_type_requestor,
1086  int entity_topology_requestor,
1087  int entity_type_requested,
1088  iBase_EntityHandle** adj_entities,
1089  int* adj_entities_allocated,
1090  int* adj_entities_size,
1091  int** offset,
1092  int* offset_allocated,
1093  int* offset_size,
1094  int** in_entity_set,
1095  int* in_entity_set_allocated,
1096  int* in_entity_set_size,
1097  int* err );
1098 
1099 /** \brief Create an entity iterator for a given part and entity set.
1100 
1101  * Given a local part and an entity set, return an iterator over the
1102  * entities of the requested type and topology that are in both the
1103  * part and the entity set.
1104  * Iterator functionality for getNext, reset, and end is
1105  * provided through the regular iMesh iterator functions
1106  * iMesh_getNextEntIter, iMesh_resetEntIter, and iMesh_endEntIter,
1107  * respectively.
1108  *
1109  * COMMUNICATION: None.
1110  *
1111  * \param instance (In) Mesh instance containing the
1112  * partition.
1113  * \param partition (In) The partition being queried.
1114  * \param part (In) The part being queried.
1115  * \param entity_set (In) Entity set handle for the
1116  * entity set being queried.
1117  * \param requested_entity_type (In) Type of entities to include in
1118  * the iterator.
1119  * \param requested_entity_topology (In) Topology of entities to include
1120  * in the iterator.
1121  * \param entity_iterator (Out) Iterator returned from function.
1122  * \param err (Out) Error code.
1123  */
1124 void iMeshP_initEntIter( iMesh_Instance instance,
1125  const iMeshP_PartitionHandle partition,
1126  const iMeshP_PartHandle part,
1127  const iBase_EntitySetHandle entity_set,
1128  const int requested_entity_type,
1129  const int requested_entity_topology,
1130  iBase_EntityIterator* entity_iterator,
1131  int* err );
1132 
1133 /** \brief Create an entity array iterator for a given part and entity set.
1134 
1135  * Given a local part and an entity set, return an array iterator over the
1136  * entities of the requested type and topology that are in both the
1137  * part and the entity set.
1138  * Iterator functionality for getNext, reset, and end is
1139  * provided through the regular iMesh iterator functions
1140  * iMesh_getNextEntArrIter, iMesh_resetEntArrIter, and iMesh_endEntArrIter,
1141  * respectively.
1142  *
1143  * COMMUNICATION: None.
1144  *
1145  * \param instance (In) Mesh instance containing the
1146  * partition.
1147  * \param partition (In) The partition being queried.
1148  * \param part (In) The part being queried.
1149  * \param entity_set (In) Entity set handle for the
1150  * entity set being queried.
1151  * \param requested_entity_type (In) Type of entities to include in
1152  * the iterator.
1153  * \param requested_entity_topology (In) Topology of entities to include
1154  * in the iterator.
1155  * \param requested_array_size (In) The number of handles returned
1156  * in each value of the iterator.
1157  * \param entArr_iterator (Out) Iterator returned from function.
1158  * \param err (Out) Error code.
1159  */
1160 void iMeshP_initEntArrIter( iMesh_Instance instance,
1161  const iMeshP_PartitionHandle partition,
1162  const iMeshP_PartHandle part,
1163  const iBase_EntitySetHandle entity_set,
1164  const int requested_entity_type,
1165  const int requested_entity_topology,
1166  const int requested_array_size,
1167  iBase_EntityArrIterator* entArr_iterator,
1168  int* err );
1169 
1170 /*------------------------------------------------------------------------*/
1171 /*------------------------------------------------------------------------*/
1172 /* Entity Functionality */
1173 /*------------------------------------------------------------------------*/
1174 /*------------------------------------------------------------------------*/
1175 
1176 /** \brief Return the part ID of the part owning an entity.
1177  *
1178  * Given an entity handle and a partition handle, return the part ID
1179  * of the part that owns the entity.
1180  * Return an error code if an entity is not in the partition.
1181  *
1182  * COMMUNICATION: None++.
1183  *
1184  * \param instance (In) Mesh instance containing the
1185  * partition.
1186  * \param partition (In) The partition being queried.
1187  * \param entity (In) Entity whose owning part is to be
1188  * returned.
1189  * \param part_id (Out) Part ID of the part owning
1190  * the entity.
1191  * \param err (Out) Error code.
1192  */
1193 void iMeshP_getEntOwnerPart( iMesh_Instance instance,
1194  const iMeshP_PartitionHandle partition,
1195  const iBase_EntityHandle entity,
1196  iMeshP_Part* part_id,
1197  int* err );
1198 
1199 /** \brief Return the part IDs of the parts owning the given entities.
1200  *
1201  * Given an array of entity handles and a partition handle, return for each
1202  * entity handle the part ID of the part that owns the entity.
1203  * Return an error code if an entity is not in the partition.
1204  *
1205  * COMMUNICATION: None++.
1206  *
1207  * \param instance (In) Mesh instance containing the
1208  * partition.
1209  * \param partition (In) The partition being queried.
1210  * \param entities (In) Entity whose owning part is to be
1211  * returned.
1212  * \param entities_size (In) Number of entities in
1213  * entities array.
1214  * \param part_ids (Out) Part IDs of the parts owning
1215  * the entities.
1216  * \param part_ids_allocated (In/Out) Allocated size of part_ids array.
1217  * \param part_ids_size (Out) Occupied size of part_ids array.
1218  * \param err (Out) Error code.
1219  */
1221  const iMeshP_PartitionHandle partition,
1223  const int entities_size,
1224  iMeshP_Part** part_ids,
1225  int* part_ids_allocated,
1226  int* part_ids_size,
1227  int* err );
1228 
1229 /** \brief Test for entity ownership with respect to a part.
1230  *
1231  * Given a partition handle, a part handle, and an entity handle, return a
1232  * flag indicating whether the entity is owned by the part.
1233  *
1234  * COMMUNICATION: None.
1235  *
1236  * \param instance (In) Mesh instance containing the partition.
1237  * \param partition (In) The partition being queried.
1238  * \param part (In) The part being queried.
1239  * \param entity (In) Entity whose ownership is being tested.
1240  * \param is_owner (Out) Flag indicating whether the given part
1241  * is the owner of the given entity.
1242  * \param err (Out) Error code.
1243  */
1244 void iMeshP_isEntOwner( iMesh_Instance instance,
1245  const iMeshP_PartitionHandle partition,
1246  const iMeshP_PartHandle part,
1247  const iBase_EntityHandle entity,
1248  int* is_owner,
1249  int* err );
1250 
1251 /** \brief Test for entity ownership of many entities with respect to a part.
1252  *
1253  * Given a partition handle, a part handle, and an array of entity handles,
1254  * return for each entity handle a flag indicating whether the entity
1255  * is owned by the part.
1256  *
1257  * COMMUNICATION: None.
1258  *
1259  * \param instance (In) Mesh instance containing the
1260  * partition.
1261  * \param partition (In) The partition being queried.
1262  * \param part (In) The part being queried.
1263  * \param entities (In) Entities whose ownership is
1264  * being tested.
1265  * \param entities_size (In) Number of entity handles in
1266  * entities.
1267  * \param is_owner (Out) Flag for each entity indicating
1268  * whether the given part is the
1269  * owner of the given entity.
1270  * \param is_owner_allocated (In/Out) Allocated size of is_owner array.
1271  * \param is_owner_size (Out) Occupied size of is_owner array.
1272  * \param err (Out) Error code.
1273  */
1274 void iMeshP_isEntOwnerArr( iMesh_Instance instance,
1275  const iMeshP_PartitionHandle partition,
1276  const iMeshP_PartHandle part,
1278  const int entities_size,
1279  int** is_owner,
1280  int* is_owner_allocated,
1281  int* is_owner_size,
1282  int* err );
1283 
1284 /** \brief Return entity status (Internal, boundary, ghost).
1285  *
1286  * Given a partition handle, a part handle, and an entity handle, return a
1287  * flag indicating whether the entity is strictly internal, is on a
1288  * part boundary, or is a ghost with respect to the given part.
1289  * The returned value is a member of the iMeshP_EntStatus enumerated type.
1290  *
1291  * COMMUNICATION: None.
1292  *
1293  * \param instance (In) Mesh instance containing the partition.
1294  * \param partition (In) The partition being queried.
1295  * \param part (In) The part being queried.
1296  * \param entity (In) Entity whose status is being tested.
1297  * \param par_status (Out) Value indicating the status of the
1298  * is the entity with respect to the part.
1299  * \param err (Out) Error code.
1300  */
1301 void iMeshP_getEntStatus( iMesh_Instance instance,
1302  const iMeshP_PartitionHandle partition,
1303  const iMeshP_PartHandle part,
1304  const iBase_EntityHandle entity,
1305  int* par_status,
1306  int* err );
1307 
1308 /** \brief Return entity status (Internal, boundary, ghost).
1309  *
1310  * Given a partition handle, a part handle, and an array of entity handles,
1311  * return for each entity handle a flag indicating whether the entity is
1312  * strictly internal, is on a part boundary, or is a ghost with respect
1313  * to the given part.
1314  * The returned value is a member of the iMeshP_EntStatus enumerated type.
1315  *
1316  * COMMUNICATION: None.
1317  *
1318  * \param instance (In) Mesh instance containing the
1319  * partition.
1320  * \param partition (In) The partition being queried.
1321  * \param part (In) The part being queried.
1322  * \param entities (In) Entities whose status is
1323  * being tested.
1324  * \param entities_size (In) Number of entity handles in
1325  * entities.
1326  * \param par_status (Out) Value for each entity indicating
1327  * the status of the entity with
1328  * respect to the part.
1329  * \param par_status_allocated (In/Out) Allocated size of par_status array.
1330  * \param par_status_size (Out) Occupied size of par_status array.
1331  * \param err (Out) Error code.
1332  */
1333 
1334 void iMeshP_getEntStatusArr( iMesh_Instance instance,
1335  const iMeshP_PartitionHandle partition,
1336  const iMeshP_PartHandle part,
1338  const int entities_size,
1339  int** par_status, /* enum iMeshP_EntStatus */
1340  int* par_status_allocated,
1341  int* par_status_size,
1342  int* err );
1343 
1344 /** \brief Return the number of copies of an entity that exist in the partition.
1345  *
1346  * Given a partition handle and an entity handle, return the number
1347  * of copies of the entity in the partition.
1348  * If the given entity is an owned entity or boundary entity,
1349  * the number of copies will be complete.
1350  * If the given entity is a ghost entity, the number of copies will be two
1351  * (the ghost and its owner).
1352  *
1353  * COMMUNICATION: None++.
1354  *
1355  * \param instance (In) Mesh instance containing the partition.
1356  * \param partition (In) The partition being queried.
1357  * \param entity (In) Entity whose copy info is requested.
1358  * \param num_copies_ent (Out) Number of copies of the entity that
1359  * exist in the partition.
1360  * \param err (Out) Error code.
1361  */
1362 void iMeshP_getNumCopies( iMesh_Instance instance,
1363  const iMeshP_PartitionHandle partition,
1364  const iBase_EntityHandle entity,
1365  int* num_copies_ent,
1366  int* err );
1367 
1368 /** \brief Return the part IDs of parts having copies of a given entity.
1369  *
1370  * Given a partition handle and an entity handle, return the part IDs
1371  * of copies of the entity in the partition.
1372  * If the given entity is an owned entity or boundary entity,
1373  * the number of copies considered will be complete.
1374  * If the given entity is a ghost entity, the number of copies considered
1375  * will be two (the ghost and its owner).
1376  *
1377  * COMMUNICATION: None++.
1378  *
1379  * \param instance (In) Mesh instance containing the
1380  * partition.
1381  * \param partition (In) The partition being queried.
1382  * \param entity (In) Entity whose copy info
1383  * is requested.
1384  * \param part_ids (Out) Part IDs of parts having copies
1385  * of the given entity.
1386  * \param part_ids_allocated (In/Out) Allocated size of part_ids array.
1387  * \param part_ids_size (Out) Occupied size of part_ids array.
1388  * \param err (Out) Error code.
1389  */
1390 void iMeshP_getCopyParts( iMesh_Instance instance,
1391  const iMeshP_PartitionHandle partition,
1392  const iBase_EntityHandle entity,
1393  iMeshP_Part** part_ids,
1394  int* part_ids_allocated,
1395  int* part_ids_size,
1396  int* err );
1397 
1398 /** \brief Get (remote) entity handles of copies of a given entity.
1399  *
1400  * Given a partition handle and an entity handle, return (remote) entity
1401  * handles and part IDs of all copies of the entity.
1402  * If the given entity is an owned entity or boundary entity,
1403  * the number of copies considered will be complete.
1404  * If the given entity is a ghost entity, the number of copies considered
1405  * will be two (the ghost and its owner).
1406  *
1407  * COMMUNICATION: None++.
1408  *
1409  * \param instance (In) Mesh instance containing the
1410  * partition.
1411  * \param partition (In) The partition being queried.
1412  * \param entity (In) Entity whose copy info
1413  * is requested.
1414  * \param part_ids (Out) Part IDs of parts having copies
1415  * of the given entity.
1416  * \param part_ids_allocated (In/Out) Allocated size of part_ids array.
1417  * \param part_ids_size (Out) Occupied size of part_ids array.
1418  * \param copies (Out) (Remote) entity handles of the
1419  * entity copies.
1420  * \param copies_allocated (In/Out) Allocated size of copies.
1421  * \param copies_size (Out) Occupied size of copies.
1422  * \param err (Out) Error code.
1423  */
1424 void iMeshP_getCopies( iMesh_Instance instance,
1425  const iMeshP_PartitionHandle partition,
1426  const iBase_EntityHandle entity,
1427  iMeshP_Part** part_ids,
1428  int* part_ids_allocated,
1429  int* part_ids_size,
1430  iBase_EntityHandle** copies,
1431  int* copies_allocated,
1432  int* copies_size,
1433  int* err );
1434 
1435 /** \brief Get the entity handle of a copy of a given entity in a given part.
1436  *
1437  * Given a partition handle, an entity handle and a part ID,
1438  * return the (remote) entity handle of the copy of the entity in that part.
1439  * Return an error if the entity does not exist in the specified part.
1440  *
1441  * COMMUNICATION: None++.
1442  *
1443  * \param instance (In) Mesh instance containing the
1444  * partition.
1445  * \param partition (In) The partition being queried.
1446  * \param entity (In) Entity whose copy info
1447  * is requested.
1448  * \param part_id (In) Part ID of part whose copy
1449  * of the given entity is requested.
1450  * \param copy_entity (Out) (Remote) entity handle of the
1451  * entity copy from the given part.
1452  * \param err (Out) Error code.
1453  */
1454 void iMeshP_getCopyOnPart( iMesh_Instance instance,
1455  const iMeshP_PartitionHandle partition,
1456  const iBase_EntityHandle entity,
1457  const iMeshP_Part part_id,
1458  iBase_EntityHandle* copy_entity,
1459  int* err );
1460 
1461 /** \brief Get the entity handle of a copy of a given entity in its owner part.
1462  *
1463  * Given a partition handle and an entity handle, return the (remote)
1464  * entity handle of the copy of the entity in its owner part.
1465  *
1466  * COMMUNICATION: None++.
1467  *
1468  * \param instance (In) Mesh instance containing the
1469  * partition.
1470  * \param partition (In) The partition being queried.
1471  * \param entity (In) Entity whose copy info
1472  * is requested.
1473  * \param owner_part_id (Out) Part ID of the entity's owner part.
1474  * \param owner_entity (Out) (Remote) entity handle of the
1475  * entity copy from the owner part.
1476  * \param err (Out) Error code.
1477  */
1478 void iMeshP_getOwnerCopy( iMesh_Instance instance,
1479  const iMeshP_PartitionHandle partition,
1480  const iBase_EntityHandle entity,
1481  iMeshP_Part* owner_part_id,
1482  iBase_EntityHandle* owner_entity,
1483  int* err );
1484 
1485 /*------------------------------------------------------------------------*/
1486 /*------------------------------------------------------------------------*/
1487 /*------- COMMUNICATION ----------*/
1488 /*------------------------------------------------------------------------*/
1489 /*------------------------------------------------------------------------*/
1490 
1491 /**\brief Wait for a specific iMeshP request to complete.
1492  *
1493  * Given an iMeshP_RequestHandle, wait for the request to complete.
1494  *
1495  * COMMUNICATION: Blocking point-to-point.
1496  *
1497  * \param instance (In) Mesh instance containing the
1498  * partition.
1499  * \param partition (In) The partition being queried.
1500  * \param request (In) iMeshP request for whose completion
1501  * we should wait.
1502  * \param err (Out) Error code.
1503  */
1505  const iMeshP_PartitionHandle partition,
1506  iMeshP_RequestHandle request,
1507  int* err );
1508 
1509 /**\brief Wait for any of the specified iMeshP requests to complete.
1510  *
1511  * Given an array of iMeshP_RequestHandles, wait for any one of the requests
1512  * to complete.
1513  *
1514  * COMMUNICATION: Blocking point-to-point.
1515  *
1516  * \param instance (In) Mesh instance containing the
1517  * partition.
1518  * \param partition (In) The partition being queried.
1519  * \param requests (In) iMeshP requests for which we wait
1520  * until one request completes.
1521  * \param requests_size (In) Number of requests in requests.
1522  * \param index (Out) Index of the request that completed.
1523  * \param err (Out) Error code.
1524  */
1526  const iMeshP_PartitionHandle partition,
1527  iMeshP_RequestHandle* requests,
1528  int requests_size,
1529  int* index,
1530  int* err );
1531 
1532 /**\brief Wait for all of the specified iMeshP requests to complete.
1533  *
1534  * Given an array of iMeshP_RequestHandles, wait for all of the requests
1535  * to complete.
1536  *
1537  * COMMUNICATION: Blocking point-to-point.
1538  *
1539  * \param instance (In) Mesh instance containing the
1540  * partition.
1541  * \param partition (In) The partition being queried.
1542  * \param requests (In) iMeshP requests for which we wait
1543  * until completion.
1544  * \param requests_size (In) Number of requests in requests.
1545  * \param err (Out) Error code.
1546  */
1548  const iMeshP_PartitionHandle partition,
1549  iMeshP_RequestHandle* requests,
1550  int requests_size,
1551  int* err );
1552 
1553 /**\brief Wait for a specific request to complete; return entities received.
1554  *
1555  * Given an iMeshP_RequestHandle, wait for the request to complete. Return
1556  * entities for which information was received.
1557  *
1558  * COMMUNICATION: Blocking point-to-point.
1559  *
1560  * \param instance (In) Mesh instance containing the
1561  * partition.
1562  * \param partition (In) The partition being queried.
1563  * \param request (In) iMeshP request for whose completion
1564  * we should wait.
1565  * \param out_entities (Out) Entities for which information was
1566  * received.
1567  * \param out_entities_allocated (In/Out) Allocated size of out_entities.
1568  * \param out_entities_size (Out) Occupied size of out_entities.
1569  * \param err (Out) Error code.
1570  */
1572  const iMeshP_PartitionHandle partition,
1573  iMeshP_RequestHandle request,
1574  iBase_EntityHandle** out_entities,
1575  int* out_entities_allocated,
1576  int* out_entities_size,
1577  int* err );
1578 
1579 /**\brief Test whether a specific request has completed.
1580  *
1581  * Given an iMeshP_RequestHandle, test whether the request has completed.
1582  * This function will not wait until the request completes; it will only
1583  * return the completion status (complete = 1 or 0).
1584  *
1585  * COMMUNICATION: None.
1586  *
1587  * \param instance (In) Mesh instance containing the
1588  * partition.
1589  * \param partition (In) The partition being queried.
1590  * \param request (In) iMeshP request for whose completion
1591  * we should test.
1592  * \param completed (Out) Flag indicating whether (1) or
1593  * not (0) the given request has
1594  * completed.
1595  * \param err (Out) Error code.
1596  */
1597 void iMeshP_testRequest( iMesh_Instance instance,
1598  const iMeshP_PartitionHandle partition,
1599  iMeshP_RequestHandle request,
1600  int* completed,
1601  int* err );
1602 
1603 /** \brief Poll for outstanding requests.
1604  *
1605  * Check for outstanding requests from other parts, handle any requests
1606  * found, and return an array of requests that have been handled. If
1607  * the array has a size allocated already, then the implementation stops
1608  * working when it has generated that many completed requests, even if there
1609  * are more requests waiting.
1610  *
1611  * COMMUNICATION: non-blocking; point-to-point.
1612  *
1613  * \param instance (In) Mesh instance containing the
1614  * partition.
1615  * \param partition (In) The partition being queried.
1616  * \param requests_completed (Out) Requests that were completed.
1617  * \param requests_completed_allocated (In/Out) Allocated size of
1618  * requests_completed.
1619  * \param requests_completed_size (Out) Occupied size of
1620  * requests_completed.
1621  * \param err (Out) Error code.
1622  */
1623 void iMeshP_pollForRequests( iMesh_Instance instance,
1624  iMeshP_PartitionHandle partition,
1625  iMeshP_RequestHandle** requests_completed,
1626  int* requests_completed_allocated,
1627  int* requests_completed_size,
1628  int* err );
1629 
1630 /*--------------------------------------------------------------------
1631  ------- Requests for off-processor mesh modification -------
1632  --------------------------------------------------------------------*/
1633 
1634 /** \brief Add entities to on-process and/or off-process parts.
1635  *
1636  * Given a partition and a list of entities, add those entities to the
1637  * target parts. The entities can be added as copies or migrated entirely
1638  * (i.e., change ownership of the entities)
1639  * to the parts. The entities' downward adjacencies are also copied and/or
1640  * migrated as appropriate to support the entities.
1641  * This function is a collective, non-blocking operation
1642  * to be called by all processes in the partition's communicator.
1643  * An iMeshP_RequestHandle is returned; any of the
1644  * iMeshP_wait* functions can be used to block until the request is completed.
1645  *
1646  * COMMUNICATION: Collective. Non-blocking.
1647  *
1648  * \param instance (In) Mesh instance containing the partition.
1649  * \param partition (In) Handle for the partition being queried.
1650  * \param entities (In) Entities to be sent.
1651  * \param entities_size (In) Number of entities to be sent.
1652  * \param target_part_ids (In) Array of size entities_size listing
1653  * the parts to which the entities should
1654  * be sent.
1655  * \param command_code (In) Flag indicating whether to migrate
1656  * the entities or only make copies.
1657  * \param update_ghost (In) Flag indicating whether (1) or not (0)
1658  * ghost copies of the entities should be
1659  * updated with new owner information.
1660  * \param request (Out) iMeshP RequestHandle returned; can be used
1661  * for blocking until this send is complete.
1662  * \param err (Out) Error code.
1663  */
1665  const iMeshP_PartitionHandle partition,
1667  const int entities_size,
1668  const iMeshP_Part* target_part_ids,
1669  int command_code,
1670  int update_ghost,
1671  iMeshP_RequestHandle* request,
1672  int* err );
1673 
1674 /** \brief Request in-migration of an entity and its upward adjacencies.
1675  *
1676  * This function is a "pull" migration, where a part requests to become the
1677  * owner of an entity that is owned by another part (so that the part has
1678  * the right to modify the entity). The requested
1679  * entity must be on the part boundary and is identified by a local handle
1680  * (i.e., an entity part-boundary copy). This operation may require multiple
1681  * rounds of communication, and at some times, certain entities may be
1682  * locked (unavailable for local modification) while info about their
1683  * remote copies is still in question. Tags and parallel set membership
1684  * are migrated as well as the appropriate adjacency info.
1685  * An iMeshP request handle is returned.
1686  *
1687  * COMMUNICATION: point-to-point, non-blocking, pull.
1688  *
1689  * \param instance (In) Mesh instance containing the partition.
1690  * \param partition (In) The partition being queried.
1691  * \param part (In) The part to which the entity is migrated.
1692  * \param local_entity (In) The local entity copy for the entity to be
1693  * migrated.
1694  * \param request (Out) The iMeshP request handle returned.
1695  * \param err (Out) Error code.
1696  */
1697 void iMeshP_migrateEntity( iMesh_Instance instance,
1698  const iMeshP_PartitionHandle partition,
1699  iMeshP_PartHandle part,
1700  iBase_EntityHandle local_entity,
1701  iMeshP_RequestHandle* request,
1702  int* err );
1703 
1704 /** \brief Update vertex coordinates for vertex copies.
1705  *
1706  * For a given vertex, update its copies with the vertex's coordinates.
1707  * This function assumes that a local vertex's coordinates were updated
1708  * through a call to iMesh_setVtxCoords. This function then updates all
1709  * copies of the vertex with the updated coordinates.
1710  * The communication here is push-and-forget; as such,
1711  * no request handle needs to be returned.
1712  *
1713  * COMMUNICATION: point-to-point, non-blocking, push-and-forget.
1714  *
1715  * \param instance (In) Mesh instance containing the partition.
1716  * \param partition (In) The partition being queried.
1717  * \param local_vertex (In) The vertex whose copies should be updated.
1718  * \param err (Out) Error code.
1719  */
1720 void iMeshP_updateVtxCoords( iMesh_Instance instance,
1721  const iMeshP_PartitionHandle partition,
1722  const iBase_EntityHandle local_vertex,
1723  int* err );
1724 
1725 /** \brief Replace entities on the part boundary.
1726  *
1727  * This function performs changes on the part boundary where the
1728  * calling application can ensure that things are done
1729  * identically on both sides and that the arguments are passed in an order
1730  * that can be matched. (Specifically, matching new entities should appear in
1731  * the same order in the call array.) An example is creation of new
1732  * boundary edges during edge splitting.
1733  * Communication here could be a
1734  * two-way push-and-forget, or some variant on push-and-confirm.
1735  * CHANGES: At Onkar's suggestion, added an offset array (similar to array
1736  * adjacency requests) so that a single call can easily handle coordination
1737  * with multiple entities on part-boundary.
1738  *
1739  * COMMUNICATION: point-to-point, non-blocking, push-and-forget.
1740  *
1741  * \param instance (In) Mesh instance containing the partition.
1742  * \param partition (In) The partition being queried.
1743  * \param old_entities (In) The entities to be replaced.
1744  * \param old_entities_size (In) The number of entities to be replaced.
1745  * \param new_entities (In) The entities that replace the old entities.
1746  * \param new_entities_size (In) The number of entities in new_entities.
1747  * \param offset (In) Index into new_entities; old_entities[i]
1748  * is replaced by new_entities[offset[i]] to
1749  * new_entities[offset[i+1]-1].
1750  * \param offset_size (In) The number of entries in offset.
1751  * \param err (Out) Error code.
1752  */
1754  const iMeshP_PartitionHandle partition,
1755  const iBase_EntityHandle* old_entities,
1756  const int old_entities_size,
1757  const iBase_EntityHandle* new_entities,
1758  const int new_entities_size,
1759  const int* offset,
1760  const int offset_size,
1761  int* err );
1762 
1763 /** \brief Push ghost copies of individual entities onto other parts.
1764  *
1765  * Given an entity and a target part, create a ghost copy of the entity on
1766  * the target part.
1767  *
1768  * Communication here is push-and-confirm (so that the original knows remote
1769  * entity handle of the created ghosts). The closure of a new ghost is pushed
1770  * automatically as part of the underlying communication.
1771  *
1772  * COMMUNICATION: point-to-point, non-blocking, push.
1773  *
1774  * \param instance (In) Mesh instance containing the partition.
1775  * \param partition (In) The partition being queried.
1776  * \param target_part_id (In) The part to receive the new ghost.
1777  * \param entity_to_copy (In) The entity to be copied in target_part_id.
1778  * \param request (Out) The iMeshP request handle returned.
1779  * \param err (Out) Error code.
1780  */
1781 void iMeshP_addGhostOf( iMesh_Instance instance,
1782  const iMeshP_PartitionHandle partition,
1783  const iMeshP_Part target_part_id,
1784  iBase_EntityHandle entity_to_copy,
1785  iMeshP_RequestHandle* request,
1786  int* err );
1787 
1788 /** \brief Remove ghost copies of individual entities from other parts.
1789  *
1790  * Given an entity and a target part, remove the ghost copy of the entity on
1791  * the target part.
1792  *
1793  * Communication is push-and-forget; as such, no request handle is needed.
1794  * The remote part will clean up the closure of the removed ghost
1795  * as appropriate during deletion.
1796  *
1797  * COMMUNICATION: point-to-point, non-blocking, push-and-forget.
1798  *
1799  * \param instance (In) Mesh instance containing the partition.
1800  * \param partition (In) The partition being queried.
1801  * \param target_part_id (In) The part to lose the ghost.
1802  * \param copy_to_purge (In) The entity whose ghost is removed from
1803  * target_part_id.
1804  * \param err (Out) Error code.
1805  */
1806 void iMeshP_rmvGhostOf( iMesh_Instance instance,
1807  const iMeshP_PartitionHandle partition,
1808  const iMeshP_Part target_part_id,
1809  iBase_EntityHandle copy_to_purge,
1810  int* err );
1811 
1812 /** \brief Indicate completion of mesh modification.
1813  *
1814  * Calling this function indicates that the user is finished with mesh
1815  * modification for now. With mesh modification complete, the implementation
1816  * can update ghost, partition, boundary, and other information to
1817  * re-establish a valid distributed mesh. This function waits for all
1818  * message traffic to clear and rebuilds ghost information that was
1819  * allowed to go obsolete during mesh modification.
1820  *
1821  * COMMUNICATION: collective.
1822  *
1823  * \param instance (In) Mesh instance containing the partition.
1824  * \param partition (In) The partition being queried.
1825  * \param err (Out) Error code.
1826  */
1827 void iMeshP_syncMeshAll( iMesh_Instance instance, iMeshP_PartitionHandle partition, int* err );
1828 
1829 /*--------------------------------------------------------------------------*/
1830 /* Functions to send Tag data from owning entities to copies. */
1831 /*--------------------------------------------------------------------------*/
1832 
1833 /**\brief Synchronously send tag data for given entity types and topologies.
1834  *
1835  * Send tag information for shared entities of specified type and
1836  * topology. The tag data is "pushed" from the owner entities to all copies.
1837  * This version operates on all shared entities of specified type and topology
1838  * (or all types/topologies if iBase_ALL_TYPES/iMesh_ALL_TOPOLOGIES are
1839  * given). This function assumes tag handles given on various
1840  * calling parts are consistent; i.e. they have the same name,
1841  * data type, size, etc. This call blocks until communication is
1842  * completed.
1843  *
1844  * COMMUNICATION: point-to-point, blocking.
1845  *
1846  * \param instance (In) Mesh instance containing the partition.
1847  * \param partition (In) The partition being queried.
1848  * \param source_tag (In) Tag handle for the sending entities.
1849  * \param dest_tag (In) Tag handle for the receiving entities.
1850  * \param entity_type (In) Tag data is exchanged only for this
1851  * entity type.
1852  * \param entity_topo (In) Tag data is exchanged only for this
1853  * entity topology.
1854  * \param err (Out) Error code.
1855  */
1856 void iMeshP_pushTags( iMesh_Instance instance,
1857  const iMeshP_PartitionHandle partition,
1858  iBase_TagHandle source_tag,
1859  iBase_TagHandle dest_tag,
1860  int entity_type,
1861  int entity_topo,
1862  int* err );
1863 
1864 /**\brief Synchronously send tag data for individual entities.
1865  *
1866  * Send tag information for the specified entities.
1867  * The tag data is "pushed" from the owner entities to all copies.
1868  * This function assumes tag handles given on various
1869  * calling parts are consistent; i.e. they have the same name,
1870  * data type, size, etc. This call blocks until communication is
1871  * completed.
1872  *
1873  * COMMUNICATION: point-to-point, blocking.
1874  *
1875  * \param instance (In) Mesh instance containing the partition.
1876  * \param partition (In) The partition being queried.
1877  * \param source_tag (In) Tag handle for the sending entities.
1878  * \param dest_tag (In) Tag handle for the receiving entities.
1879  * \param entities (In) Owned entities for which to send data.
1880  * \param entities_size (In) The number of entities for which to send data.
1881  * \param err (Out) Error code.
1882  */
1883 void iMeshP_pushTagsEnt( iMesh_Instance instance,
1884  const iMeshP_PartitionHandle partition,
1885  iBase_TagHandle source_tag,
1886  iBase_TagHandle dest_tag,
1888  int entities_size,
1889  int* err );
1890 
1891 /**\brief Asynchronously send tag data for given entity types and topologies.
1892  *
1893  * Send tag information for shared entities of specified type and
1894  * topology. The tag data is "pushed" from the owner entities to all copies.
1895  * This version operates on all shared entities of specified type and topology
1896  * (or all types/topologies if iBase_ALL_TYPES/iMesh_ALL_TOPOLOGIES are
1897  * given). This function assumes tag handles given on various
1898  * calling parts are consistent; i.e. they have the same name,
1899  * data type, size, etc.
1900  * This call does not block; applications should call
1901  * iMeshP_waitForRequest (or a similar wait function)
1902  * to block until this push is completed.
1903  *
1904  * COMMUNICATION: point-to-point, non-blocking.
1905  *
1906  * \param instance (In) Mesh instance containing the partition.
1907  * \param partition (In) The partition being queried.
1908  * \param source_tag (In) Tag handle for the sending entities.
1909  * \param dest_tag (In) Tag handle for the receiving entities.
1910  * \param entity_type (In) Tag data is exchanged only for this
1911  * entity type.
1912  * \param entity_topo (In) Tag data is exchanged only for this
1913  * entity topology.
1914  * \param request (Out) The iMeshP request handle returned.
1915  * \param err (Out) Error code.
1916  */
1917 void iMeshP_iPushTags( iMesh_Instance instance,
1918  const iMeshP_PartitionHandle partition,
1919  iBase_TagHandle source_tag,
1920  iBase_TagHandle dest_tag,
1921  int entity_type,
1922  int entity_topo,
1923  iMeshP_RequestHandle* request,
1924  int* err );
1925 
1926 /**\brief Asynchronously send tag data for individual entities.
1927  *
1928  * Send tag information for the specified entities.
1929  * The tag data is "pushed" from the owner entities to all copies.
1930  * This function assumes tag handles given on various
1931  * calling parts are consistent; i.e. they have the same name,
1932  * data type, size, etc.
1933  * This call does not block; applications should call
1934  * iMeshP_waitForRequest (or a similar wait function)
1935  * to block until this push is completed.
1936  *
1937  * COMMUNICATION: point-to-point, non-blocking.
1938  *
1939  * \param instance (In) Mesh instance containing the partition.
1940  * \param partition (In) The partition being queried.
1941  * \param source_tag (In) Tag handle for the sending entities.
1942  * \param dest_tag (In) Tag handle for the receiving entities.
1943  * \param entities (In) Owned entities for which to send data.
1944  * \param entities_size (In) The number of entities for which to send data.
1945  * \param request (Out) The iMeshP request handle returned.
1946  * \param err (Out) Error code.
1947  */
1948 void iMeshP_iPushTagsEnt( iMesh_Instance instance,
1949  const iMeshP_PartitionHandle partition,
1950  iBase_TagHandle source_tag,
1951  iBase_TagHandle dest_tag,
1953  int entities_size,
1954  iMeshP_RequestHandle* request,
1955  int* err );
1956 
1957 /*------------------------------------------------------------*
1958  * GHOSTING *
1959  *------------------------------------------------------------*/
1960 
1961 /* \brief Create ghost entities between parts.
1962  *
1963  * Ghost entities are specified similar to 2nd-order adjacencies, i.e.,
1964  * through a "bridge" dimension. The number of layers is measured from
1965  * the inter-part interfaces. For example, to get two layers of region
1966  * entities in the ghost layer, measured from faces on the interface,
1967  * use ghost_dim=3, bridge_dim=2, and num_layers=2.
1968  * The number of layers specified is with respect to the global mesh;
1969  * that is, ghosting may extend beyond a single neighboring processor if the
1970  * number of layers is high.
1971  *
1972  * Ghost information is cached in the partition.
1973  * The triplet describing a ghosting "rule" (ghost dim, bridge dim, #
1974  * layers) is stored in the partition; ghosting that became incorrect
1975  * due to mesh modification or redistribution of mesh entities is
1976  * re-established using these rules by the end
1977  * of iMeshP_syncPartitionAll and iMeshP_syncMeshAll.
1978  * Implementations can choose to keep ghosting consistent throughout
1979  * mesh modification, but ghosts are not required to be consistent until
1980  * the end of these two functions.
1981 
1982  * iMeshP_createGhostEntsAll is cumulative; that is, multiple calls can only
1983  * add more ghosts, not eliminate previous ghosts.
1984  *
1985  * COMMUNICATION: Collective. Blocking.
1986  *
1987  * \param instance (In) Mesh instance containing the partition.
1988  * \param partition (In) The partition in which to create ghosts.
1989  * \param ghost_type (In) Entity type of entities to be ghosted.
1990  * \param bridge_type (In) Entity type through which bridge
1991  * adjacencies are found.
1992  * \param num_layers (In) Number of layers of ghost entities.
1993  * \param include_copies (In) Flag indicating whether to create ghosts
1994  * of non-owned part boundary entities
1995  * (YES=1, NO=0).
1996  * \param err (Out) Error code.
1997  */
1999  iMeshP_PartitionHandle partition,
2000  int ghost_type,
2001  int bridge_type,
2002  int num_layers,
2003  int include_copies,
2004  int* err );
2005 
2006 /* \brief Delete all ghost entities between parts.
2007  *
2008  * Given a partition, delete all ghost entities in that partition of the mesh.
2009  *
2010  * COMMUNICATION: Collective. Blocking.
2011  *
2012  * \param instance (In) Mesh instance containing the partition.
2013  * \param partition (In) The partition from which to delete ghosts.
2014  * \param err (Out) Error code.
2015  *
2016  */
2017 void iMeshP_deleteGhostEntsAll( iMesh_Instance instance, iMeshP_PartitionHandle partition, int* err );
2018 
2019 /** \brief Return information about all ghosting on a partition.
2020  *
2021  * Return the ghosting rules established through calls to
2022  * iMeshP_createGhostEntsAll.
2023  *
2024  * COMMUNICATION: None.
2025  *
2026  * \param instance (In) Mesh instance containing the
2027  * partition.
2028  * \param partition (In) The partition to be queried.
2029  * \param ghost_rules_allocated (In/Out) Allocated size of ghost_type,
2030  * bridge_type and num_layers.
2031  * \param ghost_rules_size (Out) Occupied size of ghost_type,
2032  * bridge_type and num_layers;
2033  * equal to the number of ghosting
2034  * rules currently registered in
2035  * the partition.
2036  * \param ghost_type (Out) Entity type of ghost entities
2037  * for each rule.
2038  * \param bridge_type (Out) Entity type of bridge entities
2039  * for each rule.
2040  * \param num_layers (Out) Number of layers of ghosts in each
2041  * rule.
2042  * \param err (Out) Error code.
2043  */
2044 void iMeshP_ghostEntInfo( const iMesh_Instance instance,
2045  const iMeshP_PartitionHandle partition,
2046  int* ghost_rules_allocated,
2047  int* ghost_rules_size,
2048  int** ghost_type,
2049  int** bridge_type,
2050  int** num_layers,
2051  int* err );
2052 
2053 /*--------------------------------------------------------------------------
2054  FILE I/O
2055  --------------------------------------------------------------------------*/
2056 /* iMeshP file I/O closely aligns with iMesh file I/O. The major
2057  * change is the addition of a iMeshP_PartitionHandle argument to both
2058  * iMeshP_loadAll and iMeshP_saveAll, enabling I/O from parallel processes.
2059  * For now, individual implementations will support different sets of
2060  * options; Tim and Ken will work to unify the options by SC08.
2061  */
2062 
2063 /** \brief Populate a mesh instance and a partition by reading data from files.
2064  *
2065  * Before calling iMeshP_loadAll, the application creates both a mesh
2066  * instance and a partition handle. iMeshP_loadAll then reads the
2067  * specified file, inserts entities into the mesh instance, constructs
2068  * parts within the partition, and inserts entities into the parts.
2069  * Options allow n>=1 files on p processes.
2070  * Optional capabilities of iMeshP_loadAll include computing an initial
2071  * partition (e.g., if a serial mesh file without part assignments is read)
2072  * and creating ghost entities as requested by the application; the
2073  * availability of these options is implementation dependent.
2074  *
2075  * COMMUNICATION: Collective.
2076  *
2077  * \param instance (In) Mesh instance to contain the data.
2078  * \param partition (In) The newly populated partition.
2079  * \param entity_set (In) Set to which the mesh will be added.
2080  * \param name (in) File name from which mesh data is read.
2081  * \param options (In) Implementation-specific options string.
2082  * \param err (Out) Error code.
2083  * \param name_len (In) Length of the file name character string.
2084  * \param options_len (In) Length of the options character string.
2085  */
2086 void iMeshP_loadAll( iMesh_Instance instance,
2087  const iMeshP_PartitionHandle partition,
2088  const iBase_EntitySetHandle entity_set,
2089  const char* name,
2090  const char* options,
2091  int* err,
2092  int name_len,
2093  int options_len );
2094 
2095 /** \brief Write data from a mesh instance and a partition to files.
2096  *
2097  * iMeshP_saveAll writes mesh and partition data to the specified file.
2098  * Options allow n>=1 files on p processes.
2099  *
2100  * COMMUNICATION: Collective.
2101  *
2102  * \param instance (In) Mesh instance containing the partition.
2103  * \param partition (In) The partition being saved.
2104  * \param entity_set (In) Set from which data will be saved.
2105  * \param name (in) File name to which mesh data is written.
2106  * \param options (In) Implementation-specific options string.
2107  * \param err (Out) Error code.
2108  * \param name_len (In) Length of the file name character string.
2109  * \param options_len (In) Length of the options character string.
2110  */
2111 void iMeshP_saveAll( iMesh_Instance instance,
2112  const iMeshP_PartitionHandle partition,
2113  const iBase_EntitySetHandle entity_set,
2114  const char* name,
2115  const char* options,
2116  int* err,
2117  const int name_len,
2118  int options_len );
2119 
2120 /*
2121 ------------------------------------------------
2122 Major Items left to do:
2123 - Support for multiple partitions.
2124  We discussed designating a given partition as
2125  the "active" partition; i.e., the partition that is actually used in
2126  the distribution of mesh data in distributed memory. We were concerned
2127  that when multiple partitions were used, multiple copies of mesh
2128  entities would be needed to fully support multiple partitions at the
2129  same time. Designating one partition as "active" would store data
2130  with respect to only one partition.
2131 - File I/O support.
2132  Need common set of options to allow interoperability.
2133  Support single files, N << P files on P processes, and P files.
2134  Support reading and writing partition information.
2135  Support initial parallel partitioning of serial file data.
2136  Support storing mapping of parts to processes in files.
2137 
2138 ------------------------------------------------
2139 Minor Items left to do:
2140 - Determine which capabilities need both "getNumX" and "getX" functions.
2141  That is, when would an application need "getNumX" to allocate memory
2142  for "getX" or separately from "getX". When could we use only "getX"
2143  and return numX as a byproduct.
2144 
2145 - Determine with functions need "Ent" and "EntArr" versions, or whether
2146  we should adopt only the more general "EntArr" version.
2147 
2148 - Determine whether to revise iMeshP_createPartition to make it less MPI
2149  specific. We don't want to require applications to link with MPI if the
2150  implementation doesn't require it. We may define an ITAPS_Comm name
2151  typedef'ed appropriately.
2152 
2153 - iMeshP_getOwnerCopy could be achieved by calling iMeshP_getOwnerPart
2154  followed by iMeshP_getCopyOnPart. Do we want to keep iMeshP_getOwnerCopy?
2155 
2156 - Need function to receive tag data from part-boundary entities in owner.
2157  Possible options: return the tag data values received directly, or
2158  include a mathematical operation (similar to MPI_SUM). 9/15/08
2159 
2160 ------------------------------------------------
2161 Comments and resolved questions:
2162 
2163 - Applications will build partitions by (1) creating a partition handle
2164  on each process to be included in the partition; (2) adding parts to
2165  the partition handle within the process; (3) populating the parts with
2166  entities, and (4) calling iMeshP_syncPartitionAll to allow the
2167  implementation to compute global data for the partition.
2168 
2169 - For now, we will not include an iterator over local (to a
2170  process) parts within a partition. If it is needed, it can be added
2171  later.
2172 
2173 - We will not provide capability to move entire parts to new
2174  processes; instead, the new process must create the part in its
2175  partition handle and then receive (perhaps in bulk) the entities to
2176  populate the part. In other words, parts can be added to only a local
2177  partition handle.
2178 
2179 - Currently, iMesh doesn't have the functionality to get entities or
2180  entity sets by type and tag in serial. Should it?
2181  Many people said it would be useful; others said it could be costly
2182  (in parallel) or numerically difficult (for floating point values).
2183  This issue is an iMesh issue, not a parallel interface issue, so
2184  for this document, the issue is resolved. The resolution: If
2185  iMesh adopts this capability, we will add it to the
2186  parallel interface.
2187 
2188 - We will not include functions that return all entities with
2189  given characteristics within a partition; the memory use of these
2190  functions can be large. Instead, we will return entity information
2191  with respect to parts and/or mesh instances. If the user wants such
2192  info, he should go through the mechanics of gathering it himself so
2193  that he is painfully aware of how much memory he is allocating.
2194  Removed the following global queries:
2195  + All tag names over the partition;
2196  + All entities in this partition having a given type, tag and/or
2197  tag name.
2198  + All entity sets in this partition having a given
2199  type, tag and/or tag name.
2200 
2201 - We will not include functions that return information about each
2202  part and/or process in a partition. Such functions limit memory
2203  scalability for large numbers of parts. If the user wants such
2204  info, he should go through the mechanics of gathering it himself so
2205  that he is painfully aware of how much memory he is allocating.
2206  Removed the following global queries:
2207  + The number of entities in each part of the partition;
2208  + The number of entity sets in each part of the partition;
2209  + The number of entities with given type, tag, and/or
2210  tag name in each part of the partition;
2211  + The number of entity sets with given type, tag,
2212  and/or tag name in each part of the partition;
2213  + All tag names in each part of the partition;
2214 
2215 - For functions that replace a set handle with a part handle, return
2216  all appropriate entities in a part, whether they are owned or are
2217  copies. The application can test for ownership if needed.
2218 
2219 - Part assignments computed with respect to a set of
2220  entities induce part assignments to adjacent entities in an
2221  implementation-dependent fashion. That is, if a partition is computed
2222  with respect to regions, queries about ownership of faces and vertices
2223  are valid.
2224 
2225 ------------------------------------------------
2226 Discussed but unresolved questions:
2227 
2228 - We discussed adding functions that give
2229  hints to an implementation about which data mappings the application
2230  will use, allowing the implementation to pre-compute them if it chooses
2231  to. The example discussed was mapping between entities and parts, but
2232  other examples in iMesh may also exist.
2233 
2234 - We discussed adding an iterator over entities
2235  with given type/topology in a set or part. We have non-iterator
2236  functionality, but not an iterator.
2237  KDD: Is this true? What is iMesh_initEntIter (and its analogous
2238  KDD: iMeshP_initEntIter)?
2239 
2240 - We discussed storing in a partition
2241  information about which "objects" were used in computing the partition.
2242  These objects can be single entities or groups of entities.
2243  KDD: Perhaps this capability should be part of the load-balancing service.
2244 
2245 - We discussed designating a given partition as
2246  the "active" partition; i.e., the partition that is actually used in
2247  the distribution of mesh data in distributed memory. We were concerned
2248  that when multiple partitions were used, multiple copies of mesh
2249  entities would be needed to fully support multiple partitions at the
2250  same time. Designating one partition as "active" would store data
2251  with respect to only one partition.
2252 
2253 ------------------------------------------------
2254 Not-yet-discussed, unresolved questions
2255 
2256 Entity questions:
2257 - From Carl: "getTag*Operate: Again, we haven't got this in serial. Does
2258  the existence of such operations imply that we expect to implement
2259  fields as tags? (Because that wasn't what I was assuming about field
2260  implementations at all, personally...) Note that I'm not opposed to
2261  this sort of global reduction operation, I just wonder whether it'll see
2262  use outside of field-like situations. If not, then it should be in
2263  parallel fields, not parallel mesh, and usage for
2264  fields-implemented-as-tags should be handled there."
2265 */
2266 
2267 /*--------------------------------*/
2268 /* NOTES FROM BOOTCAMP MARCH 2008 */
2269 /*--------------------------------*/
2270 /*
2271 - Changed getPartRank to getRankOfPart. (Carl)
2272 - Made sure iMeshP_getNumOfTypeAll and iMeshP_getNumOfTopoAll were
2273 documented as collective operations. (Carl)
2274 - Changed suffix "Par" to "All". (Lori)
2275 - Added iMeshP_testPart() to test status of part handle, returning
2276 LOCAL, REMOTE, or INVALID. (Mark M, Lori).
2277 6/25/08: Removed this function since part handles can no longer be remote.
2278 If an application wants to test the validity of a part handle, it can try
2279 to compute its Part ID.
2280 - Changed iMeshP_addCopyOf and iMeshP_rmvCopyOf back to
2281 iMeshP_addGhostOf and iMeshP_rmvGhostOf. If we wanted to use these
2282 functions for adding boundary copies, we'd have to include a list of
2283 already existing remote copies in the arguments, as well as
2284 communicate with parts already owning copies to let them know a ghost
2285 copy has been made. Actually, this raises an interesting question:
2286 does a boundary copy need to know about all ghost copies of it?
2287 - Change getEntParStatus to getEntStatus. (Lori)
2288 - Changed sendEntArrToPartsPar to exchEntArrToPartsAll. (Lori,Tim)
2289 
2290 
2291 Parts and Processes:
2292 - Martin argued for consecutive unique Part IDs in addition to or
2293 instead of Part handles. He will send use cases. If we decide to
2294 add them back to the interface, we could compute them in
2295 iMeshP_syncPartitionAll rather than in iMeshP_createPart. That is, an
2296 application couldn't access them until after iMeshP_syncPartitionAll.
2297 6/25/08: On follow-up, Martin couldn't recall why having consecutive
2298 PartIDs was necessary. While we all agree they are conceptually nice,
2299 they are difficult to implement and not really necessary. Part IDs will
2300 be globally unique but not necessarily consecutive.
2301 - Are part handles globally unique? They probably need to be
2302 globally unique in order for them to be useful as remote part
2303 handles. Also, does the process rank need to be encoded in the part
2304 handle in order to map from parts to processes for communication?
2305 6/25/08: DECIDED: We will have globally unique part IDs. Part handles
2306 will be valid for only local parts. Accessing remote parts must be done
2307 via Part IDs.
2308 - If in iMeshP_syncPartitionAll, we computed a mapping from part
2309 handles to integers 0,..., k-1, we could store only ranges of
2310 integers to achieve the part-to-process and process-to-parts mappings;
2311 this would require O(P) storage per process for P processes.
2312 6/5/08: DECIDED: Do not need getPartOnRank or getNumPartOnRank. These
2313 functions were troublesome due to their storage or communication requirements.
2314 We decided to remove them.
2315 - Alternatively, the mapping of all parts to processes can be stored
2316 in O(k) total memory, distributed across processors (e.g., a
2317 distributed data directory) but interrogating the directory requires
2318 communication.
2319 6/5/08: See note above.
2320 - iMeshP_getPartsOnRank created discussion and needs to be resolved.
2321 IMeshP_getPartsOnRank would likely require either O(k) storage per
2322 process for k parts or communication. For other points, please see
2323 Mark M's 3/12/08 email.
2324 6/5/08: See note above.
2325 
2326 CreateEnt:
2327 - Carl asked if we should have a version of createEnt that accepts a
2328 part handle. Should this function be used only for creating owned
2329 entities? How do you envision creating part boundary entities when a
2330 parallel mesh is initially loaded?
2331 
2332 Ghost entities:
2333 - We currently have a mechanism only for pushing ghosts onto other
2334 parts. Will we want a mechanism for pulling them, too? (E.g., a
2335 part says, "I want ghosts for this entity.")
2336 
2337 PartNbor functions:
2338 - Did we agree to remove the entity type from these functions? That
2339 is, do we want to return the part IDs for all parts that have
2340 any copies? The entity type was intended to allow us to get the part
2341 IDs for all parts that have copies of a given type (perhaps
2342 ALL_TYPES).
2343 
2344 Functions handling both Parts and Entity Sets:
2345 - Tim said these function names (e.g., iMeshP_getNumOfType,
2346 iMeshP_getAllVtxCoord) are too close to existing iMesh function
2347 names, even though the argument lists would be different. He agreed
2348 to email suggestions for better names.
2349 
2350 Copies:
2351 - Functions getNumCopies, getCopies, getCopyParts, and getCopyOnPart
2352 have different behavior for ghost and part-boundary copies. Ghosts
2353 will return only itself and its owner in getCopies; part-boundary
2354 entities will return copies on other parts as well.
2355 - Tim envisions applications (e.g., FETI methods) updating tag data
2356 in their copies that they would like to accumulate back to the
2357 owner. Xiaolin said that he writes in his ghosts, but doesn't send
2358 those values back to the owner. Currently, we have the ability
2359 to send tag data only from owners to ghosts. Tim will look at this issue
2360 and propose a solution.
2361 
2362 Communication:
2363 - Although we should think in terms of parts, communication really
2364 occurs with respect to processes. We need to make sure all our
2365 communication routines make sense with respect to both processes and
2366 parts, and perhaps, revise their descriptions. Also, if we send to
2367 parts, the implementation really does need the mapping of parts to
2368 processes.
2369 
2370 Entity Owner/Status Queries:
2371 - Should we combine functions getEntOwnerPart and getEntStatus into
2372 one function? Or should we combine functions getOwnerCopy and
2373 getEntOwner into one function? Or should we remove getOwnerCopy and
2374 make applications call getOwnerPart followed by getCopyOnPart?
2375 
2376 Reducing storage:
2377 - Mark Miller proposed allowing the user to specify the amount of
2378 copying done by the implementation, depending on applications' needs.
2379 For example, for a static viz application, every boundary entity may not
2380 need to know where all its copies are, so the implementation would not
2381 have to store them. Can the implementations accept a flag advising them how
2382 much copying is needed? If so, the implementations could choose to
2383 optimize storage or ignore the flag.
2384 */
2385 
2386 /*--------------------------------------------------------------------
2387  * SVN File Information
2388  *
2389  * $SVN:Author$
2390  * $SVN:Date$
2391  * $SVN:Revision$
2392  *--------------------------------------------------------------------
2393  */
2394 
2395 #ifdef __cplusplus
2396 } /* extern "C" */
2397 #endif
2398 
2399 #endif /* !defined(_ITAPS_iMeshP) */