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  Searching is performed using an advancing front.
34 
35 SourceFiles
36  faceAreaWeightAMI.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef faceAreaWeightAMI_H
41 #define faceAreaWeightAMI_H
42 
43 #include "advancingFrontAMI.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class faceAreaWeightAMI Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public advancingFrontAMI
57 {
58 private:
59 
60  // Private data
61 
62  //- Flag to restart uncovered source faces
63  const bool restartUncoveredSourceFace_;
64 
65 
66 protected:
67 
68  // Protected Member Functions
69 
70  //- No copy assignment
71  void operator=(const faceAreaWeightAMI&) = delete;
72 
73 
74  // Marching front
75 
76  //- Calculate addressing, weights and centroids using temporary
77  //- storage
78  virtual void calcAddressing
79  (
85  label srcFacei,
86  label tgtFacei
87  );
88 
89  //- Determine overlap contributions for source face srcFacei
90  virtual bool processSourceFace
91  (
92  const label srcFacei,
93  const label tgtStartFacei,
94  DynamicList<label>& nbrFaces,
95  DynamicList<label>& visitedFaces,
96  List<DynamicList<label>>& srcAddr,
97  List<DynamicList<scalar>>& srcWght,
98  List<DynamicList<point>>& srcCtr,
99  List<DynamicList<label>>& tgtAddr,
100  List<DynamicList<scalar>>& tgtWght
101  );
102 
103  //- Attempt to re-evaluate source faces that have not been included
104  virtual void restartUncoveredSourceFace
105  (
106  List<DynamicList<label>>& srcAddr,
107  List<DynamicList<scalar>>& srcWght,
108  List<DynamicList<point>>& srcCtr,
109  List<DynamicList<label>>& tgtAddr,
110  List<DynamicList<scalar>>& tgtWght
111  );
112 
113  //- Set the source and target seed faces
114  virtual bool setNextFaces
115  (
116  label& startSeedi,
117  label& srcFacei,
118  label& tgtFacei,
119  const bitSet& mapFlag,
120  labelList& seedFaces,
121  const DynamicList<label>& visitedFaces,
122  const bool errorOnNotFound = true
123  ) const;
124 
125 
126  // Evaluation
127 
128  //- Area of intersection between source and target faces
129  virtual void calcInterArea
130  (
131  const label srcFacei,
132  const label tgtFacei,
133  scalar& area,
134  vector& centroid
135  ) const;
136 
137  //- Return true if faces overlap
138  virtual bool overlaps
139  (
140  const label srcFacei,
141  const label tgtFacei,
142  const scalar threshold
143  ) const;
144 
145 
146 public:
147 
148  //- Runtime type information
149  TypeName("faceAreaWeightAMI");
150 
151 
152  // Constructors
153 
154  //- Construct from dictionary
156  (
157  const dictionary& dict,
158  const bool reverseTarget = false
159  );
160 
161  //- Construct from components
163  (
164  const bool requireMatch,
165  const bool reverseTarget = false,
166  const scalar lowWeightCorrection = -1,
169  const bool restartUncoveredSourceFace = true
170  );
171 
172  //- Construct as copy
174 
175  //- Construct and return a clone
176  virtual autoPtr<AMIInterpolation> clone() const
177  {
178  return autoPtr<AMIInterpolation>(new faceAreaWeightAMI(*this));
179  }
180 
181 
182  //- Destructor
183  virtual ~faceAreaWeightAMI() = default;
184 
185 
186  // Member Functions
187 
188  //- Update addressing, weights and (optional) centroids
189  virtual bool calculate
190  (
191  const primitivePatch& srcPatch,
192  const primitivePatch& tgtPatch,
193  const autoPtr<searchableSurface>& surfPtr = nullptr
194  );
195 
196  //- Write
197  virtual void write(Ostream& os) const;
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
Foam::faceAreaWeightAMI::write
virtual void write(Ostream &os) const
Write.
Definition: faceAreaWeightAMI.C:804
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:522
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:183
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
Foam::AMIInterpolation::srcCentroids
const pointListList & srcCentroids() const
Return const access to source patch face centroids.
Definition: AMIInterpolationI.H:165
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:195
Foam::AMIInterpolation::tgtWeights
const scalarListList & tgtWeights() const
Return const access to target patch weights.
Definition: AMIInterpolationI.H:207
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:256
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:373
Foam::faceAreaWeightAMI::~faceAreaWeightAMI
virtual ~faceAreaWeightAMI()=default
Destructor.
Foam::faceAreaWeightAMI
Face area weighted Arbitrary Mesh Interface (AMI) method.
Definition: faceAreaWeightAMI.H:53
Foam::faceAreaWeightAMI::faceAreaWeightAMI
faceAreaWeightAMI(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
Definition: faceAreaWeightAMI.C:598
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:641
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:175
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::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::faceAreaWeightAMI::operator=
void operator=(const faceAreaWeightAMI &)=delete
No copy assignment.
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
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::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:98
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:456
Foam::AMIInterpolation::srcAddress
const labelListList & srcAddress() const
Return const access to source patch addressing.
Definition: AMIInterpolationI.H:129
Foam::AMIInterpolation::srcWeights
const scalarListList & srcWeights() const
Return const access to source patch weights.
Definition: AMIInterpolationI.H:141
Foam::faceAreaIntersect::tmMesh
Definition: faceAreaIntersect.H:66
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79