faceAreaWeightAMI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::faceAreaWeightAMI
26 
27 Description
28  Face area weighted Arbitrary Mesh Interface (AMI) method
29 
30 SourceFiles
31  faceAreaWeightAMI.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef faceAreaWeightAMI_H
36 #define faceAreaWeightAMI_H
37 
38 #include "AMIMethod.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class faceAreaWeightAMI Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class SourcePatch, class TargetPatch>
51 :
52  public AMIMethod<SourcePatch, TargetPatch>
53 {
54 private:
55 
56  // Private data
57 
58  //- Flag to restart uncovered source faces
59  const bool restartUncoveredSourceFace_;
60 
61 
62 protected:
63 
64  // Protected Member Functions
65 
66  //- Disallow default bitwise copy construct
68 
69  //- Disallow default bitwise assignment
70  void operator=(const faceAreaWeightAMI&);
71 
72  // Marching front
73 
74  //- Calculate addressing and weights using temporary storage
75  virtual void calcAddressing
76  (
77  List<DynamicList<label>>& srcAddress,
78  List<DynamicList<scalar>>& srcWeights,
79  List<DynamicList<label>>& tgtAddress,
80  List<DynamicList<scalar>>& tgtWeights,
81  label srcFacei,
82  label tgtFacei
83  );
84 
85  //- Determine overlap contributions for source face srcFacei
86  virtual bool processSourceFace
87  (
88  const label srcFacei,
89  const label tgtStartFacei,
90  DynamicList<label>& nbrFaces,
91  DynamicList<label>& visitedFaces,
92  List<DynamicList<label>>& srcAddr,
93  List<DynamicList<scalar>>& srcWght,
94  List<DynamicList<label>>& tgtAddr,
95  List<DynamicList<scalar>>& tgtWght
96  );
97 
98  //- Attempt to re-evaluate source faces that have not been included
99  virtual void restartUncoveredSourceFace
100  (
101  List<DynamicList<label>>& srcAddr,
102  List<DynamicList<scalar>>& srcWght,
103  List<DynamicList<label>>& tgtAddr,
104  List<DynamicList<scalar>>& tgtWght
105  );
106 
107  //- Set the source and target seed faces
108  virtual void setNextFaces
109  (
110  label& startSeedI,
111  label& srcFacei,
112  label& tgtFacei,
113  const boolList& mapFlag,
114  labelList& seedFaces,
115  const DynamicList<label>& visitedFaces,
116  bool errorOnNotFound = true
117  ) const;
118 
119 
120  // Evaluation
121 
122  //- The minimum weight below which connections are discarded
123  virtual scalar minWeight() const;
124 
125  //- Area of intersection between source and target faces
126  virtual scalar interArea
127  (
128  const label srcFacei,
129  const label tgtFacei
130  ) const;
131 
132 
133 public:
134 
135  //- Runtime type information
136  TypeName("faceAreaWeightAMI");
137 
138 
139  // Constructors
140 
141  //- Construct from components
143  (
144  const SourcePatch& srcPatch,
145  const TargetPatch& tgtPatch,
146  const scalarField& srcMagSf,
147  const scalarField& tgtMagSf,
149  const bool reverseTarget = false,
150  const bool requireMatch = true,
151  const bool restartUncoveredSourceFace = true
152  );
153 
154 
155  //- Destructor
156  virtual ~faceAreaWeightAMI();
157 
158 
159  // Member Functions
160 
161  // Manipulation
162 
163  //- Update addressing and weights
164  virtual void calculate
165  (
166  labelListList& srcAddress,
167  scalarListList& srcWeights,
168  labelListList& tgtAddress,
169  scalarListList& tgtWeights,
170  label srcFacei = -1,
171  label tgtFacei = -1
172  );
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #ifdef NoRepository
183  #include "faceAreaWeightAMI.C"
184 #endif
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
virtual void calcAddressing(List< DynamicList< label >> &srcAddress, List< DynamicList< scalar >> &srcWeights, List< DynamicList< label >> &tgtAddress, List< DynamicList< scalar >> &tgtWeights, label srcFacei, label tgtFacei)
Calculate addressing and weights using temporary storage.
virtual scalar interArea(const label srcFacei, const label tgtFacei) const
Area of intersection between source and target faces.
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< label >> &tgtAddr, List< DynamicList< scalar >> &tgtWght)
Determine overlap contributions for source face srcFacei.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:60
virtual ~faceAreaWeightAMI()
Destructor.
virtual void calculate(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label srcFacei=-1, label tgtFacei=-1)
Update addressing and weights.
TypeName("faceAreaWeightAMI")
Runtime type information.
Face area weighted Arbitrary Mesh Interface (AMI) method.
virtual scalar minWeight() const
The minimum weight below which connections are discarded.
virtual void setNextFaces(label &startSeedI, label &srcFacei, label &tgtFacei, const boolList &mapFlag, labelList &seedFaces, const DynamicList< label > &visitedFaces, bool errorOnNotFound=true) const
Set the source and target seed faces.
Base class for Arbitrary Mesh Interface (AMI) methods.
Definition: AMIMethod.H:55
void operator=(const faceAreaWeightAMI &)
Disallow default bitwise assignment.
virtual void restartUncoveredSourceFace(List< DynamicList< label >> &srcAddr, List< DynamicList< scalar >> &srcWght, List< DynamicList< label >> &tgtAddr, List< DynamicList< scalar >> &tgtWght)
Attempt to re-evaluate source faces that have not been included.
Namespace for OpenFOAM.
faceAreaWeightAMI(const faceAreaWeightAMI &)
Disallow default bitwise copy construct.