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 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 bounday 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 singleCellFvMesh_H
42#define singleCellFvMesh_H
43
44#include "fvPatchFieldMapper.H"
45#include "fvMesh.H"
46#include "labelListIOList.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class singleCellFvMesh Declaration
55\*---------------------------------------------------------------------------*/
58:
59 public fvMesh
60{
61 // Private data
62
63 const labelListIOList patchFaceAgglomeration_;
64
65 //- From patch faces back to agglomeration or fine mesh
66 labelListIOList patchFaceMap_;
67
68 //- From fine mesh faces to coarse mesh
69 labelIOList reverseFaceMap_;
70
71 //- From coarse points back to original mesh
72 labelIOList pointMap_;
73
74 //- From fine points to coarse mesh
75 labelIOList reversePointMap_;
76
77
78 // Private Member Functions
79
80 //- Calculate agglomerated mesh
81 void agglomerateMesh(const fvMesh&, const labelListList&);
82
83
84 //- No copy construct
85 singleCellFvMesh(const singleCellFvMesh&) = delete;
86
87 //- No copy assignment
88 void operator=(const singleCellFvMesh&) = delete;
89
90
91public:
92
93 //- Patch field mapper class for agglomerated meshes
95 :
97 {
98 // Private data
99
100 const labelListList& addressing_;
101 const scalarListList& weights_;
102 bool hasUnmapped_;
103
104 public:
105
106 //- Construct given addressing
108 (
111 )
112 :
113 addressing_(addressing),
114 weights_(weights),
115 hasUnmapped_(false)
116 {
117 for (const labelList& addr : addressing)
118 {
119 if (addr.empty())
120 {
121 hasUnmapped_ = true;
122 break;
123 }
124 }
125 }
127 virtual label size() const
128 {
129 return addressing_.size();
130 }
132 virtual bool direct() const
133 {
134 return false;
135 }
137 bool hasUnmapped() const
138 {
139 return hasUnmapped_;
140 }
142 virtual const labelListList& addressing() const
143 {
144 return addressing_;
145 }
147 virtual const scalarListList& weights() const
148 {
149 return weights_;
150 }
151 };
152
153
154
155 // Constructors
156
157 //- Construct from fvMesh and no agglomeration
158 singleCellFvMesh(const IOobject& io, const fvMesh&);
159
160 //- Construct from fvMesh and agglomeration of boundary faces.
161 // Agglomeration is per patch, per patch face index the agglomeration
162 // the face goes into.
164 (
165 const IOobject& io,
166 const fvMesh&,
167 const labelListList& patchFaceAgglomeration
168 );
169
170 //- Read from IOobject
172
173 // Member Functions
175 bool agglomerate() const
176 {
177 return patchFaceAgglomeration_.size() > 0;
178 }
179
180 //- From patchFace on this back to original mesh or agglomeration
181 const labelListList& patchFaceMap() const
182 {
183 return patchFaceMap_;
184 }
185
186 //- From point on this back to original mesh
187 const labelList& pointMap() const
188 {
189 return pointMap_;
190 }
191
192 //- From face on original mesh to face on this
193 const labelList& reverseFaceMap() const
194 {
195 return reverseFaceMap_;
196 }
197
198 //- From point on original mesh to point on this (or -1 for removed
199 //- points)
200 const labelList& reversePointMap() const
201 {
202 return reversePointMap_;
203 }
204
205 //- Map volField. Internal field set to average, patch fields straight
206 //- copies.
207 template<class Type>
210 (
212 ) const;
213
214};
215
216
217// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218
219} // End namespace Foam
220
221// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222
223#ifdef NoRepository
225#endif
226
227// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228
229#endif
230
231// ************************************************************************* //
Generic GeometricField class.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
A FieldMapper for finite-volume patch fields.
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 bounday faces....
const labelListList & patchFaceMap() const
From patchFace on this back to original mesh or agglomeration.
const labelList & pointMap() const
From point on this back to original mesh.
const labelList & reversePointMap() const
const labelList & reverseFaceMap() const
From face on original mesh to face on this.
tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &) const
A class for managing temporary objects.
Definition: tmp.H:65
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.