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-2018 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  boolList& procTransforms = otherTransforms[otherI];
332  List<label>& procRanks = otherRanks[otherI];
333 
334  fromSlave >> procTransforms;
335  fromSlave >> procRanks;
336 
337  // Size coefficients
338  otherBouCoeffs.set
339  (
340  otherI,
341  new FieldField<Field, scalar>(procRanks.size())
342  );
343  otherIntCoeffs.set
344  (
345  otherI,
346  new FieldField<Field, scalar>(procRanks.size())
347  );
348  forAll(procRanks, intI)
349  {
350  if (procRanks[intI] != -1)
351  {
352  otherBouCoeffs[otherI].set
353  (
354  intI,
355  new scalarField(fromSlave)
356  );
357  otherIntCoeffs[otherI].set
358  (
359  intI,
360  new scalarField(fromSlave)
361  );
362  }
363  }
364  }
365  }
366  else
367  {
368  // Send to master
369 
370  // Count valid interfaces
371  boolList procTransforms(interfaceBouCoeffs.size(), false);
372  List<label> procRanks(interfaceBouCoeffs.size(), -1);
373  forAll(interfaces, intI)
374  {
375  if (interfaces.set(intI))
376  {
377  const processorLduInterfaceField& interface =
378  refCast<const processorLduInterfaceField>
379  (
380  interfaces[intI]
381  );
382 
383  procTransforms[intI] = interface.doTransform();
384  procRanks[intI] = interface.rank();
385  }
386  }
387 
388  OPstream toMaster
389  (
391  procIDs[0],
392  0,
394  meshComm
395  );
396 
397  toMaster << mat << procTransforms << procRanks;
398  forAll(procRanks, intI)
399  {
400  if (procRanks[intI] != -1)
401  {
402  toMaster
403  << interfaceBouCoeffs[intI]
404  << interfaceIntCoeffs[intI];
405  }
406  }
407  }
408 }
409 
410 
411 void Foam::GAMGSolver::procAgglomerateMatrix
412 (
413  // Agglomeration information
414  const labelList& procAgglomMap,
415  const List<label>& agglomProcIDs,
416 
417  const label levelI,
418 
419  // Resulting matrix
420  autoPtr<lduMatrix>& allMatrixPtr,
421  FieldField<Field, scalar>& allInterfaceBouCoeffs,
422  FieldField<Field, scalar>& allInterfaceIntCoeffs,
423  PtrList<lduInterfaceField>& allPrimitiveInterfaces,
424  lduInterfaceFieldPtrsList& allInterfaces
425 ) const
426 {
427  const lduMatrix& coarsestMatrix = matrixLevels_[levelI];
428  const lduInterfaceFieldPtrsList& coarsestInterfaces =
429  interfaceLevels_[levelI];
430  const FieldField<Field, scalar>& coarsestBouCoeffs =
431  interfaceLevelsBouCoeffs_[levelI];
432  const FieldField<Field, scalar>& coarsestIntCoeffs =
433  interfaceLevelsIntCoeffs_[levelI];
434  const lduMesh& coarsestMesh = coarsestMatrix.mesh();
435 
436  label coarseComm = coarsestMesh.comm();
437 
438  // Gather all matrix coefficients onto agglomProcIDs[0]
439  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
440 
441  PtrList<lduMatrix> otherMats;
442  PtrList<FieldField<Field, scalar>> otherBouCoeffs;
443  PtrList<FieldField<Field, scalar>> otherIntCoeffs;
444  List<boolList> otherTransforms;
445  List<List<label>> otherRanks;
446  gatherMatrices
447  (
448  agglomProcIDs,
449  coarsestMesh,
450  coarseComm,
451 
452  coarsestMatrix,
453  coarsestBouCoeffs,
454  coarsestIntCoeffs,
455  coarsestInterfaces,
456 
457  otherMats,
458  otherBouCoeffs,
459  otherIntCoeffs,
460  otherTransforms,
461  otherRanks
462  );
463 
464 
465  if (Pstream::myProcNo(coarseComm) == agglomProcIDs[0])
466  {
467  // Agglomerate all matrix
468  // ~~~~~~~~~~~~~~~~~~~~~~
469 
470  // Pout<< "Own matrix:" << coarsestMatrix.info() << endl;
471  //
472  // forAll(otherMats, i)
473  //{
474  // Pout<< "** otherMats " << i << " "
475  // << otherMats[i].info()
476  // << endl;
477  //}
478  // Pout<< endl;
479 
480 
481  const lduMesh& allMesh = agglomeration_.meshLevel(levelI+1);
482  const labelList& cellOffsets = agglomeration_.cellOffsets(levelI+1);
483  const labelListList& faceMap = agglomeration_.faceMap(levelI+1);
484  const labelListList& boundaryMap = agglomeration_.boundaryMap(levelI+1);
485  const labelListListList& boundaryFaceMap =
486  agglomeration_.boundaryFaceMap(levelI+1);
487 
488  allMatrixPtr.reset(new lduMatrix(allMesh));
489  lduMatrix& allMatrix = allMatrixPtr();
490 
491  if (coarsestMatrix.hasDiag())
492  {
493  scalarField& allDiag = allMatrix.diag();
494 
495  SubList<scalar>
496  (
497  allDiag,
498  coarsestMatrix.diag().size()
499  ) = coarsestMatrix.diag();
500 
501  forAll(otherMats, i)
502  {
503  SubList<scalar>
504  (
505  allDiag,
506  otherMats[i].diag().size(),
507  cellOffsets[i+1]
508  ) = otherMats[i].diag();
509  }
510  }
511  if (coarsestMatrix.hasLower())
512  {
513  scalarField& allLower = allMatrix.lower();
514  UIndirectList<scalar>
515  (
516  allLower,
517  faceMap[0]
518  ) = coarsestMatrix.lower();
519  forAll(otherMats, i)
520  {
521  UIndirectList<scalar>
522  (
523  allLower,
524  faceMap[i+1]
525  ) = otherMats[i].lower();
526  }
527  }
528  if (coarsestMatrix.hasUpper())
529  {
530  scalarField& allUpper = allMatrix.upper();
531  UIndirectList<scalar>
532  (
533  allUpper,
534  faceMap[0]
535  ) = coarsestMatrix.upper();
536  forAll(otherMats, i)
537  {
538  UIndirectList<scalar>
539  (
540  allUpper,
541  faceMap[i+1]
542  ) = otherMats[i].upper();
543  }
544  }
545 
546 
547  // Agglomerate interface fields and coefficients
548  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
549 
550  lduInterfacePtrsList allMeshInterfaces = allMesh.interfaces();
551 
552  allInterfaceBouCoeffs.setSize(allMeshInterfaces.size());
553  allInterfaceIntCoeffs.setSize(allMeshInterfaces.size());
554  allPrimitiveInterfaces.setSize(allMeshInterfaces.size());
555  allInterfaces.setSize(allMeshInterfaces.size());
556 
557  forAll(allMeshInterfaces, intI)
558  {
559  const lduInterface& patch = allMeshInterfaces[intI];
560  label size = patch.faceCells().size();
561 
562  allInterfaceBouCoeffs.set(intI, new scalarField(size));
563  allInterfaceIntCoeffs.set(intI, new scalarField(size));
564  }
565 
566  labelList nBounFaces(allMeshInterfaces.size());
567  forAll(boundaryMap, proci)
568  {
569  const FieldField<Field, scalar>& procBouCoeffs
570  (
571  (proci == 0)
572  ? coarsestBouCoeffs
573  : otherBouCoeffs[proci-1]
574  );
575  const FieldField<Field, scalar>& procIntCoeffs
576  (
577  (proci == 0)
578  ? coarsestIntCoeffs
579  : otherIntCoeffs[proci-1]
580  );
581 
582  const labelList& bMap = boundaryMap[proci];
583  forAll(bMap, procIntI)
584  {
585  label allIntI = bMap[procIntI];
586 
587  if (allIntI != -1)
588  {
589  // So this boundary has been preserved. Copy
590  // data across.
591 
592  if (!allInterfaces.set(allIntI))
593  {
594  // Construct lduInterfaceField
595 
596  bool doTransform = false;
597  int rank = -1;
598  if (proci == 0)
599  {
600  const processorGAMGInterfaceField& procInt =
601  refCast
602  <
603  const processorGAMGInterfaceField
604  >
605  (
606  coarsestInterfaces[procIntI]
607  );
608  doTransform = procInt.doTransform();
609  rank = procInt.rank();
610  }
611  else
612  {
613  doTransform =
614  otherTransforms[proci-1][procIntI];
615  rank = otherRanks[proci-1][procIntI];
616  }
617 
618  allPrimitiveInterfaces.set
619  (
620  allIntI,
622  (
623  refCast<const GAMGInterface>
624  (
625  allMeshInterfaces[allIntI]
626  ),
627  doTransform,
628  rank
629  ).ptr()
630  );
631  allInterfaces.set
632  (
633  allIntI,
634  &allPrimitiveInterfaces[allIntI]
635  );
636  }
637 
638 
639  // Map data from processor to complete mesh
640 
641  scalarField& allBou = allInterfaceBouCoeffs[allIntI];
642  scalarField& allInt = allInterfaceIntCoeffs[allIntI];
643 
644  const labelList& map = boundaryFaceMap[proci][procIntI];
645 
646  const scalarField& procBou = procBouCoeffs[procIntI];
647  const scalarField& procInt = procIntCoeffs[procIntI];
648 
649  forAll(map, i)
650  {
651  label allFacei = map[i];
652  if (allFacei < 0)
653  {
655  << "problem." << abort(FatalError);
656  }
657  allBou[allFacei] = procBou[i];
658  allInt[allFacei] = procInt[i];
659  }
660  }
661  else if (procBouCoeffs.set(procIntI))
662  {
663  // Boundary has become internal face
664 
665  const labelList& map = boundaryFaceMap[proci][procIntI];
666  const scalarField& procBou = procBouCoeffs[procIntI];
667  const scalarField& procInt = procIntCoeffs[procIntI];
668 
669 
670  forAll(map, i)
671  {
672  if (map[i] >= 0)
673  {
674  label allFacei = map[i];
675 
676  if (coarsestMatrix.hasUpper())
677  {
678  allMatrix.upper()[allFacei] = -procBou[i];
679  }
680  if (coarsestMatrix.hasLower())
681  {
682  allMatrix.lower()[allFacei] = -procInt[i];
683  }
684  }
685  else
686  {
687  label allFacei = -map[i]-1;
688 
689  if (coarsestMatrix.hasUpper())
690  {
691  allMatrix.upper()[allFacei] = -procInt[i];
692  }
693  if (coarsestMatrix.hasLower())
694  {
695  allMatrix.lower()[allFacei] = -procBou[i];
696  }
697  }
698  }
699  }
700  }
701  }
702 
703  // Pout<< "** Assembled allMatrix:" << allMatrix.info() << endl;
704  //
705  // forAll(allInterfaces, intI)
706  //{
707  // if (allInterfaces.set(intI))
708  // {
709  // Pout<< " patch:" << intI
710  // << " type:" << allInterfaces[intI].type()
711  // << " size:"
712  // << allInterfaces[intI].interface().
713  // faceCells().size()
714  // << endl;
715  //
716  // // const scalarField& bouCoeffs = allInterfaceBouCoeffs[intI];
717  // // const scalarField& intCoeffs = allInterfaceIntCoeffs[intI];
718  // // forAll(bouCoeffs, facei)
719  // //{
720  // // Pout<< " " << facei
721  // // << "\tbou:" << bouCoeffs[facei]
722  // // << "\tint:" << intCoeffs[facei]
723  // // << endl;
724  // //}
725  // }
726  //}
727  }
728 }
729 
730 
731 void Foam::GAMGSolver::procAgglomerateMatrix
732 (
733  const labelList& procAgglomMap,
734  const List<label>& agglomProcIDs,
735 
736  const label levelI
737 )
738 {
739  autoPtr<lduMatrix> allMatrixPtr;
740  autoPtr<FieldField<Field, scalar>> allInterfaceBouCoeffs
741  (
742  new FieldField<Field, scalar>(0)
743  );
744  autoPtr<FieldField<Field, scalar>> allInterfaceIntCoeffs
745  (
746  new FieldField<Field, scalar>(0)
747  );
748  autoPtr<PtrList<lduInterfaceField>> allPrimitiveInterfaces
749  (
750  new PtrList<lduInterfaceField>(0)
751  );
752  autoPtr<lduInterfaceFieldPtrsList> allInterfaces
753  (
755  );
756 
757  procAgglomerateMatrix
758  (
759  // Agglomeration information
760  procAgglomMap,
761  agglomProcIDs,
762 
763  levelI,
764 
765  // Resulting matrix
766  allMatrixPtr,
767  allInterfaceBouCoeffs(),
768  allInterfaceIntCoeffs(),
769  allPrimitiveInterfaces(),
770  allInterfaces()
771  );
772 
773  matrixLevels_.set(levelI, allMatrixPtr);
774  interfaceLevelsBouCoeffs_.set(levelI, allInterfaceBouCoeffs);
775  interfaceLevelsIntCoeffs_.set(levelI, allInterfaceIntCoeffs);
776  primitiveInterfaceLevels_.set(levelI, allPrimitiveInterfaces);
777  interfaceLevels_.set(levelI, allInterfaces);
778 }
779 
780 
781 // ************************************************************************* //
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:256
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.