singleCellFvMesh.H
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-2023 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 Class
25  Foam::singleCellFvMesh
26 
27 Description
28  fvMesh as subset of other mesh. Consists of one cell and all original
29  boundary faces. Useful when manipulating boundary data. Single internal
30  cell only needed to be able to manipulate in a standard way.
31 
32 SourceFiles
33  singleCellFvMesh.C
34  singleCellFvMeshInterpolate.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef singleCellFvMesh_H
39 #define singleCellFvMesh_H
40 
41 #include "generalFieldMapper.H"
42 #include "fvMesh.H"
43 #include "labelListIOList.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class singleCellFvMesh Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class singleCellFvMesh
55 :
56  public fvMesh
57 {
58  // Private Data
59 
60  const labelListIOList patchFaceAgglomeration_;
61 
62  //- From patch faces back to agglomeration or fine mesh
63  labelListIOList patchFaceMap_;
64 
65  //- From fine mesh faces to coarse mesh
66  labelIOList reverseFaceMap_;
67 
68  //- From coarse points back to original mesh
69  labelIOList pointMap_;
70 
71  //- From fine points to coarse mesh
72  labelIOList reversePointMap_;
73 
74 
75  // Private Member Functions
76 
77  //- Calculate agglomerated mesh
78  void agglomerateMesh(const fvMesh&, const labelListList&);
79 
80 
81 public:
82 
83  // Public Classes
84 
85  //- Patch field mapper class for agglomerated meshes
87  :
88  public generalFieldMapper
89  {
90  // Private Data
91 
92  //- Interpolated addressing
93  const labelListList& addressing_;
94 
95  //- Interpolation weights
96  const scalarListList& weights_;
97 
98 
99  public:
100 
101  // Constructors
102 
103  //- Construct given addressing
105  (
106  const labelListList& addressing,
107  const scalarListList& weights
108  )
109  :
110  addressing_(addressing),
111  weights_(weights)
112  {}
113 
114 
115  // Member Functions
116 
117  //- Is the mapping direct?
118  virtual bool direct() const
119  {
120  return false;
121  }
122 
123  //- Return interpolated addressing
124  virtual const labelListList& addressing() const
125  {
126  return addressing_;
127  }
128 
129  //- Return interpolation weights
130  virtual const scalarListList& weights() const
131  {
132  return weights_;
133  }
134  };
135 
136 
137  // Constructors
138 
139  //- Construct from fvMesh and no agglomeration
140  singleCellFvMesh(const IOobject& io, const fvMesh&);
141 
142  //- Construct from fvMesh and agglomeration of boundary faces.
143  // agglomeration is per patch, per patch face index the agglomeration
144  // the face goes into.
146  (
147  const IOobject& io,
148  const fvMesh&,
149  const labelListList& patchFaceAgglomeration
150  );
151 
152  //- Read from IOobject
153  singleCellFvMesh(const IOobject& io);
154 
155  //- Disallow default bitwise copy construction
156  singleCellFvMesh(const singleCellFvMesh&) = delete;
157 
158 
159  // Member Functions
160 
161  bool agglomerate() const
162  {
163  return patchFaceAgglomeration_.size() > 0;
164  }
165 
166  //- From patchFace on this back to original mesh or agglomeration
167  const labelListList& patchFaceMap() const
168  {
169  return patchFaceMap_;
170  }
171 
172  //- From point on this back to original mesh
173  const labelList& pointMap() const
174  {
175  return pointMap_;
176  }
177 
178  //- From face on original mesh to face on this
179  const labelList& reverseFaceMap() const
180  {
181  return reverseFaceMap_;
182  }
183 
184  //- From point on original mesh to point on this (or -1 for removed
185  // points)
186  const labelList& reversePointMap() const
187  {
188  return reversePointMap_;
189  }
190 
191  //- Map volField. Internal field set to average, patch fields straight
192  // copies.
193  template<class Type>
196  (
197  const VolField<Type>&
198  ) const;
199 
200 
201  // Member Operators
202 
203  //- Disallow default bitwise assignment
204  void operator=(const singleCellFvMesh&) = delete;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #ifdef NoRepository
216 #endif
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
General field mapper supporting both direct and weighted mapping.
Patch field mapper class for agglomerated meshes.
virtual const labelListList & addressing() const
Return interpolated addressing.
agglomPatchFieldMapper(const labelListList &addressing, const scalarListList &weights)
Construct given addressing.
virtual bool direct() const
Is the mapping direct?
virtual const scalarListList & weights() const
Return interpolation weights.
fvMesh as subset of other mesh. Consists of one cell and all original boundary faces....
const labelListList & patchFaceMap() const
From patchFace on this back to original mesh or agglomeration.
const labelList & reversePointMap() const
From point on original mesh to point on this (or -1 for removed.
const labelList & pointMap() const
From point on this back to original mesh.
const labelList & reverseFaceMap() const
From face on original mesh to face on this.
void operator=(const singleCellFvMesh &)=delete
Disallow default bitwise assignment.
tmp< VolField< Type > > interpolate(const VolField< Type > &) const
Map volField. Internal field set to average, patch fields straight.
singleCellFvMesh(const IOobject &io, const fvMesh &)
Construct from fvMesh and no agglomeration.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.