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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "GAMGAgglomeration.H"
30 #include "GAMGInterface.H"
31 #include "processorGAMGInterface.H"
32 
33 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34 
36 (
37  const label fineLevelIndex
38 )
39 {
40  const lduMesh& fineMesh = meshLevel(fineLevelIndex);
41  const lduAddressing& fineMeshAddr = fineMesh.lduAddr();
42 
43  const labelUList& upperAddr = fineMeshAddr.upperAddr();
44  const labelUList& lowerAddr = fineMeshAddr.lowerAddr();
45 
46  label nFineFaces = upperAddr.size();
47 
48  // Get restriction map for current level
49  const labelField& restrictMap = restrictAddressing(fineLevelIndex);
50 
51  if (min(restrictMap) == -1)
52  {
54  << "min(restrictMap) == -1" << exit(FatalError);
55  }
56 
57  if (restrictMap.size() != fineMeshAddr.size())
58  {
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, Zero);
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  {
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
267  (
268  fineLevelIndex,
269  new labelList(fineInterfaces.size(), Zero)
270  );
271  labelList& nPatchFaces = nPatchFaces_[fineLevelIndex];
272 
273  patchFaceRestrictAddressing_.set
274  (
275  fineLevelIndex,
276  new labelListList(fineInterfaces.size())
277  );
278  labelListList& patchFineToCoarse =
279  patchFaceRestrictAddressing_[fineLevelIndex];
280 
281 
282  // Initialise transfer of restrict addressing on the interface
283  forAll(fineInterfaces, inti)
284  {
285  if (fineInterfaces.set(inti))
286  {
287  fineInterfaces[inti].initInternalFieldTransfer
288  (
289  Pstream::commsTypes::nonBlocking,
290  restrictMap
291  );
292  }
293  }
294 
295  if (Pstream::parRun())
296  {
297  Pstream::waitRequests();
298  }
299 
300 
301  // Add the coarse level
302  meshLevels_.set
303  (
304  fineLevelIndex,
305  new lduPrimitiveMesh
306  (
307  nCoarseCells,
308  coarseOwner,
309  coarseNeighbour,
310  fineMesh.comm(),
311  true
312  )
313  );
314 
315  lduInterfacePtrsList coarseInterfaces(fineInterfaces.size());
316 
317  forAll(fineInterfaces, inti)
318  {
319  if (fineInterfaces.set(inti))
320  {
321  coarseInterfaces.set
322  (
323  inti,
325  (
326  inti,
327  meshLevels_[fineLevelIndex].rawInterfaces(),
328  fineInterfaces[inti],
329  fineInterfaces[inti].interfaceInternalField(restrictMap),
330  fineInterfaces[inti].internalFieldTransfer
331  (
332  Pstream::commsTypes::nonBlocking,
333  restrictMap
334  ),
335  fineLevelIndex,
336  fineMesh.comm()
337  ).ptr()
338  );
339 
340  nPatchFaces[inti] = coarseInterfaces[inti].faceCells().size();
341  patchFineToCoarse[inti] = refCast<const GAMGInterface>
342  (
343  coarseInterfaces[inti]
344  ).faceRestrictAddressing();
345  }
346  }
347 
348  meshLevels_[fineLevelIndex].addInterfaces
349  (
350  coarseInterfaces,
351  lduPrimitiveMesh::nonBlockingSchedule<processorGAMGInterface>
352  (
353  coarseInterfaces
354  )
355  );
356 
357 
358  if (debug & 2)
359  {
360  Pout<< "GAMGAgglomeration :"
361  << " agglomerated level " << fineLevelIndex
362  << " from nCells:" << fineMeshAddr.size()
363  << " nFaces:" << upperAddr.size()
364  << " to nCells:" << nCoarseCells
365  << " nFaces:" << nCoarseFaces
366  << endl;
367  }
368 }
369 
370 
372 (
373  const label meshComm,
374  const labelList& procAgglomMap,
375  const labelList& procIDs,
376  const label allMeshComm,
377 
378  const label levelIndex
379 )
380 {
381  const lduMesh& myMesh = meshLevels_[levelIndex-1];
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 
443 
445 (
446  const label comm,
447  const labelList& procIDs,
448  const label levelIndex
449 )
450 {
451  // Collect number of cells
452  labelList nFineCells;
453  gatherList
454  (
455  comm,
456  procIDs,
457  restrictAddressing_[levelIndex].size(),
458  nFineCells
459  );
460 
461  labelList offsets(nFineCells.size()+1);
462  {
463  offsets[0] = 0;
464  forAll(nFineCells, i)
465  {
466  offsets[i+1] = offsets[i] + nFineCells[i];
467  }
468  }
469 
470  // Combine and renumber nCoarseCells
471  labelList nCoarseCells;
472  gatherList
473  (
474  comm,
475  procIDs,
476  nCells_[levelIndex],
477  nCoarseCells
478  );
479 
480  // (cell)restrictAddressing
481  const globalIndex cellOffsetter(offsets);
482 
483  labelList procRestrictAddressing;
484  cellOffsetter.gather
485  (
486  comm,
487  procIDs,
488  restrictAddressing_[levelIndex],
489  procRestrictAddressing,
490 
491  UPstream::msgType(),
492  Pstream::commsTypes::nonBlocking //Pstream::commsTypes::scheduled
493  );
494 
495 
496  if (Pstream::myProcNo(comm) == procIDs[0])
497  {
498  labelList coarseCellOffsets(procIDs.size()+1);
499  {
500  coarseCellOffsets[0] = 0;
501  forAll(procIDs, i)
502  {
503  coarseCellOffsets[i+1] = coarseCellOffsets[i]+nCoarseCells[i];
504  }
505  }
506 
507  nCells_[levelIndex] = coarseCellOffsets.last();
508 
509  // Renumber consecutively
510  for (label proci = 1; proci < procIDs.size(); proci++)
511  {
512  SubList<label> procSlot
513  (
514  procRestrictAddressing,
515  offsets[proci+1]-offsets[proci],
516  offsets[proci]
517  );
518  forAll(procSlot, i)
519  {
520  procSlot[i] += coarseCellOffsets[proci];
521  }
522  }
523 
524  restrictAddressing_[levelIndex].transfer(procRestrictAddressing);
525  }
526 }
527 
528 
530 {
531  label prevLevel = curLevel - 1;
532 
533  // Set the previous level nCells to the current
534  nCells_[prevLevel] = nCells_[curLevel];
535  nFaces_[prevLevel] = nFaces_[curLevel];
536 
537  // Map the restrictAddressing from the coarser level into the previous
538  // finer level
539 
540  const labelList& curResAddr = restrictAddressing_[curLevel];
541  labelList& prevResAddr = restrictAddressing_[prevLevel];
542 
543  const labelList& curFaceResAddr = faceRestrictAddressing_[curLevel];
544  labelList& prevFaceResAddr = faceRestrictAddressing_[prevLevel];
545  const boolList& curFaceFlipMap = faceFlipMap_[curLevel];
546  boolList& prevFaceFlipMap = faceFlipMap_[prevLevel];
547 
548  forAll(prevFaceResAddr, i)
549  {
550  if (prevFaceResAddr[i] >= 0)
551  {
552  label fineFacei = prevFaceResAddr[i];
553  prevFaceResAddr[i] = curFaceResAddr[fineFacei];
554  prevFaceFlipMap[i] = curFaceFlipMap[fineFacei];
555  }
556  else
557  {
558  label fineFacei = -prevFaceResAddr[i] - 1;
559  prevFaceResAddr[i] = -curResAddr[fineFacei] - 1;
560  prevFaceFlipMap[i] = curFaceFlipMap[fineFacei];
561  }
562  }
563 
564  // Delete the restrictAddressing for the coarser level
565  faceRestrictAddressing_.set(curLevel, nullptr);
566  faceFlipMap_.set(curLevel, nullptr);
567 
568  forAll(prevResAddr, i)
569  {
570  prevResAddr[i] = curResAddr[prevResAddr[i]];
571  }
572 
573  const labelListList& curPatchFaceResAddr =
575  labelListList& prevPatchFaceResAddr =
576  patchFaceRestrictAddressing_[prevLevel];
577 
578  forAll(prevPatchFaceResAddr, inti)
579  {
580  const labelList& curResAddr = curPatchFaceResAddr[inti];
581  labelList& prevResAddr = prevPatchFaceResAddr[inti];
582  forAll(prevResAddr, i)
583  {
584  label fineFacei = prevResAddr[i];
585  prevResAddr[i] = curResAddr[fineFacei];
586  }
587  }
588 
589  // Delete the restrictAddressing for the coarser level
590  restrictAddressing_.set(curLevel, nullptr);
591 
592  // Patch faces
593  nPatchFaces_[prevLevel] = nPatchFaces_[curLevel];
594 
595 
596 
597  // Adapt the restrict addressing for the patches
598  const lduInterfacePtrsList& curInterLevel =
599  meshLevels_[curLevel].rawInterfaces();
600  const lduInterfacePtrsList& prevInterLevel =
601  meshLevels_[prevLevel].rawInterfaces();
602 
603  forAll(prevInterLevel, inti)
604  {
605  if (prevInterLevel.set(inti))
606  {
607  GAMGInterface& prevInt = refCast<GAMGInterface>
608  (
609  const_cast<lduInterface&>
610  (
611  prevInterLevel[inti]
612  )
613  );
614  const GAMGInterface& curInt = refCast<const GAMGInterface>
615  (
616  curInterLevel[inti]
617  );
618  prevInt.combine(curInt);
619  }
620  }
621 
622  // Delete the matrix addressing and coefficients from the previous level
623  // and replace with the corresponding entry from the coarser level
624  meshLevels_.set(prevLevel, meshLevels_.set(curLevel, nullptr));
625 }
626 
627 
628 //void Foam::GAMGAgglomeration::gatherList
629 //(
630 // const label comm,
631 // const labelList& procIDs,
632 //
633 // const label myVal,
634 // labelList& vals,
635 // const int tag
636 //)
637 //{
638 // vals.setSize(procIDs.size());
639 //
640 // if (Pstream::myProcNo(comm) == procIDs[0])
641 // {
642 // vals[0] = myVal;
643 //
644 // for (label i=1; i<procIDs.size(); i++)
645 // {
646 // label& slaveVal = vals[i];
647 // IPstream::read
648 // (
649 // Pstream::commsTypes::scheduled,
650 // procIDs[i],
651 // reinterpret_cast<char*>(&slaveVal),
652 // sizeof(slaveVal),
653 // tag,
654 // comm
655 // );
656 // }
657 // }
658 // else
659 // {
660 // OPstream::write
661 // (
662 // Pstream::commsTypes::scheduled,
663 // procIDs[0],
664 // reinterpret_cast<const char*>(&myVal),
665 // sizeof(myVal),
666 // tag,
667 // comm
668 // );
669 // }
670 //}
671 
672 
674 (
675  const label comm,
676  const labelList& procAgglomMap,
677  labelList& masterProcs,
678  List<label>& agglomProcIDs
679 )
680 {
681  // Determine the master processors
682  Map<label> agglomToMaster(procAgglomMap.size());
683 
684  forAll(procAgglomMap, proci)
685  {
686  const label coarsei = procAgglomMap[proci];
687 
688  auto iter = agglomToMaster.find(coarsei);
689  if (iter.found())
690  {
691  iter.val() = min(iter.val(), proci);
692  }
693  else
694  {
695  agglomToMaster.insert(coarsei, proci);
696  }
697  }
698 
699  masterProcs.setSize(agglomToMaster.size());
700  forAllConstIters(agglomToMaster, iter)
701  {
702  masterProcs[iter.key()] = iter.val();
703  }
704 
705 
706  // Collect all the processors in my agglomeration
707  label myProcID = Pstream::myProcNo(comm);
708  label myAgglom = procAgglomMap[myProcID];
709 
710  // Get all processors agglomerating to the same coarse
711  // processor
712  agglomProcIDs = findIndices(procAgglomMap, myAgglom);
713 
714  // Make sure the master is the first element.
715  const label index =
716  agglomProcIDs.find(agglomToMaster[myAgglom]);
717 
718  Swap(agglomProcIDs[0], agglomProcIDs[index]);
719 }
720 
721 
722 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:74
Foam::UPtrList::size
label size() const noexcept
The number of elements in the list.
Definition: UPtrListI.H:90
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::lduInterface
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:54
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
Foam::GAMGAgglomeration::procAgglomerateRestrictAddressing
void procAgglomerateRestrictAddressing(const label comm, const labelList &procIDs, const label levelIndex)
Collect and combine basic restriction addressing:
Definition: GAMGAgglomerateLduAddressing.C:445
Foam::GAMGAgglomeration::nCells_
labelList nCells_
The number of cells in each level.
Definition: GAMGAgglomeration.H:84
Foam::Map< label >
Foam::UPtrList::set
const T * set(const label i) const
Return const pointer to element (if set) or nullptr.
Definition: UPtrListI.H:176
Foam::boolList
List< bool > boolList
A List of bools.
Definition: List.H:72
GAMGAgglomeration.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::GAMGAgglomeration::faceRestrictAddressing_
PtrList< labelList > faceRestrictAddressing_
Face restriction addressing array.
Definition: GAMGAgglomeration.H:100
Foam::Pout
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Foam::GAMGAgglomeration::meshLevels_
PtrList< lduPrimitiveMesh > meshLevels_
Hierarchy of mesh addressing.
Definition: GAMGAgglomeration.H:117
Foam::Swap
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
Definition: DynamicListI.H:909
Foam::lduAddressing::size
label size() const
Return number of equations.
Definition: lduAddressing.H:171
Foam::lduAddressing::upperAddr
virtual const labelUList & upperAddr() const =0
Return upper addressing.
Foam::GAMGAgglomeration::restrictAddressing_
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
Definition: GAMGAgglomeration.H:88
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::GAMGAgglomeration::agglomerateLduAddressing
void agglomerateLduAddressing(const label fineLevelIndex)
Assemble coarse mesh addressing.
Definition: GAMGAgglomerateLduAddressing.C:36
Foam::GAMGAgglomeration::calculateRegionMaster
static void calculateRegionMaster(const label comm, const labelList &procAgglomMap, labelList &masterProcs, List< label > &agglomProcIDs)
Given fine to coarse processor map determine:
Definition: GAMGAgglomerateLduAddressing.C:674
GAMGInterface.H
Foam::label
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:62
Foam::Field< label >
Foam::GAMGInterface
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:53
Foam::UPtrList< const lduInterface >
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:65
Foam::GAMGAgglomeration::nPatchFaces_
PtrList< labelList > nPatchFaces_
The number of (coarse) patch faces in each level.
Definition: GAMGAgglomeration.H:109
Foam::GAMGAgglomeration::combineLevels
void combineLevels(const label curLevel)
Combine a level with the previous one.
Definition: GAMGAgglomerateLduAddressing.C:529
Foam::FatalError
error FatalError
processorGAMGInterface.H
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:137
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:68
Foam::labelListListList
List< labelListList > labelListListList
A List of labelListList.
Definition: labelList.H:57
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::lduPrimitiveMesh
Simplest contrete lduMesh which stores the addressing needed by lduMatrix.
Definition: lduPrimitiveMesh.H:52
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:444
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::labelListList
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::GAMGAgglomeration::nFaces_
labelList nFaces_
The number of (coarse) faces in each level.
Definition: GAMGAgglomeration.H:92
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
Foam::lduAddressing::lowerAddr
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
Foam::List< label >
Foam::UList< label >
Foam::List::set
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
Definition: List.H:320
Foam::lduMesh::comm
virtual label comm() const =0
Return communicator used for parallel communication.
Foam::UList::size
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
Definition: UListI.H:360
forAllReverse
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Definition: stdFoam.H:303
Foam::GAMGAgglomeration::procAgglomerateLduAddressing
void procAgglomerateLduAddressing(const label comm, const labelList &procAgglomMap, const labelList &procIDs, const label allMeshComm, const label levelIndex)
Collect and combine processor meshes into allMesh:
Definition: GAMGAgglomerateLduAddressing.C:372
Foam::List::setSize
void setSize(const label newSize)
Alias for resize(const label)
Definition: ListI.H:146
Foam::GAMGAgglomeration::faceFlipMap_
PtrList< boolList > faceFlipMap_
Face flip: for faces mapped to internal faces stores whether.
Definition: GAMGAgglomeration.H:105
Foam::GAMGAgglomeration::patchFaceRestrictAddressing_
PtrList< labelListList > patchFaceRestrictAddressing_
Patch-local face restriction addressing array.
Definition: GAMGAgglomeration.H:114
Foam::lduMesh::lduAddr
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
Foam::lduMesh
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition: lduMesh.H:62
Foam::GAMGInterface::combine
void combine(const GAMGInterface &)
Merge the next level with this level.
Definition: GAMGInterface.C:58
Foam::globalIndex::gather
static void gather(const labelUList &offsets, const label comm, const Container &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
Definition: globalIndexTemplates.C:35