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 "patchToPatch.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 patchToPatch
55 {
56  // Private Member Data
57 
58  //- For each source face, the distance to its coupled target face
59  List<scalar> srcDistances_;
60 
61  //- For each target face, the distance to its coupled source face
62  List<scalar> tgtDistances_;
63 
64 
65  // Private Member Functions
66 
67  //- Get the bound box for a source face
68  virtual treeBoundBox srcBox
69  (
70  const face& srcFace,
71  const pointField& srcPoints,
72  const vectorField& srcPointNormals
73  ) const;
74 
75  //- Intersect two faces
76  bool intersectFaces
77  (
78  const primitivePatch& patch,
79  const primitivePatch& otherPatch,
80  const label facei,
81  const label otherFacei,
82  DynamicList<label>& faceOtherFaces,
83  scalar& faceDistance
84  ) const;
85 
86  //- Intersect two faces
87  virtual bool intersectFaces
88  (
89  const primitiveOldTimePatch& srcPatch,
90  const vectorField& srcPointNormals,
91  const vectorField& srcPointNormals0,
92  const primitiveOldTimePatch& tgtPatch,
93  const label srcFacei,
94  const label tgtFacei
95  );
96 
97  //- Initialisation
98  virtual void initialise
99  (
100  const primitiveOldTimePatch& srcPatch,
101  const vectorField& srcPointNormals,
102  const vectorField& srcPointNormals0,
103  const primitiveOldTimePatch& tgtPatch
104  );
105 
106  //- Send data that resulted from an intersection between the source
107  // patch and a distributed source-local-target patch back to the
108  // original target processes.
109  virtual void rDistributeTgt
110  (
111  const primitiveOldTimePatch& tgtPatch,
112  const distributionMap& tgtMap
113  );
114 
115 
116 public:
117 
118  //- Runtime type information
119  TypeName("nearest");
120 
121 
122  // Constructors
123 
124  //- Construct from components
125  nearest(const bool reverse);
126 
127 
128  //- Destructor
129  ~nearest();
130 
131 
132  // Member Functions
133 
134  //- For each source face, the coupled target weights
136  (
137  const primitivePatch& srcPatch
138  ) const;
139 
140  //- For each target face, the coupled source weights
142  (
143  const primitivePatch& tgtPatch
144  ) const;
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace patchToPatches
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
bool reverse() const
Flag to indicate that the two patches are co-directional and.
Definition: patchToPatchI.H:87
Class to generate patchToPatch coupling geometry. Couples a face to the single nearest opposite face ...
TypeName("nearest")
Runtime type information.
virtual tmpNrc< List< DynamicList< scalar > > > srcWeights(const primitivePatch &srcPatch) const
For each source face, the coupled target weights.
A list of faces which address into the list of points.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
nearest(const bool reverse)
Construct from components.
A class for managing temporary objects without reference counting.
Definition: tmpNrc.H:52
Class containing processor-to-processor mapping information.
Standard boundBox + extra functionality for use in octree.
Definition: treeBoundBox.H:87
Class to generate coupling geometry between two primitive patches.
Definition: patchToPatch.H:53
virtual tmpNrc< List< DynamicList< scalar > > > tgtWeights(const primitivePatch &tgtPatch) const
For each target face, the coupled source weights.
Namespace for OpenFOAM.