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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::faceAreaWeightAMI2D
28
29Description
30 Face area weighted Arbitrary Mesh Interface (AMI) method that performs
31 the intersection of src and tgt face area in 2D.
32
33SourceFiles
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
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class faceAreaWeightAMI2D Declaration
51\*---------------------------------------------------------------------------*/
54:
56{
57protected:
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
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
105public:
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 (
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// ************************************************************************* //
Templated tree of axis-aligned bounding boxes (AABB)
Definition: AABBTree.H:73
bool reverseTarget() const
Access to the reverseTarget flag.
bool requireMatch() const
Access to the requireMatch flag.
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of faces which address into the list of points.
Base class for Arbitrary Mesh Interface (AMI) methods.
const primitivePatch & tgtPatch() const
Return const access to the target patch.
const primitivePatch & srcPatch() const
Return const access to the source patch.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Face area weighted Arbitrary Mesh Interface (AMI) method that performs the intersection of src and tg...
virtual autoPtr< AMIInterpolation > clone() const
Construct and return a clone.
void storeInterArea(const label srcFacei, const label tgtFacei, DynamicList< label > &srcAddr, DynamicList< scalar > &srcWght, DynamicList< vector > &srcCtr, DynamicList< label > &tgtAddr, DynamicList< scalar > &tgtWght) const
virtual ~faceAreaWeightAMI2D()=default
Destructor.
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
scalar Cbb_
Face bounding box factor.
void operator=(const faceAreaWeightAMI2D &)=delete
No copy assignment.
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.
TypeName("faceAreaWeightAMI2D")
Runtime type information.
void writeNoMatch(const label srcFacei, const labelList &tgtFaceCandidates, const boundBox &srcFaceBb) const
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73