46 #define __VERBOSE_PARALLEL 71 #ifdef __VERBOSE_PARALLEL 89 for (
int i = 1; i <= nnodes; i++ ) {
93 for (
int j = 1; j <= partitionList->
giveSize(); j++ ) {
94 if ( !( excludeSelfCommFlag && ( this->
rank == partitionList->
at(j) ) ) ) {
95 domainNodeSendCount.
at(partitionList->
at(j) + 1)++;
103 std :: vector< IntArray >maps(
size );
104 for (
int i = 0; i <
size; i++ ) {
105 maps [ i ].resize( domainNodeSendCount.
at ( i + 1 ) );
109 for (
int i = 1; i <= nnodes; i++ ) {
114 for (
int j = 1; j <= partitionList->
giveSize(); j++ ) {
115 int partition = partitionList->
at(j);
116 if ( !( excludeSelfCommFlag && ( this->
rank == partition ) ) ) {
117 maps [ partition ].at( ++pos.
at(partition + 1) ) = i;
124 for (
int i = 0; i <
size; i++ ) {
138 #ifdef __VERBOSE_PARALLEL 168 int domainRecvListSize = 0, domainRecvListPos = 0;
173 for (
int i = 1; i <= nelems; i++ ) {
178 for (
int j = 1; j <= partitionList->
giveSize(); j++ ) {
179 if ( !( excludeSelfCommFlag && ( this->
rank == partitionList->
at(j) ) ) ) {
180 domainRecvListSize++;
181 domainNodeRecvCount.
at(partitionList->
at(j) + 1)++;
189 std :: vector< IntArray >maps(
size );
190 for (
int i = 0; i <
size; i++ ) {
191 maps [ i ].resize( domainNodeRecvCount.
at ( i + 1 ) );
195 IntArray domainRecvList(domainRecvListSize);
197 if ( domainRecvListSize ) {
198 for (
int i = 1; i <= nelems; i++ ) {
206 for (
int j = 1; j <= partitionList->
giveSize(); j++ ) {
207 if ( !( excludeSelfCommFlag && ( this->
rank == partitionList->
at(j) ) ) ) {
208 int partition = partitionList->
at(j);
209 maps [ partition ].at( ++pos.
at(partition + 1) ) = i;
217 for (
int i = 0; i <
size; i++ ) {
223 #ifdef __VERBOSE_PARALLEL 224 for (
int i=0; i<
size; i++) {
225 fprintf (stderr,
"domain %d-%d: domainCommRecvsize is %d\n",
rank,i,this->
giveProcessCommunicator(i)->giveToRecvMap()->giveSize() );
226 printf (
"domain %d-%d: reecv map:",
rank,i);
235 #ifdef __VERBOSE_PARALLEL 243 int localExpectedSize, globalRecvSize;
244 int sendMapPos, sendMapSize, globalDofManNum;
247 #ifndef IBM_MPI_IMPLEMENTATION 248 localExpectedSize = domainRecvList.
givePackSize(commBuff);
250 localExpectedSize = domainRecvList.
givePackSize(commBuff) + 1;
255 result = MPI_Allreduce(& localExpectedSize, & globalRecvSize, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
256 if ( result != MPI_SUCCESS ) {
261 WARNING: NOT SUPPORTED MESSAGE PARSING LIBRARY
264 #ifdef __VERBOSE_PARALLEL 270 commBuff.
resize(globalRecvSize);
273 toSendMap.
resize(globalRecvSize);
275 for (
int i = 0; i <
size; i++ ) {
281 #ifdef __VERBOSE_PARALLEL 286 result = commBuff.
bcast(i);
287 if ( result != MPI_SUCCESS ) {
291 #ifdef __VERBOSE_PARALLEL 295 #ifdef __VERBOSE_PARALLEL 296 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Receiving broadcasted send map from partition %3d\n",
297 rank,
"ProblemCommunicator :: unpackAllData", i);
300 result = commBuff.
bcast(i);
301 if ( result != MPI_SUCCESS ) {
305 #ifdef __VERBOSE_PARALLEL 306 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Receiving broadcasted send map from partition %3d finished\n",
307 rank,
"ProblemCommunicator :: unpackAllData", i);
321 for (
int j = 1; j <= nelems; j++ ) {
332 toSendMap.
resize(sendMapSize);
334 for (
int j = 1; j <= nelems; j++ ) {
341 toSendMap.
at(++sendMapPos) = j;
349 #ifdef __VERBOSE_PARALLEL 350 fprintf (stderr,
"domain %d-%d: domainCommSendsize is %d\n",
rank,i,this->
giveProcessCommunicator(i)->giveToSendMap()->giveSize() );
351 printf (
"domain %d-%d: send map:",
rank,i);
360 #ifdef __VERBOSE_PARALLEL 424 int i = l - 1, j = r;
429 while ( ( ( this->*cmp )(map.
at(++i), v) ) < 0 ) {
433 while ( ( ( this->*cmp )( v, map.
at(--j) ) ) < 0 ) {
444 map.
at(i) = map.
at(j);
449 map.
at(i) = map.
at(r);
contextIOResultType storeYourself(DataStream &stream) const
Stores array to output stream.
void printYourself() const
Prints receiver on stdout.
int giveGlobalNumber() const
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
NodeCommunicator(EngngModel *emodel, CommunicatorBuff *b, int rank, int size)
Class representing communicator for engng model.
int giveGlobalNumber() const
virtual int setProcessCommunicatorToRecvArry(ProcessCommunicator *processComm, IntArray &map)
Assigns given map to given process communicator.
void setToSendArry(T *emodel, const IntArray &src, int packUnpackType)
Sets receiver toSend array to src.
int givePackSize(DataStream &buff) const
Returns how much space is needed to pack receivers message.
const IntArray * givePartitionList()
Returns partition list of receiver.
Abstract base class for all finite elements.
virtual int setProcessCommunicatorToSendArry(ProcessCommunicator *processComm, IntArray &map)
Assigns given map to given process communicator.
Base class for dof managers.
ProblemCommunicator(EngngModel *emodel, CommunicatorBuff *b, int rank, int size)
Constructor.
int giveNumberOfElements() const
Returns number of elements in domain.
#define OOFEM_LOG_DEBUG(...)
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
#define OOFEM_LOG_RELEVANT(...)
const IntArray * giveToSendMap()
Returns receiver to send map.
virtual void setUpCommunicationMaps(EngngModel *emodel, bool excludeSelfCommFlag, bool forceReinit=false)
Service for setting up the communication patterns with other remote process.
Element * giveElement(int n)
Service for accessing particular domain fe element.
virtual int resize(int newSize)
Resizes buffer to given size.
#define VERBOSEPARALLEL_PRINT(service, str, rank)
const IntArray * giveToRecvMap()
Returns receiver to receive map.
virtual void init()
Initializes buffer to empty state.
Class representing process communicator for engineering model.
void resize(int n)
Checks size of receiver towards requested bounds.
EngngModel * engngModel
Engineering model.
contextIOResultType restoreYourself(DataStream &stream)
Restores array from image on stream.
void quickSortCommMap(IntArray &map, int l, int r, int(ProblemCommunicator::*cmp)(int, int))
Implementation of quicksort algorithm.
virtual ~ProblemCommunicator()
Destructor.
void sortCommMap(IntArray &map, int(ProblemCommunicator::*cmp)(int, int))
Sorts given communication map, containing local DofManager numbers according to their corresponding g...
virtual int setProcessCommunicatorToSendArry(ProcessCommunicator *processComm, IntArray &map)
Assigns given map to given process communicator.
elementParallelMode giveParallelMode() const
Return elementParallelMode of receiver.
virtual void setUpCommunicationMaps(EngngModel *emodel, bool excludeSelfCommFlag, bool forceReinit=false)
Service for setting up the communication patterns with other remote process.
Element is local, there are no contributions from other domains to this element.
Class representing communicator.
void setToRecvArry(T *emodel, const IntArray &src, int packUnpackType)
Sets receiver toRecv array to src.
int DofManCmp(int, int)
Global dofManager number comparison function.
virtual int bcast(int root)
Initializes broadcast over collaborating processes.
virtual int setProcessCommunicatorToRecvArry(ProcessCommunicator *processComm, IntArray &map)
Assigns given map to given process communicator.
ElementCommunicator(EngngModel *emodel, CommunicatorBuff *b, int rank, int size)
int size
Number of processes.
Element in active domain is only mirror of some remote element.
ProcessCommunicator * giveProcessCommunicator(int i)
Returns i-th problem communicator.
The Communicator and corresponding buffers (represented by this class) are separated in order to allo...
Abstract base class representing the "problem" under consideration.
const IntArray * givePartitionList() const
Returns partition list of receiver.
int quickSortPartition(IntArray &map, int l, int r, int(ProblemCommunicator::*cmp)(int, int))
Partitioning used in quicksort.
int ElemCmp(int, int)
Global element comparison function.
the oofem namespace is to define a context or scope in which all oofem names are defined.
Domain * giveDomain(int n)
Service for accessing particular problem domain.
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
DofManager is shared by neighboring partitions, it is necessary to sum contributions from all contrib...
dofManagerParallelMode giveParallelMode() const
Return dofManagerParallelMode of receiver.
int findFirstIndexOf(int value) const
Finds index of first occurrence of given value in array.