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{
51
52/*---------------------------------------------------------------------------*\
53 Class advancingFrontAMI Declaration
54\*---------------------------------------------------------------------------*/
57:
58 public AMIInterpolation
59{
60
61private:
62
63 // Private Member Functions
64
65 //- No copy assignment
66 void operator=(const advancingFrontAMI&) = delete;
67
68
69 // Parallel operations
70
71 label calcOverlappingProcs
72 (
73 const List<treeBoundBoxList>& procBb,
74 const treeBoundBox& bb,
75 boolList& overlaps
76 ) const;
77
78 void distributePatches
79 (
80 const mapDistribute& map,
81 const primitivePatch& pp,
82 const globalIndex& gi,
83 List<faceList>& faces,
85 List<labelList>& tgtFaceIDs
86 ) const;
87
88 void distributeAndMergePatches
89 (
90 const mapDistribute& map,
92 const globalIndex& gi,
93 faceList& tgtFaces,
94 pointField& tgtPoints,
95 labelList& tgtFaceIDs
96 ) const;
97
98 autoPtr<mapDistribute> calcProcMap
99 (
102 ) const;
103
104
105protected:
106
107 // Protected data
108
109 //- Maximum squared distance
110 const scalar maxDistance2_;
111
112 //- Minimum (cos of) angle. 1 for perfectly matching.
113 const scalar minCosAngle_;
114
115 //- Storage for src-side triangle decomposition
117
118 //- Storage for tgt-side triangle decomposition
120
121 //- Demand-driven extended target mesh (distributed parallel usage)
123
124 //- Extended patch faces
126
127 //- Extended patch points
129
130 //- Extended patch face IDs
132
133 //- Extended patch map
135
136 //- Labels of faces that are not overlapped by any target faces
137 //- (should be empty for correct functioning for fully covered AMIs)
139
140 //- Octree used to find face seeds
142
143 //- Face triangulation mode
145
146
147 // Protected Member Functions
148
149 // Helper functions
150
151 //- Create a map that extends tgtPatch so that it covers srcPatch
153
154 //- Check AMI patch coupling
155 void checkPatches() const;
156
157 //- Is source/target a valid pair (i.e. not too far/different
158 // orientation). Used for prefiltering before e.g. area overlap
159 bool isCandidate(const label srcFacei, const label tgtFacei) const;
160
161 virtual bool calculate
162 (
165 const autoPtr<searchableSurface>& surfPtr = nullptr
166 );
167
168 //- Initialise walk and return true if all ok
169 bool initialiseWalk
170 (
171 label& srcFacei,
172 label& tgtFacei
173 );
174
175 //- Write triangle intersection to OBJ file
177 (
178 const scalar area,
179 const face& f1,
180 const face& f2,
181 const pointField& f1Points,
182 const pointField& f2Points
183 ) const;
184
185
186 // Common AMI method functions
187
188 label findTargetFace
189 (
190 const label srcFacei,
191 const UList<label>& excludeFaces = UList<label>::null(),
192 const label srcFacePti = -1
193 ) const;
194
195 //- Add faces neighbouring facei to the ID list
196 void appendNbrFaces
197 (
198 const label facei,
199 const primitivePatch& patch,
200 const DynamicList<label>& visitedFaces,
201 DynamicList<label>& faceIDs
202 ) const;
203
204 //- Helper function to decompose a patch
206 (
207 const primitivePatch& patch,
208 List<DynamicList<face>>& tris,
209 List<scalar>& magSf
210 ) const;
211
212 //- Correction for non-conformal interpolations, e.g. for ACMI
213 virtual void nonConformalCorrection();
214
215
216public:
217
218 //- Runtime type information
219 TypeName("advancingFrontAMI");
220
221 // Constructors
222
223 //- Construct from components
225 (
226 const dictionary& dict,
227 const bool reverseTarget
228 );
229
230 //- Construct from components
232 (
233 const bool requireMatch = true,
234 const bool reverseTarget = false,
235 const scalar lowWeightCorrection = -1,
238 );
239
240 //- Construct as copy
242
243 //- Construct and return a clone
244 virtual autoPtr<AMIInterpolation> clone() const
245 {
247 }
248
249
250 //- Destructor
251 virtual ~advancingFrontAMI() = default;
252
253
254 // Member Functions
255
256 //- Return const access to the source patch
257 inline const primitivePatch& srcPatch() const;
258
259 //- Return const access to the target patch
260 inline const primitivePatch& tgtPatch() const;
261
262 //- Labels of faces that are not overlapped by any target faces
263 // Note: this should be empty for correct functioning
264 inline const labelList& srcNonOverlap() const;
265
266
267 // I-O
268
269 //- Write
270 virtual void write(Ostream& os) const;
271};
272
273
274// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275
276} // End namespace Foam
277
278// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279
280#include "advancingFrontAMII.H"
281
282// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283
284#endif
285
286// ************************************************************************* //
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
bool reverseTarget() const
Access to the reverseTarget flag.
bool requireMatch() const
Access to 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:72
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of faces which address into the list of points.
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:94
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.
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.
void checkPatches() const
Check AMI patch coupling.
void appendNbrFaces(const label facei, const primitivePatch &patch, const DynamicList< label > &visitedFaces, DynamicList< label > &faceIDs) const
Add faces neighbouring facei to the ID list.
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.
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.
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.
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.
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:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:68
Class containing processor-to-processor mapping information.
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:89
Macro definitions for declaring ClassName(), NamespaceName(), etc.
OBJstream os(runTime.globalPath()/outputName)
const pointField & points
Namespace for OpenFOAM.
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73