Loading...
Searching...
No Matches
advancingFrontAMI.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-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::advancingFrontAMI
29
30Description
31 Base class for Arbitrary Mesh Interface (AMI) methods
32
33SourceFiles
34 advancingFrontAMI.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef advancingFrontAMI_H
39#define advancingFrontAMI_H
40
41#include "className.H"
42#include "DynamicList.H"
43#include "faceAreaIntersect.H"
44#include "pointList.H"
45#include "AMIInterpolation.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
52/*---------------------------------------------------------------------------*\
53 Class advancingFrontAMI Declaration
54\*---------------------------------------------------------------------------*/
55
57:
58 public AMIInterpolation
59{
60public:
61
62 //- Area normalisation mode
64 {
65 project,
66 mag
67 };
68
70
71
72private:
73
74 // Private Member Functions
75
76 //- No copy assignment
77 void operator=(const advancingFrontAMI&) = delete;
78
79
80 // Parallel operations
81
82 label calcOverlappingProcs
83 (
84 const List<treeBoundBoxList>& procBb,
85 const treeBoundBox& bb,
86 boolList& overlaps
87 ) const;
88
89 void distributePatches
90 (
91 const mapDistribute& map,
92 const primitivePatch& pp,
93 const globalIndex& gi,
94 List<faceList>& faces,
96 List<labelList>& tgtFaceIDs
97 ) const;
98
99 void distributeAndMergePatches
100 (
101 const mapDistribute& map,
103 const globalIndex& gi,
104 faceList& tgtFaces,
105 pointField& tgtPoints,
106 labelList& tgtFaceIDs
107 ) const;
108
109 autoPtr<mapDistribute> calcProcMap
110 (
113 ) const;
114
115
116protected:
117
118 // Protected data
119
120 //- Maximum squared distance
121 const scalar maxDistance2_;
123 //- Minimum (cos of) angle. 1 for perfectly matching.
124 const scalar minCosAngle_;
125
126 //- Storage for src-side triangle decomposition
128
129 //- Storage for tgt-side triangle decomposition
131
132 //- Demand-driven extended target mesh (distributed parallel usage)
134
135 //- Extended patch faces
138 //- Extended patch points
140
141 //- Extended patch face IDs
143
144 //- Extended patch map
146
147 //- Labels of faces that are not overlapped by any target faces
148 //- (should be empty for correct functioning for fully covered AMIs)
150
151 //- Octree used to find face seeds
153
154 //- Face triangulation mode
156
157 //- Area normalisation mode; default = project
159
160
161 // Protected Member Functions
163 // Helper functions
164
165 //- Create a map that extends tgtPatch so that it covers srcPatch
167
168 //- Check AMI patch coupling
169 void checkPatches() const;
170
171 //- Is source/target a valid pair (i.e. not too far/different
172 // orientation). Used for prefiltering before e.g. area overlap
173 bool isCandidate(const label srcFacei, const label tgtFacei) const;
174
175 virtual bool calculate
176 (
179 const autoPtr<searchableSurface>& surfPtr = nullptr
180 );
181
182 //- Initialise walk and return true if all ok
184 (
185 label& srcFacei,
186 label& tgtFacei
187 );
188
189 //- Write triangle intersection to OBJ file
191 (
192 const scalar area,
193 const face& f1,
194 const face& f2,
195 const pointField& f1Points,
196 const pointField& f2Points
197 ) const;
198
199
200 // Common AMI method functions
201
202 label findTargetFace
203 (
204 const label srcFacei,
205 const UList<label>& excludeFaces = UList<label>::null(),
206 const label srcFacePti = -1
207 ) const;
208
209 //- Add faces neighbouring facei to the ID list
210 void appendNbrFaces
211 (
212 const label facei,
213 const primitivePatch& patch,
214 const labelUList& visitedFaces,
215 DynamicList<label>& faceIDs
216 ) const;
217
218 //- Helper function to decompose a patch
220 (
221 const primitivePatch& patch,
222 List<DynamicList<face>>& tris,
223 List<scalar>& magSf
224 ) const;
225
226 //- Correction for non-conformal interpolations, e.g. for ACMI
227 virtual void nonConformalCorrection();
228
229
230public:
231
232 //- Runtime type information
233 TypeName("advancingFrontAMI");
234
235 // Constructors
236
237 //- Construct from components
239 (
240 const dictionary& dict,
241 const bool reverseTarget
242 );
243
244 //- Construct from components
246 (
247 const bool requireMatch = true,
248 const bool reverseTarget = false,
249 const scalar lowWeightCorrection = -1,
252 );
253
254 //- Construct as copy
256
257 //- Construct and return a clone
258 virtual autoPtr<AMIInterpolation> clone() const
259 {
261 }
262
263
264 //- Destructor
265 virtual ~advancingFrontAMI() = default;
266
267
268 // Member Functions
269
270 //- Return const access to the source patch
271 inline const primitivePatch& srcPatch() const;
272
273 //- Return const access to the target patch
274 inline const primitivePatch& tgtPatch() const;
275
276 //- Labels of faces that are not overlapped by any target faces
277 // Note: this should be empty for correct functioning
278 inline const labelList& srcNonOverlap() const;
279
280
281 // I-O
282
283 //- Write
284 virtual void write(Ostream& os) const;
285};
286
287
288// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289
290} // End namespace Foam
291
292// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
293
294#include "advancingFrontAMII.H"
295
296// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
297
298#endif
299
300// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
bool reverseTarget() const noexcept
Access to the reverseTarget flag.
AMIInterpolation(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
bool requireMatch() const noexcept
Return 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:68
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
static const UList< T > & null() noexcept
Return a null UList (reference to a nullObject). Behaves like an empty UList.
Definition UList.H:225
Base class for Arbitrary Mesh Interface (AMI) methods.
const scalar maxDistance2_
Maximum squared distance.
const primitivePatch & tgtPatch() const
Return const access to the target patch.
pointField extendedTgtPoints_
Extended patch points.
areaNormalisationMode areaNormalisationMode_
Area normalisation mode; default = project.
virtual autoPtr< AMIInterpolation > clone() const
Construct and return a clone.
faceList extendedTgtFaces_
Extended patch faces.
bool initialiseWalk(label &srcFacei, label &tgtFacei)
Initialise walk and return true if all ok.
const scalar minCosAngle_
Minimum (cos of) angle. 1 for perfectly matching.
static const Enum< areaNormalisationMode > areaNormalisationModeNames_
void checkPatches() const
Check AMI patch coupling.
List< DynamicList< face > > srcTris_
Storage for src-side triangle decomposition.
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
areaNormalisationMode
Area normalisation mode.
bool isCandidate(const label srcFacei, const label tgtFacei) const
Is source/target a valid pair (i.e. not too far/different.
virtual void nonConformalCorrection()
Correction for non-conformal interpolations, e.g. for ACMI.
void createExtendedTgtPatch()
Create a map that extends tgtPatch so that it covers srcPatch.
void appendNbrFaces(const label facei, const primitivePatch &patch, const labelUList &visitedFaces, DynamicList< label > &faceIDs) const
Add faces neighbouring facei to the ID list.
virtual ~advancingFrontAMI()=default
Destructor.
void writeIntersectionOBJ(const scalar area, const face &f1, const face &f2, const pointField &f1Points, const pointField &f2Points) const
Write triangle intersection to OBJ file.
advancingFrontAMI(const dictionary &dict, const bool reverseTarget)
Construct from components.
autoPtr< indexedOctree< treeType > > treePtr_
Octree used to find face seeds.
TypeName("advancingFrontAMI")
Runtime type information.
List< DynamicList< face > > tgtTris_
Storage for tgt-side triangle decomposition.
const primitivePatch & srcPatch() const
Return const access to the source patch.
autoPtr< mapDistribute > extendedTgtMapPtr_
Extended patch map.
const labelList & srcNonOverlap() const
Labels of faces that are not overlapped by any target faces.
labelList extendedTgtFaceIDs_
Extended patch face IDs.
labelList srcNonOverlap_
Labels of faces that are not overlapped by any target faces (should be empty for correct functioning ...
const faceAreaIntersect::triangulationMode triMode_
Face triangulation mode.
autoPtr< primitivePatch > extendedTgtPatchPtr_
Demand-driven extended target mesh (distributed parallel usage).
void triangulatePatch(const primitivePatch &patch, List< DynamicList< face > > &tris, List< scalar > &magSf) const
Helper function to decompose a patch.
label findTargetFace(const label srcFacei, const UList< label > &excludeFaces=UList< label >::null(), const label srcFacePti=-1) const
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A face is a list of labels corresponding to mesh vertices.
Definition face.H:71
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Definition globalIndex.H:77
Class containing processor-to-processor mapping information.
Standard boundBox with extra functionality for use in octree.
Macro definitions for declaring ClassName(), NamespaceName(), etc.
OBJstream os(runTime.globalPath()/outputName)
const pointField & points
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
List< face > faceList
List of faces.
Definition faceListFwd.H:41
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< bool > boolList
A List of bools.
Definition List.H:60
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68