Loading...
Searching...
No Matches
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-2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
38 (
42 );
44 (
48 );
49}
50
51
52// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53
54Foam::oversetGAMGInterface::oversetGAMGInterface
55(
56 const label index,
57 const lduInterfacePtrsList& coarseInterfaces,
58 const lduInterface& fineInterface,
59 const labelField& localRestrictAddressing,
60 const labelField& neighbourRestrictAddressing,
61 const label fineLevelIndex,
62 const label coarseComm
63)
64:
66 (
67 index,
68 coarseInterfaces
69 )
70{
71 // Problem:
72 // - we only want the oversetGAMGInterfaceField
73 // - but this needs a oversetGAMGInterface of at least size 1
74 // (since faceRestrictAddressing cannot have -1 or so in it - it
75 // can only have >= 0 i.e. we cannot agglomerate into nothing)
76 // - note that the end result is not used - the (current) corresponding
77 // oversetGAMGInterfaceField has dummy updateInterfaceMatrix.
78
79 // Construct face agglomeration from cell agglomeration. Code same as
80 // in e.g. cyclicAMIGAMGInterface.
81 {
82 // From coarse face to cell
83 DynamicList<label> dynFaceCells(localRestrictAddressing.size());
84
85 // From face to coarse face
86 DynamicList<label> dynFaceRestrictAddressing
87 (
88 localRestrictAddressing.size()
89 );
90
91 Map<label> masterToCoarseFace(localRestrictAddressing.size());
92
93 for (const label curMaster : localRestrictAddressing)
94 {
95 const auto iter = masterToCoarseFace.cfind(curMaster);
96
97 if (iter.good())
98 {
99 // Already have coarse face
100 dynFaceRestrictAddressing.append(iter.val());
101 }
102 else
103 {
104 // New coarse face
105 const label coarseI = dynFaceCells.size();
106
107 dynFaceRestrictAddressing.append(coarseI);
108 dynFaceCells.append(curMaster);
109 masterToCoarseFace.insert(curMaster, coarseI);
110 }
111 }
113 faceCells_.transfer(dynFaceCells);
114 faceRestrictAddressing_.transfer(dynFaceRestrictAddressing);
115 }
116}
117
118
119Foam::oversetGAMGInterface::oversetGAMGInterface
120(
121 const label index,
122 const lduInterfacePtrsList& coarseInterfaces,
124)
125:
127{}
128
129
130Foam::oversetGAMGInterface::oversetGAMGInterface
131(
132 const label index,
133 const lduInterfacePtrsList& coarseInterfaces,
134 const lduInterface& fineInterface,
135 const labelList& interfaceMap,
136 const labelUList& faceCells,
137 const labelUList& faceRestrictAddresssing,
138 const labelUList& faceOffsets,
139 const lduInterfacePtrsList& allInterfaces
140)
141:
143 (
144 index,
145 coarseInterfaces,
146 faceCells,
147 faceRestrictAddresssing
148 )
149{}
150
151
152// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
153
155(
156 const Pstream::commsTypes commsType,
157 const labelUList& iF
158) const
159{
160 return tmp<labelField>::New(iF);
161}
162
163
165{
167}
168
169
170// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
void append(const T &val)
Copy append an element to the end of this list.
Abstract base class for GAMG agglomerated interfaces.
labelList faceRestrictAddressing_
Face restrict addressing.
virtual label index() const
virtual const lduInterfacePtrsList & coarseInterfaces() const
virtual const labelUList & faceCells() const
Return faceCell addressing.
labelList faceCells_
Face-cell addressing.
GAMGInterface(const GAMGInterface &)=delete
No copy construct.
virtual void write(Ostream &) const =0
Write to stream.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
Definition HashTableI.H:113
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
Definition HashTableI.H:152
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A HashTable to objects of type <T> with a label key.
Definition Map.H:54
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
commsTypes
Communications types.
Definition UPstream.H:81
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
GAMG agglomerated cyclic AMI interface.
virtual void write(Ostream &) const
Write to stream.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
Field< label > labelField
Specialisation of Field<T> for label.
Definition labelField.H:48
UList< label > labelUList
A UList of labels.
Definition UList.H:75