Loading...
Searching...
No Matches
AMIInterpolationI.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2023 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
27\*---------------------------------------------------------------------------*/
28
30{
31 if (!tsrcPatch0_)
32 {
34 << "tsrcPatch0Ptr_ not set"
36 }
37
38 return tsrcPatch0_();
39}
40
41
43{
44
45 if (!ttgtPatch0_)
46 {
48 << "ttgtPatch0Ptr_ not set"
50 }
51
52 return ttgtPatch0_();
53}
54
57{
58 return (singlePatchProc_ == -1);
59}
60
63{
64 return requireMatch_;
65}
66
67
68inline bool Foam::AMIInterpolation::setRequireMatch(bool flag) noexcept
69{
70 requireMatch_ = flag;
71 return requireMatch_;
72}
73
78}
79
84}
85
87inline Foam::scalar Foam::AMIInterpolation::lowWeightCorrection() const
88{
90}
91
96}
97
100{
101 return singlePatchProc_;
102}
103
104
105inline Foam::label Foam::AMIInterpolation::comm() const noexcept
106{
107 if (const auto* ptr = geomComm_.get())
108 {
109 return ptr->comm();
110 }
111 else
112 {
113 return comm_;
114 }
115}
116
117
118inline Foam::label Foam::AMIInterpolation::comm(label communicator) noexcept
120 label old(comm_);
121 comm_ = communicator;
122 return old;
123}
124
126inline bool Foam::AMIInterpolation::cacheActive() const
127{
128 return cache_.active();
129}
130
133{
134 return srcMagSf_;
135}
136
141}
142
145{
146 return srcAddress_;
147}
148
153}
154
157{
158 return srcWeights_;
159}
160
165}
166
171}
172
177}
178
183}
184
189}
190
191
193{
194 return *srcMapPtr_;
195}
196
197
200{
201 return srcMapPtr_.get();
202}
203
206{
207 return tgtMagSf_;
208}
209
214}
215
218{
219 return tgtAddress_;
220}
221
226}
227
230{
231 return tgtWeights_;
232}
233
238}
239
244}
245
250}
251
252
254{
255 return *tgtMapPtr_;
256}
257
258
259inline const Foam::mapDistribute*
261{
262 return tgtMapPtr_.get();
263}
264
265
266// ************************************************************************* //
bool requireMatch_
Flag to indicate that the two patches must be matched/an overlap exists between them.
const mapDistribute & srcMap() const
Source map - valid only if singlePatchProc = -1 This gets source data into a form to be consumed by t...
refPtr< primitivePatch > tsrcPatch0_
Source patch using manipulated input points.
label singlePatchProc_
Index of processor that holds all of both sides. The value is -1 for distributed cases.
bool mustMatchFaces() const
Return true if requireMatch and but not lowWeightCorrection.
const scalarField & srcWeightsSum() const
Return const access to normalisation factor of source patch weights (i.e. the sum before normalisatio...
bool reverseTarget() const noexcept
Access to the reverseTarget flag.
bool cacheActive() const
Return true if caching is active.
labelListList srcAddress_
Addresses of target faces per source face.
label comm() const noexcept
Communicator (local or otherwise) for parallel operations.
bool distributed() const noexcept
Distributed across processors (singlePatchProc == -1).
const mapDistribute * hasTgtMap() const noexcept
Pointer to the target map (if distributed). Can be checked as a bool.
scalarList tgtMagSf_
Target face areas.
const mapDistribute & tgtMap() const
Target map - valid only if singlePatchProc=-1. This gets target data into a form to be consumed by sr...
const scalarListList & tgtWeights() const
Return const access to target patch weights.
const labelListList & srcAddress() const
Return const access to source patch addressing.
const bool reverseTarget_
Flag to indicate that the two patches are co-directional and that the orientation of the target patch...
autoPtr< mapDistribute > srcMapPtr_
Source map pointer - parallel running only.
autoPtr< UPstream::communicator > geomComm_
Communicator to use for geometry calculations. Not valid (-1) on processors that do not have faces.
const scalarField & tgtWeightsSum() const
Return const access to normalisation factor of target patch weights (i.e. the sum before normalisatio...
bool requireMatch() const noexcept
Return the requireMatch flag.
const primitivePatch & tgtPatch0() const
Return the original tgt patch with optionally updated points.
autoPtr< mapDistribute > tgtMapPtr_
Target map pointer - parallel running only.
const scalarListList & srcWeights() const
Return const access to source patch weights.
labelListList tgtAddress_
Addresses of source faces per target face.
const scalar lowWeightCorrection_
Threshold weight below which interpolation is deactivated.
pointListList srcCentroids_
Centroid of target faces per source face.
label singlePatchProc() const noexcept
The processor holding all faces (both sides), or -1 if distributed.
const mapDistribute * hasSrcMap() const noexcept
Pointer to the source map (if distributed). Can be checked as a bool.
const pointListList & srcCentroids() const
Return const access to source patch face centroids.
bool setRequireMatch(bool flag) noexcept
Set the require match flag, return the new value.
label comm_
Communicator to use for parallel operations.
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
scalarField srcWeightsSum_
Sum of weights of target faces per source face.
refPtr< primitivePatch > ttgtPatch0_
Target patch using manipulated input points.
bool applyLowWeightCorrection() const
Return true if employing a 'lowWeightCorrection'.
scalarListList tgtWeights_
Weights of source faces per target face.
scalarListList srcWeights_
Weights of target faces per source face.
const List< scalar > & srcMagSf() const
Return const access to source patch face areas.
scalarList srcMagSf_
Source face areas.
const primitivePatch & srcPatch0() const
Return the original src patch with optionally updated points.
scalarField tgtWeightsSum_
Sum of weights of source faces per target face.
const List< scalar > & tgtMagSf() const
Return const access to target patch face areas.
const labelListList & tgtAddress() const
Return const access to target patch addressing.
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
Class containing processor-to-processor mapping information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
List< scalarList > scalarListList
List of scalarList.
Definition scalarList.H:35
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
errorManip< error > abort(error &err)
Definition errorManip.H:139
const direction noexcept
Definition scalarImpl.H:265
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
List< pointList > pointListList
List of pointList.
Definition pointList.H:35