86 #ifdef __VERBOSE_PARALLEL 91 for (
int i = 1; i <= ndofman; i++ ) {
95 for (
Dof *dof: *dman ) {
96 if ( dof->isPrimaryDof() ) {
97 if ( dof->giveEquationNumber() ) {
107 int minrank = myrank;
108 for ( j = 1; j <= n; j++ ) {
109 minrank =
min( minrank, plist->
at(j) );
111 if ( minrank == myrank ) {
112 for (
Dof *dof: *dman ) {
113 if ( dof->isPrimaryDof() ) {
114 if ( dof->giveEquationNumber() ) {
123 for (
Dof *dof: *dman ) {
124 if ( dof->isPrimaryDof() ) {
125 if ( dof->giveEquationNumber(n) ) {
135 MPI_Allgather(&
l_neqs, 1, MPI_INT, leqs, 1, MPI_INT, MPI_COMM_WORLD);
138 for (
int j = 0; j < myrank; j++ ) {
139 offset += leqs [ j ];
153 IntArray sizeToSend(nproc), sizeToRecv(nproc), nrecToReceive(nproc);
154 #ifdef __VERBOSE_PARALLEL 158 for (
int i = 1; i <= ndofman; i++ ) {
164 int minrank = myrank;
165 for (
int j = 1; j <= psize; j++ ) {
166 minrank =
min( minrank, plist->
at(j) );
169 if ( minrank == myrank ) {
170 for (
int j = 1; j <= psize; j++ ) {
171 #ifdef __VERBOSE_PARALLEL 172 nrecToSend( plist->
at(j) )++;
174 sizeToSend( plist->
at(j) ) += ( 1 + n );
177 nrecToReceive(minrank)++;
178 sizeToRecv(minrank) += ( 1 + n );
183 #ifdef __VERBOSE_PARALLEL 184 for (
int i = 0; i < nproc; i++ ) {
185 OOFEM_LOG_INFO(
"[%d] Record Statistics: Sending %d Receiving %d to %d\n",
186 myrank, nrecToSend(i), nrecToReceive(i), i);
192 std :: map< int, int >globloc;
195 for (
int i = 1; i <= ndofman; i++ ) {
203 int minrank = myrank;
204 for (
int j = 1; j <= psize; j++ ) {
205 minrank =
min( minrank, plist->
at(j) );
208 if ( minrank == myrank ) {
209 for (
Dof *dof: *dman ) {
210 if ( dof->isPrimaryDof() ) {
211 int eq = dof->giveEquationNumber(n);
222 for (
Dof *dof: *dman ) {
223 if ( dof->isPrimaryDof() ) {
224 int eq = dof->giveEquationNumber(n);
243 for (
int p = 0; p < nproc; p++ ) {
245 buffs [ p ]->
resize( buffs [ p ]->givePackSizeOfInt(1) * sizeToSend(p) );
248 OOFEM_LOG_INFO(
"[%d]Natural2GlobalOrdering :: init: Send buffer[%d] size %d\n",
249 myrank, p, sizeToSend(p) );
254 for (
int i = 1; i <= ndofman; i++ ) {
259 int minrank = myrank;
260 for (
int j = 1; j <= psize; j++ ) {
261 minrank =
min( minrank, plist->
at(j) );
264 if ( minrank == myrank ) {
265 for (
int j = 1; j <= psize; j++ ) {
266 int p = plist->
at(j);
272 OOFEM_LOG_INFO(
"[%d]Natural2GlobalOrdering :: init: Sending localShared node %d[%d] to proc %d\n",
276 for (
Dof *dof: *dman ) {
277 if ( dof->isPrimaryDof() ) {
278 int eq = dof->giveEquationNumber(n);
293 for (
int p = 0; p < nproc; p++ ) {
295 buffs [ p ]->
iSend(p, 999);
301 for (
int p = 0; p < nproc; p++ ) {
305 for (
int i = 1; i <= ndofman; i++ ) {
311 int minrank = myrank;
312 for ( j = 1; j <= psize; j++ ) {
313 minrank =
min( minrank, plist->
at(j) );
315 if ( minrank == myrank ) {
317 for (
Dof *dof: *dman ) {
318 if ( dof->isPrimaryDof() ) {
326 buffs [ p ]->
iSend(p, 999);
332 for (
int p = 0; p < nproc; p++ ) {
334 rbuffs [ p ]->
resize( rbuffs [ p ]->givePackSizeOfInt(1) * sizeToRecv(p) );
336 OOFEM_LOG_INFO(
"[%d]Natural2GlobalOrdering :: init: Receive buffer[%d] size %d\n",
337 myrank, p, sizeToRecv(p) );
343 for (
int p = 0; p < nproc; p++ ) {
345 rbuffs [ p ]->
iRecv(p, 999);
355 for (
int p = 0; p < nproc; p++ ) {
356 if ( finished.
at(p + 1) == 0 ) {
357 if ( rbuffs [ p ]->testCompletion() ) {
360 int nite = nrecToReceive(p);
362 for (
int i = 1; i <= nite; i++ ) {
363 rbuffs [ p ]->
read(shdm);
366 OOFEM_LOG_INFO(
"[%d]Natural2GlobalOrdering :: init: Received shared node [%d] from proc %d\n",
371 if ( globloc.find(shdm) != globloc.end() ) {
372 ldm = globloc [ shdm ];
375 OOFEM_ERROR(
"[%d] invalid shared dofman received, globnum %d\n", myrank, shdm);
380 for (
Dof *dof: *dman ) {
381 if ( dof->isPrimaryDof() ) {
382 int eq = dof->giveEquationNumber(n);
386 rbuffs [ p ]->
read(val);
393 finished.
at(p + 1) = 1;
398 }
while ( fin < nproc );
409 #ifdef __VERBOSE_PARALLEL 412 char locname[] =
"local", shname[] =
"shared", unkname[] =
"unknown";
413 for (
int i = 1; i <= ndofman; i++ ) {
423 for (
Dof *dof: *dman ) {
425 if ( ( _eq = dof->giveEquationNumber(n) ) ) {
426 fprintf( stderr,
"[%d] n:%6s %d[%d] (%d), leq = %d, geq = %d\n", emodel->
giveRank(), ptr, i, dman->giveGlobalNumber(), id, _eq,
locGlobMap.
at(_eq) );
428 fprintf(stderr,
"[%d] n:%6s %d[%d] (%d), leq = %d, geq = %d\n", emodel->
giveRank(), ptr, i, dman->giveGlobalNumber(), id, _eq, 0);
440 for (
int i = 1; i <= lneq; i++ ) {
444 for (
int p = 0; p < nproc; p++ ) {
453 MPI_Barrier(MPI_COMM_WORLD);
454 #ifdef __VERBOSE_PARALLEL 469 std :: map< int, int > :: iterator i =
globLocMap.find(eq);
484 for (
int i = 1; i <= n; i++ ) {
485 if ( ( indx = src.
at(i) ) ) {
488 answer.
at(i) = ( -1 ) + baseOffset;
498 int offset = baseOffset - 1;
500 for (
int i = 1; i <= n; i++ ) {
521 for (
int i = 1; i <= ndofman; i++ ) {
524 for (
Dof *dof: *dman ) {
525 if ( dof->isPrimaryDof() ) {
526 int n_eq = dof->giveEquationNumber(n);
533 n2l.
at(n_eq) = loc_eq++;
562 for (
int i = 1; i <= n; i++ ) {
563 if ( ( indx = src.
at(i) ) ) {
564 answer.
at(i) =
n2l.
at(indx) - baseOffset;
566 answer.
at(i) = 0 - baseOffset;
576 for (
int i = 1; i <= n; i++ ) {
virtual int resize(int newSize)=0
Resizes buffer to given size.
virtual int giveNumberOfDomainEquations(int di, const UnknownNumberingScheme &num)
Returns number of equations for given domain in active (current time step) time step.
int giveGlobalNumber() const
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
virtual void init(EngngModel *, int di, const UnknownNumberingScheme &n)
Initiates the receiver.
void zero()
Sets all component to zero.
int minimum() const
Finds the minimum component in the array.
virtual int giveOldEq(int eq)
Finds the local equation number from a global equation.
const IntArray * givePartitionList()
Returns partition list of receiver.
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
Base class for dof managers.
int giveNumberOfProcesses() const
Returns the number of collaborating processes.
virtual void map2Old(IntArray &answer, const IntArray &src, int baseOffset=0)
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
IntArray n2l
Natural to local.
virtual int giveNewEq(int leq)
Finds the global equation from a local equation.
virtual int iSend(int dest, int tag)=0
Starts standard mode, nonblocking send.
#define OOFEM_LOG_INFO(...)
int giveNumberOfDofs() const
Class CommunicationBuffer provides abstraction for communication buffer.
virtual void map2Old(IntArray &answer, const IntArray &src, int baseOffset=0)
DofIDItem
Type representing particular dof type.
virtual void init(EngngModel *, int di, const UnknownNumberingScheme &n)
Initiates the receiver.
#define VERBOSEPARALLEL_PRINT(service, str, rank)
virtual int write(bool data)
Writes a bool value.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
virtual int giveNewEq(int leq)
Finds the global equation from a local equation.
void resize(int n)
Checks size of receiver towards requested bounds.
int l_neqs
Number of local and global eqs.
virtual int giveOldEq(int eq)
Finds the local equation number from a global equation.
virtual void map2New(IntArray &answer, const IntArray &src, int baseOffset=0)
virtual int iRecv(int source, int tag, int count=0)=0
Starts standard mode, nonblocking receive.
bool isLocal(DofManager *dman)
Returns true if given DofManager is local (ie maintained by the receiver processor).
int giveRank() const
Returns domain rank in a group of collaborating processes (0..groupSize-1)
Domain * giveDomain() const
int min(int i, int j)
Returns smaller value from two given decimals.
Abstract base class representing the "problem" under consideration.
the oofem namespace is to define a context or scope in which all oofem names are defined.
std::map< int, int > globLocMap
New to old mapping.
Domain * giveDomain(int n)
Service for accessing particular problem domain.
virtual int read(bool &data)
Reads a bool value from data.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
IntArray locGlobMap
Old to new mapping; uses 0-based global eq ordering; 1-based local ordering.
DofManager is local, there are no contribution from other domains to this DofManager.
bool isShared(DofManager *dman)
Returns true if given DofManager is shared between partitions.
DofManager is shared by neighboring partitions, it is necessary to sum contributions from all contrib...
dofManagerParallelMode giveParallelMode() const
Return dofManagerParallelMode of receiver.
virtual void map2New(IntArray &answer, const IntArray &src, int baseOffset=0)
int findFirstIndexOf(int value) const
Finds index of first occurrence of given value in array.