[MOAB-dev] r4203 - MOAB/trunk/test/parallel
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Thu Oct 7 12:53:06 CDT 2010
Author: kraftche
Date: 2010-10-07 12:53:06 -0500 (Thu, 07 Oct 2010)
New Revision: 4203
Modified:
MOAB/trunk/test/parallel/parallel_unit_tests.cpp
Log:
add test of PComm::assign_global_ids
Modified: MOAB/trunk/test/parallel/parallel_unit_tests.cpp
===================================================================
--- MOAB/trunk/test/parallel/parallel_unit_tests.cpp 2010-10-07 17:52:35 UTC (rev 4202)
+++ MOAB/trunk/test/parallel/parallel_unit_tests.cpp 2010-10-07 17:53:06 UTC (rev 4203)
@@ -124,6 +124,8 @@
ErrorCode regression_owners_with_ghosting( const char* );
// Verify all sharing data for vertices with one level of ghosting
ErrorCode test_ghosted_entity_shared_data( const char* );
+// Test assignment of global IDs
+ErrorCode test_assign_global_ids( const char* );
/**************************************************************************
Main Method
**************************************************************************/
@@ -211,6 +213,7 @@
num_errors += RUN_TEST( test_interface_owners, filename );
num_errors += RUN_TEST( regression_owners_with_ghosting, filename );
num_errors += RUN_TEST( test_ghosted_entity_shared_data, filename );
+ num_errors += RUN_TEST( test_assign_global_ids, filename );
if (rank == 0) {
if (!num_errors)
@@ -1121,3 +1124,122 @@
return MB_SUCCESS;
}
+
+bool check_consistent_ids( Interface& mb,
+ const EntityHandle* entities,
+ const int* orig_ids,
+ int num_ents,
+ const char* singular_name,
+ const char* plural_name )
+{
+ ErrorCode rval;
+ int rank, size, ierr;
+ MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+ MPI_Comm_size( MPI_COMM_WORLD, &size );
+
+ Tag id_tag;
+ rval = mb.tag_get_handle( GLOBAL_ID_TAG_NAME, id_tag ); CHKERR(rval);
+ std::vector<int> new_ids(num_ents);
+ rval = mb.tag_get_data( id_tag, entities, num_ents, &new_ids[0] ); CHKERR(rval);
+ bool valid = true;
+ for (int i = 0; i < num_ents; ++i)
+ if (new_ids[i] < 0 || new_ids[i] >= num_ents*size) {
+ std::cerr << "ID out of bounds on proc " << rank
+ << " : " << new_ids[i] << " not in [0," << num_ents*size-1
+ << "]" << std::endl;
+ valid = false;
+ }
+ if (!valid)
More information about the moab-dev
mailing list