All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
patchToPatchTools.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) 2022-2023 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 Namespace
25  Foam::patchToPatchTools
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #ifndef patchToPatchTools_H
30 #define patchToPatchTools_H
31 
32 #include "distributionMap.H"
33 #include "remote.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 namespace patchToPatchTools
40 {
41 
42 //- Determine whether this intersection is confined to a single processor or
43 // not, purely from the numbers of elements in the geometry
44 label singleProcess(const label srcSize, const label tgtSize);
45 
46 //- Turn a list of send-to-processor indices into a distribution map
48 (
50 );
51 
52 //- Construct local addressing from the given distribution map. The result is a
53 // list of remote element indices that correspond to the elements that were
54 // sent by the distribution map.
56 
57 //- Given a local intersection addressing, determine what elements need sending
58 // to each processor
60 (
61  const labelListList& tgtLocalSrcFaces,
62  const List<remote>& localTgtProcFaces
63 );
64 
65 //- Dynamic list overload of the above
67 (
68  const List<DynamicList<label>>& tgtLocalSrcFaces,
69  const List<remote>& localTgtProcFaces
70 );
71 
72 //- Trim unused elements from a distribution map. Return the map and maps
73 // between the old and new construct list.
75 (
76  const boolList& oldIsUsed,
77  distributionMap& map,
78  labelList& oldToNew,
79  labelList& newToOld
80 );
81 
82 //- Transfer list-list b into list-list a
83 template<class SubListA, class SubListB>
84 static inline void transferListList
85 (
86  List<SubListA>& a,
88 );
89 
90 //- Reverse distribute a list-list given the map
91 template<class Type>
92 static inline void rDistributeListList
93 (
94  const label size,
95  const distributionMap& map,
96  List<List<Type>>& data
97 );
98 
99 //- Dynamic list overload of the above
100 template<class Type>
101 static inline void rDistributeListList
102 (
103  const label size,
104  const distributionMap& map,
105  List<DynamicList<Type>>& data
106 );
107 
108 //- Map local to remote indices
110 (
111  const labelListList& indices,
112  const List<remote>& indexToProcIndex = NullObjectRef<List<remote>>()
113 );
114 
115 //- Dynamic list overload of the above
117 (
118  const List<DynamicList<label>>& indices,
119  const List<remote>& indexToProcIndex = NullObjectRef<List<remote>>()
120 );
121 
122 //- Reverse distribute a set of target addressing
124 (
125  const label tgtSize,
126  const distributionMap& tgtMap,
127  const List<remote>& localSrcProcFaces,
128  labelListList& tgtLocalSrcFaces
129 );
130 
131 //- Dynamic list overload of the above
133 (
134  const label tgtSize,
135  const distributionMap& tgtMap,
136  const List<remote>& localSrcProcFaces,
137  List<DynamicList<label>>& tgtLocalSrcFaces
138 );
139 
140 //- Interpolate with normalisation
141 template<class Type, class LabelList, class ScalarList>
143 (
144  const List<LabelList>& localOtherFaces,
145  const List<ScalarList>& weights,
146  const autoPtr<distributionMap>& otherMapPtr,
147  const Field<Type>& otherFld
148 );
149 
150 //- Interpolate without normalisation
151 template<class Type, class LabelList, class ScalarList>
153 (
154  const List<LabelList>& localOtherFaces,
155  const List<ScalarList>& weights,
156  const autoPtr<distributionMap>& otherMapPtr,
157  const Field<Type>& otherFld,
158  const Field<Type>& leftOverFld
159 );
160 
161 } // End namespace patchToPatchTools
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #ifdef NoRepository
168 #endif
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
Pre-declare SubField and related Field type.
Definition: Field.H:83
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Class containing processor-to-processor mapping information.
A class for managing temporary objects.
Definition: tmp.H:55
volScalarField & b
Definition: createFields.H:25
label singleProcess(const label srcSize, const label tgtSize)
Determine whether this intersection is confined to a single processor or.
autoPtr< distributionMap > constructDistributionMap(const labelListList &procSendIndices)
Turn a list of send-to-processor indices into a distribution map.
List< remote > distributeAddressing(const distributionMap &map)
Construct local addressing from the given distribution map. The result is a.
void rDistributeTgtAddressing(const label tgtSize, const distributionMap &tgtMap, const List< remote > &localSrcProcFaces, labelListList &tgtLocalSrcFaces)
Reverse distribute a set of target addressing.
static tmp< Field< Type > > interpolate(const List< LabelList > &localOtherFaces, const List< ScalarList > &weights, const autoPtr< distributionMap > &otherMapPtr, const Field< Type > &otherFld)
Interpolate with normalisation.
static void rDistributeListList(const label size, const distributionMap &map, List< List< Type >> &data)
Reverse distribute a list-list given the map.
labelListList procSendIndices(const labelListList &tgtLocalSrcFaces, const List< remote > &localTgtProcFaces)
Given a local intersection addressing, determine what elements need sending.
void trimDistributionMap(const boolList &oldIsUsed, distributionMap &map, labelList &oldToNew, labelList &newToOld)
Trim unused elements from a distribution map. Return the map and maps.
List< List< remote > > localToRemote(const labelListList &indices, const List< remote > &indexToProcIndex=NullObjectRef< List< remote >>())
Map local to remote indices.
static void transferListList(List< SubListA > &a, List< SubListB > &b)
Transfer list-list b into list-list a.
Namespace for OpenFOAM.
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
const T & NullObjectRef()
Return const reference to the nullObject of type T.
Definition: nullObjectI.H:27