processorTopology.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) 2022 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::processorTopology
29
30Description
31 Determines/represents processor-processor connection.
32 After instantiation contains the processor-processor connection table
33 (globally synchronized on all processors).
34
35Note
36 A processorTopology is usually generated by using the \c New
37 factory method, which has been wrapped into a separate header to
38 minimize dependencies.
39
40Warning
41 Does not currently correctly support multiple processor
42 patches connecting two processors.
43
44SourceFiles
45 processorTopologyNew.H
46
47\*---------------------------------------------------------------------------*/
48
49#ifndef Foam_processorTopology_H
50#define Foam_processorTopology_H
51
52#include "labelList.H"
53#include "lduSchedule.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59
60/*---------------------------------------------------------------------------*\
61 Class processorTopology Declaration
62\*---------------------------------------------------------------------------*/
65{
66 // Private Data
67
68 //- The processor to processor connection (adjacency) table
69 labelListList procNeighbours_;
70
71 //- Order in which the patches should be initialised/evaluated
72 //- corresponding to the schedule
73 lduSchedule patchSchedule_;
74
75 //- Local map from neighbour proc to patchi. Different per processor!
76 // -1 or patchi for connection to procID
77 labelList procPatchMap_;
78
79
80 // Private Member Functions
81
82 //- From neighbour processor to index in our local boundary.
83 // Local information (so not same over all processors)
88
89 //- Which \em local boundary is attached to specified processor
90 // Local information (so not same over all processors)
91 // \return -1 if not currently connected to specified processor.
92 label procToLocalPatch(const label proci) const
93 {
94 return
95 (
96 proci >= 0 && proci < procPatchMap_.size()
97 ? procPatchMap_[proci]
98 : static_cast<label>(-1)
99 );
100 }
101
102
103public:
104
105 // Generated Methods
106
107 //- Default construct (empty)
108 processorTopology() = default;
109
110 //- Copy construct
111 processorTopology(const processorTopology&) = default;
112
113 //- Move construct
115
116 //- Copy assignment
118
119 //- Move assignment
121
122
123 // Static Functions
124
125 //- Factory method to create topology, schedule and proc/patch maps.
126 // Scans the list of patches for processor connections corresponding
127 // to the ProcPatch type.
128 template<class ProcPatch, class PatchListType>
130 (
131 const PatchListType& patches,
132 const label comm
133 );
134
135
136 // Member Functions
137
138 //- The number of processors used by the topology
139 label nProcs() const noexcept
140 {
141 return procNeighbours_.size();
142 }
143
144 //- The processor to processor connection topology
145 //- (like an adjacency list). Globally synchronized information
147 {
148 return procNeighbours_;
149 }
150
151 //- Order in which the patches should be initialised/evaluated
152 //- corresponding to the schedule
153 const lduSchedule& patchSchedule() const noexcept
154 {
155 return patchSchedule_;
156 }
157
158 //- Which \em local boundary is attached to specified processor
159 // Local information (so not same over all processors)
160 // \return -1 if not currently connected to specified processor.
161 label procPatchLookup(const label proci) const
162 {
163 return procToLocalPatch(proci);
164 }
165};
166
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170} // End namespace Foam
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#endif
175
176// ************************************************************************* //
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Determines/represents processor-processor connection. After instantiation contains the processor-proc...
static processorTopology New(const PatchListType &patches, const label comm)
Factory method to create topology, schedule and proc/patch maps.
label procPatchLookup(const label proci) const
Which local boundary is attached to specified processor.
processorTopology(const processorTopology &)=default
Copy construct.
processorTopology(processorTopology &&)=default
Move construct.
const labelListList & procNeighbours() const noexcept
const lduSchedule & patchSchedule() const noexcept
label nProcs() const noexcept
The number of processors used by the topology.
processorTopology & operator=(const processorTopology &)=default
Copy assignment.
processorTopology()=default
Default construct (empty)
processorTopology & operator=(processorTopology &&)=default
Move assignment.
const polyBoundaryMesh & patches
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223