fvMeshAdder.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fvMeshAdder
28 
29 Description
30  Adds two fvMeshes without using any polyMesh morphing.
31  Uses polyMeshAdder.
32 
33 SourceFiles
34  fvMeshAdder.C
35  fvMeshAdderTemplates.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef fvMeshAdder_H
40 #define fvMeshAdder_H
41 
42 #include "polyMeshAdder.H"
43 #include "volFieldsFwd.H"
44 #include "fvPatchFieldsFwd.H"
45 #include "fvsPatchFieldsFwd.H"
46 #include "fvPatchFieldMapper.H"
47 #include "DimensionedField.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward Declarations
55 class IOobject;
56 class faceCoupleInfo;
57 class IOobjectList;
58 class fvMesh;
59 class volMesh;
60 class surfaceMesh;
61 class mapAddedPolyMesh;
62 
63 /*---------------------------------------------------------------------------*\
64  Class fvMeshAdder Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class fvMeshAdder
68 :
69  public polyMeshAdder
70 {
71 private:
72 
73  // Private Member Functions
74 
75  //- Calculate map from new patch faces to old patch faces. -1 where
76  // could not map.
77  static labelList calcPatchMap
78  (
79  const label oldStart,
80  const label oldSize,
81  const labelList& oldToNew,
82  const polyPatch& newPatch,
83  const label unmappedIndex
84  );
85 
86  //- Update single volField.
87  template<class Type>
88  static void MapVolField
89  (
90  const mapAddedPolyMesh& meshMap,
91 
94  const bool fullyMapped
95  );
96 
97  //- Update single surfaceField.
98  template<class Type>
99  static void MapSurfaceField
100  (
101  const mapAddedPolyMesh& meshMap,
102 
105  const bool fullyMapped
106  );
107 
108  //- Update single dimensionedField.
109  template<class Type>
110  static void MapDimField
111  (
112  const mapAddedPolyMesh& meshMap,
113 
115  const DimensionedField<Type, volMesh>& fldToAdd
116  );
117 
118 public:
119 
120  // Declare name of the class and its debug switch
121  ClassName("fvMeshAdder");
122 
123 
124  // Member Functions
125 
126  //- Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
128  (
129  fvMesh& mesh0,
130  const fvMesh& mesh1,
131  const faceCoupleInfo& coupleInfo,
132  const bool validBoundary = true,
133  const bool fullyMapped = false
134  );
135 
136  //- Map all volFields of Type.
137  // Optionally override mapping detection
138  // of unmapped values (e.g. used in fvMeshDistribute since it fixes
139  // up mapping itself)
140  template<class Type>
141  static void MapVolFields
142  (
143  const mapAddedPolyMesh&,
144  const fvMesh& mesh,
145  const fvMesh& meshToAdd,
146  const bool fullyMapped = false
147  );
148 
149  //- Map all surfaceFields of Type
150  template<class Type>
151  static void MapSurfaceFields
152  (
153  const mapAddedPolyMesh&,
154  const fvMesh& mesh,
155  const fvMesh& meshToAdd,
156  const bool fullyMapped = false
157  );
158 
159  //- Map all DimensionedFields of Type
160  template<class Type>
161  static void MapDimFields
162  (
163  const mapAddedPolyMesh&,
164  const fvMesh& mesh,
165  const fvMesh& meshToAdd
166  );
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #ifdef NoRepository
177  #include "fvMeshAdderTemplates.C"
178 #endif
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
volFieldsFwd.H
Foam::fvMeshAdder
Adds two fvMeshes without using any polyMesh morphing. Uses polyMeshAdder.
Definition: fvMeshAdder.H:66
fvsPatchFieldsFwd.H
Foam::polyMeshAdder
Adds two meshes without using any polyMesh morphing.
Definition: polyMeshAdder.H:62
Foam::fvMeshAdder::MapSurfaceFields
static void MapSurfaceFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd, const bool fullyMapped=false)
Map all surfaceFields of Type.
Definition: fvMeshAdderTemplates.C:578
Foam::fvMeshAdder::ClassName
ClassName("fvMeshAdder")
DimensionedField.H
Foam::fvMeshAdder::MapVolFields
static void MapVolFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd, const bool fullyMapped=false)
Map all volFields of Type.
Definition: fvMeshAdderTemplates.C:266
fvPatchFieldsFwd.H
fvPatchFieldMapper.H
Foam::fvMeshAdder::add
static autoPtr< mapAddedPolyMesh > add(fvMesh &mesh0, const fvMesh &mesh1, const faceCoupleInfo &coupleInfo, const bool validBoundary=true, const bool fullyMapped=false)
Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
Definition: fvMeshAdder.C:72
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
polyMeshAdder.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
Foam::fvMeshAdder::MapDimFields
static void MapDimFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all DimensionedFields of Type.
Definition: fvMeshAdderTemplates.C:662
Foam::faceCoupleInfo
Container for information needed to couple to meshes. When constructed from two meshes and a geometri...
Definition: faceCoupleInfo.H:160
Foam::mapAddedPolyMesh
Class containing mesh-to-mesh mapping information after a mesh addition where we add a mesh ('added m...
Definition: mapAddedPolyMesh.H:58
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
fvMeshAdderTemplates.C