mappedPatchBaseTemplates.C
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) 2011-2019 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 \*---------------------------------------------------------------------------*/
25 
26 template<class Type>
28 {
29  switch (mode_)
30  {
32  {
33  lst = AMI().interpolateToSource(Field<Type>(move(lst)));
34  break;
35  }
36  default:
37  {
38  map().distribute(lst);
39  }
40  }
41 }
42 
43 
44 template<class Type, class CombineOp>
46 (
47  List<Type>& lst,
48  const CombineOp& cop
49 ) const
50 {
51  switch (mode_)
52  {
54  {
55  lst = AMI().interpolateToSource
56  (
57  Field<Type>(move(lst)),
58  cop
59  );
60  break;
61  }
62  default:
63  {
65  (
67  map().schedule(),
68  map().constructSize(),
69  map().subMap(),
70  false,
71  map().constructMap(),
72  false,
73  lst,
74  cop,
75  flipOp(),
76  Type(Zero)
77  );
78  }
79  }
80 }
81 
82 
83 template<class Type>
85 {
86  switch (mode_)
87  {
89  {
90  lst = AMI().interpolateToTarget(Field<Type>(move(lst)));
91  break;
92  }
93  default:
94  {
96  break;
97  }
98  }
99 }
100 
101 
102 template<class Type, class CombineOp>
104 (
105  List<Type>& lst,
106  const CombineOp& cop
107 ) const
108 {
109  switch (mode_)
110  {
111  case NEARESTPATCHFACEAMI:
112  {
113  lst = AMI().interpolateToTarget
114  (
115  Field<Type>(move(lst)),
116  cop
117  );
118  break;
119  }
120  default:
121  {
122  label cSize = sampleSize();
124  (
126  map().schedule(),
127  cSize,
128  map().constructMap(),
129  false,
130  map().subMap(),
131  false,
132  lst,
133  cop,
134  flipOp(),
135  Type(Zero)
136  );
137  break;
138  }
139  }
140 }
141 
142 
143 // ************************************************************************* //
Class containing functor to negate primitives. Dummy for all other types.
Definition: flipOp.H:50
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
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
const mapDistribute & map() const
Return reference to the parallel distribution map.
const AMIInterpolation & AMI(const bool forceUpdate=false) const
Return reference to the AMI interpolator.
Pre-declare SubField and related Field type.
Definition: Field.H:56
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &, const negateOp &negOp, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for.
static const zero Zero
Definition: zero.H:97
void interpolateToTarget(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Interpolate from source to target with supplied op.
label sampleSize() const
Return size of mapped mesh/patch/boundary.
void interpolateToSource(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Interpolate from target to source with supplied op.
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
void distribute(List< Type > &lst) const
Wrapper around map/interpolate data distribution.
static commsTypes defaultCommsType
Default commsType.
Definition: UPstream.H:272
void reverseDistribute(List< Type > &lst) const
Wrapper around map/interpolate data distribution.
const sampleMode mode_
What to sample.