1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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)
94 virtual ~directFvPatchFieldMapper()
102 return directAddressing_.size();
110 const labelUList& directAddressing() const
112 return directAddressing_;
117 // Private Member Functions
119 //- Calculate map from new patch faces to old patch faces. -1 where
121 static labelList calcPatchMap
123 const label oldStart,
125 const labelList& oldToNew,
126 const polyPatch& newPatch,
127 const label unmappedIndex
130 //- Map from old to new according to map. Handles map = -1.
135 const labelList& map,
139 //- Update single volField.
141 static void MapVolField
143 const mapAddedPolyMesh& meshMap,
145 GeometricField<Type, fvPatchField, volMesh>& fld,
146 const GeometricField<Type, fvPatchField, volMesh>& fldToAdd
149 //- Update single surfaceField.
151 static void MapSurfaceField
153 const mapAddedPolyMesh& meshMap,
155 GeometricField<Type, fvsPatchField, surfaceMesh>& fld,
156 const GeometricField<Type, fvsPatchField, surfaceMesh>& fldToAdd
163 //- Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
164 static autoPtr<mapAddedPolyMesh> add
168 const faceCoupleInfo& coupleInfo,
169 const bool validBoundary = true
172 //- Map all volFields of Type
174 static void MapVolFields
176 const mapAddedPolyMesh&,
178 const fvMesh& meshToAdd
181 //- Map all surfaceFields of Type
183 static void MapSurfaceFields
185 const mapAddedPolyMesh&,
187 const fvMesh& meshToAdd
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 } // End namespace Foam
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 # include "fvMeshAdderTemplates.C"
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 // ************************************************************************* //