All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GAMGSolverAgglomerateMatrix.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 "GAMGSolver.H"
27 #include "GAMGInterfaceField.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 void Foam::GAMGSolver::agglomerateMatrix
34 (
35  const label fineLevelIndex,
36  const lduMesh& coarseMesh,
37  const lduInterfacePtrsList& coarseMeshInterfaces
38 )
39 {
40  // Get fine matrix
41  const lduMatrix& fineMatrix = matrixLevel(fineLevelIndex);
42 
43  if (UPstream::myProcNo(fineMatrix.mesh().comm()) != -1)
44  {
45  const label nCoarseFaces = agglomeration_.nFaces(fineLevelIndex);
46  const label nCoarseCells = agglomeration_.nCells(fineLevelIndex);
47 
48  // Set the coarse level matrix
49  matrixLevels_.set
50  (
51  fineLevelIndex,
52  new lduMatrix(coarseMesh)
53  );
54  lduMatrix& coarseMatrix = matrixLevels_[fineLevelIndex];
55 
56 
57  // Coarse matrix diagonal initialised by restricting the finer mesh
58  // diagonal. Note that we size with the cached coarse nCells and not
59  // the actual coarseMesh size since this might be dummy when processor
60  // agglomerating.
61  scalarField& coarseDiag = coarseMatrix.diag(nCoarseCells);
62 
63  agglomeration_.restrictField
64  (
65  coarseDiag,
66  fineMatrix.diag(),
67  fineLevelIndex,
68  false // no processor agglomeration
69  );
70 
71  // Get reference to fine-level interfaces
72  const lduInterfaceFieldPtrsList& fineInterfaces =
73  interfaceLevel(fineLevelIndex);
74 
75  // Create coarse-level interfaces
76  primitiveInterfaceLevels_.set
77  (
78  fineLevelIndex,
79  new PtrList<lduInterfaceField>(fineInterfaces.size())
80  );
81 
82  PtrList<lduInterfaceField>& coarsePrimInterfaces =
83  primitiveInterfaceLevels_[fineLevelIndex];
84 
85  interfaceLevels_.set
86  (
87  fineLevelIndex,
88  new lduInterfaceFieldPtrsList(fineInterfaces.size())
89  );
90 
91  lduInterfaceFieldPtrsList& coarseInterfaces =
92  interfaceLevels_[fineLevelIndex];
93 
94  // Set coarse-level boundary coefficients
95  interfaceLevelsBouCoeffs_.set
96  (
97  fineLevelIndex,
98  new FieldField<Field, scalar>(fineInterfaces.size())
99  );
100  FieldField<Field, scalar>& coarseInterfaceBouCoeffs =
101  interfaceLevelsBouCoeffs_[fineLevelIndex];
102 
103  // Set coarse-level internal coefficients
104  interfaceLevelsIntCoeffs_.set
105  (
106  fineLevelIndex,
107  new FieldField<Field, scalar>(fineInterfaces.size())
108  );
109  FieldField<Field, scalar>& coarseInterfaceIntCoeffs =
110  interfaceLevelsIntCoeffs_[fineLevelIndex];
111 
112  // Add the coarse level
113  agglomerateInterfaceCoefficients
114  (
115  fineLevelIndex,
116  coarseMeshInterfaces,
117  coarsePrimInterfaces,
118  coarseInterfaces,
119  coarseInterfaceBouCoeffs,
120  coarseInterfaceIntCoeffs
121  );
122 
123 
124  // Get face restriction map for current level
125  const labelList& faceRestrictAddr =
126  agglomeration_.faceRestrictAddressing(fineLevelIndex);
127  const boolList& faceFlipMap =
128  agglomeration_.faceFlipMap(fineLevelIndex);
129 
130  // Check if matrix is asymmetric and if so agglomerate both upper
131  // and lower coefficients ...
132  if (fineMatrix.hasLower())
133  {
134  // Get off-diagonal matrix coefficients
135  const scalarField& fineUpper = fineMatrix.upper();
136  const scalarField& fineLower = fineMatrix.lower();
137 
138  // Coarse matrix upper coefficients. Note passed in size
139  scalarField& coarseUpper = coarseMatrix.upper(nCoarseFaces);
140  scalarField& coarseLower = coarseMatrix.lower(nCoarseFaces);
141 
142  forAll(faceRestrictAddr, fineFacei)
143  {
144  label cFace = faceRestrictAddr[fineFacei];
145 
146  if (cFace >= 0)
147  {
148  // Check the orientation of the fine-face relative to the
149  // coarse face it is being agglomerated into
150  if (!faceFlipMap[fineFacei])
151  {
152  coarseUpper[cFace] += fineUpper[fineFacei];
153  coarseLower[cFace] += fineLower[fineFacei];
154  }
155  else
156  {
157  coarseUpper[cFace] += fineLower[fineFacei];
158  coarseLower[cFace] += fineUpper[fineFacei];
159  }
160  }
161  else
162  {
163  // Add the fine face coefficients into the diagonal.
164  coarseDiag[-1 - cFace] +=
165  fineUpper[fineFacei] + fineLower[fineFacei];
166  }
167  }
168  }
169  else // ... Otherwise it is symmetric so agglomerate just the upper
170  {
171  // Get off-diagonal matrix coefficients
172  const scalarField& fineUpper = fineMatrix.upper();
173 
174  // Coarse matrix upper coefficients
175  scalarField& coarseUpper = coarseMatrix.upper(nCoarseFaces);
176 
177  forAll(faceRestrictAddr, fineFacei)
178  {
179  label cFace = faceRestrictAddr[fineFacei];
180 
181  if (cFace >= 0)
182  {
183  coarseUpper[cFace] += fineUpper[fineFacei];
184  }
185  else
186  {
187  // Add the fine face coefficient into the diagonal.
188  coarseDiag[-1 - cFace] += 2*fineUpper[fineFacei];
189  }
190  }
191  }
192  }
193 }
194 
195 
196 void Foam::GAMGSolver::agglomerateInterfaceCoefficients
197 (
198  const label fineLevelIndex,
199  const lduInterfacePtrsList& coarseMeshInterfaces,
200  PtrList<lduInterfaceField>& coarsePrimInterfaces,
201  lduInterfaceFieldPtrsList& coarseInterfaces,
202  FieldField<Field, scalar>& coarseInterfaceBouCoeffs,
203  FieldField<Field, scalar>& coarseInterfaceIntCoeffs
204 ) const
205 {
206  // Get reference to fine-level interfaces
207  const lduInterfaceFieldPtrsList& fineInterfaces =
208  interfaceLevel(fineLevelIndex);
209 
210  // Get reference to fine-level boundary coefficients
211  const FieldField<Field, scalar>& fineInterfaceBouCoeffs =
212  interfaceBouCoeffsLevel(fineLevelIndex);
213 
214  // Get reference to fine-level internal coefficients
215  const FieldField<Field, scalar>& fineInterfaceIntCoeffs =
216  interfaceIntCoeffsLevel(fineLevelIndex);
217 
218  const labelListList& patchFineToCoarse =
219  agglomeration_.patchFaceRestrictAddressing(fineLevelIndex);
220 
221  const labelList& nPatchFaces =
222  agglomeration_.nPatchFaces(fineLevelIndex);
223 
224 
225  // Add the coarse level
226  forAll(fineInterfaces, inti)
227  {
228  if (fineInterfaces.set(inti))
229  {
230  const GAMGInterface& coarseInterface =
231  refCast<const GAMGInterface>
232  (
233  coarseMeshInterfaces[inti]
234  );
235 
236  coarsePrimInterfaces.set
237  (
238  inti,
240  (
241  coarseInterface,
242  fineInterfaces[inti]
243  ).ptr()
244  );
245  coarseInterfaces.set
246  (
247  inti,
248  &coarsePrimInterfaces[inti]
249  );
250 
251  const labelList& faceRestrictAddressing = patchFineToCoarse[inti];
252 
253  coarseInterfaceBouCoeffs.set
254  (
255  inti,
256  new scalarField(nPatchFaces[inti], 0.0)
257  );
258  agglomeration_.restrictField
259  (
260  coarseInterfaceBouCoeffs[inti],
261  fineInterfaceBouCoeffs[inti],
262  faceRestrictAddressing
263  );
264 
265  coarseInterfaceIntCoeffs.set
266  (
267  inti,
268  new scalarField(nPatchFaces[inti], 0.0)
269  );
270  agglomeration_.restrictField
271  (
272  coarseInterfaceIntCoeffs[inti],
273  fineInterfaceIntCoeffs[inti],
274  faceRestrictAddressing
275  );
276  }
277  }
278 }
279 
280 
281 void Foam::GAMGSolver::gatherMatrices
282 (
283  const labelList& procIDs,
284  const lduMesh& dummyMesh,
285  const label meshComm,
286 
287  const lduMatrix& mat,
288  const FieldField<Field, scalar>& interfaceBouCoeffs,
289  const FieldField<Field, scalar>& interfaceIntCoeffs,
290  const lduInterfaceFieldPtrsList& interfaces,
291 
292  PtrList<lduMatrix>& otherMats,
293  PtrList<FieldField<Field, scalar>>& otherBouCoeffs,
294  PtrList<FieldField<Field, scalar>>& otherIntCoeffs,
295  List<boolList>& otherTransforms,
296  List<List<label>>& otherRanks
297 ) const
298 {
299  if (debug)
300  {
301  Pout<< "GAMGSolver::gatherMatrices :"
302  << " collecting matrices from procs:" << procIDs
303  << " using comm:" << meshComm << endl;
304  }
305 
306  if (Pstream::myProcNo(meshComm) == procIDs[0])
307  {
308  // Master.
309  otherMats.setSize(procIDs.size()-1);
310  otherBouCoeffs.setSize(procIDs.size()-1);
311  otherIntCoeffs.setSize(procIDs.size()-1);
312  otherTransforms.setSize(procIDs.size()-1);
313  otherRanks.setSize(procIDs.size()-1);
314 
315  for (label proci = 1; proci < procIDs.size(); proci++)
316  {
317  label otherI = proci-1;
318 
319  IPstream fromSlave
320  (
322  procIDs[proci],
323  0, // bufSize
325  meshComm
326  );
327 
328  otherMats.set(otherI, new lduMatrix(dummyMesh, fromSlave));
329 
330  // Receive number of/valid interfaces
331  List<label>& procRanks = otherRanks[otherI];
332 
333  fromSlave >> procRanks;
334 
335  // Size coefficients
336  otherBouCoeffs.set
337  (
338  otherI,
339  new FieldField<Field, scalar>(procRanks.size())
340  );
341  otherIntCoeffs.set
342  (
343  otherI,
344  new FieldField<Field, scalar>(procRanks.size())
345  );
346  forAll(procRanks, intI)
347  {
348  if (procRanks[intI] != -1)
349  {
350  otherBouCoeffs[otherI].set
351  (
352  intI,
353  new scalarField(fromSlave)
354  );
355  otherIntCoeffs[otherI].set
356  (
357  intI,
358  new scalarField(fromSlave)
359  );
360  }
361  }
362  }
363  }
364  else
365  {
366  // Send to master
367 
368  // Count valid interfaces
369  List<label> procRanks(interfaceBouCoeffs.size(), -1);
370  forAll(interfaces, intI)
371  {
372  if (interfaces.set(intI))
373  {
374  const processorLduInterfaceField& interface =
375  refCast<const processorLduInterfaceField>
376  (
377  interfaces[intI]
378  );
379 
380  procRanks[intI] = interface.rank();
381  }
382  }
383 
384  OPstream toMaster
385  (
387  procIDs[0],
388  0,
390  meshComm
391  );
392 
393  toMaster << mat << procRanks;
394  forAll(procRanks, intI)
395  {
396  if (procRanks[intI] != -1)
397  {
398  toMaster
399  << interfaceBouCoeffs[intI]
400  << interfaceIntCoeffs[intI];
401  }
402  }
403  }
404 }
405 
406 
407 void Foam::GAMGSolver::procAgglomerateMatrix
408 (
409  // Agglomeration information
410  const labelList& procAgglomMap,
411  const List<label>& agglomProcIDs,
412 
413  const label levelI,
414 
415  // Resulting matrix
416  autoPtr<lduMatrix>& allMatrixPtr,
417  FieldField<Field, scalar>& allInterfaceBouCoeffs,
418  FieldField<Field, scalar>& allInterfaceIntCoeffs,
419  PtrList<lduInterfaceField>& allPrimitiveInterfaces,
420  lduInterfaceFieldPtrsList& allInterfaces
421 ) const
422 {
423  const lduMatrix& coarsestMatrix = matrixLevels_[levelI];
424  const lduInterfaceFieldPtrsList& coarsestInterfaces =
425  interfaceLevels_[levelI];
426  const FieldField<Field, scalar>& coarsestBouCoeffs =
427  interfaceLevelsBouCoeffs_[levelI];
428  const FieldField<Field, scalar>& coarsestIntCoeffs =
429  interfaceLevelsIntCoeffs_[levelI];
430  const lduMesh& coarsestMesh = coarsestMatrix.mesh();
431 
432  label coarseComm = coarsestMesh.comm();
433 
434  // Gather all matrix coefficients onto agglomProcIDs[0]
435  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
436 
437  PtrList<lduMatrix> otherMats;
438  PtrList<FieldField<Field, scalar>> otherBouCoeffs;
439  PtrList<FieldField<Field, scalar>> otherIntCoeffs;
440  List<boolList> otherTransforms;
441  List<List<label>> otherRanks;
442  gatherMatrices
443  (
444  agglomProcIDs,
445  coarsestMesh,
446  coarseComm,
447 
448  coarsestMatrix,
449  coarsestBouCoeffs,
450  coarsestIntCoeffs,
451  coarsestInterfaces,
452 
453  otherMats,
454  otherBouCoeffs,
455  otherIntCoeffs,
456  otherTransforms,
457  otherRanks
458  );
459 
460 
461  if (Pstream::myProcNo(coarseComm) == agglomProcIDs[0])
462  {
463  // Agglomerate all matrix
464  // ~~~~~~~~~~~~~~~~~~~~~~
465 
466  // Pout<< "Own matrix:" << coarsestMatrix.info() << endl;
467  //
468  // forAll(otherMats, i)
469  //{
470  // Pout<< "** otherMats " << i << " "
471  // << otherMats[i].info()
472  // << endl;
473  //}
474  // Pout<< endl;
475 
476 
477  const lduMesh& allMesh = agglomeration_.meshLevel(levelI+1);
478  const labelList& cellOffsets = agglomeration_.cellOffsets(levelI+1);
479  const labelListList& faceMap = agglomeration_.faceMap(levelI+1);
480  const labelListList& boundaryMap = agglomeration_.boundaryMap(levelI+1);
481  const labelListListList& boundaryFaceMap =
482  agglomeration_.boundaryFaceMap(levelI+1);
483 
484  allMatrixPtr.reset(new lduMatrix(allMesh));
485  lduMatrix& allMatrix = allMatrixPtr();
486 
487  if (coarsestMatrix.hasDiag())
488  {
489  scalarField& allDiag = allMatrix.diag();
490 
491  SubList<scalar>
492  (
493  allDiag,
494  coarsestMatrix.diag().size()
495  ) = coarsestMatrix.diag();
496 
497  forAll(otherMats, i)
498  {
499  SubList<scalar>
500  (
501  allDiag,
502  otherMats[i].diag().size(),
503  cellOffsets[i+1]
504  ) = otherMats[i].diag();
505  }
506  }
507  if (coarsestMatrix.hasLower())
508  {
509  scalarField& allLower = allMatrix.lower();
510  UIndirectList<scalar>
511  (
512  allLower,
513  faceMap[0]
514  ) = coarsestMatrix.lower();
515  forAll(otherMats, i)
516  {
517  UIndirectList<scalar>
518  (
519  allLower,
520  faceMap[i+1]
521  ) = otherMats[i].lower();
522  }
523  }
524  if (coarsestMatrix.hasUpper())
525  {
526  scalarField& allUpper = allMatrix.upper();
527  UIndirectList<scalar>
528  (
529  allUpper,
530  faceMap[0]
531  ) = coarsestMatrix.upper();
532  forAll(otherMats, i)
533  {
534  UIndirectList<scalar>
535  (
536  allUpper,
537  faceMap[i+1]
538  ) = otherMats[i].upper();
539  }
540  }
541 
542 
543  // Agglomerate interface fields and coefficients
544  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
545 
546  lduInterfacePtrsList allMeshInterfaces = allMesh.interfaces();
547 
548  allInterfaceBouCoeffs.setSize(allMeshInterfaces.size());
549  allInterfaceIntCoeffs.setSize(allMeshInterfaces.size());
550  allPrimitiveInterfaces.setSize(allMeshInterfaces.size());
551  allInterfaces.setSize(allMeshInterfaces.size());
552 
553  forAll(allMeshInterfaces, intI)
554  {
555  const lduInterface& patch = allMeshInterfaces[intI];
556  label size = patch.faceCells().size();
557 
558  allInterfaceBouCoeffs.set(intI, new scalarField(size));
559  allInterfaceIntCoeffs.set(intI, new scalarField(size));
560  }
561 
562  labelList nBounFaces(allMeshInterfaces.size());
563  forAll(boundaryMap, proci)
564  {
565  const FieldField<Field, scalar>& procBouCoeffs
566  (
567  (proci == 0)
568  ? coarsestBouCoeffs
569  : otherBouCoeffs[proci-1]
570  );
571  const FieldField<Field, scalar>& procIntCoeffs
572  (
573  (proci == 0)
574  ? coarsestIntCoeffs
575  : otherIntCoeffs[proci-1]
576  );
577 
578  const labelList& bMap = boundaryMap[proci];
579  forAll(bMap, procIntI)
580  {
581  label allIntI = bMap[procIntI];
582 
583  if (allIntI != -1)
584  {
585  // So this boundary has been preserved. Copy
586  // data across.
587 
588  if (!allInterfaces.set(allIntI))
589  {
590  // Construct lduInterfaceField
591 
592  int rank = -1;
593  if (proci == 0)
594  {
595  const processorGAMGInterfaceField& procInt =
596  refCast
597  <
598  const processorGAMGInterfaceField
599  >
600  (
601  coarsestInterfaces[procIntI]
602  );
603  rank = procInt.rank();
604  }
605  else
606  {
607  rank = otherRanks[proci-1][procIntI];
608  }
609 
610  allPrimitiveInterfaces.set
611  (
612  allIntI,
614  (
615  refCast<const GAMGInterface>
616  (
617  allMeshInterfaces[allIntI]
618  ),
619  rank
620  ).ptr()
621  );
622  allInterfaces.set
623  (
624  allIntI,
625  &allPrimitiveInterfaces[allIntI]
626  );
627  }
628 
629 
630  // Map data from processor to complete mesh
631 
632  scalarField& allBou = allInterfaceBouCoeffs[allIntI];
633  scalarField& allInt = allInterfaceIntCoeffs[allIntI];
634 
635  const labelList& map = boundaryFaceMap[proci][procIntI];
636 
637  const scalarField& procBou = procBouCoeffs[procIntI];
638  const scalarField& procInt = procIntCoeffs[procIntI];
639 
640  forAll(map, i)
641  {
642  label allFacei = map[i];
643  if (allFacei < 0)
644  {
646  << "problem." << abort(FatalError);
647  }
648  allBou[allFacei] = procBou[i];
649  allInt[allFacei] = procInt[i];
650  }
651  }
652  else if (procBouCoeffs.set(procIntI))
653  {
654  // Boundary has become internal face
655 
656  const labelList& map = boundaryFaceMap[proci][procIntI];
657  const scalarField& procBou = procBouCoeffs[procIntI];
658  const scalarField& procInt = procIntCoeffs[procIntI];
659 
660 
661  forAll(map, i)
662  {
663  if (map[i] >= 0)
664  {
665  label allFacei = map[i];
666 
667  if (coarsestMatrix.hasUpper())
668  {
669  allMatrix.upper()[allFacei] = -procBou[i];
670  }
671  if (coarsestMatrix.hasLower())
672  {
673  allMatrix.lower()[allFacei] = -procInt[i];
674  }
675  }
676  else
677  {
678  label allFacei = -map[i]-1;
679 
680  if (coarsestMatrix.hasUpper())
681  {
682  allMatrix.upper()[allFacei] = -procInt[i];
683  }
684  if (coarsestMatrix.hasLower())
685  {
686  allMatrix.lower()[allFacei] = -procBou[i];
687  }
688  }
689  }
690  }
691  }
692  }
693 
694  // Pout<< "** Assembled allMatrix:" << allMatrix.info() << endl;
695  //
696  // forAll(allInterfaces, intI)
697  //{
698  // if (allInterfaces.set(intI))
699  // {
700  // Pout<< " patch:" << intI
701  // << " type:" << allInterfaces[intI].type()
702  // << " size:"
703  // << allInterfaces[intI].interface().
704  // faceCells().size()
705  // << endl;
706  //
707  // // const scalarField& bouCoeffs = allInterfaceBouCoeffs[intI];
708  // // const scalarField& intCoeffs = allInterfaceIntCoeffs[intI];
709  // // forAll(bouCoeffs, facei)
710  // //{
711  // // Pout<< " " << facei
712  // // << "\tbou:" << bouCoeffs[facei]
713  // // << "\tint:" << intCoeffs[facei]
714  // // << endl;
715  // //}
716  // }
717  //}
718  }
719 }
720 
721 
722 void Foam::GAMGSolver::procAgglomerateMatrix
723 (
724  const labelList& procAgglomMap,
725  const List<label>& agglomProcIDs,
726 
727  const label levelI
728 )
729 {
730  autoPtr<lduMatrix> allMatrixPtr;
731  autoPtr<FieldField<Field, scalar>> allInterfaceBouCoeffs
732  (
733  new FieldField<Field, scalar>(0)
734  );
735  autoPtr<FieldField<Field, scalar>> allInterfaceIntCoeffs
736  (
737  new FieldField<Field, scalar>(0)
738  );
739  autoPtr<PtrList<lduInterfaceField>> allPrimitiveInterfaces
740  (
741  new PtrList<lduInterfaceField>(0)
742  );
743  autoPtr<lduInterfaceFieldPtrsList> allInterfaces
744  (
746  );
747 
748  procAgglomerateMatrix
749  (
750  // Agglomeration information
751  procAgglomMap,
752  agglomProcIDs,
753 
754  levelI,
755 
756  // Resulting matrix
757  allMatrixPtr,
758  allInterfaceBouCoeffs(),
759  allInterfaceIntCoeffs(),
760  allPrimitiveInterfaces(),
761  allInterfaces()
762  );
763 
764  matrixLevels_.set(levelI, allMatrixPtr);
765  interfaceLevelsBouCoeffs_.set(levelI, allInterfaceBouCoeffs);
766  interfaceLevelsIntCoeffs_.set(levelI, allInterfaceIntCoeffs);
767  primitiveInterfaceLevels_.set(levelI, allPrimitiveInterfaces);
768  interfaceLevels_.set(levelI, allInterfaces);
769 }
770 
771 
772 // ************************************************************************* //
UPtrList< const lduInterfaceField > lduInterfaceFieldPtrsList
List of coupled interface fields to be used in coupling.
const labelList & faceRestrictAddressing(const label leveli) const
Return face restrict addressing of given level.
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:57
const labelList & nPatchFaces(const label leveli) const
Return number of coarse patch faces (before processor.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
void restrictField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex, const bool procAgglom) const
Restrict (integrate by summation) cell field.
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
const boolList & faceFlipMap(const label leveli) const
Return face flip map of given level.
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
const lduMesh & meshLevel(const label leveli) const
Return LDU mesh of given level.
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:429
const labelListList & boundaryMap(const label fineLeveli) const
Mapping from processor to procMesh boundary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
static int & msgType()
Message tag of standard messages.
Definition: UPstream.H:476
List< bool > boolList
Bool container classes.
Definition: boolList.H:50
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
void setSize(const label)
Reset size of UPtrList. This can only be used to set the size.
Definition: UPtrList.C:54
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
UPtrList< const lduInterface > lduInterfacePtrsList
List of coupled interface fields to be used in coupling.
List< label > labelList
A List of labels.
Definition: labelList.H:56
errorManip< error > abort(error &err)
Definition: errorManip.H:131
label nFaces(const label leveli) const
Return number of coarse faces (before processor agglomeration)
static autoPtr< GAMGInterfaceField > New(const GAMGInterface &GAMGCp, const lduInterfaceField &fineInterface)
Return a pointer to a new interface created on freestore given.
const labelList & cellOffsets(const label fineLeveli) const
Mapping from processor to procMesh cells.
const labelListListList & boundaryFaceMap(const label fineLeveli) const
Mapping from processor to procMesh boundary face.
List< labelListList > labelListListList
A List of labelListList.
Definition: labelList.H:58
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
const labelListList & patchFaceRestrictAddressing(const label leveli) const
label nCells(const label leveli) const
Return number of coarse cells (before processor agglomeration)
const labelListList & faceMap(const label fineLeveli) const
Mapping from processor to procMesh face.