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  (
150  const primitivePatch& srcPatch,
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 // ************************************************************************* //
Foam::faceAreaIntersect::triangulationMode
triangulationMode
Definition: faceAreaIntersect.H:63
Foam::DynamicList< label >
Foam::faceAreaWeightAMI2D::storeInterArea
void storeInterArea(const label srcFacei, const label tgtFacei, DynamicList< label > &srcAddr, DynamicList< scalar > &srcWght, DynamicList< vector > &srcCtr, DynamicList< label > &tgtAddr, DynamicList< scalar > &tgtWght) const
Definition: faceAreaWeightAMI2D.C:124
Foam::faceAreaWeightAMI2D
Face area weighted Arbitrary Mesh Interface (AMI) method that performs the intersection of src and tg...
Definition: faceAreaWeightAMI2D.H:52
Foam::faceAreaWeightAMI2D::faceAreaWeightAMI2D
faceAreaWeightAMI2D(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
Definition: faceAreaWeightAMI2D.C:260
Foam::faceAreaWeightAMI2D::writeNoMatch
void writeNoMatch(const label srcFacei, const labelList &tgtFaceCandidates, const boundBox &srcFaceBb) const
Definition: faceAreaWeightAMI2D.C:51
Foam::faceAreaWeightAMI2D::TypeName
TypeName("faceAreaWeightAMI2D")
Runtime type information.
AABBTree.H
Foam::AMIInterpolation::requireMatch
bool requireMatch() const
Access to the requireMatch flag.
Definition: AMIInterpolationI.H:74
Foam::faceAreaWeightAMI2D::calculate
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
Definition: faceAreaWeightAMI2D.C:303
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faceAreaWeightAMI2D::overlappingTgtFaces
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.
Definition: faceAreaWeightAMI2D.C:224
Foam::faceAreaWeightAMI2D::operator=
void operator=(const faceAreaWeightAMI2D &)=delete
No copy assignment.
Foam::faceAreaWeightAMI2D::Cbb_
scalar Cbb_
Face bounding box factor.
Definition: faceAreaWeightAMI2D.H:61
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::AMIInterpolation::lowWeightCorrection
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
Definition: AMIInterpolationI.H:99
Foam::faceAreaWeightAMI2D::write
virtual void write(Ostream &os) const
Write.
Definition: faceAreaWeightAMI2D.C:520
Foam::faceAreaWeightAMI2D::~faceAreaWeightAMI2D
virtual ~faceAreaWeightAMI2D()=default
Destructor.
Foam::AABBTree
Templated tree of axis-aligned bounding boxes (AABB)
Definition: AABBTree.H:59
Foam::List< label >
advancingFrontAMI.H
Foam::advancingFrontAMI
Base class for Arbitrary Mesh Interface (AMI) methods.
Definition: advancingFrontAMI.H:55
Foam::AMIInterpolation::reverseTarget
bool reverseTarget() const
Access to the reverseTarget flag.
Definition: AMIInterpolationI.H:93
Foam::faceAreaWeightAMI2D::clone
virtual autoPtr< AMIInterpolation > clone() const
Construct and return a clone.
Definition: faceAreaWeightAMI2D.H:134
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
Foam::advancingFrontAMI::srcPatch
const primitivePatch & srcPatch() const
Return const access to the source patch.
Definition: advancingFrontAMII.H:28
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::advancingFrontAMI::tgtPatch
const primitivePatch & tgtPatch() const
Return const access to the target patch.
Definition: advancingFrontAMII.H:41
Foam::faceAreaIntersect::tmMesh
Definition: faceAreaIntersect.H:66
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79