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 Class holds all necessary information for mapping fields associated with
30 dynamicTopoFvMesh and fvMesh.
34 University of Massachusetts Amherst
40 \*---------------------------------------------------------------------------*/
47 #include "volFields.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 // Class forward declarations
57 class topoSurfaceMapper;
58 class topoBoundaryMeshMapper;
60 /*---------------------------------------------------------------------------*\
61 Class topoMapper Declaration
62 \*---------------------------------------------------------------------------*/
68 //- Reference to fvMesh
71 //- Reference to the options dictionary
72 const dictionary& dict_;
74 // Demand-driven private data
77 mutable autoPtr<topoCellMapper> cellMap_;
80 mutable autoPtr<topoSurfaceMapper> surfaceMap_;
83 mutable autoPtr<topoBoundaryMeshMapper> boundaryMap_;
86 mutable autoPtr<fluxCorrector> fluxCorrector_;
88 // Stored gradients for mapping
89 mutable HashTable<autoPtr<volVectorField> > sGrads_;
90 mutable HashTable<autoPtr<volTensorField> > vGrads_;
92 //- Geometric information on the old mesh
93 mutable volVectorField* cellCentresPtr_;
95 //- Intersection weights
96 mutable List<scalarField> faceWeights_;
97 mutable List<scalarField> cellWeights_;
99 //- Intersection centres
100 mutable List<vectorField> faceCentres_;
101 mutable List<vectorField> cellCentres_;
103 //- Sizes / starts for mapping
104 mutable labelList cellSizes_;
105 mutable labelList cellStarts_;
106 mutable labelList faceSizes_;
107 mutable labelList faceStarts_;
108 mutable labelListList patchSizes_;
109 mutable labelListList patchStarts_;
111 // Private Member Functions
113 //- Disallow default bitwise copy construct
114 topoMapper(const topoMapper&);
116 //- Disallow default bitwise assignment
117 void operator=(const topoMapper&);
119 // Store gradients of volFields on the mesh
120 // prior to topology changes
121 template <class Type, class gradType>
124 HashTable<autoPtr<gradType> >& gradTable
127 //- Store gradients prior to mesh reset
128 void storeGradients() const;
130 //- Set geometric information
131 void storeGeometry() const;
137 //- Construct from mesh and dictionary
138 topoMapper(const fvMesh& mesh, const dictionary& dict);
146 //- Return reference to the mesh
147 const fvMesh& mesh() const;
149 //- Return reference to objectRegistry storing fields.
150 const objectRegistry& thisDb() const;
152 //- Set mapping information
153 void setMapper(const mapPolyMesh& mpm) const;
155 //- Set face weighting information
158 const Xfer<List<scalarField> >& weights,
159 const Xfer<List<vectorField> >& centres
162 //- Set cell weighting information
165 const Xfer<List<scalarField> >& weights,
166 const Xfer<List<vectorField> >& centres
169 //- Set cell / patch offset information
172 const labelList& cellSizes,
173 const labelList& cellStarts,
174 const labelList& faceSizes,
175 const labelList& faceStarts,
176 const labelListList& patchSizes,
177 const labelListList& patchStarts
180 //- Fetch face weights
181 const List<scalarField>& faceWeights() const;
183 //- Fetch cell weights
184 const List<scalarField>& cellWeights() const;
186 //- Fetch face centres
187 const List<vectorField>& faceCentres() const;
189 //- Fetch cell centres
190 const List<vectorField>& cellCentres() const;
193 const labelList& cellSizes() const;
196 const labelList& faceSizes() const;
198 //- Fetch patch sizes
199 const labelListList& patchSizes() const;
201 //- Fetch cell starts
202 const labelList& cellStarts() const;
204 //- Fetch face starts
205 const labelList& faceStarts() const;
207 //- Fetch patch starts
208 const labelListList& patchStarts() const;
210 //- Store mesh information for the mapping stage
211 void storeMeshInformation() const;
213 //- Return non-const access to cell centres
214 volVectorField& volCentres() const;
216 //- Return stored cell centre information
217 const vectorField& internalCentres() const;
219 //- Return stored patch centre information
220 const vectorField& patchCentres(const label i) const;
222 //- Return names of stored scalar gradients
223 const wordList scalarGrads() const;
225 //- Return names of stored vector gradients
226 const wordList vectorGrads() const;
228 //- Fetch the gradient field
229 template <class Type>
230 Type& gradient(const word& name) const;
232 //- Correct fluxes after topology change
233 void correctFluxes() const;
235 //- Return volume mapper
236 const topoCellMapper& volMap() const;
238 //- Return surface mapper
239 const topoSurfaceMapper& surfaceMap() const;
241 //- Return boundary mapper
242 const topoBoundaryMeshMapper& boundaryMap() const;
244 //- Return flux-corrector
245 const fluxCorrector& surfaceFluxCorrector() const;
247 //- Clear out member data
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 } // End namespace Foam
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 # include "topoMapperTemplates.C"
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 // ************************************************************************* //