All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
inverseDistancePatchToPatch.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::inverseDistance
26 
27 Description
28  Class to generate patchToPatch coupling geometry. Couples a face to the
29  opposite face onto which its centre-normal ray projects, plus the immediate
30  neighbours to that opposite face. The proportion of contribution from the
31  different faces is calculated using inverse distance weighting.
32 
33 SourceFiles
34  inverseDistance.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef inverseDistancePatchToPatch_H
39 #define inverseDistancePatchToPatch_H
40 
41 #include "patchToPatch.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 namespace patchToPatches
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class inverseDistance Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class inverseDistance
55 :
56  public patchToPatch
57 {
58  // Private Member Data
59 
60  //- For each source face, the coupled target weights
61  List<DynamicList<scalar>> srcWeights_;
62 
63  //- For each target face, the coupled source weights
64  List<DynamicList<scalar>> tgtWeights_;
65 
66 
67  // Private Member Functions
68 
69  //- Get the bound box for a source face
70  virtual treeBoundBox srcBox
71  (
72  const face& srcFace,
73  const pointField& srcPoints,
74  const vectorField& srcPointNormals
75  ) const;
76 
77  //- Return whether or not the face contains a point
78  bool inside
79  (
80  const face& f,
81  const pointField& ps,
82  const point& p,
83  const vector& r
84  ) const;
85 
86  //- Intersect two faces
87  virtual bool intersectFaces
88  (
89  const primitivePatch& patch,
90  const primitivePatch& otherPatch,
91  const label facei,
92  const label otherFacei,
93  DynamicList<label>& faceOtherFaces,
94  DynamicList<scalar>& faceWeights
95  ) const;
96 
97  //- Intersect two faces
98  virtual bool intersectFaces
99  (
100  const primitiveOldTimePatch& srcPatch,
101  const vectorField& srcPointNormals,
102  const vectorField& srcPointNormals0,
103  const primitiveOldTimePatch& tgtPatch,
104  const label srcFacei,
105  const label tgtFacei
106  );
107 
108  //- Initialisation
109  virtual void initialise
110  (
111  const primitiveOldTimePatch& srcPatch,
112  const vectorField& srcPointNormals,
113  const vectorField& srcPointNormals0,
114  const primitiveOldTimePatch& tgtPatch
115  );
116 
117  //- Send data that resulted from an intersection between the source
118  // patch and a distributed source-local-target patch back to the
119  // original target processes.
120  virtual void rDistributeTgt
121  (
122  const primitiveOldTimePatch& tgtPatch,
123  const distributionMap& tgtMap
124  );
125 
126  //- Finalise the intersection
127  virtual label finalise
128  (
129  const primitiveOldTimePatch& srcPatch,
130  const vectorField& srcPointNormals,
131  const vectorField& srcPointNormals0,
132  const primitiveOldTimePatch& tgtPatch,
133  const transformer& tgtToSrc
134  );
135 
136 
137 public:
138 
139  //- Runtime type information
140  TypeName("inverseDistance");
141 
142 
143  // Constructors
144 
145  //- Construct from components
146  inverseDistance(const bool reverse);
147 
148 
149  //- Destructor
151 
152 
153  // Member Functions
154 
155  //- For each source face, the coupled target weights
157  (
158  const primitivePatch& srcPatch
159  ) const;
160 
161  //- For each target face, the coupled source weights
163  (
164  const primitivePatch& tgtPatch
165  ) const;
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace patchToPatches
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
inverseDistance(const bool reverse)
Construct from components.
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
Class to generate patchToPatch coupling geometry. Couples a face to the opposite face onto which its ...
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
bool reverse() const
Flag to indicate that the two patches are co-directional and.
Definition: patchToPatchI.H:87
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
virtual tmpNrc< List< DynamicList< scalar > > > srcWeights(const primitivePatch &srcPatch) const
For each source face, the coupled target weights.
virtual tmpNrc< List< DynamicList< scalar > > > tgtWeights(const primitivePatch &tgtPatch) const
For each target face, the coupled source weights.
labelList f(nPoints)
A class for managing temporary objects without reference counting.
Definition: tmpNrc.H:52
Class containing processor-to-processor mapping information.
TypeName("inverseDistance")
Runtime type information.
Standard boundBox + extra functionality for use in octree.
Definition: treeBoundBox.H:87
volScalarField & p
Class to generate coupling geometry between two primitive patches.
Definition: patchToPatch.H:53
Namespace for OpenFOAM.