1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 This object provides mapping and fill-in information for internal
30 cell data between the two meshes after topological changes.
31 It is constructed from mapPolyMesh.
35 University of Massachusetts Amherst
41 \*---------------------------------------------------------------------------*/
43 #ifndef topoCellMapper_H
44 #define topoCellMapper_H
46 #include "topoMapper.H"
47 #include "morphFieldMapper.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class topoCellMapper Declaration
56 \*---------------------------------------------------------------------------*/
60 public morphFieldMapper
64 //- Reference to polyMesh
65 const polyMesh& mesh_;
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 // Demand-driven private data
82 mutable labelList* directAddrPtr_;
84 //- Interpolated addressing
85 mutable labelListList* interpolationAddrPtr_;
87 //- Inverse-distance weights
88 mutable scalarListList* weightsPtr_;
91 mutable labelList* insertedCellLabelsPtr_;
93 //- Interpolation volumes
94 mutable List<scalarField>* volumesPtr_;
96 //- Interpolation centres
97 mutable List<vectorField>* centresPtr_;
99 // Private Member Functions
101 //- Disallow default bitwise copy construct
102 topoCellMapper(const topoCellMapper&);
104 //- Disallow default bitwise assignment
105 void operator=(const topoCellMapper&);
107 //- Calculate addressing for interpolative mapping
108 void calcAddressing() const;
110 //- Calculate inverse-distance weights for interpolative mapping
111 void calcInverseDistanceWeights() const;
113 //- Calculate intersection weights for conservative mapping
114 void calcIntersectionWeightsAndCentres() const;
116 //- Return intersection volume weights
117 const List<scalarField>& intersectionWeights() const;
119 //- Return intersection volume centres
120 const List<vectorField>& intersectionCentres() const;
122 //- Clear out local storage
129 //- Construct from mapPolyMesh
132 const mapPolyMesh& mpm,
133 const topoMapper& mapper
138 virtual ~topoCellMapper();
143 virtual label size() const;
145 //- Return size before mapping
146 virtual label sizeBeforeMapping() const;
148 //- Is the mapping direct
149 virtual bool direct() const;
151 //- Return direct addressing
152 virtual const unallocLabelList& directAddressing() const;
154 //- Return interpolation addressing
155 virtual const labelListList& addressing() const;
158 virtual const scalarListList& weights() const;
160 //- Are there any inserted cells
161 virtual bool insertedObjects() const;
163 //- Return list of inserted cells
164 virtual const labelList& insertedObjectLabels() const;
166 //- Conservatively map the internal field
167 template <class Type, class gradType>
168 void mapInternalField
170 const word& fieldName,
171 const Field<gradType>& gF,
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 } // End namespace Foam
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 # include "topoCellMapperTemplates.C"
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 // ************************************************************************* //