faceAreaWeightAMI.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) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2016 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::faceAreaWeightAMI
29 
30 Description
31  Face area weighted Arbitrary Mesh Interface (AMI) method
32 
33 SourceFiles
34  faceAreaWeightAMI.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef faceAreaWeightAMI_H
39 #define faceAreaWeightAMI_H
40 
41 #include "advancingFrontAMI.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class faceAreaWeightAMI Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 :
54  public advancingFrontAMI
55 {
56 private:
57 
58  // Private data
59 
60  //- Flag to restart uncovered source faces
61  const bool restartUncoveredSourceFace_;
62 
63 
64 
65 protected:
66 
67  // Protected Member Functions
68 
69  //- No copy assignment
70  void operator=(const faceAreaWeightAMI&) = delete;
71 
72  //- Initialise the geometry
73  void initGeom
74  (
75  const primitivePatch& srcPatch,
76  const primitivePatch& tgtPatch,
77  const globalIndex& globalTgtFaces,
78  labelList& extendedTgtFaceIDs
79  );
80 
81 
82  // Marching front
83 
84  //- Calculate addressing, weights and centroids using temporary
85  //- storage
86  virtual void calcAddressing
87  (
93  label srcFacei,
94  label tgtFacei
95  );
96 
97  //- Determine overlap contributions for source face srcFacei
98  virtual bool processSourceFace
99  (
100  const label srcFacei,
101  const label tgtStartFacei,
102  DynamicList<label>& nbrFaces,
103  DynamicList<label>& visitedFaces,
104  List<DynamicList<label>>& srcAddr,
105  List<DynamicList<scalar>>& srcWght,
106  List<DynamicList<point>>& srcCtr,
107  List<DynamicList<label>>& tgtAddr,
108  List<DynamicList<scalar>>& tgtWght
109  );
110 
111  //- Attempt to re-evaluate source faces that have not been included
112  virtual void restartUncoveredSourceFace
113  (
114  List<DynamicList<label>>& srcAddr,
115  List<DynamicList<scalar>>& srcWght,
116  List<DynamicList<point>>& srcCtr,
117  List<DynamicList<label>>& tgtAddr,
118  List<DynamicList<scalar>>& tgtWght
119  );
120 
121  //- Set the source and target seed faces
122  virtual bool setNextFaces
123  (
124  label& startSeedi,
125  label& srcFacei,
126  label& tgtFacei,
127  const bitSet& mapFlag,
128  labelList& seedFaces,
129  const DynamicList<label>& visitedFaces,
130  const bool errorOnNotFound = true
131  ) const;
132 
133 
134  // Evaluation
135 
136  //- Area of intersection between source and target faces
137  virtual void calcInterArea
138  (
139  const label srcFacei,
140  const label tgtFacei,
141  scalar& area,
142  vector& centroid
143  ) const;
144 
145  //- Return true if faces overlap
146  virtual bool overlaps
147  (
148  const label srcFacei,
149  const label tgtFacei,
150  const scalar threshold
151  ) const;
152 
153 
154 public:
155 
156  //- Runtime type information
157  TypeName("faceAreaWeightAMI");
158 
159 
160  // Constructors
161 
162  //- Construct from dictionary
164  (
165  const dictionary& dict,
166  const bool reverseTarget = false
167  );
168 
169  //- Construct from components
171  (
172  const bool requireMatch,
173  const bool reverseTarget = false,
174  const scalar lowWeightCorrection = -1,
177  const bool restartUncoveredSourceFace = true
178  );
179 
180  //- Construct as copy
182 
183  //- Construct and return a clone
184  virtual autoPtr<AMIInterpolation> clone() const
185  {
186  return autoPtr<AMIInterpolation>(new faceAreaWeightAMI(*this));
187  }
188 
189 
190  //- Destructor
191  virtual ~faceAreaWeightAMI() = default;
192 
193 
194  // Member Functions
195 
196  //- Update addressing, weights and (optional) centroids
197  virtual bool calculate
198  (
199  const primitivePatch& srcPatch,
200  const primitivePatch& tgtPatch,
201  const autoPtr<searchableSurface>& surfPtr = nullptr
202  );
203 
204  //- Write
205  virtual void write(Ostream& os) const;
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
Foam::faceAreaWeightAMI::write
virtual void write(Ostream &os) const
Write.
Definition: faceAreaWeightAMI.C:786
Foam::faceAreaWeightAMI::restartUncoveredSourceFace
virtual void restartUncoveredSourceFace(List< DynamicList< label >> &srcAddr, List< DynamicList< scalar >> &srcWght, List< DynamicList< point >> &srcCtr, List< DynamicList< label >> &tgtAddr, List< DynamicList< scalar >> &tgtWght)
Attempt to re-evaluate source faces that have not been included.
Definition: faceAreaWeightAMI.C:506
Foam::faceAreaWeightAMI::processSourceFace
virtual bool processSourceFace(const label srcFacei, const label tgtStartFacei, DynamicList< label > &nbrFaces, DynamicList< label > &visitedFaces, List< DynamicList< label >> &srcAddr, List< DynamicList< scalar >> &srcWght, List< DynamicList< point >> &srcCtr, List< DynamicList< label >> &tgtAddr, List< DynamicList< scalar >> &tgtWght)
Determine overlap contributions for source face srcFacei.
Definition: faceAreaWeightAMI.C:167
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:64
Foam::AMIInterpolation::srcCentroids
const pointListList & srcCentroids() const
Return const access to source patch face centroids.
Definition: AMIInterpolationI.H:159
Foam::faceAreaIntersect::triangulationMode
triangulationMode
Definition: faceAreaIntersect.H:63
Foam::DynamicList< label >
Foam::AMIInterpolation::tgtAddress
const labelListList & tgtAddress() const
Return const access to target patch addressing.
Definition: AMIInterpolationI.H:189
Foam::AMIInterpolation::tgtWeights
const scalarListList & tgtWeights() const
Return const access to target patch weights.
Definition: AMIInterpolationI.H:201
Foam::faceAreaWeightAMI::setNextFaces
virtual bool setNextFaces(label &startSeedi, label &srcFacei, label &tgtFacei, const bitSet &mapFlag, labelList &seedFaces, const DynamicList< label > &visitedFaces, const bool errorOnNotFound=true) const
Set the source and target seed faces.
Definition: faceAreaWeightAMI.C:240
Foam::faceAreaWeightAMI::calcInterArea
virtual void calcInterArea(const label srcFacei, const label tgtFacei, scalar &area, vector &centroid) const
Area of intersection between source and target faces.
Definition: faceAreaWeightAMI.C:357
Foam::faceAreaWeightAMI::~faceAreaWeightAMI
virtual ~faceAreaWeightAMI()=default
Destructor.
Foam::faceAreaWeightAMI
Face area weighted Arbitrary Mesh Interface (AMI) method.
Definition: faceAreaWeightAMI.H:51
Foam::faceAreaWeightAMI::faceAreaWeightAMI
faceAreaWeightAMI(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
Definition: faceAreaWeightAMI.C:582
Foam::faceAreaWeightAMI::TypeName
TypeName("faceAreaWeightAMI")
Runtime type information.
Foam::faceAreaWeightAMI::calculate
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
Definition: faceAreaWeightAMI.C:625
Foam::AMIInterpolation::requireMatch
bool requireMatch() const
Access to the requireMatch flag.
Definition: AMIInterpolationI.H:74
Foam::faceAreaWeightAMI::clone
virtual autoPtr< AMIInterpolation > clone() const
Construct and return a clone.
Definition: faceAreaWeightAMI.H:183
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:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faceAreaWeightAMI::initGeom
void initGeom(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const globalIndex &globalTgtFaces, labelList &extendedTgtFaceIDs)
Initialise the geometry.
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:68
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:93
Foam::faceAreaWeightAMI::operator=
void operator=(const faceAreaWeightAMI &)=delete
No copy assignment.
Foam::Vector< scalar >
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:87
Foam::fieldTypes::area
const wordList area
Standard area field types (scalar, vector, tensor, etc)
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::faceAreaWeightAMI::calcAddressing
virtual void calcAddressing(List< DynamicList< label >> &srcAddress, List< DynamicList< scalar >> &srcWeights, List< DynamicList< point >> &srcCentroids, List< DynamicList< label >> &tgtAddress, List< DynamicList< scalar >> &tgtWeights, label srcFacei, label tgtFacei)
Definition: faceAreaWeightAMI.C:85
Foam::advancingFrontAMI::tgtPatch
const primitivePatch & tgtPatch() const
Return const access to the target patch.
Definition: advancingFrontAMII.H:41
Foam::faceAreaWeightAMI::overlaps
virtual bool overlaps(const label srcFacei, const label tgtFacei, const scalar threshold) const
Return true if faces overlap.
Definition: faceAreaWeightAMI.C:440
Foam::AMIInterpolation::srcAddress
const labelListList & srcAddress() const
Return const access to source patch addressing.
Definition: AMIInterpolationI.H:123
Foam::AMIInterpolation::srcWeights
const scalarListList & srcWeights() const
Return const access to source patch weights.
Definition: AMIInterpolationI.H:135
Foam::faceAreaIntersect::tmMesh
Definition: faceAreaIntersect.H:66
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85