1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Foam::singleCellFvMesh
28 fvMesh as subset of other mesh. Consists of one cell and all original
29 bounday faces. Useful when manipulating boundary data. Single internal
30 cell only needed to be able to manipulate in a standard way.
34 singleCellFvMeshInterpolate.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef singleCellFvMesh_H
39 #define singleCellFvMesh_H
41 #include "fvPatchFieldMapper.H"
43 #include "labelListIOList.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class singleCellFvMesh Declaration
52 \*---------------------------------------------------------------------------*/
54 class singleCellFvMesh
60 const labelListIOList patchFaceAgglomeration_;
62 //- From patch faces back to agglomeration or fine mesh
63 labelListIOList patchFaceMap_;
65 //- From fine mesh faces to coarse mesh
66 labelIOList reverseFaceMap_;
68 //- From coarse points back to original mesh
69 labelIOList pointMap_;
71 //- From fine points to coarse mesh
72 labelIOList reversePointMap_;
75 // Private Member Functions
77 //- Calculate agglomerated mesh
78 void agglomerateMesh(const fvMesh&, const labelListList&);
81 //- Disallow default bitwise copy construct
82 singleCellFvMesh(const singleCellFvMesh&);
84 //- Disallow default bitwise assignment
85 void operator=(const singleCellFvMesh&);
90 //- Patch field mapper class for non-agglomerated meshes
91 class directPatchFieldMapper
93 public fvPatchFieldMapper
97 const labelUList& directAddressing_;
101 //- Construct given addressing
102 directPatchFieldMapper(const labelUList& directAddressing)
104 directAddressing_(directAddressing)
107 virtual label size() const
109 return directAddressing_.size();
112 virtual bool direct() const
117 virtual const labelUList& directAddressing() const
119 return directAddressing_;
123 //- Patch field mapper class for agglomerated meshes
124 class agglomPatchFieldMapper
126 public fvPatchFieldMapper
130 const labelListList& addressing_;
131 const scalarListList& weights_;
135 //- Construct given addressing
136 agglomPatchFieldMapper
138 const labelListList& addressing,
139 const scalarListList& weights
142 addressing_(addressing),
146 virtual label size() const
148 return addressing_.size();
151 virtual bool direct() const
156 virtual const labelListList& addressing() const
161 virtual const scalarListList& weights() const
171 //- Construct from fvMesh and no agglomeration
172 singleCellFvMesh(const IOobject& io, const fvMesh&);
174 //- Construct from fvMesh and agglomeration of boundary faces.
175 // agglomeration is per patch, per patch face index the agglomeration
176 // the face goes into.
181 const labelListList& patchFaceAgglomeration
184 //- Read from IOobject
185 singleCellFvMesh(const IOobject& io);
189 bool agglomerate() const
191 return patchFaceAgglomeration_.size() > 0;
194 //- From patchFace on this back to original mesh or agglomeration
195 const labelListList& patchFaceMap() const
197 return patchFaceMap_;
200 //- From point on this back to original mesh
201 const labelList& pointMap() const
206 //- From face on original mesh to face on this
207 const labelList& reverseFaceMap() const
209 return reverseFaceMap_;
212 //- From point on original mesh to point on this (or -1 for removed
214 const labelList& reversePointMap() const
216 return reversePointMap_;
219 //- Map volField. Internal field set to average, patch fields straight
222 tmp<GeometricField<Type, fvPatchField, volMesh> >
225 const GeometricField<Type, fvPatchField, volMesh>&
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 } // End namespace Foam
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 # include "singleCellFvMeshInterpolate.C"
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 // ************************************************************************* //