1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 This object provides mapping and fill-in information for patch data
29 between the two meshes after the topological change. It is
30 constructed from mapPolyMesh.
34 University of Massachusetts Amherst
40 \*---------------------------------------------------------------------------*/
42 #ifndef topoPatchMapper_H
43 #define topoPatchMapper_H
45 #include "vectorList.H"
46 #include "topoMapper.H"
47 #include "fvPatchFieldMapper.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class topoPatchMapper Declaration
56 \*---------------------------------------------------------------------------*/
60 public fvPatchFieldMapper
64 //- Reference to patch
65 const fvPatch& patch_;
67 //- Reference to mapPolyMesh
68 const mapPolyMesh& mpm_;
70 //- Reference to the topoMapper
71 const topoMapper& tMapper_;
73 //- Is the mapping direct
76 //- Size before mapping
77 mutable label sizeBeforeMapping_;
79 //- Is the mapping conservative
80 mutable bool conservative_;
82 // Demand-driven private data
85 mutable labelList* directAddrPtr_;
87 //- Interpolated addressing
88 mutable labelListList* interpolationAddrPtr_;
90 //- Inverse-distance weights
91 mutable scalarListList* weightsPtr_;
94 mutable labelList* insertedFaceLabelsPtr_;
96 //- Inserted face index map
97 mutable labelList* insertedFaceIndexMapPtr_;
99 //- Inserted face addressing
100 mutable labelListList* insertedFaceAddressingPtr_;
102 //- Interpolation areas
103 mutable List<scalarList>* areasPtr_;
105 //- Interpolation centres
106 mutable List<vectorList>* centresPtr_;
108 // Private Member Functions
110 //- Disallow default bitwise copy construct
111 topoPatchMapper(const topoPatchMapper&);
113 //- Disallow default bitwise assignment
114 void operator=(const topoPatchMapper&);
116 //- Calculate the insertedFace addressing list
117 void calcInsertedFaceAddressing() const;
119 //- Calculate addressing for mapping
120 void calcAddressing() const;
122 //- Calculate inverse-distance weights for interpolative mapping
123 void calcInverseDistanceWeights() const;
125 //- Calculate intersection weights for conservative mapping
126 void calcIntersectionWeightsAndCentres() const;
128 //- Return intersection area weights
129 const List<scalarList>& intersectionWeights() const;
131 //- Return intersection area centres
132 const List<vectorList>& intersectionCentres() const;
134 //- Clear out local storage
141 //- Construct from mapPolyMesh
144 const fvPatch& patch,
145 const mapPolyMesh& mpm,
146 const topoMapper& mapper
151 virtual ~topoPatchMapper();
155 //- Return the polyPatch size
156 label patchSize() const;
159 virtual label size() const;
161 //- Return size of field before mapping
162 virtual label sizeBeforeMapping() const;
164 //- Is the mapping direct
165 virtual bool direct() const;
167 //- Return direct addressing
168 virtual const unallocLabelList& directAddressing() const;
170 //- Return interpolated addressing
171 virtual const labelListList& addressing() const;
173 //- Return interpolaion weights
174 virtual const scalarListList& weights() const;
176 //- Are there any inserted faces
177 virtual bool insertedObjects() const;
179 //- Return list of inserted faces
180 virtual const labelList& insertedObjectLabels() const;
182 //- Return addressing map for inserted faces
183 const labelList& insertedObjectMap() const;
185 //- Return addressing for inserted faces
186 const labelListList& insertedFaceAddressing() const;
188 //- Map the patch field
189 template <class Type>
192 const word& fieldName,
193 fvPatchField<Type>& pF
196 //- Map the patch field
197 template <class Type>
198 void mapFvsPatchField
200 const word& fieldName,
201 fvsPatchField<Type>& pF
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 } // End namespace Foam
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 # include "topoPatchMapperTemplates.C"
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 // ************************************************************************* //