MOAB: Mesh Oriented datABase  (version 5.2.1)
iMeshP_MOAB.cpp File Reference
#include "moab/MOABConfig.h"
#include "iMeshP_extensions.h"
#include "iMesh_MOAB.hpp"
#include "moab/Core.hpp"
#include "moab/Range.hpp"
#include "moab/CN.hpp"
#include "moab/MeshTopoUtil.hpp"
#include "moab/FileOptions.hpp"
#include "moab/ParallelComm.hpp"
#include "MBParallelConventions.h"
#include "MBIter.hpp"
#include "Internals.hpp"
#include <assert.h>
#include <sstream>
+ Include dependency graph for iMeshP_MOAB.cpp:

Go to the source code of this file.

Classes

class  PartBoundaryIter
class  SetIntersectIter< Container >

Defines

#define IS_BUILDING_MB
#define FIXME   printf( "Warning: function has incomplete implementation: %s\n", __func__ )
#define PCOMM   ParallelComm::get_pcomm( MOABI, itaps_cast< EntityHandle >( partition_handle ) )
#define RANGE_TO_ITAPS_ARRAY(RANGE, NAME)

Functions

template<typename T , typename S >
T itaps_cast (S handle)
iBase_TagHandle itaps_tag_cast (Tag t)
static ErrorCode get_entities (Interface *iface, EntityHandle set, int type, int topology, Range &entities)
static ErrorCode count_owned (ParallelComm *pcomm, const Range &ents, int &n)
static void set_intersection_query (iMesh_Instance instance, iMeshP_PartHandle set1, iBase_EntitySetHandle set2, int type, int topo, Range &result, int *err)
static ErrorCode get_boundary_entities (ParallelComm *pcomm, EntityHandle part_handle, int entity_type, int entity_topology, int adj_part_id, Range &entities_out)
void iMeshP_createPartitionAll (iMesh_Instance instance, MPI_Comm communicator, iMeshP_PartitionHandle *partition_handle, int *err)
 Create a partition; return its handle.
void iMeshP_destroyPartitionAll (iMesh_Instance instance, iMeshP_PartitionHandle partition_handle, int *err)
 Destroy a partition.
void iMeshP_getPartIdFromPartHandle (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, iMeshP_Part *part_id, int *err)
 Obtain a part ID from a part handle.
void iMeshP_getPartHandleFromPartId (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, iMeshP_Part part_id, iMeshP_PartHandle *part_handle, int *err)
 Obtain a part handle from a part ID.
void iMeshP_getPartIdsFromPartHandlesArr (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle *part_handles, const int part_handles_size, iMeshP_Part **part_ids, int *part_ids_allocated, int *part_ids_size, int *err)
 Obtain part IDs from part handles.
void iMeshP_getPartHandlesFromPartsIdsArr (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_Part *part_ids, const int part_ids_size, iMeshP_PartHandle **part_handles, int *part_handles_allocated, int *part_handles_size, int *err)
 Obtain part handles from part IDs.
void iMeshP_getPartitionComm (iMesh_Instance instance, iMeshP_PartitionHandle partition_handle, MPI_Comm *communicator_out, int *err)
 Return communicator associated with a partition.
void iMeshP_syncPartitionAll (iMesh_Instance instance, iMeshP_PartitionHandle partition_handle, int *err)
 Update a partition after parts have been added.
void iMeshP_getNumPartitions (iMesh_Instance instance, int *num_partitions_out, int *err)
 Return the number of partitions associated with a mesh instance.
void iMeshP_getPartitions (iMesh_Instance instance, iMeshP_PartitionHandle **partition_handle, int *partition_handle_allocated, int *partition_handle_size, int *err)
 Return the partition handles associated with a mesh instance.
void iMeshP_getNumGlobalParts (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, int *num_global_part, int *err)
 Return the global number of parts in a partition.
void iMeshP_getNumLocalParts (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, int *num_local_part, int *err)
 Return the local number of parts in a partition.
void iMeshP_getLocalParts (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, iMeshP_PartHandle **part_handles, int *part_handles_allocated, int *part_handles_size, int *err)
 Return the part handles of local parts in a partition.
void iMeshP_getRankOfPart (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_Part part_id, int *rank, int *err)
 Return the process rank of a given part.
void iMeshP_getRankOfPartArr (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_Part *part_ids, const int part_ids_size, int **rank, int *rank_allocated, int *rank_size, int *err)
 Return the process ranks of given parts.
void iMeshP_getNumOfTypeAll (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntitySetHandle entity_set_handle, const int entity_type, int *num_type, int *err)
 Return the number of entities of a given type in a partition.
void iMeshP_getNumOfTopoAll (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntitySetHandle entity_set_handle, const int entity_topology, int *num_topo, int *err)
 Return the number of entities of a given topology in a partition.
void iMeshP_createPart (iMesh_Instance instance, iMeshP_PartitionHandle partition_handle, iMeshP_PartHandle *part_handle, int *err)
 Create a new part in a partition.
void iMeshP_destroyPart (iMesh_Instance instance, iMeshP_PartitionHandle partition_handle, iMeshP_PartHandle part_handle, int *err)
 Remove a part from a partition.
void iMeshP_getNumPartNbors (iMesh_Instance instance, iMeshP_PartitionHandle partition_handle, iMeshP_PartHandle part_handle, int entity_type, int *num_part_nbors, int *err)
 Return the number of parts that neighbor a given part.
void iMeshP_getNumPartNborsArr (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle *part_handles, const int part_handles_size, int, int **num_part_nbors, int *num_part_nbors_allocated, int *num_part_nbors_size, int *err)
 Return the number of parts that neighbor given parts.
void iMeshP_getPartNbors (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, int entity_type, int *num_part_nbors, iMeshP_Part **nbor_part_ids, int *nbor_part_ids_allocated, int *nbor_part_ids_size, int *err)
 Return the parts that neighbor a given part.
void iMeshP_getPartNborsArr (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle *part_handles, const int part_handles_size, int, int **num_part_nbors, int *num_part_nbors_allocated, int *num_part_nbors_size, iMeshP_Part **nbor_part_ids, int *nbor_part_ids_allocated, int *nbor_part_ids_size, int *err)
 Return the parts that neighbor given parts.
void iMeshP_getNumPartBdryEnts (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, const int entity_type, const int entity_topology, const iMeshP_Part target_part_id, int *num_entities, int *err)
 Return the number of entities on a part boundary.
void iMeshP_getPartBdryEnts (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, const int entity_type, const int entity_topology, const iMeshP_Part target_part_id, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *err)
 Return the entity handles of entities on a part boundary.
void iMeshP_initPartBdryEntIter (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, const int entity_type, const int entity_topology, const iMeshP_Part nbor_part_id, iBase_EntityIterator *entity_iterator, int *err)
 Initialize an iterator over a specified part boundary.
void iMeshP_initPartBdryEntArrIter (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, const int entity_type, const int entity_topology, const int array_size, const iMeshP_Part nbor_part_id, iBase_EntityArrIterator *entity_iterator, int *err)
 Initialize an array iterator over a specified part boundary.
void iMeshP_getNumOfType (iMesh_Instance instance, const iMeshP_PartitionHandle, const iMeshP_PartHandle part_handle, const iBase_EntitySetHandle entity_set_handle, const int entity_type, int *num_type, int *err)
 Return the number of entities of a given type in both a part and an entity set.
void iMeshP_getNumOfTopo (iMesh_Instance instance, const iMeshP_PartitionHandle, const iMeshP_PartHandle part_handle, const iBase_EntitySetHandle entity_set_handle, const int entity_topology, int *num_topo, int *err)
 Return the number of entities of a given topology in both a part and an entity set.
void iMeshP_getAdjEntIndices (iMesh_Instance instance, iMeshP_PartitionHandle partition, iMeshP_PartHandle part, iBase_EntitySetHandle entity_set_handle, int entity_type_requestor, int entity_topology_requestor, int entity_type_requested, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, iBase_EntityHandle **adj_entity_handles, int *adj_entity_handles_allocated, int *adj_entity_handles_size, int **adj_entity_indices, int *adj_entity_indices_allocated, int *adj_entity_indices_size, int **offset, int *offset_allocated, int *offset_size, int *err)
 Get indexed representation of mesh or subset of mesh.
void iMeshP_getEntities (iMesh_Instance instance, const iMeshP_PartitionHandle, const iMeshP_PartHandle part_handle, const iBase_EntitySetHandle entity_set_handle, const int entity_type, const int entity_topology, iBase_EntityHandle **entity_handles, int *entity_handles_allocated, int *entity_handles_size, int *err)
 Return entities in a both given part and entity set.
void iMeshP_getAdjEntities (iMesh_Instance instance, const iMeshP_PartitionHandle, const iMeshP_PartHandle part_handle, const iBase_EntitySetHandle entity_set_handle, const int entity_type_requestor, const int entity_topology_requestor, const int entity_type_requested, iBase_EntityHandle **adj_entity_handles, int *adj_entity_handles_allocated, int *adj_entity_handles_size, int **offset, int *offset_allocated, int *offset_size, int **in_entity_set, int *in_entity_set_allocated, int *in_entity_set_size, int *err)
 Return entities adjacent to entities in a given part and entity set.
void iMeshP_initEntIter (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, const iBase_EntitySetHandle entity_set_handle, const int requested_entity_type, const int requested_entity_topology, iBase_EntityIterator *entity_iterator, int *err)
 Create an entity iterator for a given part and entity set.
void iMeshP_initEntArrIter (iMesh_Instance instance, const iMeshP_PartitionHandle, const iMeshP_PartHandle part_handle, const iBase_EntitySetHandle entity_set_handle, const int requested_entity_type, const int requested_entity_topology, const int requested_array_size, iBase_EntityArrIterator *entArr_iterator, int *err)
 Create an entity array iterator for a given part and entity set.
void iMeshP_getEntOwnerPart (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntityHandle entity_handle, iMeshP_Part *part_id, int *err)
 Return the part ID of the part owning an entity.
void iMeshP_getEntOwnerPartArr (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntityHandle *entity_handles, const int entity_handles_size, iMeshP_Part **part_ids, int *part_ids_allocated, int *part_ids_size, int *err)
 Return the part IDs of the parts owning the given entities.
void iMeshP_isEntOwner (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, const iBase_EntityHandle entity_handle, int *is_owner, int *err)
 Test for entity ownership with respect to a part.
void iMeshP_isEntOwnerArr (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int **is_owner, int *is_owner_allocated, int *is_owner_size, int *err)
 Test for entity ownership of many entities with respect to a part.
void iMeshP_getEntStatus (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle part_handle, const iBase_EntityHandle entity_handle, int *par_status, int *err)
 Return entity status (Internal, boundary, ghost).
void iMeshP_getEntStatusArr (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iMeshP_PartHandle, const iBase_EntityHandle *entity_handles, const int entity_handles_size, int **par_status, int *par_status_allocated, int *par_status_size, int *err)
 Return entity status (Internal, boundary, ghost).
void iMeshP_getNumCopies (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntityHandle entity_handle, int *num_copies_ent, int *err)
 Return the number of copies of an entity that exist in the partition.
void iMeshP_getCopyParts (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntityHandle entity_handle, iMeshP_Part **part_ids, int *part_ids_allocated, int *part_ids_size, int *err)
 Return the part IDs of parts having copies of a given entity.
void iMeshP_getCopies (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntityHandle entity_handle, iMeshP_Part **part_ids, int *part_ids_allocated, int *part_ids_size, iBase_EntityHandle **copies_entity_handles, int *copies_entity_handles_allocated, int *copies_entity_handles_size, int *err)
 Get (remote) entity handles of copies of a given entity.
void iMeshP_getCopyOnPart (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntityHandle entity_handle, const iMeshP_Part part_id, iBase_EntityHandle *copy_entity_handle, int *err)
 Get the entity handle of a copy of a given entity in a given part.
void iMeshP_getOwnerCopy (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntityHandle entity_handle, iMeshP_Part *owner_part_id, iBase_EntityHandle *owner_entity_handle, int *err)
 Get the entity handle of a copy of a given entity in its owner part.
void iMeshP_waitForAnyRequest (iMesh_Instance instance, iMeshP_PartitionHandle, iMeshP_RequestHandle *, int, int *, int *err)
 Wait for any of the specified iMeshP requests to complete.
void iMeshP_waitForAllRequests (iMesh_Instance instance, iMeshP_PartitionHandle, iMeshP_RequestHandle *, int, int *err)
 Wait for all of the specified iMeshP requests to complete.
void iMeshP_waitForRequestEnt (iMesh_Instance instance, const iMeshP_PartitionHandle, iMeshP_RequestHandle, iBase_EntityHandle **, int *, int *, int *err)
 Wait for a specific request to complete; return entities received.
void iMeshP_testRequest (iMesh_Instance instance, const iMeshP_PartitionHandle, iMeshP_RequestHandle, int *, int *err)
 Test whether a specific request has completed.
void iMeshP_pollForRequests (iMesh_Instance instance, iMeshP_PartitionHandle, iMeshP_RequestHandle **, int *, int *, int *err)
 Poll for outstanding requests.
void iMeshP_exchEntArrToPartsAll (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const iBase_EntityHandle *entity_handles, const int entity_handles_size, const iMeshP_Part *target_part_ids, int command_code, int update_ghost, iMeshP_RequestHandle *, int *err)
 Add entities to on-process and/or off-process parts.
void iMeshP_migrateEntity (iMesh_Instance instance, const iMeshP_PartitionHandle, const iMeshP_PartHandle, const iBase_EntityHandle, iMeshP_RequestHandle *, int *err)
 Request in-migration of an entity and its upward adjacencies.
void iMeshP_updateVtxCoords (iMesh_Instance instance, const iMeshP_PartitionHandle, const iBase_EntityHandle, int *err)
 Update vertex coordinates for vertex copies.
void iMeshP_replaceOnPartBdry (iMesh_Instance instance, const iMeshP_PartitionHandle, const iBase_EntityHandle *, const int, const iBase_EntityHandle *, const int, const int *, const int, int *err)
 Replace entities on the part boundary.
void iMeshP_addGhostOf (iMesh_Instance instance, const iMeshP_PartitionHandle, const iMeshP_Part, const iBase_EntityHandle, iMeshP_RequestHandle *, int *err)
 Push ghost copies of individual entities onto other parts.
void iMeshP_rmvGhostOf (iMesh_Instance instance, const iMeshP_PartitionHandle, const iMeshP_Part, const iBase_EntityHandle, int *err)
 Remove ghost copies of individual entities from other parts.
void iMeshP_syncMeshAll (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, int *err)
 Indicate completion of mesh modification.
void iMeshP_pushTags (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, iBase_TagHandle source_tag, iBase_TagHandle dest_tag, int entity_type, int entity_topo, int *err)
 Synchronously send tag data for given entity types and topologies.
void iMeshP_pushTagsEnt (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, iBase_TagHandle source_tag, iBase_TagHandle dest_tag, const iBase_EntityHandle *entities, int entities_size, int *err)
 Synchronously send tag data for individual entities.
void iMeshP_iPushTags (iMesh_Instance instance, const iMeshP_PartitionHandle, iBase_TagHandle, iBase_TagHandle, int, int, iMeshP_RequestHandle *, int *err)
 Asynchronously send tag data for given entity types and topologies.
void iMeshP_iPushTagsEnt (iMesh_Instance instance, const iMeshP_PartitionHandle, iBase_TagHandle, iBase_TagHandle, const iBase_EntityHandle *, int, iMeshP_RequestHandle *, int *err)
 Asynchronously send tag data for individual entities.
void iMeshP_createGhostEntsAll (iMesh_Instance instance, iMeshP_PartitionHandle partition_handle, int ghost_dim, int bridge_dim, int num_layers, int include_copies, int *err)
void iMeshP_deleteGhostEntsAll (iMesh_Instance instance, iMeshP_PartitionHandle, int *err)
void iMeshP_ghostEntInfo (const iMesh_Instance instance, const iMeshP_PartitionHandle, int *, int *, int **, int **, int **, int *err)
 Return information about all ghosting on a partition.
static bool append_option (std::string &opt, const char *option, const char *default_value=0)
void iMeshP_loadAll (iMesh_Instance instance, const iMeshP_PartitionHandle partition, const iBase_EntitySetHandle entity_set_handle, const char *name, const char *options, int *err, int name_len, int options_len)
 Populate a mesh instance and a partition by reading data from files.
void iMeshP_saveAll (iMesh_Instance instance, const iMeshP_PartitionHandle partition, const iBase_EntitySetHandle entity_set_handle, const char *name, const char *options, int *err, const int name_len, int options_len)
 Write data from a mesh instance and a partition to files.
void iMeshP_getPartsOnRank (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const int, iMeshP_PartHandle **part_handles, int *part_handles_allocated, int *part_handles_size, int *err)
void iMeshP_getPartsArrOnRank (iMesh_Instance instance, const iMeshP_PartitionHandle partition_handle, const int *rank, const int rank_size, iMeshP_PartHandle **part_handles, int *part_handles_allocated, int *part_handles_size, int *err)
void iMeshP_assignGlobalIds (iMesh_Instance instance, const iMeshP_PartitionHandle partition, const iBase_EntitySetHandle this_set, const int dimension, const int start_id, const int largest_dim_only, const int parallel, const int owned_only, int *err)
 Assign a global id space to entities Assign a global id space to entities and vertices, and optionally intermediate-dimension entities.
void iMeshP_getCommunicator (iMesh_Instance instance, int *fcomm, MPI_Comm *ccomm, int *err)
 Convert a fortran to C communicator Given a Fortran communicator, convert to a C communicator that can be passed back to iMeshP. Though this is an iMeshP function, it doesn't take an iMeshP Partition handle, since the (C) communicator is needed by the function that creates the partition. COMMUNICATION: None.

Define Documentation

#define IS_BUILDING_MB

Definition at line 13 of file iMeshP_MOAB.cpp.

#define RANGE_TO_ITAPS_ARRAY (   RANGE,
  NAME 
)
Value:
do                                                                                             \
    {                                                                                              \
        ALLOC_CHECK_ARRAY_NOFAIL( NAME, ( RANGE ).size() );                                        \
        std::copy( ( RANGE ).begin(), ( RANGE ).end(), itaps_cast< EntityHandle* >( *( NAME ) ) ); \
    } while( false )

Definition at line 165 of file iMeshP_MOAB.cpp.

Referenced by iMeshP_getEntities(), iMeshP_getLocalParts(), and iMeshP_getPartBdryEnts().


Function Documentation

static bool append_option ( std::string &  opt,
const char *  option,
const char *  default_value = 0 
) [static]

Definition at line 1384 of file iMeshP_MOAB.cpp.

References iBase_INVALID_ARGUMENT.

Referenced by iMeshP_loadAll().

{
    std::string::size_type i;

    const char sep = ' ';

    if( strchr( option, sep ) || ( default_value && strchr( default_value, sep ) ) )
    {
        // options can't have a separator in them; XXX work around this
        return iBase_INVALID_ARGUMENT;
    }

    // search for the required option
    std::string search( &sep, 1 );
    search += option;
    const std::string::size_type sl = search.length();
    i                               = opt.find( search );
    while( i != std::string::npos )
    {
        std::string::size_type end = i + sl;
        if( end == opt.size() || opt[end] == sep || opt[end] == '=' ) break;
        i = end;
    }

    // if string already contained the option, just return
    if( i != std::string::npos ) return false;

    opt += search;
    if( default_value )
    {
        opt += "=";
        opt += default_value;
    }

    return true;
}
static ErrorCode count_owned ( ParallelComm pcomm,
const Range ents,
int &  n 
) [inline, static]

Definition at line 205 of file iMeshP_MOAB.cpp.

References moab::ParallelComm::get_moab(), MB_SUCCESS, PSTATUS_NOT_OWNED, moab::ParallelComm::pstatus_tag(), and moab::Range::size().

Referenced by iMeshP_getNumOfTopoAll(), and iMeshP_getNumOfTypeAll().

{
    ErrorCode rval;
    n = 0;

    std::vector< unsigned char > pstatus( ents.size() );
    rval = pcomm->get_moab()->tag_get_data( pcomm->pstatus_tag(), ents, &pstatus[0] );
    if( MB_SUCCESS != rval ) return rval;

    std::vector< unsigned char >::const_iterator j;
    for( j = pstatus.begin(); j != pstatus.end(); ++j )
        if( !( *j & PSTATUS_NOT_OWNED ) ) ++n;

    return MB_SUCCESS;
}
static ErrorCode get_boundary_entities ( ParallelComm pcomm,
EntityHandle  part_handle,
int  entity_type,
int  entity_topology,
int  adj_part_id,
Range entities_out 
) [static]

Definition at line 247 of file iMeshP_MOAB.cpp.

References moab::Range::begin(), moab::Range::end(), get_entities(), moab::ParallelComm::get_interface_sets(), moab::ParallelComm::get_moab(), iMeshP_ALL_PARTS, and MB_SUCCESS.

Referenced by iMeshP_getNumPartBdryEnts(), iMeshP_getPartBdryEnts(), and PartBoundaryIter::reset().

{
    int* adj_part_id_ptr = ( adj_part_id == iMeshP_ALL_PARTS ) ? 0 : &adj_part_id;

    Range iface_sets;
    ErrorCode rval = pcomm->get_interface_sets( part_handle, iface_sets, adj_part_id_ptr );
    if( MB_SUCCESS != rval ) return rval;

    for( Range::iterator i = iface_sets.begin(); i != iface_sets.end(); ++i )
    {
        rval = get_entities( pcomm->get_moab(), *i, entity_type, entity_topology, entities_out );
        if( MB_SUCCESS != rval ) return rval;
    }

    return MB_SUCCESS;
}
static ErrorCode get_entities ( Interface *  iface,
EntityHandle  set,
int  type,
int  topology,
Range entities 
) [inline, static]

Definition at line 172 of file iMeshP_MOAB.cpp.

References iBase_ALL_TYPES, iMesh_ALL_TOPOLOGIES, and mb_topology_table.

{
    if( topology != iMesh_ALL_TOPOLOGIES )
        return iface->get_entities_by_type( set, mb_topology_table[topology], entities );
    else if( type != iBase_ALL_TYPES )
        return iface->get_entities_by_dimension( set, type, entities );
    else
        return iface->get_entities_by_handle( set, entities );
}
void iMeshP_addGhostOf ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_Part  target_part_id,
iBase_EntityHandle  entity_to_copy,
iMeshP_RequestHandle request,
int *  err 
)

Push ghost copies of individual entities onto other parts.

Given an entity and a target part, create a ghost copy of the entity on the target part.

Communication here is push-and-confirm (so that the original knows remote entity handle of the created ghosts). The closure of a new ghost is pushed automatically as part of the underlying communication.

COMMUNICATION: point-to-point, non-blocking, push.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
target_part_id(In) The part to receive the new ghost.
entity_to_copy(In) The entity to be copied in target_part_id.
request(Out) The iMeshP request handle returned.
err(Out) Error code.

Definition at line 1271 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_assignGlobalIds ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntitySetHandle  this_set,
const int  dimension,
const int  start_id,
const int  largest_dim_only,
const int  parallel,
const int  owned_only,
int *  err 
)

Assign a global id space to entities Assign a global id space to entities and vertices, and optionally intermediate-dimension entities.

COMMUNICATION: Collective.

Definition at line 1518 of file iMeshP_MOAB.cpp.

References moab::ParallelComm::assign_global_ids(), CHKERR, moab::ParallelComm::get_pcomm(), iBase_FAILURE, itaps_cast(), MB_FAILURE, MOABI, and RETURN.

{
    ErrorCode rval;

    // get partition set
    EntityHandle partitionset = itaps_cast< EntityHandle >( partition );
    if( !partitionset )
    {
        rval = MB_FAILURE;CHKERR( rval, "failed to get partition set" );
    }

    EntityHandle this_mb_set = itaps_cast< EntityHandle >( this_set );

    // get ParallelComm for partition
    MPI_Comm default_comm;
    ParallelComm* pcomm = ParallelComm::get_pcomm( MOABI, partitionset, &default_comm );
    if( !pcomm ) { RETURN( iBase_FAILURE ); }

    rval = pcomm->assign_global_ids( this_mb_set, dimension, start_id, largest_dim_only, parallel, owned_only );

    RETURN( rval );
}
void iMeshP_createGhostEntsAll ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition_handle,
int  ghost_dim,
int  bridge_dim,
int  num_layers,
int  include_copies,
int *  err 
)

Definition at line 1353 of file iMeshP_MOAB.cpp.

References CHKERR, moab::ParallelComm::exchange_ghost_cells(), FIXME, iBase_ALL_TYPES, iBase_NOT_SUPPORTED, iBase_SUCCESS, PCOMM, and RETURN.

{
    if( include_copies )
    {
        FIXME;
        RETURN( iBase_NOT_SUPPORTED );
    }

    ParallelComm* pcomm = PCOMM;
    ErrorCode rval;
    if( iBase_ALL_TYPES == ghost_dim ) ghost_dim = -1;
    rval = pcomm->exchange_ghost_cells( ghost_dim, bridge_dim, num_layers, 0, true );CHKERR( rval, "ghost exchange failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_createPart ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition,
iMeshP_PartHandle part,
int *  err 
)

Create a new part in a partition.

Given a partition handle, create a new part and add it to the partition on the process invoking the creation. Return the part handle for the new part.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being updated.
part(Out) The newly created part.
err(Out) Error code.

Definition at line 575 of file iMeshP_MOAB.cpp.

References CHKERR, moab::ParallelComm::create_part(), ERROR, iBase_FAILURE, iBase_SUCCESS, itaps_cast(), PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    EntityHandle h;
    ErrorCode rval = pcomm->create_part( h );CHKERR( rval, "Part creation failed" );
    *part_handle = itaps_cast< iMeshP_PartHandle >( h );
    RETURN( iBase_SUCCESS );
}
void iMeshP_createPartitionAll ( iMesh_Instance  instance,
MPI_Comm  communicator,
iMeshP_PartitionHandle partition,
int *  err 
)

Create a partition; return its handle.

Given a mesh instance and a communicator, return a partition handle for a new partition within the mesh instance that uses the communicator. In the future, we may have different creation routines for different communication systems; once the partition is created, the application would not have to worry about the communication system again. For now, implementations are MPI based, so MPI communicators are provided. For serial use, the communicator may be MPI_COMM_SELF or communicator may be NULL.

COMMUNICATION: Collective.

Parameters:
instance(In) Mesh instance to contain the partition.
communicator(In) Communicator to be used for parallel communication.
partition(Out) The newly created partition.
err(Out) Error code.

Definition at line 338 of file iMeshP_MOAB.cpp.

References CHKERR, moab::ParallelComm::get_id(), moab::ParallelComm::get_pcomm(), iBase_FAILURE, iBase_SUCCESS, itaps_cast(), MB_TAG_CREAT, MB_TAG_SPARSE, MB_TYPE_INTEGER, MESHSET_SET, MOABI, PARALLEL_PARTITIONING_TAG_NAME, and RETURN.

{
    *partition_handle = 0;

    Tag prtn_tag;
    ErrorCode rval = MOABI->tag_get_handle( PARALLEL_PARTITIONING_TAG_NAME, 1, MB_TYPE_INTEGER, prtn_tag,
                                            MB_TAG_SPARSE | MB_TAG_CREAT );CHKERR( rval, "tag creation failed" );

    EntityHandle handle;
    rval = MOABI->create_meshset( MESHSET_SET, handle );CHKERR( rval, "set creation failed" );
    ParallelComm* pcomm = ParallelComm::get_pcomm( MOABI, handle, &communicator );
    if( !pcomm )
    {
        MOABI->delete_entities( &handle, 1 );
        RETURN( iBase_FAILURE );
    }

    // set the value of pcomm id, to the partitioning tag, although this is not used
    // we just need the tag to be set
    int pid = pcomm->get_id();
    rval    = MOABI->tag_set_data( prtn_tag, &handle, 1, &pid );CHKERR( rval, "tag creation failed" );

    *partition_handle = itaps_cast< iMeshP_PartitionHandle >( handle );
    RETURN( iBase_SUCCESS );
}
void iMeshP_deleteGhostEntsAll ( iMesh_Instance  instance,
iMeshP_PartitionHandle  ,
int *  err 
)

Definition at line 1369 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_destroyPart ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition,
iMeshP_PartHandle  part,
int *  err 
)

Remove a part from a partition.

Given a partition handle and a part handle, remove the part from the partition and destroy the part. Note that the part handle is not invalidated by this function.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being updated.
part(In) The part to be removed.
err(Out) Error code.

Definition at line 587 of file iMeshP_MOAB.cpp.

References CHKERR, moab::ParallelComm::destroy_part(), ERROR, iBase_FAILURE, iBase_SUCCESS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    ErrorCode rval = pcomm->destroy_part( itaps_cast< EntityHandle >( part_handle ) );CHKERR( rval, "Part destruction failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_destroyPartitionAll ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition,
int *  err 
)

Destroy a partition.

Given a partition handle, destroy the partition associated with the handle. Note that the partition handle is not invalidated upon return.

COMMUNICATION: Collective.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition to be destroyed.
err(Out) Error code.

Definition at line 366 of file iMeshP_MOAB.cpp.

References CHKERR, iBase_SUCCESS, itaps_cast(), MOABI, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( pcomm ) delete pcomm;
    EntityHandle handle = itaps_cast< EntityHandle >( partition_handle );
    ErrorCode rval      = MOABI->delete_entities( &handle, 1 );CHKERR( rval, "entity deletion failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_exchEntArrToPartsAll ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle entities,
const int  entities_size,
const iMeshP_Part target_part_ids,
int  command_code,
int  update_ghost,
iMeshP_RequestHandle request,
int *  err 
)

Add entities to on-process and/or off-process parts.

Given a partition and a list of entities, add those entities to the target parts. The entities can be added as copies or migrated entirely (i.e., change ownership of the entities) to the parts. The entities' downward adjacencies are also copied and/or migrated as appropriate to support the entities. This function is a collective, non-blocking operation to be called by all processes in the partition's communicator. An iMeshP_RequestHandle is returned; any of the iMeshP_wait* functions can be used to block until the request is completed.

COMMUNICATION: Collective. Non-blocking.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) Handle for the partition being queried.
entities(In) Entities to be sent.
entities_size(In) Number of entities to be sent.
target_part_ids(In) Array of size entities_size listing the parts to which the entities should be sent.
command_code(In) Flag indicating whether to migrate the entities or only make copies.
update_ghost(In) Flag indicating whether (1) or not (0) ghost copies of the entities should be updated with new owner information.
request(Out) iMeshP RequestHandle returned; can be used for blocking until this send is complete.
err(Out) Error code.

Definition at line 1197 of file iMeshP_MOAB.cpp.

References CHKERR, moab::ParallelComm::exchange_owned_meshs(), moab::ParallelComm::get_part_owner(), iBase_NOT_SUPPORTED, iBase_SUCCESS, PCOMM, and RETURN.

{
    if( command_code == 1 )
    {
        std::cerr << "Entity migration option is not supported." << std::endl;
        RETURN( iBase_NOT_SUPPORTED );
    }

    if( update_ghost == 1 )
    {
        std::cerr << "Gost update option is not supported." << std::endl;
        RETURN( iBase_NOT_SUPPORTED );
    }

    // make exchange entity and processor list
    ErrorCode rval;
    ParallelComm* pcomm = PCOMM;
    std::vector< unsigned int > exchange_procs;
    std::vector< Range* > exchange_ents;

    for( int i = 0; i < entity_handles_size; i++ )
    {
        int ind = -1;
        // iMeshP_Part target_p = target_part_ids[i];
        int target_p;
        rval = pcomm->get_part_owner( target_part_ids[i], target_p );CHKERR( rval, "ParallelComm::get_part_owner failed" );

        std::vector< unsigned int >::iterator vit = std::find( exchange_procs.begin(), exchange_procs.end(), target_p );
        if( vit == exchange_procs.end() )
        {
            ind = exchange_procs.size();
            exchange_procs.push_back( target_p );
            exchange_ents.push_back( new Range );
        }
        else
            ind = vit - exchange_procs.begin();

        exchange_ents[ind]->insert( itaps_cast< EntityHandle >( entity_handles[i] ) );
    }

    std::vector< MPI_Request > recv_ent_reqs, recv_remoteh_reqs;
    rval = pcomm->exchange_owned_meshs( exchange_procs, exchange_ents, recv_ent_reqs, recv_remoteh_reqs, true );CHKERR( rval, "ParallelComm::exchange_owned_meshs failed" );

    // delete exchange list
    std::vector< Range* >::iterator vit;
    for( vit = exchange_ents.begin(); vit != exchange_ents.end(); ++vit )
        delete( *vit );

    RETURN( iBase_SUCCESS );
}
void iMeshP_getAdjEntIndices ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition,
iMeshP_PartHandle  part,
iBase_EntitySetHandle  entity_set_handle,
int  entity_type_requestor,
int  entity_topology_requestor,
int  entity_type_requested,
iBase_EntityHandle **  entity_handles,
int *  entity_handles_allocated,
int *  entity_handles_size,
iBase_EntityHandle **  adj_entity_handles,
int *  adj_entity_handles_allocated,
int *  adj_entity_handles_size,
int **  adj_entity_indices,
int *  adj_entity_indices_allocated,
int *  adj_entity_indices_size,
int **  offset,
int *  offset_allocated,
int *  offset_size,
int *  err 
)

Get indexed representation of mesh or subset of mesh.

Given part handle and an entity set and optionally a type or topology, for all entities that are in BOTH the part and the entity set, return:

  • The entities in the part and set of the specified type or topology
  • The entities adjacent to those entities with a specified type, as a list of unique handles.
  • For each entity in the first list, the adjacent entities, specified as indices into the second list.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_set_handle(In) The set being queried
entity_type_requestor(In) If not iBase_ALL_TYPES, act only on the subset of entities with the specified type.
entity_topology_requestor(In) If not iMesh_ALL_TOPOLOGIES, act only on the subset of entities with the specified topology.
entity_type_requested(In) The type of the adjacent entities to return.
entity_handles(In/Out) The handles of the (non-strict) subset of the union of the part and entity set, and the optional type and topology filtering arguments.
adj_entity_handles(In/Out) The union of the entities of type 'requested_entity_type' adjacent to each entity in 'entity_handles'.
adj_entity_indices(In/Out) For each entity in 'entity_handles', the adjacent entities of type 'entity_type_requested', specified as indices into 'adj_entity_handles'. The indices are concatenated into a single array in the order of the entity handles in 'entity_handles'.
offset(In/Out) For each entity in the corresponding position in 'entity_handles', the position in 'adj_entity_indices' at which values for that entity are stored.

Definition at line 728 of file iMeshP_MOAB.cpp.

References iBase_BAD_ARRAY_DIMENSION, iBase_MEMORY_ALLOCATION_FAILED, iBase_SUCCESS, iMesh_getEntArrAdj, iMeshP_getEntities, and size.

{
    const int allocated_entity_handles = ( *entity_handles_allocated == 0 );
    const int allocated_indices        = ( *adj_entity_indices_allocated == 0 );
    const int allocated_offset         = ( *offset_allocated == 0 );

    // get source entities
    iMeshP_getEntities( instance, partition, part, entity_set_handle, entity_type_requestor, entity_topology_requestor,
                        entity_handles, entity_handles_allocated, entity_handles_size, err );
    if( iBase_SUCCESS != *err ) return;

    // get adjacencies
    iBase_EntityHandle* all_adj_handles = 0;
    int size = 0, alloc = 0;
    iMesh_getEntArrAdj( instance, *entity_handles, *entity_handles_size, entity_type_requested, &all_adj_handles,
                        &alloc, &size, offset, offset_allocated, offset_size, err );
    if( *err != iBase_SUCCESS )
    {
        if( allocated_entity_handles )
        {
            free( *entity_handles );
            *entity_handles           = 0;
            *entity_handles_allocated = 0;
        }
        return;
    }

    // allocate or check size of adj_entity_indices
    *adj_entity_indices_size = size;
    if( allocated_indices )
    {
        *adj_entity_indices = (int*)malloc( sizeof( iBase_EntityHandle ) * size );
        if( !*adj_entity_indices )
            *err = iBase_MEMORY_ALLOCATION_FAILED;
        else
            *adj_entity_indices_allocated = size;
    }
    else if( *adj_entity_indices_allocated < size )
    {
        *err = iBase_BAD_ARRAY_DIMENSION;
    }
    if( iBase_SUCCESS != *err )
    {
        free( all_adj_handles );
        if( allocated_entity_handles )
        {
            free( *entity_handles );
            *entity_handles           = 0;
            *entity_handles_allocated = 0;
        }
        if( allocated_offset )
        {
            free( *offset );
            *offset           = 0;
            *offset_allocated = 0;
        }
        return;
    }

    // Now create an array of unique sorted handles from all_adj_handles.
    // We need to create a copy because we still need all_adj_handles.  We
    // will eventually need to copy the resulting unique list into
    // adj_entity_handles, so if adj_entity_handles is already allocated and
    // of sufficient size, use it rather than allocating another temporary.
    iBase_EntityHandle* unique_adj = 0;
    if( *adj_entity_handles_allocated >= size ) { unique_adj = *adj_entity_handles; }
    else
    {
        unique_adj = (iBase_EntityHandle*)malloc( sizeof( iBase_EntityHandle ) * size );
    }
    std::copy( all_adj_handles, all_adj_handles + size, unique_adj );
    std::sort( unique_adj, unique_adj + size );
    *adj_entity_handles_size = std::unique( unique_adj, unique_adj + size ) - unique_adj;

    // If we created a temporary array for unique_adj rather than using
    // already allocated space in adj_entity_handles, allocate adj_entity_handles
    // and copy the unique handle list into it
    if( *adj_entity_handles != unique_adj )
    {
        if( !*adj_entity_handles_allocated )
        {
            *adj_entity_handles =
                (iBase_EntityHandle*)malloc( sizeof( iBase_EntityHandle ) * *adj_entity_handles_size );
            if( !*adj_entity_handles )
                *err = iBase_MEMORY_ALLOCATION_FAILED;
            else
                *adj_entity_handles_allocated = *adj_entity_handles_size;
        }
        else if( *adj_entity_handles_allocated < *adj_entity_handles_size )
            *err = iBase_BAD_ARRAY_DIMENSION;
        if( iBase_SUCCESS != *err )
        {
            free( unique_adj );
            free( all_adj_handles );
            if( allocated_entity_handles )
            {
                free( *entity_handles );
                *entity_handles           = 0;
                *entity_handles_allocated = 0;
            }
            if( allocated_offset )
            {
                free( *offset );
                *offset           = 0;
                *offset_allocated = 0;
            }
            if( allocated_indices )
            {
                free( *adj_entity_indices );
                *adj_entity_indices           = 0;
                *adj_entity_indices_allocated = 0;
            }
            return;
        }

        std::copy( unique_adj, unique_adj + *adj_entity_handles_size, *adj_entity_handles );
        free( unique_adj );
        unique_adj = *adj_entity_handles;
    }

    // convert from adjacency list to indices into unique_adj
    for( int i = 0; i < *adj_entity_indices_size; ++i )
        ( *adj_entity_indices )[i] =
            std::lower_bound( unique_adj, unique_adj + *adj_entity_handles_size, all_adj_handles[i] ) - unique_adj;
    free( all_adj_handles );
}
void iMeshP_getAdjEntities ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntitySetHandle  entity_set,
int  entity_type_requestor,
int  entity_topology_requestor,
int  entity_type_requested,
iBase_EntityHandle **  adj_entities,
int *  adj_entities_allocated,
int *  adj_entities_size,
int **  offset,
int *  offset_allocated,
int *  offset_size,
int **  in_entity_set,
int *  in_entity_set_allocated,
int *  in_entity_set_size,
int *  err 
)

Return entities adjacent to entities in a given part and entity set.

Given an entity set handle and a part handle, return entities adjacent (with respect to a given entity type and/or topology) to entities that are in both the part and the entity set. This function is similar to iMesh_getAdjEntities, but it also restricts the returned data with respect to its existence in the given part. If a non-root entity set is specified, the function also returns flags indicating whether each adjacent entity is in the entity set; (*in_entity_set)[i]=1 indicates that adjacent entity (*adj_entities)[i] is in the specified entity set. Array entry offset[i] stores the index of first adjacent entity to entity i.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_set(In) Entity set handle for the entity set being queried; may be the root set.
entity_type_requestor(In) Return entities adjacent to entities of this type; may be iBase_ALL_TYPES.
entity_topology_requestor(In) Return entities adjacent to entities of this topology; may be iMesh_ALL_TOPOLOGIES.
entity_type_requested(In) Return adjacent entities of this type; may be iBase_ALL_TYPES.
adj_entities(In/Out) Array of adjacent entity handles returned.
adj_entities_allocated(In/Out) Allocated size of adj_entities.
adj_entities_size(Out) Occupied size of adj_entities.
offset(In/Out) Array of offsets returned.
offset_allocated(In/Out) Allocated size of offset.
offset_size(Out) Occupied size of offset.
in_entity_set(In/Out) Array of flags returned if non-root entity set was input; (*in_entity_set)[i]=1 indicates (*adj_entities)[i] is in the entity set.
in_entity_set_allocated(In/Out) Allocated size of in_entity_set.
in_entity_set_size(Out) Occupied size of in_entity_set.
err(Out) Error code.

Definition at line 875 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, moab::Range::begin(), CHKERR, moab::Range::end(), iBase_SUCCESS, iMesh_isEntArrContained, itaps_cast(), KEEP_ARRAY, MBPOLYHEDRON, MOABI, set_intersection_query(), moab::Range::size(), and moab::TYPE_FROM_HANDLE().

{
    ErrorCode rval;
    Range r;
    set_intersection_query( instance, part_handle, entity_set_handle, entity_type_requestor, entity_topology_requestor,
                            r, err );
    if( iBase_SUCCESS != *err ) return;

    // count adjacencies
    std::vector< EntityHandle > tmp_storage;
    int num_adj = 0;
    int num_conn;
    const EntityHandle* conn_ptr;
    for( Range::iterator i = r.begin(); i != r.end(); ++i )
    {
        if( entity_type_requested || TYPE_FROM_HANDLE( *i ) == MBPOLYHEDRON )
        {
            tmp_storage.clear();
            rval = MOABI->get_adjacencies( &*i, 1, entity_type_requested, false, tmp_storage );CHKERR( rval, "get_adjacencies failed" );
            num_adj += tmp_storage.size();
        }
        else
        {
            rval = MOABI->get_connectivity( *i, conn_ptr, num_conn, false, &tmp_storage );CHKERR( rval, "get_connectivity failed" );
            num_adj += num_conn;
        }
    }

    // get adjacencies
    ALLOC_CHECK_ARRAY( adj_entity_handles, num_adj );
    ALLOC_CHECK_ARRAY( offset, r.size() );
    int arr_pos      = 0;
    int* offset_iter = *offset;
    for( Range::iterator i = r.begin(); i != r.end(); ++i )
    {
        *offset_iter = arr_pos;
        ++offset_iter;

        tmp_storage.clear();
        rval = MOABI->get_adjacencies( &*i, 1, entity_type_requested, false, tmp_storage );CHKERR( rval, "get_adjacencies failed" );
        for( std::vector< EntityHandle >::iterator j = tmp_storage.begin(); j != tmp_storage.end(); ++j )
        {
            ( *adj_entity_handles )[arr_pos] = itaps_cast< iBase_EntityHandle >( *j );
            ++arr_pos;
        }
    }

    // get in_entity_set
    iMesh_isEntArrContained( instance, entity_set_handle, *adj_entity_handles, *adj_entity_handles_size, in_entity_set,
                             in_entity_set_allocated, in_entity_set_size, err );

    if( iBase_SUCCESS == *err )
    {
        KEEP_ARRAY( adj_entity_handles );
        KEEP_ARRAY( offset );
    }
}
void iMeshP_getCommunicator ( iMesh_Instance  instance,
int *  fcomm,
MPI_Comm ccomm,
int *  err 
)

Convert a fortran to C communicator Given a Fortran communicator, convert to a C communicator that can be passed back to iMeshP. Though this is an iMeshP function, it doesn't take an iMeshP Partition handle, since the (C) communicator is needed by the function that creates the partition. COMMUNICATION: None.

Parameters:
instance(In) Mesh instance to contain the partition.
fcomm(In) Pointer to fortran communicator
ccomm(Out) Pointer to the C communicator
err(Out) Error code.

Definition at line 1543 of file iMeshP_MOAB.cpp.

References iBase_SUCCESS, and RETURN.

{
    *ccomm = MPI_Comm_f2c( *fcomm );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getCopies ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle  entity,
iMeshP_Part **  part_ids,
int *  part_ids_allocated,
int *  part_ids_size,
iBase_EntityHandle **  copies,
int *  copies_allocated,
int *  copies_size,
int *  err 
)

Get (remote) entity handles of copies of a given entity.

Given a partition handle and an entity handle, return (remote) entity handles and part IDs of all copies of the entity. If the given entity is an owned entity or boundary entity, the number of copies considered will be complete. If the given entity is a ghost entity, the number of copies considered will be two (the ghost and its owner).

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entity(In) Entity whose copy info is requested.
part_ids(Out) Part IDs of parts having copies of the given entity.
part_ids_allocated(In/Out) Allocated size of part_ids array.
part_ids_size(Out) Occupied size of part_ids array.
copies(Out) (Remote) entity handles of the entity copies.
copies_allocated(In/Out) Allocated size of copies.
copies_size(Out) Occupied size of copies.
err(Out) Error code.

Definition at line 1111 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, CHKERR, ERROR, moab::ParallelComm::get_sharing_parts(), iBase_FAILURE, iBase_SUCCESS, itaps_cast(), MAX_SHARING_PROCS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    int ids[MAX_SHARING_PROCS], num_ids;
    EntityHandle handles[MAX_SHARING_PROCS];
    ErrorCode rval = pcomm->get_sharing_parts( itaps_cast< EntityHandle >( entity_handle ), ids, num_ids, handles );CHKERR( rval, "ParallelComm::get_sharing_parts failed" );
    ALLOC_CHECK_ARRAY_NOFAIL( part_ids, num_ids );
    ALLOC_CHECK_ARRAY_NOFAIL( copies_entity_handles, num_ids );
    for( int i = 0; i < num_ids; ++i )
    {
        ( *part_ids )[i]              = ids[i];
        ( *copies_entity_handles )[i] = itaps_cast< iBase_EntityHandle >( handles[i] );
    }
    RETURN( iBase_SUCCESS );
}
void iMeshP_getCopyOnPart ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle  entity,
const iMeshP_Part  part_id,
iBase_EntityHandle copy_entity,
int *  err 
)

Get the entity handle of a copy of a given entity in a given part.

Given a partition handle, an entity handle and a part ID, return the (remote) entity handle of the copy of the entity in that part. Return an error if the entity does not exist in the specified part.

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entity(In) Entity whose copy info is requested.
part_id(In) Part ID of part whose copy of the given entity is requested.
copy_entity(Out) (Remote) entity handle of the entity copy from the given part.
err(Out) Error code.

Definition at line 1132 of file iMeshP_MOAB.cpp.

References CHKERR, ERROR, moab::ParallelComm::get_sharing_parts(), iBase_FAILURE, iBase_SUCCESS, itaps_cast(), MAX_SHARING_PROCS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    int ids[MAX_SHARING_PROCS], num_ids;
    EntityHandle handles[MAX_SHARING_PROCS];
    ErrorCode rval = pcomm->get_sharing_parts( itaps_cast< EntityHandle >( entity_handle ), ids, num_ids, handles );CHKERR( rval, "ParallelComm::get_sharing_parts failed" );
    int idx = std::find( ids, ids + num_ids, part_id ) - ids;
    if( idx == num_ids ) RETURN( iBase_FAILURE );

    *copy_entity_handle = itaps_cast< iBase_EntityHandle >( handles[idx] );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getCopyParts ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle  entity,
iMeshP_Part **  part_ids,
int *  part_ids_allocated,
int *  part_ids_size,
int *  err 
)

Return the part IDs of parts having copies of a given entity.

Given a partition handle and an entity handle, return the part IDs of copies of the entity in the partition. If the given entity is an owned entity or boundary entity, the number of copies considered will be complete. If the given entity is a ghost entity, the number of copies considered will be two (the ghost and its owner).

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entity(In) Entity whose copy info is requested.
part_ids(Out) Part IDs of parts having copies of the given entity.
part_ids_allocated(In/Out) Allocated size of part_ids array.
part_ids_size(Out) Occupied size of part_ids array.
err(Out) Error code.

Definition at line 1097 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, CHKERR, ERROR, moab::ParallelComm::get_sharing_parts(), iBase_FAILURE, iBase_SUCCESS, MAX_SHARING_PROCS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    int ids[MAX_SHARING_PROCS], num_ids;
    ErrorCode rval = pcomm->get_sharing_parts( itaps_cast< EntityHandle >( entity_handle ), ids, num_ids );CHKERR( rval, "ParallelComm::get_sharing_parts failed" );
    ALLOC_CHECK_ARRAY_NOFAIL( part_ids, num_ids );
    std::copy( ids, ids + num_ids, *part_ids );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getEntities ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntitySetHandle  entity_set,
int  entity_type,
int  entity_topology,
iBase_EntityHandle **  entities,
int *  entities_allocated,
int *  entities_size,
int *  err 
)

Return entities in a both given part and entity set.

Given an entity set handle and a part handle, return entity handles for entities that are in both the part and the entity set. This function is similar to iMesh_getEntities, but it also restricts the returned data with respect to its existence in the given part.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_set(In) Entity set handle for the entity set being queried; may be the root set.
entity_type(In) Entity type of the entities; may be iBase_ALL_TYPES.
entity_topology(In) Entity topology of the entities; may be iMesh_ALL_TOPOLOGIES.
entities(In/Out) Array of entity handles for entities in both part and entity_set.
entities_allocated(In/Out) Allocated size of entities.
entities_size(Out) Occupied size of entities.
err(Out) Error code.

Definition at line 862 of file iMeshP_MOAB.cpp.

References iBase_SUCCESS, RANGE_TO_ITAPS_ARRAY, RETURN, and set_intersection_query().

{
    Range r;
    set_intersection_query( instance, part_handle, entity_set_handle, entity_type, entity_topology, r, err );
    if( iBase_SUCCESS != *err ) return;

    RANGE_TO_ITAPS_ARRAY( r, entity_handles );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getEntOwnerPart ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle  entity,
iMeshP_Part part_id,
int *  err 
)

Return the part ID of the part owning an entity.

Given an entity handle and a partition handle, return the part ID of the part that owns the entity. Return an error code if an entity is not in the partition.

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entity(In) Entity whose owning part is to be returned.
part_id(Out) Part ID of the part owning the entity.
err(Out) Error code.

Definition at line 982 of file iMeshP_MOAB.cpp.

References iMeshP_getEntOwnerPartArr.

{
    int junk1 = 1, junk2 = 1;
    iMeshP_getEntOwnerPartArr( instance, partition_handle, &entity_handle, 1, &part_id, &junk1, &junk2, err );
}
void iMeshP_getEntOwnerPartArr ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle entities,
const int  entities_size,
iMeshP_Part **  part_ids,
int *  part_ids_allocated,
int *  part_ids_size,
int *  err 
)

Return the part IDs of the parts owning the given entities.

Given an array of entity handles and a partition handle, return for each entity handle the part ID of the part that owns the entity. Return an error code if an entity is not in the partition.

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entities(In) Entity whose owning part is to be returned.
entities_size(In) Number of entities in entities array.
part_ids(Out) Part IDs of the parts owning the entities.
part_ids_allocated(In/Out) Allocated size of part_ids array.
part_ids_size(Out) Occupied size of part_ids array.
err(Out) Error code.

Definition at line 989 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, CHKERR, ERROR, moab::ParallelComm::get_owning_part(), iBase_FAILURE, iBase_SUCCESS, itaps_cast(), KEEP_ARRAY, MB_SUCCESS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    int id;
    ALLOC_CHECK_ARRAY( part_ids, entity_handles_size );
    ErrorCode rval = MB_SUCCESS;
    for( int i = 0; i < entity_handles_size; ++i )
    {
        EntityHandle h   = itaps_cast< EntityHandle >( entity_handles[i] );
        rval             = pcomm->get_owning_part( h, id );
        ( *part_ids )[i] = id;CHKERR( rval, "Failet get part owner" );
    }
    KEEP_ARRAY( part_ids );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getEntStatus ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntityHandle  entity,
int *  par_status,
int *  err 
)

Return entity status (Internal, boundary, ghost).

Given a partition handle, a part handle, and an entity handle, return a flag indicating whether the entity is strictly internal, is on a part boundary, or is a ghost with respect to the given part. The returned value is a member of the iMeshP_EntStatus enumerated type.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity(In) Entity whose status is being tested.
par_status(Out) Value indicating the status of the is the entity with respect to the part.
err(Out) Error code.

Definition at line 1043 of file iMeshP_MOAB.cpp.

References iMeshP_getEntStatusArr.

{
    int junk1 = 1, junk2 = 1;
    iMeshP_getEntStatusArr( instance, partition_handle, part_handle, &entity_handle, 1, &par_status, &junk1, &junk2,
                            err );
}
void iMeshP_getEntStatusArr ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntityHandle entities,
const int  entities_size,
int **  par_status,
int *  par_status_allocated,
int *  par_status_size,
int *  err 
)

Return entity status (Internal, boundary, ghost).

Given a partition handle, a part handle, and an array of entity handles, return for each entity handle a flag indicating whether the entity is strictly internal, is on a part boundary, or is a ghost with respect to the given part. The returned value is a member of the iMeshP_EntStatus enumerated type.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entities(In) Entities whose status is being tested.
entities_size(In) Number of entity handles in entities.
par_status(Out) Value for each entity indicating the status of the entity with respect to the part.
par_status_allocated(In/Out) Allocated size of par_status array.
par_status_size(Out) Occupied size of par_status array.
err(Out) Error code.

Definition at line 1055 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, CHKERR, ERROR, iBase_FAILURE, iBase_SUCCESS, iMeshP_BOUNDARY, iMeshP_GHOST, iMeshP_INTERNAL, itaps_cast(), KEEP_ARRAY, MOABI, PCOMM, PSTATUS_GHOST, PSTATUS_INTERFACE, moab::ParallelComm::pstatus_tag(), and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    std::vector< unsigned char > pstatus( entity_handles_size );
    ErrorCode result = MOABI->tag_get_data( pcomm->pstatus_tag(), itaps_cast< const EntityHandle* >( entity_handles ),
                                            entity_handles_size, &pstatus[0] );CHKERR( result, "error getting pstatus_tag" );

    ALLOC_CHECK_ARRAY( par_status, entity_handles_size );
    for( int i = 0; i < entity_handles_size; i++ )
    {
        if( !pstatus[i] )
            ( *par_status )[i] = iMeshP_INTERNAL;
        else if( pstatus[i] & PSTATUS_GHOST )
            ( *par_status )[i] = iMeshP_GHOST;
        else if( pstatus[i] & PSTATUS_INTERFACE )
            ( *par_status )[i] = iMeshP_BOUNDARY;
    }

    KEEP_ARRAY( par_status );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getLocalParts ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iMeshP_PartHandle **  parts,
int *  parts_allocated,
int *  parts_size,
int *  err 
)

Return the part handles of local parts in a partition.

Given a partition handle, return the part handles for the local (on-process) parts in the partition.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
parts(In/Out) Array of part handles for local parts in the partition.
parts_allocated(In/Out) Allocated size of parts array.
parts_size(Out) Occupied size of parts array.
err(Out) Error code.

Definition at line 496 of file iMeshP_MOAB.cpp.

References ERROR, iBase_FAILURE, iBase_SUCCESS, moab::ParallelComm::partition_sets(), PCOMM, RANGE_TO_ITAPS_ARRAY, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    RANGE_TO_ITAPS_ARRAY( pcomm->partition_sets(), part_handles );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getNumCopies ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle  entity,
int *  num_copies_ent,
int *  err 
)

Return the number of copies of an entity that exist in the partition.

Given a partition handle and an entity handle, return the number of copies of the entity in the partition. If the given entity is an owned entity or boundary entity, the number of copies will be complete. If the given entity is a ghost entity, the number of copies will be two (the ghost and its owner).

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entity(In) Entity whose copy info is requested.
num_copies_ent(Out) Number of copies of the entity that exist in the partition.
err(Out) Error code.

Definition at line 1086 of file iMeshP_MOAB.cpp.

References CHKERR, ERROR, moab::ParallelComm::get_sharing_parts(), iBase_FAILURE, iBase_SUCCESS, MAX_SHARING_PROCS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    int ids[MAX_SHARING_PROCS];
    ErrorCode rval = pcomm->get_sharing_parts( itaps_cast< EntityHandle >( entity_handle ), ids, *num_copies_ent );CHKERR( rval, "ParallelComm::get_sharing_parts failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getNumGlobalParts ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
int *  num_global_part,
int *  err 
)

Return the global number of parts in a partition.

Given a partition handle, return the total number of parts in the partition across all processes in the partition's communicator.

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
num_global_part(Out) Global number of parts in the partition.
err(Out) Error code.

Definition at line 476 of file iMeshP_MOAB.cpp.

References CHKERR, ERROR, moab::ParallelComm::get_global_part_count(), iBase_FAILURE, iBase_SUCCESS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    ErrorCode rval = pcomm->get_global_part_count( *num_global_part );CHKERR( rval, "PComm::get_global_part_count failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getNumLocalParts ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
int *  num_local_part,
int *  err 
)

Return the local number of parts in a partition.

Given a partition handle, return the number of local (on-process) parts in the partition.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
num_local_part(Out) Local (on-process) number of parts in the partition.
err(Out) Error code.

Definition at line 486 of file iMeshP_MOAB.cpp.

References ERROR, iBase_FAILURE, iBase_SUCCESS, moab::ParallelComm::partition_sets(), PCOMM, RETURN, and moab::Range::size().

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    *num_local_part = pcomm->partition_sets().size();
    RETURN( iBase_SUCCESS );
}
void iMeshP_getNumOfTopo ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntitySetHandle  entity_set,
int  entity_topology,
int *  num_topo,
int *  err 
)

Return the number of entities of a given topology in both a part and an entity set.

Given a part handle, an entity set handle, and an entity topology, return the number of entities of the given topology that are in BOTH the given part AND the given entity set. This function is similar to iMesh_getNumOfTopo, but it also restricts the returned data with respect to its existence in the given part.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_set(In) Entity set handle for the entity set being queried; may be the root set.
entity_topology(In) Entity topology of the boundary entities; may be iMesh_ALL_TOPOLOGIES.
num_topo(Out) Number of entities of entity_topology in both part and entity_set.
err(Out) Error code.

Definition at line 719 of file iMeshP_MOAB.cpp.

References iBase_ALL_TYPES, set_intersection_query(), and moab::Range::size().

{
    Range r;
    set_intersection_query( instance, part_handle, entity_set_handle, iBase_ALL_TYPES, entity_topology, r, err );
    *num_topo = r.size();
}
void iMeshP_getNumOfTopoAll ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntitySetHandle  entity_set,
int  entity_topology,
int *  num_topo,
int *  err 
)

Return the number of entities of a given topology in a partition.

Given a partition handle and an entity set (possibly the root set), return the global number of entities of a given entity topology in the partition and set. This function may require communication and, thus, must be called by all processes in the partition's communicator.

COMMUNICATION: Collective.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entity_set(In) Entity set handle for the entity set being queried; may be the root set.
entity_topology(In) Requested entity topology; may be iMesh_ALL_TOPOLOGIES.
num_topo(Out) Number of entities with entity_topology in the partition and entity set.
err(Out) Error code.

Definition at line 553 of file iMeshP_MOAB.cpp.

References count_owned(), entities, ERROR, get_entities(), iBase_ALL_TYPES, iBase_FAILURE, iBase_SUCCESS, ierr, MB_SUCCESS, MOABI, PCOMM, moab::ProcConfig::proc_comm(), moab::ParallelComm::proc_config(), and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    Range entities;
    ErrorCode rval = get_entities( MOABI, itaps_cast< EntityHandle >( entity_set_handle ), iBase_ALL_TYPES,
                                   entity_topology, entities );
    int count      = 0;
    if( MB_SUCCESS == rval ) rval = count_owned( pcomm, entities, count );

    int vals[2] = { count, rval }, sums[2];
    int ierr    = MPI_Allreduce( vals, sums, 2, MPI_INT, MPI_SUM, pcomm->proc_config().proc_comm() );
    assert( iBase_SUCCESS == 0 );
    if( ierr || sums[1] ) RETURN( iBase_FAILURE );

    *num_topo = sums[0];
    RETURN( iBase_SUCCESS );
}
void iMeshP_getNumOfType ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntitySetHandle  entity_set,
int  entity_type,
int *  num_type,
int *  err 
)

Return the number of entities of a given type in both a part and an entity set.

Given a part handle, an entity set handle, and an entity type, return the number of entities of the given type that are in BOTH the given part AND the given entity set. This function is similar to iMesh_getNumOfType, but it also restricts the returned data with respect to its existence in the given part.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_set(In) Entity set handle for the entity set being queried; may be the root set.
entity_type(In) Entity type of the boundary entities; may be iBase_ALL_TYPES.
num_type(Out) Number of entities of entity_type in both part and entity_set.
err(Out) Error code.

Definition at line 710 of file iMeshP_MOAB.cpp.

References iMesh_ALL_TOPOLOGIES, set_intersection_query(), and moab::Range::size().

{
    Range r;
    set_intersection_query( instance, part_handle, entity_set_handle, entity_type, iMesh_ALL_TOPOLOGIES, r, err );
    *num_type = r.size();
}
void iMeshP_getNumOfTypeAll ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntitySetHandle  entity_set,
int  entity_type,
int *  num_type,
int *  err 
)

Return the number of entities of a given type in a partition.

Given a partition handle and an entity set (possibly the root set), return the global number of entities of a given entity type in the partition and set. This function may require communication and, thus, must be called by all processes in the partition's communicator.

COMMUNICATION: Collective.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entity_set(In) Entity set handle for the entity set being queried.
entity_type(In) Requested entity type; may be iBase_ALL_TYPES.
num_type(Out) Number of entities of entity_type in the partition and entity set.
err(Out) Error code.

Definition at line 531 of file iMeshP_MOAB.cpp.

References count_owned(), entities, ERROR, get_entities(), iBase_FAILURE, iBase_SUCCESS, ierr, iMesh_ALL_TOPOLOGIES, MB_SUCCESS, MOABI, PCOMM, moab::ProcConfig::proc_comm(), moab::ParallelComm::proc_config(), and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    Range entities;
    ErrorCode rval = get_entities( MOABI, itaps_cast< EntityHandle >( entity_set_handle ), entity_type,
                                   iMesh_ALL_TOPOLOGIES, entities );
    int count      = 0;
    if( MB_SUCCESS == rval ) rval = count_owned( pcomm, entities, count );

    int vals[2] = { count, rval }, sums[2];
    int ierr    = MPI_Allreduce( vals, sums, 2, MPI_INT, MPI_SUM, pcomm->proc_config().proc_comm() );
    assert( iBase_SUCCESS == 0 );
    if( ierr || sums[1] ) RETURN( iBase_FAILURE );

    *num_type = sums[0];
    RETURN( iBase_SUCCESS );
}
void iMeshP_getNumPartBdryEnts ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
int  entity_type,
int  entity_topology,
iMeshP_Part  target_part_id,
int *  num_entities,
int *  err 
)

Return the number of entities on a part boundary.

Given a partition handle, a part handle, an entity type and topology, and a target part ID, return the number of entities of the given type and/or topology on the part boundary shared with the target part.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_type(In) Entity type of the boundary entities; may be iBase_ALL_TYPES.
entity_topology(In) Entity topology of the boundary entities; may be iMesh_ALL_TOPOLOGIES.
target_part_id(In) Part ID with which part is sharing the boundary entities; may be iMeshP_ALL_PARTS.
num_entities(Out) Number of part boundary entities shared by part and target_part_id.
err(Out) Error code.

Definition at line 666 of file iMeshP_MOAB.cpp.

References CHKERR, entities, get_boundary_entities(), iBase_SUCCESS, PCOMM, RETURN, and moab::Range::size().

{
    Range entities;
    ErrorCode rval = get_boundary_entities( PCOMM, itaps_cast< EntityHandle >( part_handle ), entity_type,
                                            entity_topology, target_part_id, entities );CHKERR( rval, "failed to get boundary entities" );
    *num_entities = entities.size();
    RETURN( iBase_SUCCESS );
}
void iMeshP_getNumPartitions ( iMesh_Instance  instance,
int *  num_partitions,
int *  err 
)

Return the number of partitions associated with a mesh instance.

Given a mesh instance, return the number of partition handles associated with the mesh instance.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partitions.
num_partitions(Out) Number of partitions associated with the mesh instance.
err(Out) Error code.

Definition at line 442 of file iMeshP_MOAB.cpp.

References CHKERR, moab::ParallelComm::get_all_pcomm(), iBase_SUCCESS, MOABI, and RETURN.

{
    std::vector< ParallelComm* > pcomms;
    ErrorCode rval = ParallelComm::get_all_pcomm( MOABI, pcomms );CHKERR( rval, "Internal error retreiving PComms" );

    std::vector< ParallelComm* >::iterator i;
    *num_partitions_out = 0;
    for( i = pcomms.begin(); i != pcomms.end(); ++i )
        if( ( *i )->get_partitioning() ) ( *num_partitions_out )++;

    RETURN( iBase_SUCCESS );
}
void iMeshP_getNumPartNbors ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
int  entity_type,
int *  num_part_nbors,
int *  err 
)

Return the number of parts that neighbor a given part.

Given a partition handle, a part handle, and an entity type, return the number of parts in the partition that neighbor the given part (i.e., that (1) have copies of entities of the given entity type owned by the given part or (2) own entities of the given entity type that are copied on the given part).

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_type(In) Entity type of the copied entities; may be iBase_ALL_TYPES.
num_part_nbors(Out) Number of parts neighboring the given part.
err(Out) Error code.

Definition at line 597 of file iMeshP_MOAB.cpp.

References iMeshP_getNumPartNborsArr.

{
    int junk1 = 1, junk2 = 1;
    iMeshP_getNumPartNborsArr( instance, partition_handle, &part_handle, 1, entity_type, &num_part_nbors, &junk1,
                               &junk2, err );
}
void iMeshP_getNumPartNborsArr ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle parts,
int  parts_size,
int  entity_type,
int **  num_part_nbors,
int *  num_part_nbors_allocated,
int *  num_part_nbors_size,
int *  err 
)

Return the number of parts that neighbor given parts.

Given a partition handle, an array of part handles, and an entity type, return the number of parts in the partition that neighbor each of the given parts (i.e., that (1) have copies of entities of the given entity type owned by the given part or (2) own entities of the given entity type that are copied on the given part).

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
parts(In) Array of part handles for the parts being queried.
parts_size(In) Number of part handles in parts.
entity_type(In) Entity type of the copied entities; may be iBase_ALL_TYPES.
num_part_nbors(In/Out) Array of values specifying the number of part neighbors for each part in parts.
num_part_nbors_allocated(In/Out) Allocated size of num_part_nbors array.
num_part_nbors_size(Out) Occupied size of num_part_nbors array.
err(Out) Error code.

Definition at line 605 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, CHKERR, ERROR, moab::ParallelComm::get_part_neighbor_ids(), iBase_FAILURE, iBase_SUCCESS, itaps_cast(), KEEP_ARRAY, MAX_SHARING_PROCS, n, neighbors(), PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    ALLOC_CHECK_ARRAY( num_part_nbors, part_handles_size );

    int n, neighbors[MAX_SHARING_PROCS];
    ErrorCode rval;
    for( int i = 0; i < part_handles_size; ++i )
    {
        EntityHandle h = itaps_cast< EntityHandle >( part_handles[i] );
        rval           = pcomm->get_part_neighbor_ids( h, neighbors, n );CHKERR( rval, "error getting neighbor ids" );
        ( *num_part_nbors )[i] = n;
    }

    KEEP_ARRAY( num_part_nbors );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getOwnerCopy ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle  entity,
iMeshP_Part owner_part_id,
iBase_EntityHandle owner_entity,
int *  err 
)

Get the entity handle of a copy of a given entity in its owner part.

Given a partition handle and an entity handle, return the (remote) entity handle of the copy of the entity in its owner part.

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
entity(In) Entity whose copy info is requested.
owner_part_id(Out) Part ID of the entity's owner part.
owner_entity(Out) (Remote) entity handle of the entity copy from the owner part.
err(Out) Error code.

Definition at line 1149 of file iMeshP_MOAB.cpp.

References CHKERR, ERROR, moab::ParallelComm::get_owning_part(), iBase_FAILURE, iBase_SUCCESS, itaps_cast(), PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    int id;
    EntityHandle h;
    ErrorCode rval = pcomm->get_owning_part( itaps_cast< EntityHandle >( entity_handle ), id, &h );CHKERR( rval, "Failed to get owner" );
    *owner_part_id       = id;
    *owner_entity_handle = itaps_cast< iBase_EntityHandle >( h );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getPartBdryEnts ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
int  entity_type,
int  entity_topology,
iMeshP_Part  target_part_id,
iBase_EntityHandle **  entities,
int *  entities_allocated,
int *  entities_size,
int *  err 
)

Return the entity handles of entities on a part boundary.

Given a partition handle, a part handle, an entity type and topology, and a target part ID, return the entity handles of entities of the given type and/or topology on the part boundary shared with the target part.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_type(In) Entity type of the boundary entities; may be iBase_ALL_TYPES.
entity_topology(In) Entity topology of the boundary entities; may be iMesh_ALL_TOPOLOGIES.
target_part_id(In) Part ID with which part is sharing the boundary entities; may be iMeshP_ALL_PARTS.
entities(In/Out) Array of entity handles for entities on the part boundary between part and target_part_id.
entities_allocated(In/Out) Allocated size of entities array.
entities_size(Out) Occupied size of entities array.
err(Out) Error code.

Definition at line 677 of file iMeshP_MOAB.cpp.

References CHKERR, entities, get_boundary_entities(), iBase_SUCCESS, PCOMM, RANGE_TO_ITAPS_ARRAY, and RETURN.

{
    Range entities;
    ErrorCode rval = get_boundary_entities( PCOMM, itaps_cast< EntityHandle >( part_handle ), entity_type,
                                            entity_topology, target_part_id, entities );CHKERR( rval, "failed to get boundary entities" );
    RANGE_TO_ITAPS_ARRAY( entities, entity_handles );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getPartHandleFromPartId ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iMeshP_Part  part_id,
iMeshP_PartHandle part,
int *  err 
)

Obtain a part handle from a part ID.

Given a partition handle and a part ID, return the part handle associated with the part if the part is local; otherwise, return an error code.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part_id(In) Part ID for the part being queried.
part(Out) Part handle associated with part_id.
err(Out) Error code.

Definition at line 382 of file iMeshP_MOAB.cpp.

References iMeshP_getPartHandlesFromPartsIdsArr.

{
    int junk1 = 1, junk2;
    iMeshP_getPartHandlesFromPartsIdsArr( instance, partition_handle, &part_id, 1, &part_handle, &junk1, &junk2, err );
}
void iMeshP_getPartHandlesFromPartsIdsArr ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_Part part_ids,
const int  part_ids_size,
iMeshP_PartHandle **  parts,
int *  parts_allocated,
int *  parts_size,
int *  err 
)

Obtain part handles from part IDs.

Given a partition handle and an array of local part IDs, return the part handle for each part ID. If any part ID is not a valid part ID for a local part, an error is returned.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part_ids(In) Array of part IDs for the parts being queried.
part_ids_size(In) Number of part IDs being queried.
parts(In/Out) Array of part handles associated with the part_ids.
parts_allocated(In/Out) Allocated size of parts array.
parts_size(Out) Occupied size of parts array.
err(Out) Error code.

Definition at line 407 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, CHKERR, moab::ParallelComm::get_part_handle(), iBase_SUCCESS, itaps_cast(), KEEP_ARRAY, PCOMM, and RETURN.

{
    ErrorCode rval;
    ParallelComm* pcomm = PCOMM;
    ALLOC_CHECK_ARRAY( part_handles, part_ids_size );
    for( int i = 0; i < part_ids_size; ++i )
    {
        EntityHandle handle;
        rval = pcomm->get_part_handle( part_ids[i], handle );CHKERR( rval, "error getting part handle" );
        ( *part_handles )[i] = itaps_cast< iMeshP_PartHandle >( handle );
    }
    KEEP_ARRAY( part_handles );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getPartIdFromPartHandle ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
iMeshP_Part part_id,
int *  err 
)

Obtain a part ID from a part handle.

Given a partition handle and a local part handle, return the part ID. If the part handle is not a valid part handle for a local part, an error is returned.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
part_id(Out) Part ID for part.
err(Out) Error code.

Definition at line 375 of file iMeshP_MOAB.cpp.

References iMeshP_getPartIdsFromPartHandlesArr.

{
    int junk1 = 1, junk2;
    iMeshP_getPartIdsFromPartHandlesArr( instance, partition_handle, &part_handle, 1, &part_id, &junk1, &junk2, err );
}
void iMeshP_getPartIdsFromPartHandlesArr ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle parts,
const int  parts_size,
iMeshP_Part **  part_ids,
int *  part_ids_allocated,
int *  part_ids_size,
int *  err 
)

Obtain part IDs from part handles.

Given a partition handle and an array of local part handles, return the part ID for each part handle. If any part handle is not a valid part handle for a local part, an error is returned.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
parts(In) Array of part handles for the parts being queried.
parts_size(In) Number of part handles being queried.
part_ids(In/Out) Array of part IDs associated with the parts.
part_ids_allocated(In/Out) Allocated size of part_ids array.
part_ids_size(Out) Occupied size of part_ids array.
err(Out) Error code.

Definition at line 389 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, CHKERR, moab::ParallelComm::get_part_id(), iBase_SUCCESS, KEEP_ARRAY, PCOMM, and RETURN.

{
    ErrorCode rval;
    ParallelComm* pcomm = PCOMM;
    ALLOC_CHECK_ARRAY( part_ids, part_handles_size );
    for( int i = 0; i < part_handles_size; ++i )
    {
        int id;
        rval             = pcomm->get_part_id( itaps_cast< EntityHandle >( part_handles[i] ), id );
        ( *part_ids )[i] = id;CHKERR( rval, "error getting part id" );
    }
    KEEP_ARRAY( part_ids );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getPartitionComm ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition,
MPI_Comm communicator,
int *  err 
)

Return communicator associated with a partition.

Given a partition handle, return the communicator associated with it during its creation by iMeshP_createPartitionAll.

COMMUNICATION: None

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
communicator(Out) Communicator associated with the partition.
err(Out) Error code.

Definition at line 425 of file iMeshP_MOAB.cpp.

References iBase_FAILURE, iBase_SUCCESS, PCOMM, moab::ProcConfig::proc_comm(), moab::ParallelComm::proc_config(), and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) RETURN( iBase_FAILURE );
    *communicator_out = pcomm->proc_config().proc_comm();
    RETURN( iBase_SUCCESS );
}
void iMeshP_getPartitions ( iMesh_Instance  instance,
iMeshP_PartitionHandle **  partitions,
int *  partitions_allocated,
int *  partitions_size,
int *  err 
)

Return the partition handles associated with a mesh instance.

Given a mesh instance, return all partition handles associated with the mesh instance.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partitions.
partitions(In/Out) Array of partition handles associated with the mesh instance.
partitions_allocated(In/Out) Allocated size of partitions array.
partitions_size(Out) Occupied size of partitions array.
err(Out) Error code.

Definition at line 455 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, CHKERR, moab::ParallelComm::get_all_pcomm(), iBase_SUCCESS, itaps_cast(), MOABI, and RETURN.

{
    std::vector< ParallelComm* > pcomms;
    ErrorCode rval = ParallelComm::get_all_pcomm( MOABI, pcomms );CHKERR( rval, "Internal error retreiving PComms" );

    std::vector< ParallelComm* >::iterator i;
    int count = 0;
    for( i = pcomms.begin(); i != pcomms.end(); ++i )
        if( ( *i )->get_partitioning() ) ++count;
    ALLOC_CHECK_ARRAY_NOFAIL( partition_handle, count );

    *partition_handle_size = 0;
    for( i = pcomms.begin(); i != pcomms.end(); ++i )
        if( ( *i )->get_partitioning() )
            ( *partition_handle )[( *partition_handle_size )++] =
                itaps_cast< iMeshP_PartitionHandle >( ( *i )->get_partitioning() );

    RETURN( iBase_SUCCESS );
}
void iMeshP_getPartNbors ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
int  entity_type,
int *  num_part_nbors,
iMeshP_Part **  nbor_part_ids,
int *  nbor_part_ids_allocated,
int *  nbor_part_ids_size,
int *  err 
)

Return the parts that neighbor a given part.

Given a partition handle, a part handle, and an entity type, return the part IDs of parts that neighbor the given part (i.e., that (1) have copies of entities of the given entity type owned by the given part or (2) own entities of the given entity type that are copied on the given part).

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_type(In) Entity type of the copied entities; may be iBase_ALL_TYPES.
num_part_nbors(Out) Number of parts neighboring the given part.
nbor_part_ids(In/Out) Array of part IDs for part neighbors of part.
nbor_part_ids_allocated(In/Out) Allocated size of nbor_part_ids array.
nbor_part_ids_size(Out) Occupied size of nbor_part_ids array.
err(Out) Error code.

Definition at line 628 of file iMeshP_MOAB.cpp.

References iMeshP_getPartNborsArr.

{
    int junk1 = 1, junk2 = 1;
    iMeshP_getPartNborsArr( instance, partition_handle, &part_handle, 1, entity_type, &num_part_nbors, &junk1, &junk2,
                            nbor_part_ids, nbor_part_ids_allocated, nbor_part_ids_size, err );
}
void iMeshP_getPartNborsArr ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle parts,
const int  parts_size,
int  entity_type,
int **  num_part_nbors,
int *  num_part_nbors_allocated,
int *  num_part_nbors_size,
iMeshP_Part **  nbor_part_ids,
int *  nbor_part_ids_allocated,
int *  nbor_part_ids_size,
int *  err 
)

Return the parts that neighbor given parts.

Given a partition handle, an array of part handles, and an entity type, return the part IDs of parts that neighbor the given parts (i.e., that (1) have copies of entities of the given entity type owned by the given part or (2) own entities of the given entity type that are copied on the given part).

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
parts(In) The parts being queried.
parts_size(In) The number of parts being queried.
entity_type(In) Entity type of the copied entities; may be iBase_ALL_TYPES.
num_part_nbors(In/Out) Array of values specifying the number of part neighbors for each part in parts.
num_part_nbors_allocated(In/Out) Allocated size of num_part_nbors array.
num_part_nbors_size(Out) Occupied size of num_part_nbors array.
nbor_part_ids(In/Out) Array of part IDs for part neighbors of part.
nbor_part_ids_allocated(In/Out) Allocated size of nbor_part_ids array.
nbor_part_ids_size(Out) Occupied size of nbor_part_ids array.
err(Out) Error code.

Definition at line 637 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, ALLOC_CHECK_ARRAY_NOFAIL, CHKERR, ERROR, moab::ParallelComm::get_part_neighbor_ids(), iBase_FAILURE, iBase_SUCCESS, itaps_cast(), KEEP_ARRAY, MAX_SHARING_PROCS, n, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    ALLOC_CHECK_ARRAY( num_part_nbors, part_handles_size );

    std::vector< int > all_neighbors;
    int n, pnbor[MAX_SHARING_PROCS];
    ErrorCode rval;
    for( int i = 0; i < part_handles_size; ++i )
    {
        EntityHandle h = itaps_cast< EntityHandle >( part_handles[i] );
        rval           = pcomm->get_part_neighbor_ids( h, pnbor, n );CHKERR( rval, "error getting neighbor ids" );
        ( *num_part_nbors )[i] = n;
        std::copy( pnbor, pnbor + n, std::back_inserter( all_neighbors ) );
    }

    ALLOC_CHECK_ARRAY_NOFAIL( nbor_part_ids, all_neighbors.size() );
    memcpy( *nbor_part_ids, &all_neighbors[0], sizeof( int ) * all_neighbors.size() );

    KEEP_ARRAY( num_part_nbors );
    RETURN( iBase_SUCCESS );
}
void iMeshP_getPartsArrOnRank ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition_handle,
const int *  rank,
const int  rank_size,
iMeshP_PartHandle **  part_handles,
int *  part_handles_allocated,
int *  part_handles_size,
int *  err 
)

Definition at line 1495 of file iMeshP_MOAB.cpp.

References moab::ParallelComm::get_pcomm(), iBase_ERROR_MAP, iMeshP_getPartsOnRank(), itaps_cast(), MB_FAILURE, MB_NOT_IMPLEMENTED, MOABI, and RETURN.

{
    EntityHandle p   = itaps_cast< EntityHandle >( partition_handle );
    ParallelComm* pc = ParallelComm::get_pcomm( MOABI, p );
    if( !pc ) RETURN( iBase_ERROR_MAP[MB_FAILURE] );

    if( rank[0] != (int)pc->proc_config().proc_rank() || rank_size > 1 )
    { RETURN( iBase_ERROR_MAP[MB_NOT_IMPLEMENTED] ); }

    iMeshP_getPartsOnRank( instance, partition_handle, rank[0], part_handles, part_handles_allocated, part_handles_size,
                           err );
}
void iMeshP_getPartsOnRank ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition_handle,
const int  ,
iMeshP_PartHandle **  part_handles,
int *  part_handles_allocated,
int *  part_handles_size,
int *  err 
)

Definition at line 1474 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY_NOFAIL, moab::ParallelComm::get_pcomm(), iBase_ERROR_MAP, iBase_SUCCESS, itaps_cast(), MB_FAILURE, MOABI, and RETURN.

Referenced by iMeshP_getPartsArrOnRank().

{
    EntityHandle p   = itaps_cast< EntityHandle >( partition_handle );
    ParallelComm* pc = ParallelComm::get_pcomm( MOABI, p );
    if( !pc ) RETURN( iBase_ERROR_MAP[MB_FAILURE] );

    Range part_sets;

    ALLOC_CHECK_ARRAY_NOFAIL( part_handles, pc->partition_sets().size() );
    Range::iterator rit;
    int i;
    for( i = 0, rit = pc->partition_sets().begin(); rit != pc->partition_sets().end(); ++rit, i++ )
        ( *part_handles )[i] = itaps_cast< iMeshP_PartHandle >( *rit );

    RETURN( iBase_SUCCESS );
}
void iMeshP_getRankOfPart ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_Part  part_id,
int *  rank,
int *  err 
)

Return the process rank of a given part.

Given a partition handle and a part ID, return the process rank (with respect to the partition's communicator) of the process that owns the part. The part may be local or remote.

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part_id(In) Part ID for the part being queried.
rank(Out) Process rank of part_id.
err(Out) Error code.

Definition at line 507 of file iMeshP_MOAB.cpp.

References iMeshP_getRankOfPartArr.

{
    int junk1 = 1, junk2 = 1;
    iMeshP_getRankOfPartArr( instance, partition_handle, &part_id, 1, &rank, &junk1, &junk2, err );
}
void iMeshP_getRankOfPartArr ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_Part part_ids,
const int  part_ids_size,
int **  ranks,
int *  ranks_allocated,
int *  ranks_size,
int *  err 
)

Return the process ranks of given parts.

Given a partition handle and an array of part IDs, return the process ranks (with respect to the partition's communicator) of the process that owns each part. The parts may be local or remote.

COMMUNICATION: None++.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part_ids(In) Array of Part IDs for the parts being queried.
part_ids_size(In) The number of Part IDs in part_ids.
ranks(In/Out) Array of ranks for the Part Ids in part_ids.
ranks_allocated(In/Out) Allocated size of ranks array.
ranks_size(Out) Occupied size of ranks array.
err(Out) Error code.

Definition at line 514 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, CHKERR, ERROR, moab::ParallelComm::get_part_owner(), iBase_FAILURE, iBase_SUCCESS, KEEP_ARRAY, MB_SUCCESS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    ALLOC_CHECK_ARRAY( rank, part_ids_size );
    ErrorCode rval = MB_SUCCESS;
    for( int i = 0; i < part_ids_size; ++i )
    {
        rval = pcomm->get_part_owner( part_ids[i], ( *rank )[i] );CHKERR( rval, "PComm::get_part_owner failed" );
    }
    KEEP_ARRAY( rank );
    RETURN( iBase_SUCCESS );
}
void iMeshP_ghostEntInfo ( const iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
int *  ghost_rules_allocated,
int *  ghost_rules_size,
int **  ghost_type,
int **  bridge_type,
int **  num_layers,
int *  err 
)

Return information about all ghosting on a partition.

Return the ghosting rules established through calls to iMeshP_createGhostEntsAll.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition to be queried.
ghost_rules_allocated(In/Out) Allocated size of ghost_type, bridge_type and num_layers.
ghost_rules_size(Out) Occupied size of ghost_type, bridge_type and num_layers; equal to the number of ghosting rules currently registered in the partition.
ghost_type(Out) Entity type of ghost entities for each rule.
bridge_type(Out) Entity type of bridge entities for each rule.
num_layers(Out) Number of layers of ghosts in each rule.
err(Out) Error code.

Definition at line 1375 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_initEntArrIter ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntitySetHandle  entity_set,
const int  requested_entity_type,
const int  requested_entity_topology,
const int  requested_array_size,
iBase_EntityArrIterator entArr_iterator,
int *  err 
)

Create an entity array iterator for a given part and entity set.

Given a local part and an entity set, return an array iterator over the entities of the requested type and topology that are in both the part and the entity set. Iterator functionality for getNext, reset, and end is provided through the regular iMesh iterator functions iMesh_getNextEntArrIter, iMesh_resetEntArrIter, and iMesh_endEntArrIter, respectively.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_set(In) Entity set handle for the entity set being queried.
requested_entity_type(In) Type of entities to include in the iterator.
requested_entity_topology(In) Topology of entities to include in the iterator.
requested_array_size(In) The number of handles returned in each value of the iterator.
entArr_iterator(Out) Iterator returned from function.
err(Out) Error code.

Definition at line 949 of file iMeshP_MOAB.cpp.

References CHKERR, iBase_SUCCESS, iMesh_initEntArrIter, itaps_cast(), MB_SUCCESS, MESHSET_ORDERED, MOABI, SetIntersectIter< Container >::reset(), and RETURN.

{
    if( !entity_set_handle || entity_set_handle == part_handle )
    {
        iMesh_initEntArrIter( instance, part_handle, requested_entity_type, requested_entity_topology,
                              requested_array_size,
                              0,  // TODO: update this function for "resilient" arg
                              entArr_iterator, err );
    }
    else
    {
        unsigned flags;
        ErrorCode result = MOABI->get_meshset_options( itaps_cast< EntityHandle >( entity_set_handle ), flags );CHKERR( result, "Invalid entity set handle" );
        if( flags & MESHSET_ORDERED )
            *entArr_iterator = new SetIntersectIter< std::vector< EntityHandle > >(
                (iBase_EntityType)requested_entity_type, (iMesh_EntityTopology)requested_entity_topology,
                itaps_cast< EntityHandle >( entity_set_handle ), itaps_cast< EntityHandle >( part_handle ),
                requested_array_size );
        else
            *entArr_iterator =
                new SetIntersectIter< Range >( (iBase_EntityType)requested_entity_type,
                                               (iMesh_EntityTopology)requested_entity_topology,
                                               itaps_cast< EntityHandle >( entity_set_handle ),
                                               itaps_cast< EntityHandle >( part_handle ), requested_array_size );
        result = ( *entArr_iterator )->reset( MOABI );
        if( MB_SUCCESS != result ) delete *entArr_iterator;CHKERR( result, "iMesh_initEntArrIter: ERROR getting entities of proper type or topology." );
        RETURN( iBase_SUCCESS );
    }
}
void iMeshP_initEntIter ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntitySetHandle  entity_set,
const int  requested_entity_type,
const int  requested_entity_topology,
iBase_EntityIterator entity_iterator,
int *  err 
)

Create an entity iterator for a given part and entity set.

Given a local part and an entity set, return an iterator over the entities of the requested type and topology that are in both the part and the entity set. Iterator functionality for getNext, reset, and end is provided through the regular iMesh iterator functions iMesh_getNextEntIter, iMesh_resetEntIter, and iMesh_endEntIter, respectively.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_set(In) Entity set handle for the entity set being queried.
requested_entity_type(In) Type of entities to include in the iterator.
requested_entity_topology(In) Topology of entities to include in the iterator.
entity_iterator(Out) Iterator returned from function.
err(Out) Error code.

Definition at line 939 of file iMeshP_MOAB.cpp.

References iMeshP_initEntArrIter.

{
    iMeshP_initEntArrIter( instance, partition_handle, part_handle, entity_set_handle, requested_entity_type,
                           requested_entity_topology, 1,
                           reinterpret_cast< iBase_EntityArrIterator* >( entity_iterator ), err );
}
void iMeshP_initPartBdryEntArrIter ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
int  entity_type,
int  entity_topology,
int  array_size,
iMeshP_Part  target_part_id,
iBase_EntityArrIterator entity_iterator,
int *  err 
)

Initialize an array iterator over a specified part boundary.

Given a partition handle, a part handle, and a target part ID, return an array iterator over all entities of a given entity type and topology along the part boundary shared with the target part. Iterator functionality for getNext, reset, and end is provided through the regular iMesh iterator functions iMesh_getNextEntArrIter, iMesh_resetEntArrIter, and iMesh_endEntArrIter, respectively.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_type(In) Entity type of the boundary entities; may be iBase_ALL_TYPES.
entity_topology(In) Entity topology of the boundary entities; may be iMesh_ALL_TOPOLOGIES.
array_size(In) Size of chunks of handles returned for each value of the iterator.
target_part_id(In) Part ID with which part is sharing the boundary entities; may be iMeshP_ALL_PARTS.
entity_iterator(Out) Iterator returned by the function.
err(Out) Error code.

Definition at line 697 of file iMeshP_MOAB.cpp.

References CHKERR, iBase_SUCCESS, MB_SUCCESS, MOABI, PCOMM, and RETURN.

{
    *entity_iterator =
        new PartBoundaryIter( PCOMM, itaps_cast< EntityHandle >( part_handle ), (iBase_EntityType)entity_type,
                              (iMesh_EntityTopology)entity_topology, nbor_part_id, array_size );
    ErrorCode result = ( *entity_iterator )->reset( MOABI );
    if( MB_SUCCESS != result ) delete *entity_iterator;CHKERR( result, "iMesh_initEntArrIter: ERROR getting entities of proper type or topology." );
    RETURN( iBase_SUCCESS );
}
void iMeshP_initPartBdryEntIter ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
int  entity_type,
int  entity_topology,
iMeshP_Part  target_part_id,
iBase_EntityIterator entity_iterator,
int *  err 
)

Initialize an iterator over a specified part boundary.

Given a partition handle, a part handle, and a target part ID, return an iterator over all entities of a given entity type and topology along the part boundary shared with the target part. Iterator functionality for getNext, reset, and end is provided through the regular iMesh iterator functions iMesh_getNextEntIter, iMesh_resetEntIter, and iMesh_endEntIter, respectively.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity_type(In) Entity type of the boundary entities; may be iBase_ALL_TYPES.
entity_topology(In) Entity topology of the boundary entities; may be iMesh_ALL_TOPOLOGIES.
target_part_id(In) Part ID with which part is sharing the boundary entities; may be iMeshP_ALL_PARTS.
entity_iterator(Out) Iterator returned by the function.
err(Out) Error code.

Definition at line 689 of file iMeshP_MOAB.cpp.

References iMeshP_initPartBdryEntArrIter.

{
    iMeshP_initPartBdryEntArrIter( instance, partition_handle, part_handle, entity_type, entity_topology, 1,
                                   nbor_part_id, reinterpret_cast< iBase_EntityArrIterator* >( entity_iterator ), err );
}
void iMeshP_iPushTags ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iBase_TagHandle  source_tag,
iBase_TagHandle  dest_tag,
int  entity_type,
int  entity_topo,
iMeshP_RequestHandle request,
int *  err 
)

Asynchronously send tag data for given entity types and topologies.

Send tag information for shared entities of specified type and topology. The tag data is "pushed" from the owner entities to all copies. This version operates on all shared entities of specified type and topology (or all types/topologies if iBase_ALL_TYPES/iMesh_ALL_TOPOLOGIES are given). This function assumes tag handles given on various calling parts are consistent; i.e. they have the same name, data type, size, etc. This call does not block; applications should call iMeshP_waitForRequest (or a similar wait function) to block until this push is completed.

COMMUNICATION: point-to-point, non-blocking.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
source_tag(In) Tag handle for the sending entities.
dest_tag(In) Tag handle for the receiving entities.
entity_type(In) Tag data is exchanged only for this entity type.
entity_topo(In) Tag data is exchanged only for this entity topology.
request(Out) The iMeshP request handle returned.
err(Out) Error code.

Definition at line 1339 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_iPushTagsEnt ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iBase_TagHandle  source_tag,
iBase_TagHandle  dest_tag,
const iBase_EntityHandle entities,
int  entities_size,
iMeshP_RequestHandle request,
int *  err 
)

Asynchronously send tag data for individual entities.

Send tag information for the specified entities. The tag data is "pushed" from the owner entities to all copies. This function assumes tag handles given on various calling parts are consistent; i.e. they have the same name, data type, size, etc. This call does not block; applications should call iMeshP_waitForRequest (or a similar wait function) to block until this push is completed.

COMMUNICATION: point-to-point, non-blocking.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
source_tag(In) Tag handle for the sending entities.
dest_tag(In) Tag handle for the receiving entities.
entities(In) Owned entities for which to send data.
entities_size(In) The number of entities for which to send data.
request(Out) The iMeshP request handle returned.
err(Out) Error code.

Definition at line 1346 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_isEntOwner ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntityHandle  entity,
int *  is_owner,
int *  err 
)

Test for entity ownership with respect to a part.

Given a partition handle, a part handle, and an entity handle, return a flag indicating whether the entity is owned by the part.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entity(In) Entity whose ownership is being tested.
is_owner(Out) Flag indicating whether the given part is the owner of the given entity.
err(Out) Error code.

Definition at line 1009 of file iMeshP_MOAB.cpp.

References iMeshP_isEntOwnerArr.

{
    int junk1 = 1, junk2 = 1;
    iMeshP_isEntOwnerArr( instance, partition_handle, part_handle, &entity_handle, 1, &is_owner, &junk1, &junk2, err );
}
void iMeshP_isEntOwnerArr ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_PartHandle  part,
const iBase_EntityHandle entities,
const int  entities_size,
int **  is_owner,
int *  is_owner_allocated,
int *  is_owner_size,
int *  err 
)

Test for entity ownership of many entities with respect to a part.

Given a partition handle, a part handle, and an array of entity handles, return for each entity handle a flag indicating whether the entity is owned by the part.

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part being queried.
entities(In) Entities whose ownership is being tested.
entities_size(In) Number of entity handles in entities.
is_owner(Out) Flag for each entity indicating whether the given part is the owner of the given entity.
is_owner_allocated(In/Out) Allocated size of is_owner array.
is_owner_size(Out) Occupied size of is_owner array.
err(Out) Error code.

Definition at line 1017 of file iMeshP_MOAB.cpp.

References ALLOC_CHECK_ARRAY, CHKERR, ERROR, moab::ParallelComm::get_owner(), moab::ParallelComm::get_part_id(), iBase_FAILURE, iBase_SUCCESS, KEEP_ARRAY, PCOMM, and RETURN.

{
    ErrorCode rval;
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );

    int id;
    rval = pcomm->get_part_id( itaps_cast< EntityHandle >( part_handle ), id );CHKERR( rval, "error getting part id" );

    ALLOC_CHECK_ARRAY( is_owner, entity_handles_size );
    *is_owner_size = entity_handles_size;

    int owner;
    for( int i = 0; i < entity_handles_size; ++i )
    {
        rval = pcomm->get_owner( itaps_cast< EntityHandle >( entity_handles[i] ), owner );CHKERR( rval, "error getting owner" );
        ( *is_owner )[i] = ( owner == id );
    }

    KEEP_ARRAY( is_owner );
    RETURN( iBase_SUCCESS );
}
void iMeshP_loadAll ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntitySetHandle  entity_set,
const char *  name,
const char *  options,
int *  err,
int  name_len,
int  options_len 
)

Populate a mesh instance and a partition by reading data from files.

Before calling iMeshP_loadAll, the application creates both a mesh instance and a partition handle. iMeshP_loadAll then reads the specified file, inserts entities into the mesh instance, constructs parts within the partition, and inserts entities into the parts. Options allow n>=1 files on p processes. Optional capabilities of iMeshP_loadAll include computing an initial partition (e.g., if a serial mesh file without part assignments is read) and creating ghost entities as requested by the application; the availability of these options is implementation dependent.

COMMUNICATION: Collective.

Parameters:
instance(In) Mesh instance to contain the data.
partition(In) The newly populated partition.
entity_set(In) Set to which the mesh will be added.
name(in) File name from which mesh data is read.
options(In) Implementation-specific options string.
err(Out) Error code.
name_len(In) Length of the file name character string.
options_len(In) Length of the options character string.

Definition at line 1421 of file iMeshP_MOAB.cpp.

References append_option(), CHKERR, moab::ParallelComm::collective_sync_partition(), moab::ParallelComm::get_id(), moab::ParallelComm::get_pcomm(), iBase_FAILURE, iBase_SUCCESS, iMesh_load, itaps_cast(), MESHSET_SET, MOABI, MPI_COMM_WORLD, and RETURN.

{
    ErrorCode rval;

    // create partition set if user didn't give us one.
    EntityHandle partitioning;
    if( partition ) { partitioning = itaps_cast< EntityHandle >( partition ); }
    else
    {
        rval = MOABI->create_meshset( MESHSET_SET, partitioning );CHKERR( rval, "failed to create meshset" );
    }

    // get ParallelComm for partition
    MPI_Comm default_comm = MPI_COMM_WORLD;
    ParallelComm* pcomm   = ParallelComm::get_pcomm( MOABI, partitioning, &default_comm );
    if( !pcomm ) { RETURN( iBase_FAILURE ); }

    // add necessary values to options string
    std::string opt = std::string( options, options + options_len );

    if( append_option( opt, "moab:PARALLEL" ) )
    {
        // only append these other ones if the parallel option wasn't there originally
        append_option( opt, "moab:PARTITION_DISTRIBUTE" );
        append_option( opt, "moab:PARALLEL_RESOLVE_SHARED_ENTS" );
        std::ostringstream id;
        id << pcomm->get_id();
        append_option( opt, "moab:PCOMM", id.str().c_str() );
    }

    // load the file
    iMesh_load( instance, entity_set_handle, name, opt.c_str(), err, name_len, opt.length() );
    if( *err ) return;

    rval = pcomm->collective_sync_partition();CHKERR( rval, "collective sync failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_migrateEntity ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iMeshP_PartHandle  part,
iBase_EntityHandle  local_entity,
iMeshP_RequestHandle request,
int *  err 
)

Request in-migration of an entity and its upward adjacencies.

This function is a "pull" migration, where a part requests to become the owner of an entity that is owned by another part (so that the part has the right to modify the entity). The requested entity must be on the part boundary and is identified by a local handle (i.e., an entity part-boundary copy). This operation may require multiple rounds of communication, and at some times, certain entities may be locked (unavailable for local modification) while info about their remote copies is still in question. Tags and parallel set membership are migrated as well as the appropriate adjacency info. An iMeshP request handle is returned.

COMMUNICATION: point-to-point, non-blocking, pull.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
part(In) The part to which the entity is migrated.
local_entity(In) The local entity copy for the entity to be migrated.
request(Out) The iMeshP request handle returned.
err(Out) Error code.

Definition at line 1251 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_pollForRequests ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition,
iMeshP_RequestHandle **  requests_completed,
int *  requests_completed_allocated,
int *  requests_completed_size,
int *  err 
)

Poll for outstanding requests.

Check for outstanding requests from other parts, handle any requests found, and return an array of requests that have been handled. If the array has a size allocated already, then the implementation stops working when it has generated that many completed requests, even if there are more requests waiting.

COMMUNICATION: non-blocking; point-to-point.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
requests_completed(Out) Requests that were completed.
requests_completed_allocated(In/Out) Allocated size of requests_completed.
requests_completed_size(Out) Occupied size of requests_completed.
err(Out) Error code.

Definition at line 1190 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_pushTags ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iBase_TagHandle  source_tag,
iBase_TagHandle  dest_tag,
int  entity_type,
int  entity_topo,
int *  err 
)

Synchronously send tag data for given entity types and topologies.

Send tag information for shared entities of specified type and topology. The tag data is "pushed" from the owner entities to all copies. This version operates on all shared entities of specified type and topology (or all types/topologies if iBase_ALL_TYPES/iMesh_ALL_TOPOLOGIES are given). This function assumes tag handles given on various calling parts are consistent; i.e. they have the same name, data type, size, etc. This call blocks until communication is completed.

COMMUNICATION: point-to-point, blocking.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
source_tag(In) Tag handle for the sending entities.
dest_tag(In) Tag handle for the receiving entities.
entity_type(In) Tag data is exchanged only for this entity type.
entity_topo(In) Tag data is exchanged only for this entity topology.
err(Out) Error code.

Definition at line 1292 of file iMeshP_MOAB.cpp.

References CHKERR, entities, moab::ParallelComm::exchange_tags(), moab::CN::getDimPair(), iBase_ALL_TYPES, iBase_SUCCESS, iMesh_ALL_TOPOLOGIES, mb_topology_table, MBENTITYSET, MBVERTEX, MOABI, PCOMM, RETURN, t, and smoab::UNION.

{
    ParallelComm* pcomm = PCOMM;
    DimensionPair types;
    if( entity_topo != iMesh_ALL_TOPOLOGIES )
        types.first = types.second = mb_topology_table[entity_topo];
    else if( entity_type != iBase_ALL_TYPES )
        // types = CN::TypeDimensionMap[entity_type];
        types = CN::getDimPair( entity_type );
    else
    {
        types.first  = MBVERTEX;
        types.second = MBENTITYSET;
        --types.second;
    }

    std::vector< Tag > src_tags( 1, itaps_cast< Tag >( source_tag ) );
    std::vector< Tag > dst_tags( 1, itaps_cast< Tag >( dest_tag ) );

    ErrorCode rval;
    Range entities;
    for( EntityType t = types.first; t <= types.second; ++t )
    {
        rval = MOABI->get_entities_by_type_and_tag( 0, t, &src_tags[0], 0, 1, entities, Interface::UNION );CHKERR( rval, "error getting entities to push" );
    }

    rval = pcomm->exchange_tags( src_tags, dst_tags, entities );CHKERR( rval, "tag data communication failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_pushTagsEnt ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iBase_TagHandle  source_tag,
iBase_TagHandle  dest_tag,
const iBase_EntityHandle entities,
int  entities_size,
int *  err 
)

Synchronously send tag data for individual entities.

Send tag information for the specified entities. The tag data is "pushed" from the owner entities to all copies. This function assumes tag handles given on various calling parts are consistent; i.e. they have the same name, data type, size, etc. This call blocks until communication is completed.

COMMUNICATION: point-to-point, blocking.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
source_tag(In) Tag handle for the sending entities.
dest_tag(In) Tag handle for the receiving entities.
entities(In) Owned entities for which to send data.
entities_size(In) The number of entities for which to send data.
err(Out) Error code.

Definition at line 1323 of file iMeshP_MOAB.cpp.

References CHKERR, entities, moab::ParallelComm::exchange_tags(), iBase_SUCCESS, itaps_cast(), PCOMM, and RETURN.

{

    Range range;
    const EntityHandle* ents = itaps_cast< const EntityHandle* >( entities );
    std::copy( ents, ents + entities_size, range_inserter( range ) );

    std::vector< Tag > src_tags( 1, itaps_cast< Tag >( source_tag ) );
    std::vector< Tag > dst_tags( 1, itaps_cast< Tag >( dest_tag ) );
    ParallelComm* pcomm = PCOMM;
    ErrorCode rval      = pcomm->exchange_tags( src_tags, dst_tags, range );CHKERR( rval, "tag data communication failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_replaceOnPartBdry ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle old_entities,
const int  old_entities_size,
const iBase_EntityHandle new_entities,
const int  new_entities_size,
const int *  offset,
const int  offset_size,
int *  err 
)

Replace entities on the part boundary.

This function performs changes on the part boundary where the calling application can ensure that things are done identically on both sides and that the arguments are passed in an order that can be matched. (Specifically, matching new entities should appear in the same order in the call array.) An example is creation of new boundary edges during edge splitting. Communication here could be a two-way push-and-forget, or some variant on push-and-confirm. CHANGES: At Onkar's suggestion, added an offset array (similar to array adjacency requests) so that a single call can easily handle coordination with multiple entities on part-boundary.

COMMUNICATION: point-to-point, non-blocking, push-and-forget.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
old_entities(In) The entities to be replaced.
old_entities_size(In) The number of entities to be replaced.
new_entities(In) The entities that replace the old entities.
new_entities_size(In) The number of entities in new_entities.
offset(In) Index into new_entities; old_entities[i] is replaced by new_entities[offset[i]] to new_entities[offset[i+1]-1].
offset_size(In) The number of entries in offset.
err(Out) Error code.

Definition at line 1264 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_rmvGhostOf ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iMeshP_Part  target_part_id,
iBase_EntityHandle  copy_to_purge,
int *  err 
)

Remove ghost copies of individual entities from other parts.

Given an entity and a target part, remove the ghost copy of the entity on the target part.

Communication is push-and-forget; as such, no request handle is needed. The remote part will clean up the closure of the removed ghost as appropriate during deletion.

COMMUNICATION: point-to-point, non-blocking, push-and-forget.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
target_part_id(In) The part to lose the ghost.
copy_to_purge(In) The entity whose ghost is removed from target_part_id.
err(Out) Error code.

Definition at line 1278 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_saveAll ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntitySetHandle  entity_set,
const char *  name,
const char *  options,
int *  err,
const int  name_len,
int  options_len 
)

Write data from a mesh instance and a partition to files.

iMeshP_saveAll writes mesh and partition data to the specified file. Options allow n>=1 files on p processes.

COMMUNICATION: Collective.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being saved.
entity_set(In) Set from which data will be saved.
name(in) File name to which mesh data is written.
options(In) Implementation-specific options string.
err(Out) Error code.
name_len(In) Length of the file name character string.
options_len(In) Length of the options character string.

Definition at line 1461 of file iMeshP_MOAB.cpp.

References iMesh_save, and itaps_cast().

{
    EntityHandle set;
    set = entity_set_handle ? itaps_cast< EntityHandle >( entity_set_handle ) : itaps_cast< EntityHandle >( partition );
    iMesh_save( instance, itaps_cast< iBase_EntitySetHandle >( set ), name, options, err, name_len, options_len );
}
void iMeshP_syncMeshAll ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition,
int *  err 
)

Indicate completion of mesh modification.

Calling this function indicates that the user is finished with mesh modification for now. With mesh modification complete, the implementation can update ghost, partition, boundary, and other information to re-establish a valid distributed mesh. This function waits for all message traffic to clear and rebuilds ghost information that was allowed to go obsolete during mesh modification.

COMMUNICATION: collective.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
err(Out) Error code.

Definition at line 1285 of file iMeshP_MOAB.cpp.

References CHKERR, iBase_SUCCESS, PCOMM, moab::ParallelComm::resolve_shared_ents(), and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    ErrorCode rval      = pcomm->resolve_shared_ents( itaps_cast< EntityHandle >( partition_handle ), -1, -1 );CHKERR( rval, "update failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_syncPartitionAll ( iMesh_Instance  instance,
iMeshP_PartitionHandle  partition,
int *  err 
)

Update a partition after parts have been added.

This function gives the implementation an opportunity to locally store info about the partition so that queries on the partition can be performed without synchronous communication. This function must be called after all parts have been added to the partition and after changes to the partition (e.g., due to load balancing). Values that are precomputed by syncPartitionAll include:

  • the total number of parts in a partition;
  • the mapping between part IDs and processes; and
  • updated remote entity handle information.

COMMUNICATION: Collective.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being updated.
err(Out) Error code.

Definition at line 434 of file iMeshP_MOAB.cpp.

References CHKERR, moab::ParallelComm::collective_sync_partition(), ERROR, iBase_FAILURE, iBase_SUCCESS, PCOMM, and RETURN.

{
    ParallelComm* pcomm = PCOMM;
    if( !pcomm ) ERROR( iBase_FAILURE, "No PComm" );
    ErrorCode rval = pcomm->collective_sync_partition();CHKERR( rval, "collective sync failed" );
    RETURN( iBase_SUCCESS );
}
void iMeshP_testRequest ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iMeshP_RequestHandle  request,
int *  completed,
int *  err 
)

Test whether a specific request has completed.

Given an iMeshP_RequestHandle, test whether the request has completed. This function will not wait until the request completes; it will only return the completion status (complete = 1 or 0).

COMMUNICATION: None.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
request(In) iMeshP request for whose completion we should test.
completed(Out) Flag indicating whether (1) or not (0) the given request has completed.
err(Out) Error code.

Definition at line 1184 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_updateVtxCoords ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
const iBase_EntityHandle  local_vertex,
int *  err 
)

Update vertex coordinates for vertex copies.

For a given vertex, update its copies with the vertex's coordinates. This function assumes that a local vertex's coordinates were updated through a call to iMesh_setVtxCoords. This function then updates all copies of the vertex with the updated coordinates. The communication here is push-and-forget; as such, no request handle needs to be returned.

COMMUNICATION: point-to-point, non-blocking, push-and-forget.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
local_vertex(In) The vertex whose copies should be updated.
err(Out) Error code.

Definition at line 1258 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_waitForAllRequests ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iMeshP_RequestHandle requests,
int  requests_size,
int *  err 
)

Wait for all of the specified iMeshP requests to complete.

Given an array of iMeshP_RequestHandles, wait for all of the requests to complete.

COMMUNICATION: Blocking point-to-point.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
requests(In) iMeshP requests for which we wait until completion.
requests_size(In) Number of requests in requests.
err(Out) Error code.

Definition at line 1171 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_waitForAnyRequest ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iMeshP_RequestHandle requests,
int  requests_size,
int *  index,
int *  err 
)

Wait for any of the specified iMeshP requests to complete.

Given an array of iMeshP_RequestHandles, wait for any one of the requests to complete.

COMMUNICATION: Blocking point-to-point.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
requests(In) iMeshP requests for which we wait until one request completes.
requests_size(In) Number of requests in requests.
index(Out) Index of the request that completed.
err(Out) Error code.

Definition at line 1164 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

void iMeshP_waitForRequestEnt ( iMesh_Instance  instance,
const iMeshP_PartitionHandle  partition,
iMeshP_RequestHandle  request,
iBase_EntityHandle **  out_entities,
int *  out_entities_allocated,
int *  out_entities_size,
int *  err 
)

Wait for a specific request to complete; return entities received.

Given an iMeshP_RequestHandle, wait for the request to complete. Return entities for which information was received.

COMMUNICATION: Blocking point-to-point.

Parameters:
instance(In) Mesh instance containing the partition.
partition(In) The partition being queried.
request(In) iMeshP request for whose completion we should wait.
out_entities(Out) Entities for which information was received.
out_entities_allocated(In/Out) Allocated size of out_entities.
out_entities_size(Out) Occupied size of out_entities.
err(Out) Error code.

Definition at line 1177 of file iMeshP_MOAB.cpp.

References FIXME, iBase_NOT_SUPPORTED, and RETURN.

Definition at line 156 of file iMeshP_MOAB.cpp.

References t.

{
    assert( sizeof( iBase_TagHandle ) >= sizeof( Tag ) );
    return reinterpret_cast< iBase_TagHandle >( t );
}
static void set_intersection_query ( iMesh_Instance  instance,
iMeshP_PartHandle  set1,
iBase_EntitySetHandle  set2,
int  type,
int  topo,
Range result,
int *  err 
) [static]

Definition at line 221 of file iMeshP_MOAB.cpp.

References CHKERR, get_entities(), iBase_SUCCESS, moab::intersect(), moab::Range::merge(), MOABI, and RETURN.

Referenced by iMeshP_getAdjEntities(), iMeshP_getEntities(), iMeshP_getNumOfTopo(), and iMeshP_getNumOfType().

{
    ErrorCode rval;

    if( !set1 )
    {
        rval = get_entities( MOABI, itaps_cast< EntityHandle >( set2 ), type, topo, result );CHKERR( rval, "Invalid Part handle" );
    }
    else if( !set2 )
    {
        rval = get_entities( MOABI, itaps_cast< EntityHandle >( set1 ), type, topo, result );CHKERR( rval, "Invalid set handle" );
    }
    else
    {
        Range r1, r2;
        rval = get_entities( MOABI, itaps_cast< EntityHandle >( set1 ), type, topo, r1 );CHKERR( rval, "Invalid Part handle" );
        rval = get_entities( MOABI, itaps_cast< EntityHandle >( set2 ), type, topo, r2 );CHKERR( rval, "Invalid set handle" );
        result.merge( intersect( r1, r2 ) );
    }

    RETURN( iBase_SUCCESS );
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines