Commit 1ead1759 authored by Mark Olesen's avatar Mark Olesen
Browse files

BUG: error with empty distributed roots specification (fixes #2196)

parent 2fe94812
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -1184,7 +1184,7 @@ void Foam::argList::parse
{
parRunControl_.distributed(true);
source = "-roots";
if (roots.size() != 1)
if (roots.size() > 1)
{
dictNProcs = roots.size()+1;
}
......@@ -1193,6 +1193,7 @@ void Foam::argList::parse
{
roots.resize(Pstream::nProcs()-1, fileName::null);
parRunControl_.distributed(true);
source = "-hostRoots";
ITstream is(source, options_["hostRoots"]);
......@@ -1231,7 +1232,7 @@ void Foam::argList::parse
}
}
if (roots.size() != 1)
if (roots.size() > 1)
{
dictNProcs = roots.size()+1;
}
......@@ -1259,6 +1260,12 @@ void Foam::argList::parse
{
parRunControl_.distributed(true);
decompDict.readEntry("roots", roots);
if (roots.empty())
{
DetailInfo
<< "WARNING: running distributed"
<< " but did not specify roots!" << nl;
}
}
}
......@@ -1326,8 +1333,8 @@ void Foam::argList::parse
{
options_.set("case", roots[slave-1]/globalCase_);
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << args_ << options_ << roots.size();
OPstream toProc(Pstream::commsTypes::scheduled, slave);
toProc << args_ << options_ << parRunControl_.distributed();
}
options_.erase("case");
......@@ -1377,24 +1384,24 @@ void Foam::argList::parse
slave++
)
{
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << args_ << options_ << roots.size();
OPstream toProc(Pstream::commsTypes::scheduled, slave);
toProc << args_ << options_ << parRunControl_.distributed();
}
}
}
else
{
// Collect the master's argument list
label nroots;
bool isDistributed;
IPstream fromMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
fromMaster >> args_ >> options_ >> nroots;
fromMaster >> args_ >> options_ >> isDistributed;
parRunControl_.distributed(nroots);
parRunControl_.distributed(isDistributed);
// Establish rootPath_/globalCase_/case_ for slave
setCasePaths();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment