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-2026 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 "fieldMapper.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 surfaceMesh;
59 class mapAddedPolyMesh;
60 
61 /*---------------------------------------------------------------------------*\
62  Class fvMeshAdder Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class fvMeshAdder
66 :
67  public polyMeshAdder
68 {
69  // Private Member Functions
70 
71  //- Calculate map from new patch faces to old patch faces. -1 where
72  // could not map.
73  static labelList calcPatchMap
74  (
75  const label oldStart,
76  const label oldSize,
77  const labelList& oldToNew,
78  const polyPatch& newPatch,
79  const label unmappedIndex
80  );
81 
82  //- Update single volField.
83  template<class Type>
84  static void MapVolField
85  (
86  const mapAddedPolyMesh& meshMap,
87 
89  const VolField<Type>& fldToAdd
90  );
91 
92  //- Update single surfaceField.
93  template<class Type>
94  static void MapSurfaceField
95  (
96  const mapAddedPolyMesh& meshMap,
97 
99  const SurfaceField<Type>& fldToAdd
100  );
101 
102  //- Update single pointField.
103  template<class Type>
104  static void MapPointField
105  (
106  const pointMesh& mesh,
107  const mapAddedPolyMesh& meshMap,
108  const labelListList& oldMeshPoints,
109 
111  const PointField<Type>& fldToAdd
112  );
113 
114  //- Update single dimensionedField.
115  template<class Type>
116  static void MapDimField
117  (
118  const mapAddedPolyMesh& meshMap,
119 
121  const DimensionedField<Type, fvMesh>& fldToAdd
122  );
123 
124 public:
125 
126  // Declare name of the class and its debug switch
127  ClassName("fvMeshAdder");
128 
129 
130  // Member Functions
131 
132  //- Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
134  (
135  fvMesh& mesh0,
136  const fvMesh& mesh1,
137  const faceCoupleInfo& coupleInfo,
138  const bool validBoundary = true
139  );
140 
141  //- Map all volFields of Type
142  template<class Type>
143  static void MapVolFields
144  (
145  const mapAddedPolyMesh&,
146  const fvMesh& mesh,
147  const fvMesh& meshToAdd
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  );
158 
159  //- Map all surfaceFields of Type
160  template<class Type>
161  static void MapPointFields
162  (
163  const mapAddedPolyMesh&,
164  const pointMesh& mesh,
165  const labelListList& oldMeshPoints,
166  const objectRegistry& meshToAdd
167  );
168 
169  //- Map all DimensionedFields of Type
170  template<class Type>
171  static void MapDimFields
172  (
173  const mapAddedPolyMesh&,
174  const fvMesh& mesh,
175  const fvMesh& meshToAdd
176  );
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #ifdef NoRepository
187  #include "fvMeshAdderTemplates.C"
188 #endif
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
Map point field on topology change. This is a partial template specialisation for GeoMesh=pointMesh.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Container for information needed to couple to meshes. When constructed from two meshes and a list of ...
Adds two fvMeshes without using any polyMesh morphing. Uses polyMeshAdder.
Definition: fvMeshAdder.H:67
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
static void MapVolFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all volFields of Type.
static void MapDimFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all DimensionedFields of Type.
static void MapSurfaceFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all surfaceFields of Type.
ClassName("fvMeshAdder")
static void MapPointFields(const mapAddedPolyMesh &, const pointMesh &mesh, const labelListList &oldMeshPoints, const objectRegistry &meshToAdd)
Map all surfaceFields of Type.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
Class containing mesh-to-mesh mapping information after a mesh addition where we add a mesh ('added m...
Registry of regIOobjects.
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:52
Adds two meshes without using any polyMesh morphing.
Definition: polyMeshAdder.H:60
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:71
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
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