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 declaration of classes
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 
72 private:
73 
74  // Private Member Functions
75 
76  //- Calculate map from new patch faces to old patch faces. -1 where
77  // could not map.
78  static labelList calcPatchMap
79  (
80  const label oldStart,
81  const label oldSize,
82  const labelList& oldToNew,
83  const polyPatch& newPatch,
84  const label unmappedIndex
85  );
86 
87  //- Update single volField.
88  template<class Type>
89  static void MapVolField
90  (
91  const mapAddedPolyMesh& meshMap,
92 
95  const bool fullyMapped
96  );
97 
98  //- Update single surfaceField.
99  template<class Type>
100  static void MapSurfaceField
101  (
102  const mapAddedPolyMesh& meshMap,
103 
106  const bool fullyMapped
107  );
108 
109  //- Update single dimensionedField.
110  template<class Type>
111  static void MapDimField
112  (
113  const mapAddedPolyMesh& meshMap,
114 
116  const DimensionedField<Type, volMesh>& fldToAdd
117  );
118 
119 public:
120 
121  // Declare name of the class and its debug switch
122  ClassName("fvMeshAdder");
123 
124 
125  // Member Functions
126 
127  //- Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
129  (
130  fvMesh& mesh0,
131  const fvMesh& mesh1,
132  const faceCoupleInfo& coupleInfo,
133  const bool validBoundary = true,
134  const bool fullyMapped = false
135  );
136 
137  //- Map all volFields of Type.
138  // Optionally override mapping detection
139  // of unmapped values (e.g. used in fvMeshDistribute since it fixes
140  // up mapping itself)
141  template<class Type>
142  static void MapVolFields
143  (
144  const mapAddedPolyMesh&,
145  const fvMesh& mesh,
146  const fvMesh& meshToAdd,
147  const bool fullyMapped = false
148  );
149 
150  //- Map all surfaceFields of Type
151  template<class Type>
152  static void MapSurfaceFields
153  (
154  const mapAddedPolyMesh&,
155  const fvMesh& mesh,
156  const fvMesh& meshToAdd,
157  const bool fullyMapped = false
158  );
159 
160  //- Map all DimensionedFields of Type
161  template<class Type>
162  static void MapDimFields
163  (
164  const mapAddedPolyMesh&,
165  const fvMesh& mesh,
166  const fvMesh& meshToAdd
167  );
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #ifdef NoRepository
178  #include "fvMeshAdderTemplates.C"
179 #endif
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
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:61
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::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
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:84
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:159
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