mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: relocate distributed flag into ParRunControl
- adjust member order in TimePaths to better packing
This commit is contained in:
@ -33,6 +33,7 @@ Description
|
|||||||
#include "nil.H"
|
#include "nil.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "PstreamBuffers.H"
|
#include "PstreamBuffers.H"
|
||||||
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -63,6 +64,13 @@ int main(int argc, char *argv[])
|
|||||||
nil x;
|
nil x;
|
||||||
cout<<"nil:" << sizeof(x) << nl;
|
cout<<"nil:" << sizeof(x) << nl;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
argList x(argc, argv);
|
||||||
|
cout<<"argList:" << sizeof(x) << nl;
|
||||||
|
|
||||||
|
TimePaths y(x);
|
||||||
|
cout<<"TimePaths:" << sizeof(y) << nl;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
zero x;
|
zero x;
|
||||||
cout<<"zero:" << sizeof(x) << nl;
|
cout<<"zero:" << sizeof(x) << nl;
|
||||||
|
|||||||
@ -336,8 +336,7 @@ void determineDecomposition
|
|||||||
{
|
{
|
||||||
Info<< "Setting caseName to " << baseRunTime.caseName()
|
Info<< "Setting caseName to " << baseRunTime.caseName()
|
||||||
<< " to read decomposeParDict" << endl;
|
<< " to read decomposeParDict" << endl;
|
||||||
const_cast<Time&>(mesh.time()).TimePaths::caseName() =
|
const_cast<Time&>(mesh.time()).caseName() = baseRunTime.caseName();
|
||||||
baseRunTime.caseName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scalarField cellWeights;
|
scalarField cellWeights;
|
||||||
@ -366,8 +365,7 @@ void determineDecomposition
|
|||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
||||||
const_cast<Time&>(mesh.time()).TimePaths::caseName() =
|
const_cast<Time&>(mesh.time()).caseName() = proc0CaseName;
|
||||||
proc0CaseName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump decomposition to volScalarField
|
// Dump decomposition to volScalarField
|
||||||
@ -383,10 +381,10 @@ void determineDecomposition
|
|||||||
|
|
||||||
Time& tm = const_cast<Time&>(mesh.time());
|
Time& tm = const_cast<Time&>(mesh.time());
|
||||||
|
|
||||||
tm.TimePaths::caseName() = baseRunTime.caseName();
|
tm.caseName() = baseRunTime.caseName();
|
||||||
writeDecomposition("cellDist", mesh, decomp);
|
writeDecomposition("cellDist", mesh, decomp);
|
||||||
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
||||||
tm.TimePaths::caseName() = proc0CaseName;
|
tm.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -908,12 +906,12 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
// Get original objects (before incrementing time!)
|
// Get original objects (before incrementing time!)
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
runTime.TimePaths::caseName() = baseRunTime.caseName();
|
runTime.caseName() = baseRunTime.caseName();
|
||||||
}
|
}
|
||||||
IOobjectList objects(mesh, runTime.timeName());
|
IOobjectList objects(mesh, runTime.timeName());
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
runTime.TimePaths::caseName() = proc0CaseName;
|
runTime.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "From time " << runTime.timeName()
|
Info<< "From time " << runTime.timeName()
|
||||||
@ -932,7 +930,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
|
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
runTime.TimePaths::caseName() = baseRunTime.caseName();
|
runTime.caseName() = baseRunTime.caseName();
|
||||||
}
|
}
|
||||||
readFields
|
readFields
|
||||||
(
|
(
|
||||||
@ -1112,7 +1110,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
|
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
runTime.TimePaths::caseName() = proc0CaseName;
|
runTime.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1192,7 +1190,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
{
|
{
|
||||||
Info<< "Setting caseName to " << baseRunTime.caseName()
|
Info<< "Setting caseName to " << baseRunTime.caseName()
|
||||||
<< " to write reconstructed mesh and fields." << endl;
|
<< " to write reconstructed mesh and fields." << endl;
|
||||||
runTime.TimePaths::caseName() = baseRunTime.caseName();
|
runTime.caseName() = baseRunTime.caseName();
|
||||||
|
|
||||||
mesh.write();
|
mesh.write();
|
||||||
topoSet::removeFiles(mesh);
|
topoSet::removeFiles(mesh);
|
||||||
@ -1212,7 +1210,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
|
|
||||||
// Now we've written all. Reset caseName on master
|
// Now we've written all. Reset caseName on master
|
||||||
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
||||||
runTime.TimePaths::caseName() = proc0CaseName;
|
runTime.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1258,7 +1256,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
// Read refinement data
|
// Read refinement data
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
runTime.TimePaths::caseName() = baseRunTime.caseName();
|
runTime.caseName() = baseRunTime.caseName();
|
||||||
}
|
}
|
||||||
IOobject io
|
IOobject io
|
||||||
(
|
(
|
||||||
@ -1274,7 +1272,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
hexRef8Data refData(io);
|
hexRef8Data refData(io);
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
runTime.TimePaths::caseName() = proc0CaseName;
|
runTime.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure all processors have valid data (since only some will
|
// Make sure all processors have valid data (since only some will
|
||||||
@ -1294,13 +1292,13 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
{
|
{
|
||||||
Info<< "Setting caseName to " << baseRunTime.caseName()
|
Info<< "Setting caseName to " << baseRunTime.caseName()
|
||||||
<< " to write reconstructed refinement data." << endl;
|
<< " to write reconstructed refinement data." << endl;
|
||||||
runTime.TimePaths::caseName() = baseRunTime.caseName();
|
runTime.caseName() = baseRunTime.caseName();
|
||||||
|
|
||||||
refData.write();
|
refData.write();
|
||||||
|
|
||||||
// Now we've written all. Reset caseName on master
|
// Now we've written all. Reset caseName on master
|
||||||
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
||||||
runTime.TimePaths::caseName() = proc0CaseName;
|
runTime.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1314,7 +1312,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
// // Read sets
|
// // Read sets
|
||||||
// if (Pstream::master() && decompose)
|
// if (Pstream::master() && decompose)
|
||||||
// {
|
// {
|
||||||
// runTime.TimePaths::caseName() = baseRunTime.caseName();
|
// runTime.caseName() = baseRunTime.caseName();
|
||||||
// }
|
// }
|
||||||
// IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
|
// IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
|
||||||
//
|
//
|
||||||
@ -1323,7 +1321,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
//
|
//
|
||||||
// if (Pstream::master() && decompose)
|
// if (Pstream::master() && decompose)
|
||||||
// {
|
// {
|
||||||
// runTime.TimePaths::caseName() = proc0CaseName;
|
// runTime.caseName() = proc0CaseName;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// forAll(cellSets, i)
|
// forAll(cellSets, i)
|
||||||
@ -1337,7 +1335,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
// {
|
// {
|
||||||
// Info<< "Setting caseName to " << baseRunTime.caseName()
|
// Info<< "Setting caseName to " << baseRunTime.caseName()
|
||||||
// << " to write reconstructed refinement data." << endl;
|
// << " to write reconstructed refinement data." << endl;
|
||||||
// runTime.TimePaths::caseName() = baseRunTime.caseName();
|
// runTime.caseName() = baseRunTime.caseName();
|
||||||
//
|
//
|
||||||
// forAll(cellSets, i)
|
// forAll(cellSets, i)
|
||||||
// {
|
// {
|
||||||
@ -1346,7 +1344,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
|||||||
//
|
//
|
||||||
// // Now we've written all. Reset caseName on master
|
// // Now we've written all. Reset caseName on master
|
||||||
// Info<< "Restoring caseName to " << proc0CaseName << endl;
|
// Info<< "Restoring caseName to " << proc0CaseName << endl;
|
||||||
// runTime.TimePaths::caseName() = proc0CaseName;
|
// runTime.caseName() = proc0CaseName;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@ -2931,7 +2929,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<< "Setting caseName to " << baseRunTime.caseName()
|
Info<< "Setting caseName to " << baseRunTime.caseName()
|
||||||
<< " to find undecomposed mesh" << endl;
|
<< " to find undecomposed mesh" << endl;
|
||||||
runTime.TimePaths::caseName() = baseRunTime.caseName();
|
runTime.caseName() = baseRunTime.caseName();
|
||||||
}
|
}
|
||||||
|
|
||||||
masterInstDir = runTime.findInstance
|
masterInstDir = runTime.findInstance
|
||||||
@ -2944,7 +2942,7 @@ int main(int argc, char *argv[])
|
|||||||
if (decompose)
|
if (decompose)
|
||||||
{
|
{
|
||||||
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
||||||
runTime.TimePaths::caseName() = proc0CaseName;
|
runTime.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Pstream::scatter(masterInstDir);
|
Pstream::scatter(masterInstDir);
|
||||||
@ -2970,7 +2968,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<< "Setting caseName to " << baseRunTime.caseName()
|
Info<< "Setting caseName to " << baseRunTime.caseName()
|
||||||
<< " to read undecomposed mesh" << endl;
|
<< " to read undecomposed mesh" << endl;
|
||||||
runTime.TimePaths::caseName() = baseRunTime.caseName();
|
runTime.caseName() = baseRunTime.caseName();
|
||||||
}
|
}
|
||||||
|
|
||||||
autoPtr<fvMesh> meshPtr = loadOrCreateMesh
|
autoPtr<fvMesh> meshPtr = loadOrCreateMesh
|
||||||
@ -2987,7 +2985,7 @@ int main(int argc, char *argv[])
|
|||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
Info<< "Restoring caseName to " << proc0CaseName << endl;
|
||||||
runTime.TimePaths::caseName() = proc0CaseName;
|
runTime.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
fvMesh& mesh = meshPtr();
|
fvMesh& mesh = meshPtr();
|
||||||
@ -3046,7 +3044,7 @@ int main(int argc, char *argv[])
|
|||||||
// Detect lagrangian fields
|
// Detect lagrangian fields
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
runTime.TimePaths::caseName() = baseRunTime.caseName();
|
runTime.caseName() = baseRunTime.caseName();
|
||||||
}
|
}
|
||||||
parLagrangianRedistributor::findClouds
|
parLagrangianRedistributor::findClouds
|
||||||
(
|
(
|
||||||
@ -3069,7 +3067,7 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
if (Pstream::master() && decompose)
|
if (Pstream::master() && decompose)
|
||||||
{
|
{
|
||||||
runTime.TimePaths::caseName() = proc0CaseName;
|
runTime.caseName() = proc0CaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -70,8 +70,8 @@ Foam::TimePaths::TimePaths
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
processorCase_(args.parRunControl().parRun()),
|
processorCase_(args.parRunControl().parRun()),
|
||||||
|
distributed_(args.parRunControl().distributed()),
|
||||||
rootPath_(args.rootPath()),
|
rootPath_(args.rootPath()),
|
||||||
distributed_(args.distributed()),
|
|
||||||
globalCaseName_(args.globalCaseName()),
|
globalCaseName_(args.globalCaseName()),
|
||||||
case_(args.caseName()),
|
case_(args.caseName()),
|
||||||
system_(systemName),
|
system_(systemName),
|
||||||
@ -93,8 +93,8 @@ Foam::TimePaths::TimePaths
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
processorCase_(false),
|
processorCase_(false),
|
||||||
rootPath_(rootPath),
|
|
||||||
distributed_(false),
|
distributed_(false),
|
||||||
|
rootPath_(rootPath),
|
||||||
globalCaseName_(caseName),
|
globalCaseName_(caseName),
|
||||||
case_(caseName),
|
case_(caseName),
|
||||||
system_(systemName),
|
system_(systemName),
|
||||||
@ -117,8 +117,8 @@ Foam::TimePaths::TimePaths
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
processorCase_(processorCase),
|
processorCase_(processorCase),
|
||||||
rootPath_(rootPath),
|
|
||||||
distributed_(distributed),
|
distributed_(distributed),
|
||||||
|
rootPath_(rootPath),
|
||||||
globalCaseName_(globalCaseName),
|
globalCaseName_(globalCaseName),
|
||||||
case_(caseName),
|
case_(caseName),
|
||||||
system_(systemName),
|
system_(systemName),
|
||||||
|
|||||||
@ -56,8 +56,9 @@ class TimePaths
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
bool processorCase_;
|
bool processorCase_;
|
||||||
const fileName rootPath_;
|
|
||||||
bool distributed_;
|
bool distributed_;
|
||||||
|
|
||||||
|
const fileName rootPath_;
|
||||||
fileName globalCaseName_;
|
fileName globalCaseName_;
|
||||||
fileName case_;
|
fileName case_;
|
||||||
const word system_;
|
const word system_;
|
||||||
|
|||||||
@ -774,8 +774,7 @@ Foam::argList::argList
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
args_(argc),
|
args_(argc),
|
||||||
options_(argc),
|
options_(argc)
|
||||||
distributed_(false)
|
|
||||||
{
|
{
|
||||||
// Check for -fileHandler, which requires an argument.
|
// Check for -fileHandler, which requires an argument.
|
||||||
word handlerType(getEnv("FOAM_FILEHANDLER"));
|
word handlerType(getEnv("FOAM_FILEHANDLER"));
|
||||||
@ -1150,7 +1149,7 @@ void Foam::argList::parse
|
|||||||
label dictNProcs = -1;
|
label dictNProcs = -1;
|
||||||
if (this->readListIfPresent("roots", roots))
|
if (this->readListIfPresent("roots", roots))
|
||||||
{
|
{
|
||||||
distributed_ = true;
|
parRunControl_.distributed(true);
|
||||||
source = "-roots";
|
source = "-roots";
|
||||||
if (roots.size() != 1)
|
if (roots.size() != 1)
|
||||||
{
|
{
|
||||||
@ -1222,7 +1221,7 @@ void Foam::argList::parse
|
|||||||
|
|
||||||
if (decompDict.lookupOrDefault("distributed", false))
|
if (decompDict.lookupOrDefault("distributed", false))
|
||||||
{
|
{
|
||||||
distributed_ = true;
|
parRunControl_.distributed(true);
|
||||||
decompDict.readEntry("roots", roots);
|
decompDict.readEntry("roots", roots);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1350,12 +1349,16 @@ void Foam::argList::parse
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Collect the master's argument list
|
// Collect the master's argument list
|
||||||
|
label nroots;
|
||||||
|
|
||||||
IPstream fromMaster
|
IPstream fromMaster
|
||||||
(
|
(
|
||||||
Pstream::commsTypes::scheduled,
|
Pstream::commsTypes::scheduled,
|
||||||
Pstream::masterNo()
|
Pstream::masterNo()
|
||||||
);
|
);
|
||||||
fromMaster >> args_ >> options_ >> distributed_;
|
fromMaster >> args_ >> options_ >> nroots;
|
||||||
|
|
||||||
|
parRunControl_.distributed(nroots);
|
||||||
|
|
||||||
// Establish rootPath_/globalCase_/case_ for slave
|
// Establish rootPath_/globalCase_/case_ for slave
|
||||||
setCasePaths();
|
setCasePaths();
|
||||||
|
|||||||
@ -129,7 +129,7 @@ class argList
|
|||||||
static bool checkProcessorDirectories_;
|
static bool checkProcessorDirectories_;
|
||||||
|
|
||||||
//- Switch on/off parallel mode.
|
//- Switch on/off parallel mode.
|
||||||
// Must be first to be constructed so destructor is done last.
|
// Construct first so destructor is done last.
|
||||||
ParRunControl parRunControl_;
|
ParRunControl parRunControl_;
|
||||||
|
|
||||||
//- The arguments after removing known options
|
//- The arguments after removing known options
|
||||||
@ -140,7 +140,6 @@ class argList
|
|||||||
|
|
||||||
word executable_;
|
word executable_;
|
||||||
fileName rootPath_;
|
fileName rootPath_;
|
||||||
bool distributed_;
|
|
||||||
fileName globalCase_;
|
fileName globalCase_;
|
||||||
fileName case_;
|
fileName case_;
|
||||||
|
|
||||||
@ -288,19 +287,12 @@ public:
|
|||||||
//- Return root path
|
//- Return root path
|
||||||
inline const fileName& rootPath() const;
|
inline const fileName& rootPath() const;
|
||||||
|
|
||||||
//- Return distributed flag
|
|
||||||
//- (i.e. are rootPaths different on different machines)
|
|
||||||
inline bool distributed() const;
|
|
||||||
|
|
||||||
//- Return case name (parallel run) or global case (serial run)
|
//- Return case name (parallel run) or global case (serial run)
|
||||||
inline const fileName& caseName() const;
|
inline const fileName& caseName() const;
|
||||||
|
|
||||||
//- Return global case name
|
//- Return global case name
|
||||||
inline const fileName& globalCaseName() const;
|
inline const fileName& globalCaseName() const;
|
||||||
|
|
||||||
//- Return parRunControl
|
|
||||||
inline const ParRunControl& parRunControl() const;
|
|
||||||
|
|
||||||
//- Return the full path to the (processor local) case
|
//- Return the full path to the (processor local) case
|
||||||
// \note This is guaranteed to be an absolute path
|
// \note This is guaranteed to be an absolute path
|
||||||
inline fileName path() const;
|
inline fileName path() const;
|
||||||
@ -309,6 +301,13 @@ public:
|
|||||||
// \note This is guaranteed to be an absolute path
|
// \note This is guaranteed to be an absolute path
|
||||||
inline fileName globalPath() const;
|
inline fileName globalPath() const;
|
||||||
|
|
||||||
|
//- Return distributed flag
|
||||||
|
//- (i.e. are rootPaths different on different machines)
|
||||||
|
inline bool distributed() const;
|
||||||
|
|
||||||
|
//- Return the ParRunControl
|
||||||
|
inline const ParRunControl& parRunControl() const;
|
||||||
|
|
||||||
//- Return the number of arguments
|
//- Return the number of arguments
|
||||||
inline label size() const;
|
inline label size() const;
|
||||||
|
|
||||||
|
|||||||
@ -63,12 +63,6 @@ inline const Foam::fileName& Foam::argList::rootPath() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::argList::distributed() const
|
|
||||||
{
|
|
||||||
return distributed_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::fileName& Foam::argList::caseName() const
|
inline const Foam::fileName& Foam::argList::caseName() const
|
||||||
{
|
{
|
||||||
return case_;
|
return case_;
|
||||||
@ -81,12 +75,6 @@ inline const Foam::fileName& Foam::argList::globalCaseName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::ParRunControl& Foam::argList::parRunControl() const
|
|
||||||
{
|
|
||||||
return parRunControl_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::fileName Foam::argList::path() const
|
inline Foam::fileName Foam::argList::path() const
|
||||||
{
|
{
|
||||||
return rootPath()/caseName();
|
return rootPath()/caseName();
|
||||||
@ -99,6 +87,18 @@ inline Foam::fileName Foam::argList::globalPath() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::argList::distributed() const
|
||||||
|
{
|
||||||
|
return parRunControl_.distributed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::ParRunControl& Foam::argList::parRunControl() const
|
||||||
|
{
|
||||||
|
return parRunControl_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::argList::size() const
|
inline Foam::label Foam::argList::size() const
|
||||||
{
|
{
|
||||||
return args_.size();
|
return args_.size();
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -49,18 +49,22 @@ namespace Foam
|
|||||||
|
|
||||||
class ParRunControl
|
class ParRunControl
|
||||||
{
|
{
|
||||||
bool RunPar;
|
bool parallel_;
|
||||||
|
bool distributed_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
ParRunControl()
|
ParRunControl()
|
||||||
:
|
:
|
||||||
RunPar(false)
|
parallel_(false),
|
||||||
|
distributed_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
//- Destructor, triggers Pstream::exit
|
||||||
~ParRunControl()
|
~ParRunControl()
|
||||||
{
|
{
|
||||||
if (RunPar)
|
if (parallel_)
|
||||||
{
|
{
|
||||||
Info<< "Finalising parallel run" << endl;
|
Info<< "Finalising parallel run" << endl;
|
||||||
}
|
}
|
||||||
@ -69,10 +73,11 @@ public:
|
|||||||
Pstream::exit(0);
|
Pstream::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Initialize Pstream for a parallel run
|
//- Initialize Pstream for a parallel run
|
||||||
void runPar(int& argc, char**& argv, const bool needsThread)
|
void runPar(int& argc, char**& argv, bool needsThread)
|
||||||
{
|
{
|
||||||
RunPar = true;
|
parallel_ = true;
|
||||||
|
|
||||||
if (!Pstream::init(argc, argv, needsThread))
|
if (!Pstream::init(argc, argv, needsThread))
|
||||||
{
|
{
|
||||||
@ -81,11 +86,22 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- True if this is parallel run.
|
||||||
//- Is this a parallel run?
|
|
||||||
bool parRun() const
|
bool parRun() const
|
||||||
{
|
{
|
||||||
return RunPar;
|
return parallel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- True if this is a parallel run and uses distributed roots.
|
||||||
|
bool distributed() const
|
||||||
|
{
|
||||||
|
return parallel_ && distributed_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Set use of distributed roots.
|
||||||
|
void distributed(bool on)
|
||||||
|
{
|
||||||
|
distributed_ = (parallel_ ? on : false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user