nearestPatchToPatch.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) 2021-2022 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::patchToPatches::nearest
26 
27 Description
28  Class to generate patchToPatch coupling geometry. Couples a face to the
29  single nearest opposite face only.
30 
31 SourceFiles
32  nearest.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef nearestPatchToPatch_H
37 #define nearestPatchToPatch_H
38 
39 #include "nearbyPatchToPatch.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 namespace patchToPatches
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class nearest Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class nearest
53 :
54  public nearby
55 {
56 protected:
57 
58  // Private Member Data
59 
60  //- For each source face, the distance to its coupled target face
62 
63  //- For each target face, the distance to its coupled source face
65 
66 
67  // Private Member Functions
68 
69  //- Intersect two faces
70  virtual bool intersectFaces
71  (
72  const primitiveOldTimePatch& srcPatch,
73  const vectorField& srcPointNormals,
74  const vectorField& srcPointNormals0,
75  const primitiveOldTimePatch& tgtPatch,
76  const label srcFacei,
77  const label tgtFacei
78  );
79 
80  //- Initialisation
81  virtual void initialise
82  (
83  const primitiveOldTimePatch& srcPatch,
84  const vectorField& srcPointNormals,
85  const vectorField& srcPointNormals0,
86  const primitiveOldTimePatch& tgtPatch
87  );
88 
89  //- Finalise the intersection locally. Trims the local target patch
90  // so that only parts that actually intersect the source remain.
91  // Returns new-to-old map for trimming target-associated data.
92  virtual labelList finaliseLocal
93  (
94  const primitiveOldTimePatch& srcPatch,
95  const vectorField& srcPointNormals,
96  const vectorField& srcPointNormals0,
97  const primitiveOldTimePatch& tgtPatch
98  );
99 
100  //- Send data that resulted from an intersection between the source
101  // patch and a distributed source-local-target patch back to the
102  // original target processes
103  virtual void rDistributeTgt(const primitiveOldTimePatch& tgtPatch);
104 
105  //- Finalise the intersection
106  virtual label finalise
107  (
108  const primitiveOldTimePatch& srcPatch,
109  const vectorField& srcPointNormals,
110  const vectorField& srcPointNormals0,
111  const primitiveOldTimePatch& tgtPatch,
112  const transformer& tgtToSrc
113  );
114 
115  //- For each source face, the coupled target weights
117 
118  //- For each target face, the coupled source weights
120 
121 
122 public:
123 
124  //- Runtime type information
125  TypeName("nearest");
126 
127 
128  // Constructors
129 
130  //- Construct from components
131  nearest(const bool reverse);
132 
133 
134  //- Destructor
135  ~nearest();
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace patchToPatches
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #endif
147 
148 // ************************************************************************* //
tmp< Field< Type > > tgtToSrc(const Field< Type > &tgtFld) const
Interpolate a target patch field to the source with no left.
bool reverse() const
Flag to indicate that the two patches are co-directional and.
Definition: patchToPatchI.H:31
Class to generate patchToPatch coupling geometry. Couples a face to the single nearby opposite face o...
Class to generate patchToPatch coupling geometry. Couples a face to the single nearest opposite face ...
nearest(const bool reverse)
Construct from components.
virtual tmpNrc< List< DynamicList< scalar > > > tgtWeights() const
For each target face, the coupled source weights.
List< scalar > tgtDistances_
For each target face, the distance to its coupled source face.
List< scalar > srcDistances_
For each source face, the distance to its coupled target face.
virtual void rDistributeTgt(const primitiveOldTimePatch &tgtPatch)
Send data that resulted from an intersection between the source.
virtual labelList finaliseLocal(const primitiveOldTimePatch &srcPatch, const vectorField &srcPointNormals, const vectorField &srcPointNormals0, const primitiveOldTimePatch &tgtPatch)
Finalise the intersection locally. Trims the local target patch.
virtual bool intersectFaces(const primitiveOldTimePatch &srcPatch, const vectorField &srcPointNormals, const vectorField &srcPointNormals0, const primitiveOldTimePatch &tgtPatch, const label srcFacei, const label tgtFacei)
Intersect two faces.
virtual void initialise(const primitiveOldTimePatch &srcPatch, const vectorField &srcPointNormals, const vectorField &srcPointNormals0, const primitiveOldTimePatch &tgtPatch)
Initialisation.
TypeName("nearest")
Runtime type information.
virtual tmpNrc< List< DynamicList< scalar > > > srcWeights() const
For each source face, the coupled target weights.
virtual label finalise(const primitiveOldTimePatch &srcPatch, const vectorField &srcPointNormals, const vectorField &srcPointNormals0, const primitiveOldTimePatch &tgtPatch, const transformer &tgtToSrc)
Finalise the intersection.
A class for managing temporary objects without reference counting.
Definition: tmpNrc.H:53
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
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