MOAB: Mesh Oriented datABase  (version 5.2.1)
scdpart.cpp
Go to the documentation of this file.
00001 #include "TestUtil.hpp"
00002 #include "moab/Core.hpp"
00003 #include "moab/ParallelComm.hpp"
00004 #include "moab/ScdInterface.hpp"
00005 #include "moab/ProgOptions.hpp"
00006 #include "MBParallelConventions.h"
00007 
00008 using namespace moab;
00009 
00010 std::string example = TestDir + "/io/eul3x48x96.t.3.nc";
00011 
00012 void test_read_parallel( int nverts );
00013 void test_read_parallel_alljorkori();
00014 void test_read_parallel_alljkbal();
00015 void test_read_parallel_sqij();
00016 void test_read_parallel_sqjk();
00017 
00018 std::string partition_method;
00019 
00020 int main( int argc, char** argv )
00021 {
00022     MPI_Init( &argc, &argv );
00023     int result = 0;
00024 
00025     result += RUN_TEST( test_read_parallel_alljorkori );
00026     result += RUN_TEST( test_read_parallel_alljkbal );
00027     result += RUN_TEST( test_read_parallel_sqij );
00028     result += RUN_TEST( test_read_parallel_sqjk );
00029 
00030     MPI_Finalize();
00031     return result;
00032 }
00033 
00034 void test_read_parallel_alljorkori()
00035 {
00036     partition_method = std::string( ";PARTITION_METHOD=alljorkori" );
00037     test_read_parallel( 4704 );
00038 }
00039 
00040 void test_read_parallel_alljkbal()
00041 {
00042     partition_method = std::string( ";PARTITION_METHOD=alljkbal" );
00043     test_read_parallel( 4704 );
00044 }
00045 
00046 void test_read_parallel_sqij()
00047 {
00048     partition_method = std::string( ";PARTITION_METHOD=sqij" );
00049     test_read_parallel( 4704 );
00050 }
00051 
00052 void test_read_parallel_sqjk()
00053 {
00054     partition_method = std::string( ";PARTITION_METHOD=sqjk" );
00055     test_read_parallel( 4704 );
00056 }
00057 
00058 void test_read_parallel( int num_verts )
00059 {
00060     Core moab;
00061     Interface& mb = moab;
00062     EntityHandle file_set;
00063     ErrorCode rval;
00064     rval = mb.create_meshset( MESHSET_SET, file_set );CHECK_ERR( rval );
00065 
00066     std::string opt = std::string( "PARALLEL=READ_PART;PARTITION=;PARTITION_DISTRIBUTE;PARALLEL_RESOLVE_SHARED_ENTS" ) +
00067                       partition_method;
00068     rval = mb.load_file( example.c_str(), &file_set, opt.c_str() );CHECK_ERR( rval );
00069 
00070     ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
00071 
00072     rval = pcomm->check_all_shared_handles();CHECK_ERR( rval );
00073 
00074     // get the total # owned verts
00075     Range verts;
00076     rval = mb.get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
00077     rval = pcomm->filter_pstatus( verts, PSTATUS_NOT_OWNED, PSTATUS_NOT );CHECK_ERR( rval );
00078     int my_num = verts.size(), total_verts;
00079     MPI_Reduce( &my_num, &total_verts, 1, MPI_INT, MPI_SUM, 0, pcomm->proc_config().proc_comm() );
00080 
00081     if( 0 == pcomm->proc_config().proc_rank() ) CHECK_EQUAL( total_verts, num_verts );
00082 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines