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 internal
29 cell data between the two meshes after topological changes.
30 It is constructed from mapPolyMesh.
34 University of Massachusetts Amherst
40 \*---------------------------------------------------------------------------*/
42 #ifndef topoCellMapper_H
43 #define topoCellMapper_H
45 #include "topoMapper.H"
46 #include "morphFieldMapper.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 /*---------------------------------------------------------------------------*\
54 Class topoCellMapper Declaration
55 \*---------------------------------------------------------------------------*/
59 public morphFieldMapper
63 //- Reference to polyMesh
64 const polyMesh& mesh_;
66 //- Reference to mapPolyMesh
67 const mapPolyMesh& mpm_;
69 //- Reference to the topoMapper
70 const topoMapper& tMapper_;
72 //- Is the mapping direct
75 //- Size before mapping
76 mutable label sizeBeforeMapping_;
78 // Demand-driven private data
81 mutable labelList* directAddrPtr_;
83 //- Interpolated addressing
84 mutable labelListList* interpolationAddrPtr_;
86 //- Inverse-distance weights
87 mutable scalarListList* weightsPtr_;
90 mutable labelList* insertedCellLabelsPtr_;
92 //- Interpolation volumes
93 mutable List<scalarField>* volumesPtr_;
95 //- Interpolation centres
96 mutable List<vectorField>* centresPtr_;
98 // Private Member Functions
100 //- Disallow default bitwise copy construct
101 topoCellMapper(const topoCellMapper&);
103 //- Disallow default bitwise assignment
104 void operator=(const topoCellMapper&);
106 //- Calculate addressing for interpolative mapping
107 void calcAddressing() const;
109 //- Calculate inverse-distance weights for interpolative mapping
110 void calcInverseDistanceWeights() const;
112 //- Calculate intersection weights for conservative mapping
113 void calcIntersectionWeightsAndCentres() const;
115 //- Return intersection volume weights
116 const List<scalarField>& intersectionWeights() const;
118 //- Return intersection volume centres
119 const List<vectorField>& intersectionCentres() const;
121 //- Clear out local storage
128 //- Construct from mapPolyMesh
131 const mapPolyMesh& mpm,
132 const topoMapper& mapper
137 virtual ~topoCellMapper();
142 virtual label size() const;
144 //- Return size before mapping
145 virtual label sizeBeforeMapping() const;
147 //- Is the mapping direct
148 virtual bool direct() const;
150 //- Return direct addressing
151 virtual const unallocLabelList& directAddressing() const;
153 //- Return interpolation addressing
154 virtual const labelListList& addressing() const;
157 virtual const scalarListList& weights() const;
159 //- Are there any inserted cells
160 virtual bool insertedObjects() const;
162 //- Return list of inserted cells
163 virtual const labelList& insertedObjectLabels() const;
165 //- Conservatively map the internal field
166 template <class Type, class gradType>
167 void mapInternalField
169 const word& fieldName,
170 const Field<gradType>& gF,
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 } // End namespace Foam
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 # include "topoCellMapperTemplates.C"
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 // ************************************************************************* //