patchToPatchI.H
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-2022 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 #include "patchToPatch.H"
27 
28 // * * * * * * * * * * * Private Static Member Functions * * * * * * * * * * //
29 
30 template<class SubListA, class SubListB>
32 (
33  List<SubListA>& a,
35 )
36 {
37  a.resize(b.size());
38  forAll(a, i)
39  {
40  a[i].transfer(b[i]);
41  }
42 }
43 
44 
45 template<class Type>
47 (
48  const label size,
49  const distributionMap& map,
51 )
52 {
53  distributionMapBase::distribute
54  (
55  Pstream::commsTypes::nonBlocking,
57  size,
58  map.constructMap(),
59  false,
60  map.subMap(),
61  false,
62  data,
64  flipOp(),
65  List<Type>()
66  );
67 }
68 
69 
70 template<class Type>
72 (
73  const label size,
74  const distributionMap& map,
76 )
77 {
78  List<List<Type>> tData;
79  transferListList(tData, data);
80  rDistributeListList(size, map, tData);
81  transferListList(data, tData);
82 }
83 
84 
85 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
86 
87 inline bool Foam::patchToPatch::reverse() const
88 {
89  return reverse_;
90 }
91 
92 
94 {
95  return singleProcess_;
96 }
97 
98 
100 {
101  return singleProcess_ != -1;
102 }
103 
104 
107 {
108  return
112 }
113 
114 
117 {
118  return
122 }
123 
124 
125 // ************************************************************************* //
Class containing functor to negate primitives. Dummy for all other types.
Definition: flipOp.H:50
List< List< procFace > > srcTgtProcFaces() const
For each source face, the coupled target procs and faces.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
const bool reverse_
Flag to indicate that the two patches are co-directional and.
Definition: patchToPatch.H:100
List< List< procFace > > tgtSrcProcFaces() const
For each target face, the coupled source procs and faces.
label singleProcess_
Index of the processor holding all faces of the patchToPatch, or -1.
Definition: patchToPatch.H:104
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
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
bool reverse() const
Flag to indicate that the two patches are co-directional and.
Definition: patchToPatchI.H:87
Holds information (coordinate and normal) regarding nearest wall point.
List< DynamicList< label > > srcLocalTgtFaces_
For each source face, the coupled local target faces.
Definition: patchToPatch.H:115
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
const labelListList & subMap() const
From subsetted data back to original data.
void resize(const label)
Alias for setSize(const label)
Definition: ListI.H:138
static List< List< procFace > > localFacesToProcFaces(const List< DynamicList< label >> &localFaces, const List< procFace > &map=NullObjectRef< List< procFace >>())
Map local faces to proc faces.
Definition: patchToPatch.C:97
static void rDistributeListList(const label size, const distributionMap &map, List< List< Type >> &data)
Reverse distribute a list-list given the map.
Definition: patchToPatchI.H:47
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
Database for solution and other reduced data.
Definition: data.H:51
Class containing processor-to-processor mapping information.
autoPtr< List< procFace > > localSrcProcFacesPtr_
When running in parallel, a map from local source face index to.
Definition: patchToPatch.H:108
List< DynamicList< label > > tgtLocalSrcFaces_
For each target face, the coupled local source faces.
Definition: patchToPatch.H:118
label singleProcess() const
Index of the processor holding all faces of the patchToPatch,.
Definition: patchToPatchI.H:93
static void transferListList(List< SubListA > &a, List< SubListB > &b)
Transfer list-list b into list-list a.
Definition: patchToPatchI.H:32
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Definition: List.C:342
autoPtr< List< procFace > > localTgtProcFacesPtr_
When running in parallel, a map from local target face index to.
Definition: patchToPatch.H:112
List operator to append one list onto another.
Definition: ListOps.H:306
bool isSingleProcess() const
Is this intersection on a single process?
Definition: patchToPatchI.H:99