Loading...
Searching...
No Matches
singleCellFvMesh.H
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-2016 OpenFOAM Foundation
9 Copyright (C) 2019,2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::singleCellFvMesh
29
30Description
31 fvMesh as subset of other mesh. Consists of one cell and all original
32 boundary faces. Useful when manipulating boundary data. Single internal
33 cell only needed to be able to manipulate in a standard way.
34
35SourceFiles
36 singleCellFvMesh.C
37 singleCellFvMeshInterpolate.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef Foam_singleCellFvMesh_H
42#define Foam_singleCellFvMesh_H
43
44#include "fvPatchFieldMapper.H"
45#include "fvMesh.H"
46#include "labelListIOList.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
53/*---------------------------------------------------------------------------*\
54 Class singleCellFvMesh Declaration
55\*---------------------------------------------------------------------------*/
56
57class singleCellFvMesh
58:
59 public fvMesh
60{
61 // Private Data
62
63 //- Fine patch face to agglomeration index addressing
64 const labelListIOList patchFaceAgglomeration_;
65
66 //- From patch faces back to agglomeration or fine mesh
67 labelListIOList patchFaceMap_;
68
69 //- From fine mesh faces to coarse mesh
70 labelIOList reverseFaceMap_;
71
72 //- From coarse points back to original mesh
73 labelIOList pointMap_;
74
75 //- From fine points to coarse mesh
76 labelIOList reversePointMap_;
77
78
79 // Private Member Functions
80
81 //- Calculate agglomerated mesh
82 void agglomerateMesh(const fvMesh&, const labelListList&);
83
84
85 //- No copy construct
86 singleCellFvMesh(const singleCellFvMesh&) = delete;
87
88 //- No copy assignment
89 void operator=(const singleCellFvMesh&) = delete;
90
91
92public:
93
94 //- Patch field mapper class for agglomerated meshes
96 :
98 {
99 // Private data
100
101 const labelListList& addressing_;
102 const scalarListList& weights_;
103 bool hasUnmapped_;
104
105 public:
106
107 //- Construct given addressing
109 (
112 )
113 :
114 addressing_(addressing),
115 weights_(weights),
116 hasUnmapped_(false)
117 {
118 for (const labelList& addr : addressing)
119 {
120 if (addr.empty())
121 {
122 hasUnmapped_ = true;
123 break;
124 }
125 }
126 }
127
128 virtual label size() const
129 {
130 return addressing_.size();
131 }
132
133 virtual bool direct() const
134 {
135 return false;
136 }
137
138 bool hasUnmapped() const
139 {
140 return hasUnmapped_;
141 }
142
143 virtual const labelListList& addressing() const
144 {
145 return addressing_;
146 }
147
148 virtual const scalarListList& weights() const
149 {
150 return weights_;
151 }
152 };
154
155
156 // Constructors
157
158 //- Construct from fvMesh and no agglomeration
159 singleCellFvMesh
160 (
161 const IOobject& io,
162 const fvMesh&,
163 const bool doInit=true
164 );
165
166 //- Construct from fvMesh and agglomeration of boundary faces.
167 // Agglomeration is per patch, per patch face index the agglomeration
168 // the face goes into.
169 singleCellFvMesh
170 (
171 const IOobject& io,
172 const fvMesh&,
174 const bool doInit=true
175 );
176
177 //- Read from IOobject
178 singleCellFvMesh(const IOobject& io, const bool doInit=true);
179
180
181 // Member Functions
182
183 bool agglomerate() const noexcept
184 {
185 return !patchFaceAgglomeration_.empty();
186 }
187
188 //- Fine patch face to agglomeration index addressing
190 {
191 return patchFaceAgglomeration_;
192 }
193
194 //- From patchFace on this back to original mesh or agglomeration
195 const labelListList& patchFaceMap() const noexcept
196 {
197 return patchFaceMap_;
198 }
199
200 //- From point on this back to original mesh
201 const labelList& pointMap() const noexcept
202 {
203 return pointMap_;
204 }
206 //- From face on original mesh to face on this
207 const labelList& reverseFaceMap() const noexcept
208 {
209 return reverseFaceMap_;
210 }
211
212 //- From point on original mesh to point on this (or -1 for removed
213 //- points)
214 const labelList& reversePointMap() const noexcept
215 {
216 return reversePointMap_;
217 }
218
219 //- Interpolate for overset (unused)
222 //- Map volField. Internal field set to average, patch fields straight
223 //- copies.
224 template<class Type>
227 (
229 ) const;
230};
231
232
233// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234
235} // End namespace Foam
236
237// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238
239#ifdef NoRepository
241#endif
242
243// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244
245#endif
247// ************************************************************************* //
Generic GeometricField class.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
virtual void interpolate(volScalarField &) const
Interpolate interpolationCells only.
Definition fvMesh.H:459
fvMesh(const fvMesh &)=delete
No copy construct.
A FieldMapper for finite-volume patch fields.
fvPatchFieldMapper()=default
Default construct.
Patch field mapper class for agglomerated meshes.
virtual label size() const
The size of the mapper.
agglomPatchFieldMapper(const labelListList &addressing, const scalarListList &weights)
Construct given addressing.
bool hasUnmapped() const
Any unmapped values?
virtual const scalarListList & weights() const
Return the interpolation weights.
virtual const labelListList & addressing() const
Return the interpolation addressing.
virtual bool direct() const
Is it a direct (non-interpolating) mapper?
fvMesh as subset of other mesh. Consists of one cell and all original boundary faces....
const labelListList & patchFaceAgglomeration() const noexcept
Fine patch face to agglomeration index addressing.
const labelList & reverseFaceMap() const noexcept
From face on original mesh to face on this.
const labelListList & patchFaceMap() const noexcept
From patchFace on this back to original mesh or agglomeration.
bool agglomerate() const noexcept
const labelList & reversePointMap() const noexcept
From point on original mesh to point on this (or -1 for removed points).
const labelList & pointMap() const noexcept
From point on this back to original mesh.
tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &) const
Map volField. Internal field set to average, patch fields straight copies.
A class for managing temporary objects.
Definition tmp.H:75
const auto & io
Namespace for OpenFOAM.
List< scalarList > scalarListList
List of scalarList.
Definition scalarList.H:35
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
IOList< label > labelIOList
IO for a List of label.
Definition labelIOList.H:32
IOList< labelList > labelListIOList
IO for a List of labelList.
const direction noexcept
Definition scalarImpl.H:265