ENH: communicators: initial version - extended Pstream API

This commit is contained in:
mattijs
2013-02-04 10:17:37 +00:00
parent e676f9472f
commit ea8d290191
56 changed files with 1250 additions and 395 deletions

View File

@ -150,45 +150,48 @@ int main(int argc, char *argv[])
top.append(i);
}
Pout<< "bottom:" << bottom << endl;
Pout<< "top:" << top << endl;
//Pout<< "bottom:" << bottom << endl;
Pout<< "top :" << top << endl;
scalar localValue = 111*UPstream::myProcNo(UPstream::worldComm);
Pout<< "localValue:" << localValue << endl;
Pout<< "localValue :" << localValue << endl;
if (Pstream::myProcNo(UPstream::worldComm) < n/2)
label comm = Pstream::allocateCommunicator
(
UPstream::worldComm,
top
);
Pout<< "allocated comm :" << comm << endl;
Pout<< "comm myproc :" << Pstream::myProcNo(comm)
<< endl;
if (Pstream::myProcNo(comm) != -1)
{
label comm = Pstream::allocateCommunicator
//scalar sum = sumReduce(comm, localValue);
//scalar sum = localValue;
//reduce
//(
// UPstream::treeCommunication(comm),
// sum,
// sumOp<scalar>(),
// Pstream::msgType(),
// comm
//);
scalar sum = returnReduce
(
UPstream::worldComm,
bottom
localValue,
sumOp<scalar>(),
Pstream::msgType(),
comm
);
Pout<< "allocated bottom comm:" << comm << endl;
Pout<< "comm myproc :" << Pstream::myProcNo(comm)
<< endl;
scalar sum = sumReduce(comm, localValue);
Pout<< "sum :" << sum << endl;
Pstream::freeCommunicator(comm);
Pout<< "sum :" << sum << endl;
}
else
{
label comm = Pstream::allocateCommunicator
(
UPstream::worldComm,
top
);
Pout<< "allocated top comm:" << comm << endl;
Pout<< "comm myproc :" << Pstream::myProcNo(comm)
<< endl;
scalar sum = sumReduce(comm, localValue);
Pout<< "sum :" << sum << endl;
Pstream::freeCommunicator(comm);
}
Pstream::freeCommunicator(comm);
Pout<< "End\n" << endl;

View File

@ -496,6 +496,7 @@ int main(int argc, char *argv[])
mesh.nFaces(), // start
patchI, // index
mesh.boundaryMesh(),// polyBoundaryMesh
Pstream::worldComm, // communicator
Pstream::myProcNo(),// myProcNo
nbrProcI // neighbProcNo
)

View File

@ -448,6 +448,7 @@ bool Foam::domainDecomposition::writeDecomposition()
curStart,
nPatches,
procMesh.boundaryMesh(),
Pstream::worldComm,
procI,
curNeighbourProcessors[procPatchI]
);
@ -475,6 +476,7 @@ bool Foam::domainDecomposition::writeDecomposition()
curStart,
nPatches,
procMesh.boundaryMesh(),
Pstream::worldComm,
procI,
curNeighbourProcessors[procPatchI],
referPatch,