oversetGAMGInterface.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) 2021-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "oversetGAMGInterface.H"
30 
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(oversetGAMGInterface, 0);
38  (
39  GAMGInterface,
40  oversetGAMGInterface,
41  lduInterface
42  );
43 }
44 
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
48 Foam::oversetGAMGInterface::oversetGAMGInterface
49 (
50  const label index,
51  const lduInterfacePtrsList& coarseInterfaces,
52  const lduInterface& fineInterface,
53  const labelField& localRestrictAddressing,
54  const labelField& neighbourRestrictAddressing,
55  const label fineLevelIndex,
56  const label coarseComm
57 )
58 :
60  (
61  index,
62  coarseInterfaces
63  )
64 {
65  // Problem:
66  // - we only want the oversetGAMGInterfaceField
67  // - but this needs a oversetGAMGInterface of at least size 1
68  // (since faceRestrictAddressing cannot have -1 or so in it - it
69  // can only have >= 0 i.e. we cannot agglomerate into nothing)
70  // - note that the end result is not used - the (current) corresponding
71  // oversetGAMGInterfaceField has dummy updateInterfaceMatrix.
72 
73  // Construct face agglomeration from cell agglomeration. Code same as
74  // in e.g. cyclicAMIGAMGInterface.
75  {
76  // From coarse face to cell
77  DynamicList<label> dynFaceCells(localRestrictAddressing.size());
78 
79  // From face to coarse face
80  DynamicList<label> dynFaceRestrictAddressing
81  (
82  localRestrictAddressing.size()
83  );
84 
85  Map<label> masterToCoarseFace(localRestrictAddressing.size());
86 
87  for (const label curMaster : localRestrictAddressing)
88  {
89  const auto iter = masterToCoarseFace.cfind(curMaster);
90 
91  if (iter.good())
92  {
93  // Already have coarse face
94  dynFaceRestrictAddressing.append(iter.val());
95  }
96  else
97  {
98  // New coarse face
99  const label coarseI = dynFaceCells.size();
100 
101  dynFaceRestrictAddressing.append(coarseI);
102  dynFaceCells.append(curMaster);
103  masterToCoarseFace.insert(curMaster, coarseI);
104  }
105  }
106 
107  faceCells_.transfer(dynFaceCells);
108  faceRestrictAddressing_.transfer(dynFaceRestrictAddressing);
109  }
110 }
111 
112 
113 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
114 
116 {}
117 
118 
119 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
120 
122 (
123  const Pstream::commsTypes commsType,
124  const labelUList& iF
125 ) const
126 {
127  return tmp<labelField>::New(iF);
128 }
129 
130 
131 // ************************************************************************* //
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
commsTypes
Communications types.
Definition: UPstream.H:74
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
Definition: List.C:452
labelList faceRestrictAddressing_
Face restrict addressing.
Definition: GAMGInterface.H:76
Macros for easy insertion into run-time selection tables.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
Definition: HashTableI.H:113
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:212
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:50
virtual ~oversetGAMGInterface()
Destructor.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
Definition: lduInterface.H:53
labelList faceCells_
Face-cell addressing.
Definition: GAMGInterface.H:71
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.