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-2021 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 #include "cyclicLduInterface.H"
33 
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35 
37 (
38  const label fineLevelIndex
39 )
40 {
41  const lduMesh& fineMesh = meshLevel(fineLevelIndex);
42  const lduAddressing& fineMeshAddr = fineMesh.lduAddr();
43 
44  const labelUList& upperAddr = fineMeshAddr.upperAddr();
45  const labelUList& lowerAddr = fineMeshAddr.lowerAddr();
46 
47  const label nFineFaces = upperAddr.size();
48 
49  // Get restriction map for current level
50  const labelField& restrictMap = restrictAddressing(fineLevelIndex);
51 
52  if (min(restrictMap) == -1)
53  {
55  << "min(restrictMap) == -1" << exit(FatalError);
56  }
57 
58  if (restrictMap.size() != fineMeshAddr.size())
59  {
61  << "restrict map does not correspond to fine level. " << endl
62  << " Sizes: restrictMap: " << restrictMap.size()
63  << " nEqns: " << fineMeshAddr.size()
64  << abort(FatalError);
65  }
66 
67 
68  // Get the number of coarse cells
69  const label nCoarseCells = nCells_[fineLevelIndex];
70 
71  // Storage for coarse cell neighbours and coefficients
72 
73  // Guess initial maximum number of neighbours in coarse cell
74  label maxNnbrs = 10;
75 
76  // Number of faces for each coarse-cell
77  labelList cCellnFaces(nCoarseCells, Zero);
78 
79  // Setup initial packed storage for coarse-cell faces
80  labelList cCellFaces(maxNnbrs*nCoarseCells);
81 
82  // Create face-restriction addressing
83  faceRestrictAddressing_.set(fineLevelIndex, new labelList(nFineFaces));
84  labelList& faceRestrictAddr = faceRestrictAddressing_[fineLevelIndex];
85 
86  // Initial neighbour array (not in upper-triangle order)
87  labelList initCoarseNeighb(nFineFaces);
88 
89  // Counter for coarse faces
90  label& nCoarseFaces = nFaces_[fineLevelIndex];
91  nCoarseFaces = 0;
92 
93  // Loop through all fine faces
94  forAll(upperAddr, fineFacei)
95  {
96  label rmUpperAddr = restrictMap[upperAddr[fineFacei]];
97  label rmLowerAddr = restrictMap[lowerAddr[fineFacei]];
98 
99  if (rmUpperAddr == rmLowerAddr)
100  {
101  // For each fine face inside of a coarse cell keep the address
102  // of the cell corresponding to the face in the faceRestrictAddr
103  // as a negative index
104  faceRestrictAddr[fineFacei] = -(rmUpperAddr + 1);
105  }
106  else
107  {
108  // this face is a part of a coarse face
109 
110  label cOwn = rmUpperAddr;
111  label cNei = rmLowerAddr;
112 
113  // get coarse owner and neighbour
114  if (rmUpperAddr > rmLowerAddr)
115  {
116  cOwn = rmLowerAddr;
117  cNei = rmUpperAddr;
118  }
119 
120  // check the neighbour to see if this face has already been found
121  label* ccFaces = &cCellFaces[maxNnbrs*cOwn];
122 
123  bool nbrFound = false;
124  label& ccnFaces = cCellnFaces[cOwn];
125 
126  for (int i=0; i<ccnFaces; i++)
127  {
128  if (initCoarseNeighb[ccFaces[i]] == cNei)
129  {
130  nbrFound = true;
131  faceRestrictAddr[fineFacei] = ccFaces[i];
132  break;
133  }
134  }
135 
136  if (!nbrFound)
137  {
138  if (ccnFaces >= maxNnbrs)
139  {
140  label oldMaxNnbrs = maxNnbrs;
141  maxNnbrs *= 2;
142 
143  cCellFaces.setSize(maxNnbrs*nCoarseCells);
144 
145  forAllReverse(cCellnFaces, i)
146  {
147  label* oldCcNbrs = &cCellFaces[oldMaxNnbrs*i];
148  label* newCcNbrs = &cCellFaces[maxNnbrs*i];
149 
150  for (int j=0; j<cCellnFaces[i]; j++)
151  {
152  newCcNbrs[j] = oldCcNbrs[j];
153  }
154  }
155 
156  ccFaces = &cCellFaces[maxNnbrs*cOwn];
157  }
158 
159  ccFaces[ccnFaces] = nCoarseFaces;
160  initCoarseNeighb[nCoarseFaces] = cNei;
161  faceRestrictAddr[fineFacei] = nCoarseFaces;
162  ccnFaces++;
163 
164  // new coarse face created
165  nCoarseFaces++;
166  }
167  }
168  } // end for all fine faces
169 
170 
171  // Renumber into upper-triangular order
172 
173  // All coarse owner-neighbour storage
174  labelList coarseOwner(nCoarseFaces);
175  labelList coarseNeighbour(nCoarseFaces);
176  labelList coarseFaceMap(nCoarseFaces);
177 
178  label coarseFacei = 0;
179 
180  forAll(cCellnFaces, cci)
181  {
182  label* cFaces = &cCellFaces[maxNnbrs*cci];
183  label ccnFaces = cCellnFaces[cci];
184 
185  for (int i=0; i<ccnFaces; i++)
186  {
187  coarseOwner[coarseFacei] = cci;
188  coarseNeighbour[coarseFacei] = initCoarseNeighb[cFaces[i]];
189  coarseFaceMap[cFaces[i]] = coarseFacei;
190  coarseFacei++;
191  }
192  }
193 
194  forAll(faceRestrictAddr, fineFacei)
195  {
196  if (faceRestrictAddr[fineFacei] >= 0)
197  {
198  faceRestrictAddr[fineFacei] =
199  coarseFaceMap[faceRestrictAddr[fineFacei]];
200  }
201  }
202 
203 
204  // Create face-flip status
205  faceFlipMap_.set(fineLevelIndex, new boolList(nFineFaces, false));
206  boolList& faceFlipMap = faceFlipMap_[fineLevelIndex];
207 
208 
209  label nFlipped = 0;
210  label nDissapear = 0;
211 
212  forAll(faceRestrictAddr, fineFacei)
213  {
214  label coarseFacei = faceRestrictAddr[fineFacei];
215 
216  if (coarseFacei >= 0)
217  {
218  // Maps to coarse face
219  label cOwn = coarseOwner[coarseFacei];
220  label cNei = coarseNeighbour[coarseFacei];
221 
222  label rmUpperAddr = restrictMap[upperAddr[fineFacei]];
223  label rmLowerAddr = restrictMap[lowerAddr[fineFacei]];
224 
225  if (cOwn == rmUpperAddr && cNei == rmLowerAddr)
226  {
227  faceFlipMap[fineFacei] = true;
228  nFlipped++;
229  }
230  else if (cOwn == rmLowerAddr && cNei == rmUpperAddr)
231  {
232  //faceFlipMap[fineFacei] = false;
233  }
234  else
235  {
237  << "problem."
238  << " fineFacei:" << fineFacei
239  << " rmUpperAddr:" << rmUpperAddr
240  << " rmLowerAddr:" << rmLowerAddr
241  << " coarseFacei:" << coarseFacei
242  << " cOwn:" << cOwn
243  << " cNei:" << cNei
244  << exit(FatalError);
245  }
246  }
247  else
248  {
249  nDissapear++;
250  }
251  }
252 
253 
254 
255  // Clear the temporary storage for the coarse cell data
256  cCellnFaces.setSize(0);
257  cCellFaces.setSize(0);
258  initCoarseNeighb.setSize(0);
259  coarseFaceMap.setSize(0);
260 
261 
262  // Create coarse-level interfaces
263 
264  // Get reference to fine-level interfaces
265  const lduInterfacePtrsList& fineInterfaces = interfaceLevel(fineLevelIndex);
266 
267  nPatchFaces_.set
268  (
269  fineLevelIndex,
270  new labelList(fineInterfaces.size(), Zero)
271  );
272  labelList& nPatchFaces = nPatchFaces_[fineLevelIndex];
273 
274  patchFaceRestrictAddressing_.set
275  (
276  fineLevelIndex,
277  new labelListList(fineInterfaces.size())
278  );
279  labelListList& patchFineToCoarse =
280  patchFaceRestrictAddressing_[fineLevelIndex];
281 
282 
283  const label nReq = Pstream::nRequests();
284 
285  // Initialise transfer of restrict addressing on the interface
286  // The finest mesh uses patchAddr from the original lduAdressing.
287  // the coarser levels create their own adressing for faceCells
288  forAll(fineInterfaces, inti)
289  {
290  if (fineInterfaces.set(inti))
291  {
292  if (fineLevelIndex == 0)
293  {
294  fineInterfaces[inti].initInternalFieldTransfer
295  (
296  Pstream::commsTypes::nonBlocking,
297  restrictMap,
298  fineMeshAddr.patchAddr(inti)
299  );
300  }
301  else
302  {
303  fineInterfaces[inti].initInternalFieldTransfer
304  (
305  Pstream::commsTypes::nonBlocking,
306  restrictMap
307  );
308  }
309  }
310  }
311 
312  if (Pstream::parRun())
313  {
314  Pstream::waitRequests(nReq);
315  }
316 
317 
318  // Add the coarse level
319  meshLevels_.set
320  (
321  fineLevelIndex,
322  new lduPrimitiveMesh
323  (
324  nCoarseCells,
325  coarseOwner,
326  coarseNeighbour,
327  fineMesh.comm(),
328  true
329  )
330  );
331 
332  lduInterfacePtrsList coarseInterfaces(fineInterfaces.size());
333 
334  forAll(fineInterfaces, inti)
335  {
336  if (fineInterfaces.set(inti))
337  {
338  tmp<labelField> restrictMapInternalField;
339 
340  // The finest mesh uses patchAddr from the original lduAdressing.
341  // the coarser levels create thei own adressing for faceCells
342  if (fineLevelIndex == 0)
343  {
344  restrictMapInternalField =
345  fineInterfaces[inti].interfaceInternalField
346  (
347  restrictMap,
348  fineMeshAddr.patchAddr(inti)
349  );
350  }
351  else
352  {
353  restrictMapInternalField =
354  fineInterfaces[inti].interfaceInternalField
355  (
356  restrictMap
357  );
358  }
359 
360  tmp<labelField> nbrRestrictMapInternalField =
361  fineInterfaces[inti].internalFieldTransfer
362  (
363  Pstream::commsTypes::nonBlocking,
364  restrictMap
365  );
366 
367  coarseInterfaces.set
368  (
369  inti,
371  (
372  inti,
373  meshLevels_[fineLevelIndex].rawInterfaces(),
374  fineInterfaces[inti],
375  restrictMapInternalField(),
376  nbrRestrictMapInternalField(),
377  fineLevelIndex,
378  fineMesh.comm()
379  ).ptr()
380  );
381 
382  /* Same as below:
383  coarseInterfaces.set
384  (
385  inti,
386  GAMGInterface::New
387  (
388  inti,
389  meshLevels_[fineLevelIndex].rawInterfaces(),
390  fineInterfaces[inti],
391  fineInterfaces[inti].interfaceInternalField(restrictMap),
392  fineInterfaces[inti].internalFieldTransfer
393  (
394  Pstream::commsTypes::nonBlocking,
395  restrictMap
396  ),
397  fineLevelIndex,
398  fineMesh.comm()
399  ).ptr()
400  );
401  */
402 
403  nPatchFaces[inti] = coarseInterfaces[inti].faceCells().size();
404  patchFineToCoarse[inti] = refCast<const GAMGInterface>
405  (
406  coarseInterfaces[inti]
407  ).faceRestrictAddressing();
408  }
409  }
410 
411  meshLevels_[fineLevelIndex].addInterfaces
412  (
413  coarseInterfaces,
414  lduPrimitiveMesh::nonBlockingSchedule<processorGAMGInterface>
415  (
416  coarseInterfaces
417  )
418  );
419 
420 
421  if (debug & 2)
422  {
423  Pout<< "GAMGAgglomeration :"
424  << " agglomerated level " << fineLevelIndex
425  << " from nCells:" << fineMeshAddr.size()
426  << " nFaces:" << upperAddr.size()
427  << " to nCells:" << nCoarseCells
428  << " nFaces:" << nCoarseFaces
429  << endl;
430  }
431 }
432 
433 
435 (
436  const label meshComm,
437  const labelList& procAgglomMap,
438  const labelList& procIDs,
439  const label allMeshComm,
440 
441  const label levelIndex
442 )
443 {
444  const lduMesh& myMesh = meshLevels_[levelIndex-1];
445 
446 
447  procAgglomMap_.set(levelIndex, new labelList(procAgglomMap));
448  agglomProcIDs_.set(levelIndex, new labelList(procIDs));
449  procCommunicator_[levelIndex] = allMeshComm;
450 
451  // These could only be set on the master procs but it is
452  // quite convenient to also have them on the slaves
453  procCellOffsets_.set(levelIndex, new labelList(0));
454  procFaceMap_.set(levelIndex, new labelListList(0));
455  procBoundaryMap_.set(levelIndex, new labelListList(0));
456  procBoundaryFaceMap_.set(levelIndex, new labelListListList(0));
457 
458 
459  // Collect meshes
460  PtrList<lduPrimitiveMesh> otherMeshes;
461  lduPrimitiveMesh::gather(meshComm, myMesh, procIDs, otherMeshes);
462 
463  if (Pstream::myProcNo(meshComm) == procIDs[0])
464  {
465  // Combine all addressing
466 
467  labelList procFaceOffsets;
468  meshLevels_.set
469  (
470  levelIndex-1,
471  new lduPrimitiveMesh
472  (
473  allMeshComm,
474  procAgglomMap,
475 
476  procIDs,
477  myMesh,
478  otherMeshes,
479 
480  procCellOffsets_[levelIndex],
481  procFaceOffsets,
482  procFaceMap_[levelIndex],
483  procBoundaryMap_[levelIndex],
484  procBoundaryFaceMap_[levelIndex]
485  )
486  );
487  }
488 
489 
490  // Combine restrict addressing
491  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
492 
493  procAgglomerateRestrictAddressing
494  (
495  meshComm,
496  procIDs,
497  levelIndex
498  );
499 
500  if (Pstream::myProcNo(meshComm) != procIDs[0])
501  {
502  clearLevel(levelIndex);
503  }
504 }
505 
506 
508 (
509  const label comm,
510  const labelList& procIDs,
511  const label levelIndex
512 )
513 {
514  // Collect number of cells
515  labelList nFineCells;
516  gatherList
517  (
518  comm,
519  procIDs,
520  restrictAddressing_[levelIndex].size(),
521  nFineCells
522  );
523 
524  labelList offsets(nFineCells.size()+1);
525  {
526  offsets[0] = 0;
527  forAll(nFineCells, i)
528  {
529  offsets[i+1] = offsets[i] + nFineCells[i];
530  }
531  }
532 
533  // Combine and renumber nCoarseCells
534  labelList nCoarseCells;
535  gatherList
536  (
537  comm,
538  procIDs,
539  nCells_[levelIndex],
540  nCoarseCells
541  );
542 
543  // (cell)restrictAddressing
544  const globalIndex cellOffsetter(offsets);
545 
546  labelList procRestrictAddressing;
547  cellOffsetter.gather
548  (
549  comm,
550  procIDs,
551  restrictAddressing_[levelIndex],
552  procRestrictAddressing,
553 
554  UPstream::msgType(),
555  Pstream::commsTypes::nonBlocking //Pstream::commsTypes::scheduled
556  );
557 
558 
559  if (Pstream::myProcNo(comm) == procIDs[0])
560  {
561  labelList coarseCellOffsets(procIDs.size()+1);
562  {
563  coarseCellOffsets[0] = 0;
564  forAll(procIDs, i)
565  {
566  coarseCellOffsets[i+1] = coarseCellOffsets[i]+nCoarseCells[i];
567  }
568  }
569 
570  nCells_[levelIndex] = coarseCellOffsets.last();
571 
572  // Renumber consecutively
573  for (label proci = 1; proci < procIDs.size(); proci++)
574  {
575  SubList<label> procSlot
576  (
577  procRestrictAddressing,
578  offsets[proci+1]-offsets[proci],
579  offsets[proci]
580  );
581  forAll(procSlot, i)
582  {
583  procSlot[i] += coarseCellOffsets[proci];
584  }
585  }
586 
587  restrictAddressing_[levelIndex].transfer(procRestrictAddressing);
588  }
589 }
590 
591 
592 void Foam::GAMGAgglomeration::combineLevels(const label curLevel)
593 {
594  label prevLevel = curLevel - 1;
595 
596  // Set the previous level nCells to the current
597  nCells_[prevLevel] = nCells_[curLevel];
598  nFaces_[prevLevel] = nFaces_[curLevel];
599 
600  // Map the restrictAddressing from the coarser level into the previous
601  // finer level
602 
603  const labelList& curResAddr = restrictAddressing_[curLevel];
604  labelList& prevResAddr = restrictAddressing_[prevLevel];
605 
606  const labelList& curFaceResAddr = faceRestrictAddressing_[curLevel];
607  labelList& prevFaceResAddr = faceRestrictAddressing_[prevLevel];
608  const boolList& curFaceFlipMap = faceFlipMap_[curLevel];
609  boolList& prevFaceFlipMap = faceFlipMap_[prevLevel];
610 
611  forAll(prevFaceResAddr, i)
612  {
613  if (prevFaceResAddr[i] >= 0)
614  {
615  label fineFacei = prevFaceResAddr[i];
616  prevFaceResAddr[i] = curFaceResAddr[fineFacei];
617  prevFaceFlipMap[i] = curFaceFlipMap[fineFacei];
618  }
619  else
620  {
621  label fineFacei = -prevFaceResAddr[i] - 1;
622  prevFaceResAddr[i] = -curResAddr[fineFacei] - 1;
623  prevFaceFlipMap[i] = curFaceFlipMap[fineFacei];
624  }
625  }
626 
627  // Delete the restrictAddressing for the coarser level
628  faceRestrictAddressing_.set(curLevel, nullptr);
629  faceFlipMap_.set(curLevel, nullptr);
630 
631  forAll(prevResAddr, i)
632  {
633  prevResAddr[i] = curResAddr[prevResAddr[i]];
634  }
635 
636  const labelListList& curPatchFaceResAddr =
638  labelListList& prevPatchFaceResAddr =
639  patchFaceRestrictAddressing_[prevLevel];
640 
641  forAll(prevPatchFaceResAddr, inti)
642  {
643  const labelList& curResAddr = curPatchFaceResAddr[inti];
644  labelList& prevResAddr = prevPatchFaceResAddr[inti];
645  forAll(prevResAddr, i)
646  {
647  label fineFacei = prevResAddr[i];
648  prevResAddr[i] = curResAddr[fineFacei];
649  }
650  }
651 
652  // Delete the restrictAddressing for the coarser level
653  restrictAddressing_.set(curLevel, nullptr);
654 
655  // Patch faces
656  nPatchFaces_[prevLevel] = nPatchFaces_[curLevel];
657 
658 
659 
660  // Adapt the restrict addressing for the patches
661  const lduInterfacePtrsList& curInterLevel =
662  meshLevels_[curLevel].rawInterfaces();
663  const lduInterfacePtrsList& prevInterLevel =
664  meshLevels_[prevLevel].rawInterfaces();
665 
666  forAll(prevInterLevel, inti)
667  {
668  if (prevInterLevel.set(inti))
669  {
670  GAMGInterface& prevInt = refCast<GAMGInterface>
671  (
672  const_cast<lduInterface&>
673  (
674  prevInterLevel[inti]
675  )
676  );
677  const GAMGInterface& curInt = refCast<const GAMGInterface>
678  (
679  curInterLevel[inti]
680  );
681  prevInt.combine(curInt);
682  }
683  }
684 
685  // Delete the matrix addressing and coefficients from the previous level
686  // and replace with the corresponding entry from the coarser level
687  meshLevels_.set(prevLevel, meshLevels_.set(curLevel, nullptr));
688 }
689 
690 
691 //void Foam::GAMGAgglomeration::gatherList
692 //(
693 // const label comm,
694 // const labelList& procIDs,
695 //
696 // const label myVal,
697 // labelList& vals,
698 // const int tag
699 //)
700 //{
701 // vals.setSize(procIDs.size());
702 //
703 // if (Pstream::myProcNo(comm) == procIDs[0])
704 // {
705 // vals[0] = myVal;
706 //
707 // for (label i=1; i<procIDs.size(); i++)
708 // {
709 // label& slaveVal = vals[i];
710 // IPstream::read
711 // (
712 // Pstream::commsTypes::scheduled,
713 // procIDs[i],
714 // reinterpret_cast<char*>(&slaveVal),
715 // sizeof(slaveVal),
716 // tag,
717 // comm
718 // );
719 // }
720 // }
721 // else
722 // {
723 // OPstream::write
724 // (
725 // Pstream::commsTypes::scheduled,
726 // procIDs[0],
727 // reinterpret_cast<const char*>(&myVal),
728 // sizeof(myVal),
729 // tag,
730 // comm
731 // );
732 // }
733 //}
734 
735 
737 (
738  const label comm,
739  const labelList& procAgglomMap,
740  labelList& masterProcs,
741  List<label>& agglomProcIDs
742 )
743 {
744  // Determine the master processors
745  Map<label> agglomToMaster(procAgglomMap.size());
746 
747  forAll(procAgglomMap, proci)
748  {
749  const label coarsei = procAgglomMap[proci];
750 
751  auto iter = agglomToMaster.find(coarsei);
752  if (iter.found())
753  {
754  iter.val() = min(iter.val(), proci);
755  }
756  else
757  {
758  agglomToMaster.insert(coarsei, proci);
759  }
760  }
761 
762  masterProcs.setSize(agglomToMaster.size());
763  forAllConstIters(agglomToMaster, iter)
764  {
765  masterProcs[iter.key()] = iter.val();
766  }
767 
768 
769  // Collect all the processors in my agglomeration
770  label myProcID = Pstream::myProcNo(comm);
771  label myAgglom = procAgglomMap[myProcID];
772 
773  // Get all processors agglomerating to the same coarse
774  // processor
775  agglomProcIDs = findIndices(procAgglomMap, myAgglom);
776 
777  // Make sure the master is the first element.
778  const label index =
779  agglomProcIDs.find(agglomToMaster[myAgglom]);
780 
781  std::swap(agglomProcIDs[0], agglomProcIDs[index]);
782 }
783 
784 
785 // ************************************************************************* //
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:67
Foam::UPtrList::size
label size() const noexcept
The number of elements in the list.
Definition: UPtrListI.H:106
Foam::globalIndex::gather
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes=Pstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
Definition: globalIndexTemplates.C:75
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
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:54
Foam::GAMGAgglomeration::procAgglomerateRestrictAddressing
void procAgglomerateRestrictAddressing(const label comm, const labelList &procIDs, const label levelIndex)
Collect and combine basic restriction addressing:
Definition: GAMGAgglomerateLduAddressing.C:508
Foam::GAMGAgglomeration::nCells_
labelList nCells_
The number of cells in each level.
Definition: GAMGAgglomeration.H:84
Foam::Map< label >
Foam::boolList
List< bool > boolList
A List of bools.
Definition: List.H:65
GAMGAgglomeration.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
cyclicLduInterface.H
Foam::GAMGAgglomeration::faceRestrictAddressing_
PtrList< labelList > faceRestrictAddressing_
Face restriction addressing array.
Definition: GAMGAgglomeration.H:100
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::GAMGAgglomeration::meshLevels_
PtrList< lduPrimitiveMesh > meshLevels_
Hierarchy of mesh addressing.
Definition: GAMGAgglomeration.H:117
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:296
Foam::GAMGAgglomeration::agglomerateLduAddressing
void agglomerateLduAddressing(const label fineLevelIndex)
Assemble coarse mesh addressing.
Definition: GAMGAgglomerateLduAddressing.C:37
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:737
GAMGInterface.H
Foam::Field< label >
Foam::GAMGInterface
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:54
Foam::List::setSize
void setSize(const label n)
Alias for resize()
Definition: List.H:222
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:59
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:592
Foam::FatalError
error FatalError
processorGAMGInterface.H
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
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 concrete lduMesh that stores the addressing needed by lduMatrix.
Definition: lduPrimitiveMesh.H:52
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:453
Foam::UPtrList::set
const T * set(const label i) const
Definition: UPtrList.H:176
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:463
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:341
Foam::lduAddressing::patchAddr
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
Foam::lduMesh::comm
virtual label comm() const =0
Return communicator used for parallel communication.
forAllReverse
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Definition: stdFoam.H:309
Foam::findIndices
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
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:435
Foam::UList::size
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
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:59