/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Class Foam::UPstream Description Inter-processor communications stream SourceFiles UPstream.C UPstreamCommsStruct.C gatherScatter.C combineGatherScatter.C gatherScatterList.C \*---------------------------------------------------------------------------*/ #ifndef UPstream_H #define UPstream_H #include "labelList.H" #include "DynamicList.H" #include "HashTable.H" #include "string.H" #include "NamedEnum.H" #include "ListOps.H" #include "LIFOStack.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Class UPstream Declaration \*---------------------------------------------------------------------------*/ class UPstream { public: //- Types of communications enum class commsTypes { blocking, scheduled, nonBlocking }; static const NamedEnum commsTypeNames; // Public classes //- Structure for communicating between processors class commsStruct { // Private Data //- procID of above processor label above_; //- procIDs of processors directly below me labelList below_; //- procIDs of all processors below (so not just directly below) labelList allBelow_; //- procIDs of all processors not below. (inverse set of // allBelow_ and minus myProcNo) labelList allNotBelow_; public: // Constructors //- Construct null commsStruct(); //- Construct from components commsStruct ( const label, const labelList&, const labelList&, const labelList& ); //- Construct from components; construct allNotBelow_ commsStruct ( const label nProcs, const label myProcID, const label, const labelList&, const labelList& ); // Member Functions // Access label above() const { return above_; } const labelList& below() const { return below_; } const labelList& allBelow() const { return allBelow_; } const labelList& allNotBelow() const { return allNotBelow_; } // Member Operators bool operator==(const commsStruct&) const; bool operator!=(const commsStruct&) const; // Ostream Operator friend Ostream& operator<<(Ostream&, const commsStruct&); }; //- combineReduce operator for lists. Used for counting. class listEq { public: template void operator()(T& x, const T& y) const { forAll(y, i) { if (y[i].size()) { x[i] = y[i]; } } } }; private: // Private Data //- By default this is not a parallel run static bool parRun_; //- Have support for threads? static bool haveThreads_; //- Standard transfer message type static int msgType_; // Communicator specific data //- Free communicators static LIFOStack