50 #define CHECKIERR( rc, message ) \
53 printf( "%s. ErrorCode = %d.\n", message, rc ); \
66 std::string
atmFilename = TestDir +
"unittest/wholeATM_T.h5m";
92 std::string
readopts(
"PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS" );
93 std::string
readoptsPC(
"PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION" );
95 std::string
tagT(
"a2oTbot" );
96 std::string
tagU(
"a2oUbot" );
97 std::string
tagV(
"a2oVbot" );
99 std::string
tagT1(
"a2oTbot_1" );
131 tagT1 = std::string(
"newT" );
132 tagT2 = std::string(
"newT2" );
147 MPI_Group atmPEGroup;
157 MPI_Group atmPhysGroup;
165 int ATM_COMM_TAG = 1;
171 int PHYS_COMM_TAG = 2;
174 ierr = MPI_Comm_create_group(
MPI_COMM_WORLD, atmPhysGroup, PHYS_COMM_TAG, &physComm );
180 MPI_Group joinAtmPhysAtmGroup;
181 ierr = MPI_Group_union( atmPEGroup, atmPhysGroup, &joinAtmPhysAtmGroup );
182 CHECKIERR(
ierr,
"Cannot create joint atm - phys atm group" )
183 int JOIN_COMM_TAG = 5;
185 ierr = MPI_Comm_create_group(
MPI_COMM_WORLD, joinAtmPhysAtmGroup, JOIN_COMM_TAG, &joinComm );
186 CHECKIERR(
ierr,
"Cannot create joint atm cou communicator" )
191 int cmpAtmAppID = -1;
193 int physAtmAppID = -1;
197 if( atmComm != MPI_COMM_NULL )
211 if( physComm != MPI_COMM_NULL )
222 if( MPI_COMM_NULL != joinComm )
224 ierr = iMOAB_ComputeCommGraph( cmpAtmPID, physAtmPID, &joinComm, &atmPEGroup, &atmPhysGroup, &
typeA, &
typeB,
228 CHECKIERR(
ierr,
"Cannot compute comm graph between the two apps " )
231 if( atmComm != MPI_COMM_NULL )
235 ierr = iMOAB_SendElementTag( cmpAtmPID, tags.c_str(), &joinComm, &
physatm );
239 if( physComm != MPI_COMM_NULL )
245 if(
typeB == 1 ) ndof = 16;
256 ierr = iMOAB_ReceiveElementTag( physAtmPID, tags1.c_str(), &joinComm, &
cmpatm );
261 if( atmComm != MPI_COMM_NULL )
263 ierr = iMOAB_FreeSenderBuffers( cmpAtmPID, &
physatm );
267 if( physComm != MPI_COMM_NULL )
271 if( physComm != MPI_COMM_NULL )
274 ierr = iMOAB_SendElementTag( physAtmPID,
tagT1.c_str(), &joinComm, &
cmpatm );
278 if( atmComm != MPI_COMM_NULL )
283 if(
typeA == 2 ) ndof = 1;
286 CHECKIERR(
ierr,
"failed to define the field tag a2oTbot_2" );
288 ierr = iMOAB_ReceiveElementTag( cmpAtmPID,
tagT2.c_str(), &joinComm, &
physatm );
293 if( physComm != MPI_COMM_NULL )
295 ierr = iMOAB_FreeSenderBuffers( physAtmPID, &
cmpatm );
298 if( atmComm != MPI_COMM_NULL )
304 if( physComm != MPI_COMM_NULL )
310 if( atmComm != MPI_COMM_NULL )
320 if( MPI_COMM_NULL != atmComm ) MPI_Comm_free( &atmComm );
321 MPI_Group_free( &atmPEGroup );
324 if( MPI_COMM_NULL != physComm ) MPI_Comm_free( &physComm );
325 MPI_Group_free( &atmPhysGroup );
328 if( MPI_COMM_NULL != joinComm ) MPI_Comm_free( &joinComm );
329 MPI_Group_free( &joinAtmPhysAtmGroup );
333 int main(
int argc,
char* argv[] )
336 MPI_Init( &argc, &argv );
348 opts.
addOpt<
int >(
"typeA,t",
" type of first model ", &
typeA );
351 opts.
addOpt<
int >(
"typeB,v",
" type of the second model ", &
typeB );
353 opts.
addOpt<
int >(
"startAtm,a",
"start task for first model layout", &
startG1 );
354 opts.
addOpt<
int >(
"endAtm,b",
"end task for first model layout", &
endG1 );
356 opts.
addOpt<
int >(
"startPhys,c",
"start task for second model layout", &
startG2 );
357 opts.
addOpt<
int >(
"endPhys,d",
"end task for second model layout", &
endG2 );
374 MPI_Group_free( &
jgroup );