Loading...
Searching...
No Matches
globalOffsetI.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) 2025 Mark Olesen
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29
30template<class IntType>
32:
33 OffsetRange<IntType>()
34{}
35
36
37template<class IntType>
39:
41{}
42
43
44template<class IntType>
46(
47 IntType len,
48 int communicator,
49 bool parallel
50)
51:
52 OffsetRange<IntType>(len)
53{
54 if (parallel)
55 {
56 this->reduce(communicator);
57 }
58}
59
60
61template<class IntType>
63(
64 const OffsetRange<IntType>& range
66:
71// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72
73template<class IntType>
74inline void Foam::GlobalOffset<IntType>::reset(IntType len) noexcept
75{
77}
78
79
80template<class IntType>
82(
83 IntType len,
84 int communicator,
85 bool parallel
86)
87{
89
90 if (parallel)
91 {
92 this->reduce(communicator);
93 }
94}
95
96
97// ************************************************************************* //
scalar range
constexpr GlobalOffset() noexcept
Default construct as (0,0,0).
void reduce(int communicator=UPstream::worldComm)
Based on the local input size, determine the globally-consistent start offset and total size.
void reset(IntType len) noexcept
Reset from local size with zero offset.
A tuple of integers comprising start, size, total.
Definition OffsetRange.H:82
IntRange< IntType > range() const noexcept
The (state,size) range.
OffsetRange(const OffsetRange &) noexcept=default
Copy construct.
void reset(IntType len) noexcept
Reset to the specified size, with start=0 and total=size.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
const direction noexcept
Definition scalarImpl.H:265