fvMeshAdder.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  Foam::fvMeshAdder
26 
27 Description
28  Adds two fvMeshes without using any polyMesh morphing.
29  Uses polyMeshAdder.
30 
31 SourceFiles
32  fvMeshAdder.C
33  fvMeshAdderTemplates.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef fvMeshAdder_H
38 #define fvMeshAdder_H
39 
40 #include "polyMeshAdder.H"
41 #include "volFieldsFwd.H"
42 #include "fvPatchFieldsFwd.H"
43 #include "fvsPatchFieldsFwd.H"
44 #include "fvPatchFieldMapper.H"
45 #include "DimensionedField.H"
46 #include "pointFieldsFwd.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of classes
54 class IOobject;
55 class faceCoupleInfo;
56 class IOobjectList;
57 class fvMesh;
58 class volMesh;
59 class surfaceMesh;
60 class mapAddedPolyMesh;
61 
62 /*---------------------------------------------------------------------------*\
63  Class fvMeshAdder Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class fvMeshAdder
67 :
68  public polyMeshAdder
69 {
70  // Private Member Functions
71 
72  //- Calculate map from new patch faces to old patch faces. -1 where
73  // could not map.
74  static labelList calcPatchMap
75  (
76  const label oldStart,
77  const label oldSize,
78  const labelList& oldToNew,
79  const polyPatch& newPatch,
80  const label unmappedIndex
81  );
82 
83  //- Update single volField.
84  template<class Type>
85  static void MapVolField
86  (
87  const mapAddedPolyMesh& meshMap,
88 
91  );
92 
93  //- Update single surfaceField.
94  template<class Type>
95  static void MapSurfaceField
96  (
97  const mapAddedPolyMesh& meshMap,
98 
101  );
102 
103  //- Update single pointField.
104  template<class Type>
105  static void MapPointField
106  (
107  const pointMesh& mesh,
108  const mapAddedPolyMesh& meshMap,
109  const labelListList& oldMeshPoints,
110 
113  );
114 
115  //- Update single dimensionedField.
116  template<class Type>
117  static void MapDimField
118  (
119  const mapAddedPolyMesh& meshMap,
120 
122  const DimensionedField<Type, volMesh>& fldToAdd
123  );
124 
125 public:
126 
127  // Declare name of the class and its debug switch
128  ClassName("fvMeshAdder");
129 
130 
131  // Member Functions
132 
133  //- Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
135  (
136  fvMesh& mesh0,
137  const fvMesh& mesh1,
138  const faceCoupleInfo& coupleInfo,
139  const bool validBoundary = true
140  );
141 
142  //- Map all volFields of Type
143  template<class Type>
144  static void MapVolFields
145  (
146  const mapAddedPolyMesh&,
147  const fvMesh& mesh,
148  const fvMesh& meshToAdd
149  );
150 
151  //- Map all surfaceFields of Type
152  template<class Type>
153  static void MapSurfaceFields
154  (
155  const mapAddedPolyMesh&,
156  const fvMesh& mesh,
157  const fvMesh& meshToAdd
158  );
159 
160  //- Map all surfaceFields of Type
161  template<class Type>
162  static void MapPointFields
163  (
164  const mapAddedPolyMesh&,
165  const pointMesh& mesh,
166  const labelListList& oldMeshPoints,
167  const objectRegistry& meshToAdd
168  );
169 
170  //- Map all DimensionedFields of Type
171  template<class Type>
172  static void MapDimFields
173  (
174  const mapAddedPolyMesh&,
175  const fvMesh& mesh,
176  const fvMesh& meshToAdd
177  );
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #ifdef NoRepository
188  #include "fvMeshAdderTemplates.C"
189 #endif
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
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:59
Map point field on topology change. This is a partial template specialisation for GeoMesh=pointMesh...
Adds two fvMeshes without using any polyMesh morphing. Uses polyMeshAdder.
Definition: fvMeshAdder.H:65
Class containing mesh-to-mesh mapping information after a mesh addition where we add a mesh (&#39;added m...
Generic GeometricField class.
Adds two meshes without using any polyMesh morphing.
Definition: polyMeshAdder.H:59
Container for information needed to couple to meshes. When constructed from two meshes and a geometri...
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
dynamicFvMesh & mesh
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
static void MapPointFields(const mapAddedPolyMesh &, const pointMesh &mesh, const labelListList &oldMeshPoints, const objectRegistry &meshToAdd)
Map all surfaceFields of Type.
static autoPtr< mapAddedPolyMesh > add(fvMesh &mesh0, const fvMesh &mesh1, const faceCoupleInfo &coupleInfo, const bool validBoundary=true)
Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
Definition: fvMeshAdder.C:71
ClassName("fvMeshAdder")
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static void MapSurfaceFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all surfaceFields of Type.
static void MapDimFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all DimensionedFields of Type.
static void MapVolFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all volFields of Type.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Registry of regIOobjects.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Namespace for OpenFOAM.