GAMGAgglomerateLduAddressing.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "GAMGAgglomeration.H"
27 #include "GAMGInterface.H"
28 #include "processorGAMGInterface.H"
29 
30 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31 
33 (
34  const label fineLevelIndex
35 )
36 {
37  const lduMesh& fineMesh = meshLevel(fineLevelIndex);
38  const lduAddressing& fineMeshAddr = fineMesh.lduAddr();
39 
40  const labelUList& upperAddr = fineMeshAddr.upperAddr();
41  const labelUList& lowerAddr = fineMeshAddr.lowerAddr();
42 
43  label nFineFaces = upperAddr.size();
44 
45  // Get restriction map for current level
46  const labelField& restrictMap = restrictAddressing(fineLevelIndex);
47 
48  if (min(restrictMap) == -1)
49  {
50  FatalErrorIn("GAMGAgglomeration::agglomerateLduAddressing")
51  << "min(restrictMap) == -1" << exit(FatalError);
52  }
53 
54  if (restrictMap.size() != fineMeshAddr.size())
55  {
57  (
58  "GAMGAgglomeration::agglomerateLduAddressing"
59  "(const label fineLevelIndex)"
60  ) << "restrict map does not correspond to fine level. " << endl
61  << " Sizes: restrictMap: " << restrictMap.size()
62  << " nEqns: " << fineMeshAddr.size()
63  << abort(FatalError);
64  }
65 
66 
67  // Get the number of coarse cells
68  const label nCoarseCells = nCells_[fineLevelIndex];
69 
70  // Storage for coarse cell neighbours and coefficients
71 
72  // Guess initial maximum number of neighbours in coarse cell
73  label maxNnbrs = 10;
74 
75  // Number of faces for each coarse-cell
76  labelList cCellnFaces(nCoarseCells, 0);
77 
78  // Setup initial packed storage for coarse-cell faces
79  labelList cCellFaces(maxNnbrs*nCoarseCells);
80 
81  // Create face-restriction addressing
82  faceRestrictAddressing_.set(fineLevelIndex, new labelList(nFineFaces));
83  labelList& faceRestrictAddr = faceRestrictAddressing_[fineLevelIndex];
84 
85  // Initial neighbour array (not in upper-triangle order)
86  labelList initCoarseNeighb(nFineFaces);
87 
88  // Counter for coarse faces
89  label& nCoarseFaces = nFaces_[fineLevelIndex];
90  nCoarseFaces = 0;
91 
92  // Loop through all fine faces
93  forAll(upperAddr, fineFacei)
94  {
95  label rmUpperAddr = restrictMap[upperAddr[fineFacei]];
96  label rmLowerAddr = restrictMap[lowerAddr[fineFacei]];
97 
98  if (rmUpperAddr == rmLowerAddr)
99  {
100  // For each fine face inside of a coarse cell keep the address
101  // of the cell corresponding to the face in the faceRestrictAddr
102  // as a negative index
103  faceRestrictAddr[fineFacei] = -(rmUpperAddr + 1);
104  }
105  else
106  {
107  // this face is a part of a coarse face
108 
109  label cOwn = rmUpperAddr;
110  label cNei = rmLowerAddr;
111 
112  // get coarse owner and neighbour
113  if (rmUpperAddr > rmLowerAddr)
114  {
115  cOwn = rmLowerAddr;
116  cNei = rmUpperAddr;
117  }
118 
119  // check the neighbour to see if this face has already been found
120  label* ccFaces = &cCellFaces[maxNnbrs*cOwn];
121 
122  bool nbrFound = false;
123  label& ccnFaces = cCellnFaces[cOwn];
124 
125  for (int i=0; i<ccnFaces; i++)
126  {
127  if (initCoarseNeighb[ccFaces[i]] == cNei)
128  {
129  nbrFound = true;
130  faceRestrictAddr[fineFacei] = ccFaces[i];
131  break;
132  }
133  }
134 
135  if (!nbrFound)
136  {
137  if (ccnFaces >= maxNnbrs)
138  {
139  label oldMaxNnbrs = maxNnbrs;
140  maxNnbrs *= 2;
141 
142  cCellFaces.setSize(maxNnbrs*nCoarseCells);
143 
144  forAllReverse(cCellnFaces, i)
145  {
146  label* oldCcNbrs = &cCellFaces[oldMaxNnbrs*i];
147  label* newCcNbrs = &cCellFaces[maxNnbrs*i];
148 
149  for (int j=0; j<cCellnFaces[i]; j++)
150  {
151  newCcNbrs[j] = oldCcNbrs[j];
152  }
153  }
154 
155  ccFaces = &cCellFaces[maxNnbrs*cOwn];
156  }
157 
158  ccFaces[ccnFaces] = nCoarseFaces;
159  initCoarseNeighb[nCoarseFaces] = cNei;
160  faceRestrictAddr[fineFacei] = nCoarseFaces;
161  ccnFaces++;
162 
163  // new coarse face created
164  nCoarseFaces++;
165  }
166  }
167  } // end for all fine faces
168 
169 
170  // Renumber into upper-triangular order
171 
172  // All coarse owner-neighbour storage
173  labelList coarseOwner(nCoarseFaces);
174  labelList coarseNeighbour(nCoarseFaces);
175  labelList coarseFaceMap(nCoarseFaces);
176 
177  label coarseFacei = 0;
178 
179  forAll(cCellnFaces, cci)
180  {
181  label* cFaces = &cCellFaces[maxNnbrs*cci];
182  label ccnFaces = cCellnFaces[cci];
183 
184  for (int i=0; i<ccnFaces; i++)
185  {
186  coarseOwner[coarseFacei] = cci;
187  coarseNeighbour[coarseFacei] = initCoarseNeighb[cFaces[i]];
188  coarseFaceMap[cFaces[i]] = coarseFacei;
189  coarseFacei++;
190  }
191  }
192 
193  forAll(faceRestrictAddr, fineFacei)
194  {
195  if (faceRestrictAddr[fineFacei] >= 0)
196  {
197  faceRestrictAddr[fineFacei] =
198  coarseFaceMap[faceRestrictAddr[fineFacei]];
199  }
200  }
201 
202 
203  // Create face-flip status
204  faceFlipMap_.set(fineLevelIndex, new boolList(nFineFaces, false));
205  boolList& faceFlipMap = faceFlipMap_[fineLevelIndex];
206 
207 
208  label nFlipped = 0;
209  label nDissapear = 0;
210 
211  forAll(faceRestrictAddr, fineFacei)
212  {
213  label coarseFacei = faceRestrictAddr[fineFacei];
214 
215  if (coarseFacei >= 0)
216  {
217  // Maps to coarse face
218  label cOwn = coarseOwner[coarseFacei];
219  label cNei = coarseNeighbour[coarseFacei];
220 
221  label rmUpperAddr = restrictMap[upperAddr[fineFacei]];
222  label rmLowerAddr = restrictMap[lowerAddr[fineFacei]];
223 
224  if (cOwn == rmUpperAddr && cNei == rmLowerAddr)
225  {
226  faceFlipMap[fineFacei] = true;
227  nFlipped++;
228  }
229  else if (cOwn == rmLowerAddr && cNei == rmUpperAddr)
230  {
231  //faceFlipMap[fineFacei] = false;
232  }
233  else
234  {
235  FatalErrorIn("GAMGAgglomeration::agglomerateLduAddressing(..)")
236  << "problem."
237  << " fineFacei:" << fineFacei
238  << " rmUpperAddr:" << rmUpperAddr
239  << " rmLowerAddr:" << rmLowerAddr
240  << " coarseFacei:" << coarseFacei
241  << " cOwn:" << cOwn
242  << " cNei:" << cNei
243  << exit(FatalError);
244  }
245  }
246  else
247  {
248  nDissapear++;
249  }
250  }
251 
252 
253 
254  // Clear the temporary storage for the coarse cell data
255  cCellnFaces.setSize(0);
256  cCellFaces.setSize(0);
257  initCoarseNeighb.setSize(0);
258  coarseFaceMap.setSize(0);
259 
260 
261  // Create coarse-level interfaces
262 
263  // Get reference to fine-level interfaces
264  const lduInterfacePtrsList& fineInterfaces = interfaceLevel(fineLevelIndex);
265 
266  nPatchFaces_.set(fineLevelIndex, new labelList(fineInterfaces.size(), 0));
267  labelList& nPatchFaces = nPatchFaces_[fineLevelIndex];
268 
269  patchFaceRestrictAddressing_.set
270  (
271  fineLevelIndex,
272  new labelListList(fineInterfaces.size())
273  );
274  labelListList& patchFineToCoarse =
275  patchFaceRestrictAddressing_[fineLevelIndex];
276 
277 
278  // Initialise transfer of restrict addressing on the interface
279  forAll(fineInterfaces, inti)
280  {
281  if (fineInterfaces.set(inti))
282  {
283  fineInterfaces[inti].initInternalFieldTransfer
284  (
285  Pstream::nonBlocking,
286  restrictMap
287  );
288  }
289  }
290 
291  if (Pstream::parRun())
292  {
293  Pstream::waitRequests();
294  }
295 
296 
297  // Add the coarse level
298  meshLevels_.set
299  (
300  fineLevelIndex,
301  new lduPrimitiveMesh
302  (
303  nCoarseCells,
304  coarseOwner,
305  coarseNeighbour,
306  fineMesh.comm(),
307  true
308  )
309  );
310 
311  lduInterfacePtrsList coarseInterfaces(fineInterfaces.size());
312 
313  forAll(fineInterfaces, inti)
314  {
315  if (fineInterfaces.set(inti))
316  {
317  coarseInterfaces.set
318  (
319  inti,
321  (
322  inti,
323  meshLevels_[fineLevelIndex].rawInterfaces(),
324  fineInterfaces[inti],
325  fineInterfaces[inti].interfaceInternalField(restrictMap),
326  fineInterfaces[inti].internalFieldTransfer
327  (
328  Pstream::nonBlocking,
329  restrictMap
330  ),
331  fineLevelIndex,
332  fineMesh.comm()
333  ).ptr()
334  );
335 
336  nPatchFaces[inti] = coarseInterfaces[inti].faceCells().size();
337  patchFineToCoarse[inti] = refCast<const GAMGInterface>
338  (
339  coarseInterfaces[inti]
340  ).faceRestrictAddressing();
341  }
342  }
343 
344  meshLevels_[fineLevelIndex].addInterfaces
345  (
346  coarseInterfaces,
347  lduPrimitiveMesh::nonBlockingSchedule<processorGAMGInterface>
348  (
349  coarseInterfaces
350  )
351  );
352 
353 
354  if (debug & 2)
355  {
356  Pout<< "GAMGAgglomeration :"
357  << " agglomerated level " << fineLevelIndex
358  << " from nCells:" << fineMeshAddr.size()
359  << " nFaces:" << upperAddr.size()
360  << " to nCells:" << nCoarseCells
361  << " nFaces:" << nCoarseFaces
362  << endl;
363  }
364 }
365 
366 
368 (
369  const label meshComm,
370  const labelList& procAgglomMap,
371  const labelList& procIDs,
372  const label allMeshComm,
373 
374  const label levelIndex
375 )
376 {
377  const lduMesh& myMesh = meshLevels_[levelIndex-1];
378 
379 
380  label oldWarn = UPstream::warnComm;
381  UPstream::warnComm = meshComm;
382 
383 
384  procAgglomMap_.set(levelIndex, new labelList(procAgglomMap));
385  agglomProcIDs_.set(levelIndex, new labelList(procIDs));
386  procCommunicator_[levelIndex] = allMeshComm;
387 
388  // These could only be set on the master procs but it is
389  // quite convenient to also have them on the slaves
390  procCellOffsets_.set(levelIndex, new labelList(0));
391  procFaceMap_.set(levelIndex, new labelListList(0));
392  procBoundaryMap_.set(levelIndex, new labelListList(0));
393  procBoundaryFaceMap_.set(levelIndex, new labelListListList(0));
394 
395 
396  // Collect meshes
397  PtrList<lduPrimitiveMesh> otherMeshes;
398  lduPrimitiveMesh::gather(meshComm, myMesh, procIDs, otherMeshes);
399 
400  if (Pstream::myProcNo(meshComm) == procIDs[0])
401  {
402  // Combine all addressing
403 
404  labelList procFaceOffsets;
405  meshLevels_.set
406  (
407  levelIndex-1,
408  new lduPrimitiveMesh
409  (
410  allMeshComm,
411  procAgglomMap,
412 
413  procIDs,
414  myMesh,
415  otherMeshes,
416 
417  procCellOffsets_[levelIndex],
418  procFaceOffsets,
419  procFaceMap_[levelIndex],
420  procBoundaryMap_[levelIndex],
421  procBoundaryFaceMap_[levelIndex]
422  )
423  );
424  }
425 
426 
427  // Combine restrict addressing
428  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
429 
430  procAgglomerateRestrictAddressing
431  (
432  meshComm,
433  procIDs,
434  levelIndex
435  );
436 
437  if (Pstream::myProcNo(meshComm) != procIDs[0])
438  {
439  clearLevel(levelIndex);
440  }
441 
442  UPstream::warnComm = oldWarn;
443 }
444 
445 
447 (
448  const label comm,
449  const labelList& procIDs,
450  const label levelIndex
451 )
452 {
453  // Collect number of cells
454  labelList nFineCells;
455  gatherList
456  (
457  comm,
458  procIDs,
459  restrictAddressing_[levelIndex].size(),
460  nFineCells
461  );
462 
463  labelList offsets(nFineCells.size()+1);
464  {
465  offsets[0] = 0;
466  forAll(nFineCells, i)
467  {
468  offsets[i+1] = offsets[i] + nFineCells[i];
469  }
470  }
471 
472  // Combine and renumber nCoarseCells
473  labelList nCoarseCells;
474  gatherList
475  (
476  comm,
477  procIDs,
478  nCells_[levelIndex],
479  nCoarseCells
480  );
481 
482  // (cell)restrictAddressing
483  const globalIndex cellOffsetter(offsets);
484 
485  labelList procRestrictAddressing;
486  cellOffsetter.gather
487  (
488  comm,
489  procIDs,
490  restrictAddressing_[levelIndex],
491  procRestrictAddressing,
492 
493  UPstream::msgType(),
494  Pstream::nonBlocking //Pstream::scheduled
495  );
496 
497 
498  if (Pstream::myProcNo(comm) == procIDs[0])
499  {
500  labelList coarseCellOffsets(procIDs.size()+1);
501  {
502  coarseCellOffsets[0] = 0;
503  forAll(procIDs, i)
504  {
505  coarseCellOffsets[i+1] = coarseCellOffsets[i]+nCoarseCells[i];
506  }
507  }
508 
509  nCells_[levelIndex] = coarseCellOffsets.last();
510 
511  // Renumber consecutively
512  for (label procI = 1; procI < procIDs.size(); procI++)
513  {
514  SubList<label> procSlot
515  (
516  procRestrictAddressing,
517  offsets[procI+1]-offsets[procI],
518  offsets[procI]
519  );
520  forAll(procSlot, i)
521  {
522  procSlot[i] += coarseCellOffsets[procI];
523  }
524  }
525 
526  restrictAddressing_[levelIndex].transfer(procRestrictAddressing);
527  }
528 }
529 
530 
532 {
533  label prevLevel = curLevel - 1;
534 
535  // Set the previous level nCells to the current
536  nCells_[prevLevel] = nCells_[curLevel];
537  nFaces_[prevLevel] = nFaces_[curLevel];
538 
539  // Map the restrictAddressing from the coarser level into the previous
540  // finer level
541 
542  const labelList& curResAddr = restrictAddressing_[curLevel];
543  labelList& prevResAddr = restrictAddressing_[prevLevel];
544 
545  const labelList& curFaceResAddr = faceRestrictAddressing_[curLevel];
546  labelList& prevFaceResAddr = faceRestrictAddressing_[prevLevel];
547  const boolList& curFaceFlipMap = faceFlipMap_[curLevel];
548  boolList& prevFaceFlipMap = faceFlipMap_[prevLevel];
549 
550  forAll(prevFaceResAddr, i)
551  {
552  if (prevFaceResAddr[i] >= 0)
553  {
554  label fineFaceI = prevFaceResAddr[i];
555  prevFaceResAddr[i] = curFaceResAddr[fineFaceI];
556  prevFaceFlipMap[i] = curFaceFlipMap[fineFaceI];
557  }
558  else
559  {
560  label fineFaceI = -prevFaceResAddr[i] - 1;
561  prevFaceResAddr[i] = -curResAddr[fineFaceI] - 1;
562  prevFaceFlipMap[i] = curFaceFlipMap[fineFaceI];
563  }
564  }
565 
566  // Delete the restrictAddressing for the coarser level
567  faceRestrictAddressing_.set(curLevel, NULL);
568  faceFlipMap_.set(curLevel, NULL);
569 
570  forAll(prevResAddr, i)
571  {
572  prevResAddr[i] = curResAddr[prevResAddr[i]];
573  }
574 
575  const labelListList& curPatchFaceResAddr =
577  labelListList& prevPatchFaceResAddr =
578  patchFaceRestrictAddressing_[prevLevel];
579 
580  forAll(prevPatchFaceResAddr, inti)
581  {
582  const labelList& curResAddr = curPatchFaceResAddr[inti];
583  labelList& prevResAddr = prevPatchFaceResAddr[inti];
584  forAll(prevResAddr, i)
585  {
586  label fineFaceI = prevResAddr[i];
587  prevResAddr[i] = curResAddr[fineFaceI];
588  }
589  }
590 
591  // Delete the restrictAddressing for the coarser level
592  restrictAddressing_.set(curLevel, NULL);
593 
594  // Patch faces
595  nPatchFaces_[prevLevel] = nPatchFaces_[curLevel];
596 
597 
598 
599  // Adapt the restrict addressing for the patches
600  const lduInterfacePtrsList& curInterLevel =
601  meshLevels_[curLevel].rawInterfaces();
602  const lduInterfacePtrsList& prevInterLevel =
603  meshLevels_[prevLevel].rawInterfaces();
604 
605  forAll(prevInterLevel, inti)
606  {
607  if (prevInterLevel.set(inti))
608  {
609  GAMGInterface& prevInt = refCast<GAMGInterface>
610  (
611  const_cast<lduInterface&>
612  (
613  prevInterLevel[inti]
614  )
615  );
616  const GAMGInterface& curInt = refCast<const GAMGInterface>
617  (
618  curInterLevel[inti]
619  );
620  prevInt.combine(curInt);
621  }
622  }
623 
624  // Delete the matrix addressing and coefficients from the previous level
625  // and replace with the corresponding entry from the coarser level
626  meshLevels_.set(prevLevel, meshLevels_.set(curLevel, NULL));
627 }
628 
629 
630 //void Foam::GAMGAgglomeration::gatherList
631 //(
632 // const label comm,
633 // const labelList& procIDs,
634 //
635 // const label myVal,
636 // labelList& vals,
637 // const int tag
638 //)
639 //{
640 // vals.setSize(procIDs.size());
641 //
642 // if (Pstream::myProcNo(comm) == procIDs[0])
643 // {
644 // vals[0] = myVal;
645 //
646 // for (label i = 1; i < procIDs.size(); i++)
647 // {
648 // label& slaveVal = vals[i];
649 // IPstream::read
650 // (
651 // Pstream::scheduled,
652 // procIDs[i],
653 // reinterpret_cast<char*>(&slaveVal),
654 // sizeof(slaveVal),
655 // tag,
656 // comm
657 // );
658 // }
659 // }
660 // else
661 // {
662 // OPstream::write
663 // (
664 // Pstream::scheduled,
665 // procIDs[0],
666 // reinterpret_cast<const char*>(&myVal),
667 // sizeof(myVal),
668 // tag,
669 // comm
670 // );
671 // }
672 //}
673 
674 
676 (
677  const label comm,
678  const labelList& procAgglomMap,
679  labelList& masterProcs,
680  List<label>& agglomProcIDs
681 )
682 {
683  // Determine the master processors
684  Map<label> agglomToMaster(procAgglomMap.size());
685 
686  forAll(procAgglomMap, procI)
687  {
688  label coarseI = procAgglomMap[procI];
689 
690  Map<label>::iterator fnd = agglomToMaster.find(coarseI);
691  if (fnd == agglomToMaster.end())
692  {
693  agglomToMaster.insert(coarseI, procI);
694  }
695  else
696  {
697  fnd() = min(fnd(), procI);
698  }
699  }
700 
701  masterProcs.setSize(agglomToMaster.size());
702  forAllConstIter(Map<label>, agglomToMaster, iter)
703  {
704  masterProcs[iter.key()] = iter();
705  }
706 
707 
708  // Collect all the processors in my agglomeration
709  label myProcID = Pstream::myProcNo(comm);
710  label myAgglom = procAgglomMap[myProcID];
711 
712  // Get all processors agglomerating to the same coarse
713  // processor
714  agglomProcIDs = findIndices(procAgglomMap, myAgglom);
715  // Make sure the master is the first element.
716  label index = findIndex
717  (
718  agglomProcIDs,
719  agglomToMaster[myAgglom]
720  );
721  Swap(agglomProcIDs[0], agglomProcIDs[index]);
722 }
723 
724 
725 // ************************************************************************* //
label size() const
Return number of equations.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
void combineLevels(const label curLevel)
Combine a level with the previous one.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
static void calculateRegionMaster(const label comm, const labelList &procAgglomMap, labelList &masterProcs, List< label > &agglomProcIDs)
Given fine to coarse processor map determine:
virtual label comm() const =0
Return communicator used for parallel communication.
PtrList< boolList > faceFlipMap_
Face flip: for faces mapped to internal faces stores whether.
PtrList< lduPrimitiveMesh > meshLevels_
Hierarchy of mesh addressing.
T & last()
Return the last element of the list.
Definition: UListI.H:131
List< labelListList > labelListListList
A List of labelListList.
Definition: labelList.H:58
void procAgglomerateRestrictAddressing(const label comm, const labelList &procIDs, const label levelIndex)
Collect and combine basic restriction addressing:
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:63
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition: lduMesh.H:51
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
void setSize(const label)
Reset size of List.
Definition: List.C:318
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
Definition: lduInterface.H:53
PtrList< labelList > nPatchFaces_
The number of (coarse) patch faces in each level.
#define forAll(list, i)
Definition: UList.H:421
PtrList< labelListList > patchFaceRestrictAddressing_
Patch-local face restriction addressing array.
void combine(const GAMGInterface &)
Merge the next level with this level.
Definition: GAMGInterface.C:56
label size() const
Return the number of elements in the UList.
Definition: UListI.H:299
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
void procAgglomerateLduAddressing(const label comm, const labelList &procAgglomMap, const labelList &procIDs, const label allMeshComm, const label levelIndex)
Collect and combine processor meshes into allMesh.
PtrList< labelList > faceRestrictAddressing_
Face restriction addressing array.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:404
void Swap(T &a, T &b)
Definition: Swap.H:43
bool set(const label) const
Is element set.
Definition: UPtrListI.H:80
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
#define forAllReverse(list, i)
Definition: UList.H:424
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:31
error FatalError
List< label > labelList
A List of labels.
Definition: labelList.H:56
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
Definition: HashTable.H:106
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:51
A List obtained as a section of another List.
Definition: SubList.H:53
labelList nCells_
The number of cells in each level.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
static void gather(const labelUList &offsets, const label comm, const labelList &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Definition: HashTable.C:139
labelList nFaces_
The number of (coarse) faces in each level.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:57
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurences of given element. Linear search.
void agglomerateLduAddressing(const label fineLevelIndex)
Assemble coarse mesh addressing.
Simplest contrete lduMesh which stores the addressing needed by lduMatrix.
prefixOSstream Pout(cout,"Pout")
Definition: IOstreams.H:53
List< bool > boolList
Bool container classes.
Definition: boolList.H:50