mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: minor code cleanup of commSchedule
- obtain sorted order directly without SortableList, relocate private method to static local.
This commit is contained in:
committed by
Andrew Heather
parent
f4ebc90a02
commit
05b1bc9e79
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,8 +27,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "commSchedule.H"
|
||||
#include "SortableList.H"
|
||||
#include "boolList.H"
|
||||
#include "ListOps.H"
|
||||
#include "IOstreams.H"
|
||||
#include "IOmanip.H"
|
||||
#include "StringStream.H"
|
||||
@ -41,26 +41,33 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::commSchedule::outstandingComms
|
||||
namespace Foam
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
// Count the number of outstanding communications for a single processor
|
||||
static label outstandingComms
|
||||
(
|
||||
const labelList& commToSchedule,
|
||||
DynamicList<label>& procComms
|
||||
) const
|
||||
)
|
||||
{
|
||||
label nOutstanding = 0;
|
||||
|
||||
forAll(procComms, i)
|
||||
for (const label commi : procComms)
|
||||
{
|
||||
if (commToSchedule[procComms[i]] == -1)
|
||||
if (commToSchedule[commi] == -1)
|
||||
{
|
||||
nOutstanding++;
|
||||
++nOutstanding;
|
||||
}
|
||||
}
|
||||
return nOutstanding;
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -94,7 +101,7 @@ Foam::commSchedule::commSchedule
|
||||
|
||||
if (debug && Pstream::master())
|
||||
{
|
||||
Pout<< "commSchedule::commSchedule : Wanted communication:" << endl;
|
||||
Pout<< "commSchedule : Wanted communication:" << endl;
|
||||
|
||||
forAll(comms, i)
|
||||
{
|
||||
@ -106,7 +113,7 @@ Foam::commSchedule::commSchedule
|
||||
Pout<< endl;
|
||||
|
||||
|
||||
Pout<< "commSchedule::commSchedule : Schedule:" << endl;
|
||||
Pout<< "commSchedule : Schedule:" << endl;
|
||||
|
||||
// Print header. Use buffered output to prevent parallel output messing
|
||||
// up.
|
||||
@ -239,8 +246,9 @@ Foam::commSchedule::commSchedule
|
||||
}
|
||||
|
||||
|
||||
// Sort commToSchedule and obtain order in comms
|
||||
schedule_ = SortableList<label>(commToSchedule).indices();
|
||||
// Sort commToSchedule to obtain order in comms
|
||||
|
||||
Foam::sortedOrder(commToSchedule, schedule_);
|
||||
|
||||
// Sort schedule_ by processor
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,10 +50,9 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef commSchedule_H
|
||||
#define commSchedule_H
|
||||
#ifndef Foam_commSchedule_H
|
||||
#define Foam_commSchedule_H
|
||||
|
||||
#include "DynamicList.H"
|
||||
#include "labelPair.H"
|
||||
#include "labelList.H"
|
||||
|
||||
@ -67,7 +67,7 @@ namespace Foam
|
||||
|
||||
class commSchedule
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Order in which input communication has been scheduled
|
||||
labelList schedule_;
|
||||
@ -75,12 +75,6 @@ class commSchedule
|
||||
//- Per processor the order in which communication has been scheduled
|
||||
labelListList procSchedule_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Count the number of outstanding communications for a single
|
||||
// processor
|
||||
label outstandingComms(const labelList&, DynamicList<label>&) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user