1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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/>.
28 Adds two fvMeshes without using any polyMesh morphing.
33 fvMeshAdderTemplates.C
35 \*---------------------------------------------------------------------------*/
40 #include "polyMeshAdder.H"
41 #include "fvPatchFieldsFwd.H"
42 #include "fvsPatchFieldsFwd.H"
43 #include "fvPatchFieldMapper.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of classes
57 class mapAddedPolyMesh;
59 /*---------------------------------------------------------------------------*\
60 Class fvMeshAdder Declaration
61 \*---------------------------------------------------------------------------*/
73 class directFvPatchFieldMapper
75 public fvPatchFieldMapper
79 const labelList& directAddressing_;
85 //- Construct from components
86 directFvPatchFieldMapper(const labelList& directAddressing)
89 directAddressing_(directAddressing)
95 virtual ~directFvPatchFieldMapper()
103 return directAddressing_.size();
111 const unallocLabelList& directAddressing() const
113 return directAddressing_;
118 // Private Member Functions
120 //- Calculate map from new patch faces to old patch faces. -1 where
122 static labelList calcPatchMap
124 const label oldStart,
126 const labelList& oldToNew,
127 const polyPatch& newPatch,
128 const label unmappedIndex
131 //- Map from old to new according to map. Handles map = -1.
136 const labelList& map,
140 //- Update single volField.
142 static void MapVolField
144 const mapAddedPolyMesh& meshMap,
146 GeometricField<Type, fvPatchField, volMesh>& fld,
147 const GeometricField<Type, fvPatchField, volMesh>& fldToAdd
150 //- Update single surfaceField.
152 static void MapSurfaceField
154 const mapAddedPolyMesh& meshMap,
156 GeometricField<Type, fvsPatchField, surfaceMesh>& fld,
157 const GeometricField<Type, fvsPatchField, surfaceMesh>& fldToAdd
164 //- Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
165 static autoPtr<mapAddedPolyMesh> add
169 const faceCoupleInfo& coupleInfo,
170 const bool validBoundary = true
173 //- Map all volFields of Type
175 static void MapVolFields
177 const mapAddedPolyMesh&,
179 const fvMesh& meshToAdd
182 //- Map all surfaceFields of Type
184 static void MapSurfaceFields
186 const mapAddedPolyMesh&,
188 const fvMesh& meshToAdd
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 } // End namespace Foam
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 # include "fvMeshAdderTemplates.C"
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 // ************************************************************************* //