faceAreaWeightAMI2D.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::faceAreaWeightAMI2D
28 
29 Description
30  Face area weighted Arbitrary Mesh Interface (AMI) method that performs
31  the intersection of src and tgt face area in 2D.
32 
33 SourceFiles
34  faceAreaWeightAMI2D.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef faceAreaWeightAMI2D_H
39 #define faceAreaWeightAMI2D_H
40 
41 #include "advancingFrontAMI.H"
42 #include "AABBTree.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class faceAreaWeightAMI2D Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public advancingFrontAMI
56 {
57 protected:
58 
59  // Protected Data
60 
61  //- Face bounding box factor
62  scalar Cbb_;
63 
64 
65  // Protected Member Functions
66 
67  //- No copy assignment
68  void operator=(const faceAreaWeightAMI2D&) = delete;
69 
70  //- Helper function to write non-matched source faces to the set
71  //- of candidate faces
72  void writeNoMatch
73  (
74  const label srcFacei,
75  const labelList& tgtFaceCandidates,
76  const boundBox& srcFaceBb
77  ) const;
78 
79 
80  // Evaluation
81 
82  //- Calculate and store the area of intersection between source and
83  //- target faces
84  void storeInterArea
85  (
86  const label srcFacei,
87  const label tgtFacei,
88  DynamicList<label>& srcAddr,
89  DynamicList<scalar>& srcWght,
90  DynamicList<vector>& srcCtr,
91  DynamicList<label>& tgtAddr,
92  DynamicList<scalar>& tgtWght
93  ) const;
94 
95 
96  //- Return the set of tgt face IDs that overlap the src face bb
98  (
99  const AABBTree<face>& tree,
100  const List<boundBox>& tgtFaceBbs,
101  const boundBox& srcFaceBb
102  ) const;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("faceAreaWeightAMI2D");
109 
110 
111  // Constructors
112 
113  //- Construct from dictionary
115  (
116  const dictionary& dict,
117  const bool reverseTarget = false
118  );
119 
120  //- Construct from components
122  (
123  const bool requireMatch,
124  const bool reverseTarget = false,
125  const scalar lowWeightCorrection = -1,
128  const bool restartUncoveredSourceFace = true
129  );
130 
131  //- Construct as copy
133 
134  //- Construct and return a clone
135  virtual autoPtr<AMIInterpolation> clone() const
136  {
138  }
139 
140 
141  //- Destructor
142  virtual ~faceAreaWeightAMI2D() = default;
143 
144 
145  // Member Functions
146 
147  //- Update addressing, weights and (optional) centroids
148  virtual bool calculate
149  (
151  const primitivePatch& tgtPatch,
152  const autoPtr<searchableSurface>& surfPtr = nullptr
153  );
154 
155  //- Write
156  virtual void write(Ostream& os) const;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
dictionary dict
void writeNoMatch(const label srcFacei, const labelList &tgtFaceCandidates, const boundBox &srcFaceBb) const
Helper function to write non-matched source faces to the set of candidate faces.
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual ~faceAreaWeightAMI2D()=default
Destructor.
bool requireMatch() const noexcept
Return the requireMatch flag.
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
scalar Cbb_
Face bounding box factor.
virtual void write(Ostream &os) const
Write.
void operator=(const faceAreaWeightAMI2D &)=delete
No copy assignment.
virtual autoPtr< AMIInterpolation > clone() const
Construct and return a clone.
const primitivePatch & tgtPatch() const
Return const access to the target patch.
A list of faces which address into the list of points.
Face area weighted Arbitrary Mesh Interface (AMI) method that performs the intersection of src and tg...
Tree tree(triangles.begin(), triangles.end())
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
labelList overlappingTgtFaces(const AABBTree< face > &tree, const List< boundBox > &tgtFaceBbs, const boundBox &srcFaceBb) const
Return the set of tgt face IDs that overlap the src face bb.
Templated tree of axis-aligned bounding boxes (AABB)
Definition: AABBTree.H:55
bool reverseTarget() const noexcept
Access to the reverseTarget flag.
TypeName("faceAreaWeightAMI2D")
Runtime type information.
faceAreaWeightAMI2D(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
Base class for Arbitrary Mesh Interface (AMI) methods.
void storeInterArea(const label srcFacei, const label tgtFacei, DynamicList< label > &srcAddr, DynamicList< scalar > &srcWght, DynamicList< vector > &srcCtr, DynamicList< label > &tgtAddr, DynamicList< scalar > &tgtWght) const
Calculate and store the area of intersection between source and target faces.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
const primitivePatch & srcPatch() const
Return const access to the source patch.
Namespace for OpenFOAM.