MOAB: Mesh Oriented datABase  (version 5.3.1)
scd_test_partn.cpp
Go to the documentation of this file.
00001 #include "moab/ScdInterface.hpp"
00002 #include "moab/Core.hpp"
00003 #include "TestUtil.hpp"
00004 
00005 #include <iostream>
00006 
00007 #ifdef MOAB_HAVE_MPI
00008 #include "moab/ParallelComm.hpp"
00009 #endif
00010 
00011 using namespace moab;
00012 
00013 int gdims[6], np;
00014 
00015 void test_sqijk()
00016 {
00017     Core moab;
00018     ScdInterface* scd;
00019     ErrorCode rval = moab.Interface::query_interface( scd );CHECK_ERR( rval );
00020     int ldims[6];
00021     ScdParData par_data;
00022     std::copy( gdims, gdims + 6, par_data.gDims );
00023     for( int i = 0; i < 3; i++ )
00024         par_data.gPeriodic[i] = 0;
00025     par_data.partMethod = ScdParData::SQIJK;
00026 
00027     std::cout << "gDims =  (" << par_data.gDims[0] << "," << par_data.gDims[1] << "," << par_data.gDims[2] << ")--("
00028               << par_data.gDims[3] << "," << par_data.gDims[4] << "," << par_data.gDims[5] << ")" << std::endl;
00029 
00030     int lperiodic[3], pijk[3];
00031 
00032     rval = ScdInterface::compute_partition( np, 0, par_data, ldims, lperiodic, pijk );CHECK_ERR( rval );
00033 
00034     std::cout << "#proc in 3 directions = (" << pijk[0] << "," << pijk[1] << "," << pijk[2] << ")" << std::endl;
00035     std::cout << "local dims are (" << ldims[0] << "," << ldims[1] << "," << ldims[2] << ")--(" << ldims[3] << ","
00036               << ldims[4] << "," << ldims[5] << ")\n";
00037 }
00038 
00039 int main( int argc, char** argv )
00040 {
00041     if( argc < 2 )
00042     {
00043         std::cout << "Usage: " << argv[0] << " <#proc> [<imax> [<jmax> <kmax>]]" << std::endl;
00044         std::cout << "Using default parameters for autotest purposes." << std::endl;
00045         np       = 4;
00046         gdims[0] = gdims[1] = gdims[2] = 0;
00047         gdims[3] = gdims[4] = gdims[5] = 100;
00048     }
00049     else if( argc < 3 )
00050     {
00051         np       = atoi( argv[1] );
00052         gdims[0] = gdims[1] = gdims[2] = 0;
00053         gdims[3] = gdims[4] = gdims[5] = 100;
00054     }
00055     else if( argc < 4 )
00056     {
00057         np       = atoi( argv[1] );
00058         gdims[0] = gdims[1] = gdims[2] = 0;
00059         gdims[3] = gdims[4] = gdims[5] = atoi( argv[2] );
00060     }
00061     else if( argc < 6 )
00062     {
00063         np       = atoi( argv[1] );
00064         gdims[0] = gdims[1] = gdims[2] = 0;
00065         gdims[3]                       = atoi( argv[2] );
00066         gdims[4]                       = atoi( argv[3] );
00067         gdims[5]                       = atoi( argv[4] );
00068     }
00069 
00070     // test partition method
00071     RUN_TEST( test_sqijk );
00072 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines