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 | Copyright (C) 2013-2016 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  //- Area of intersection between source and target faces
123  virtual scalar interArea
124  (
125  const label srcFacei,
126  const label tgtFacei
127  ) const;
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("faceAreaWeightAMI");
134 
135 
136  // Constructors
137 
138  //- Construct from components
140  (
141  const SourcePatch& srcPatch,
142  const TargetPatch& tgtPatch,
143  const scalarField& srcMagSf,
144  const scalarField& tgtMagSf,
146  const bool reverseTarget = false,
147  const bool requireMatch = true,
148  const bool restartUncoveredSourceFace = true
149  );
150 
151 
152  //- Destructor
153  virtual ~faceAreaWeightAMI();
154 
155 
156  // Member Functions
157 
158  // Manipulation
159 
160  //- Update addressing and weights
161  virtual void calculate
162  (
163  labelListList& srcAddress,
164  scalarListList& srcWeights,
165  labelListList& tgtAddress,
166  scalarListList& tgtWeights,
167  label srcFacei = -1,
168  label tgtFacei = -1
169  );
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #ifdef NoRepository
180  #include "faceAreaWeightAMI.C"
181 #endif
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
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 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:59
virtual scalar interArea(const label srcFacei, const label tgtFacei) const
Area of intersection between source and target faces.
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 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.