meshToMesh.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) 2012-2023 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::meshToMesh
26 
27 Description
28  Class to calculate interpolative addressing and weights between the cells
29  and patches of two overlapping meshes
30 
31 SourceFiles
32  meshToMesh.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef meshToMesh_H
37 #define meshToMesh_H
38 
39 #include "polyMesh.H"
40 #include "cellsToCells.H"
42 #include "patchToPatch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class meshToMesh Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class meshToMesh
55 {
56  // Private Data
57 
58  //- Reference to the source mesh
59  const polyMesh& srcMesh_;
60 
61  //- Reference to the target mesh
62  const polyMesh& tgtMesh_;
63 
64  //- Interpolation engine between source and target cells
65  autoPtr<cellsToCells> cellsInterpolation_;
66 
67  //- Stabilisation engine for the source cells
68  mutable autoPtr<cellsToCellsStabilisation> srcCellsStabilisation_;
69 
70  //- Stabilisation engine for the target cells
71  mutable autoPtr<cellsToCellsStabilisation> tgtCellsStabilisation_;
72 
73  //- List of corresponding source and target patch indices
74  List<labelPair> patchIDs_;
75 
76  //- List of interpolation engines between source and target patches
77  PtrList<patchToPatch> patchInterpolations_;
78 
79  //- List of stabilisation engines for the source patches
80  mutable PtrList<patchToPatchStabilisation> srcPatchStabilisations_;
81 
82  //- List of stabilisation engines for the source patches
83  mutable PtrList<patchToPatchStabilisation> tgtPatchStabilisations_;
84 
85 
86 protected:
87 
88  // Protected Member Functions
89 
90  // Access
91 
92  //- Return the interpolation engine between source and target cells
93  inline const cellsToCells& cellsInterpolation() const;
94 
95  //- Return the stabilisation engine for the source cells
96  inline const cellsToCellsStabilisation&
97  srcCellsStabilisation() const;
98 
99  //- Return the stabilisation engine for the target cells
100  inline const cellsToCellsStabilisation&
101  tgtCellsStabilisation() const;
102 
103  //- Return the list of corresponding source and target patch indices
104  inline const List<labelPair>& patchIDs() const;
105 
106  //- Return the interpolation engine between a source and a target
107  // patch
108  inline const patchToPatch& patchInterpolation
109  (
110  const label i
111  ) const;
112 
113  //- Return the stabilisation engine for a source patch
115  (
116  const label i
117  ) const;
118 
119  //- Return the stabilisation engine for a target patch
121  (
122  const label i
123  ) const;
124 
125 
126 public:
127 
128  //- Run-time type information
129  TypeName("meshToMesh");
130 
131 
132  // Constructors
133 
134  //- Construct from source and target meshes. If a patchMap is supplied,
135  // then interpolate between the specified patches. If not, then assume
136  // a consistent mesh with consistently named patches and interpolate
137  // 1-to-1 between patches with the same name.
138  meshToMesh
139  (
140  const polyMesh& srcMesh,
141  const polyMesh& tgtMesh,
142  const word& engineType,
143  const HashTable<word>& patchMap = NullObjectRef<HashTable<word>>()
144  );
145 
146  //- Disallow default bitwise copy construction
147  meshToMesh(const meshToMesh&) = delete;
148 
149 
150  //- Destructor
151  virtual ~meshToMesh();
152 
153 
154  // Member Functions
155 
156  // Access
157 
158  //- Return const access to the source mesh
159  inline const polyMesh& srcMesh() const;
160 
161  //- Return const access to the target mesh
162  inline const polyMesh& tgtMesh() const;
163 
164  //- Is the interpolation between consistent meshes? I.e., are all
165  // (non-processor) patches coupled one-to-one?
166  bool consistent() const;
167 
168 
169  // Source-to-target point finding
170 
171  //- Find the target processor and cell associated with a point in a
172  // source cell. See cellsToCells::srcToTgtPoint.
173  remote srcToTgtPoint(const label srcCelli, const point& p) const;
174 
175 
176  // Member Operators
177 
178  //- Disallow default bitwise assignment
179  void operator=(const meshToMesh&) = delete;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #include "meshToMeshI.H"
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
An STL-conforming hash table.
Definition: HashTable.H:127
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Stabilisation data and routines for cell-to-cell interpolations.
Class to calculate interpolative addressing and weights between the cells of two overlapping meshes.
Definition: cellsToCells.H:56
Class to calculate interpolative addressing and weights between the cells and patches of two overlapp...
Definition: meshToMesh.H:54
virtual ~meshToMesh()
Destructor.
Definition: meshToMesh.C:190
const polyMesh & srcMesh() const
Return const access to the source mesh.
Definition: meshToMeshI.H:127
const cellsToCellsStabilisation & tgtCellsStabilisation() const
Return the stabilisation engine for the target cells.
Definition: meshToMeshI.H:54
const patchToPatch & patchInterpolation(const label i) const
Return the interpolation engine between a source and a target.
Definition: meshToMeshI.H:77
remote srcToTgtPoint(const label srcCelli, const point &p) const
Find the target processor and cell associated with a point in a.
Definition: meshToMesh.C:249
const cellsToCellsStabilisation & srcCellsStabilisation() const
Return the stabilisation engine for the source cells.
Definition: meshToMeshI.H:37
const polyMesh & tgtMesh() const
Return const access to the target mesh.
Definition: meshToMeshI.H:133
TypeName("meshToMesh")
Run-time type information.
void operator=(const meshToMesh &)=delete
Disallow default bitwise assignment.
const patchToPatchStabilisation & srcPatchStabilisation(const label i) const
Return the stabilisation engine for a source patch.
Definition: meshToMeshI.H:86
const List< labelPair > & patchIDs() const
Return the list of corresponding source and target patch indices.
Definition: meshToMeshI.H:70
bool consistent() const
Is the interpolation between consistent meshes? I.e., are all.
Definition: meshToMesh.C:196
meshToMesh(const polyMesh &srcMesh, const polyMesh &tgtMesh, const word &engineType, const HashTable< word > &patchMap=NullObjectRef< HashTable< word >>())
Construct from source and target meshes. If a patchMap is supplied,.
Definition: meshToMesh.C:43
const cellsToCells & cellsInterpolation() const
Return the interpolation engine between source and target cells.
Definition: meshToMeshI.H:30
const patchToPatchStabilisation & tgtPatchStabilisation(const label i) const
Return the stabilisation engine for a target patch.
Definition: meshToMeshI.H:106
Stabilisation data and routines for patch-to-patch interpolations.
Class to generate coupling geometry between two primitive patches.
Definition: patchToPatch.H:56
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Struct for keeping processor, element (cell, face, point) index.
Definition: remote.H:57
A class for handling words, derived from string.
Definition: word.H:62
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
const T & NullObjectRef()
Return const reference to the nullObject of type T.
Definition: nullObjectI.H:27
volScalarField & p