mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Skip processing of filename if external deck already exists.
This commit is contained in:
committed by
Joakim Hove
parent
0eee2c37e6
commit
e1e1efbaaf
@@ -262,33 +262,37 @@ public:
|
|||||||
std::string fileName = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName);
|
std::string fileName = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName);
|
||||||
edgeWeightsMethod_ = Dune::EdgeWeightMethod(EWOMS_GET_PARAM(TypeTag, int, EdgeWeightsMethod));
|
edgeWeightsMethod_ = Dune::EdgeWeightMethod(EWOMS_GET_PARAM(TypeTag, int, EdgeWeightsMethod));
|
||||||
|
|
||||||
if (fileName == "")
|
// Skip processing of filename if external deck already exists.
|
||||||
throw std::runtime_error("No input deck file has been specified as a command line argument,"
|
if (!externalDeck_)
|
||||||
" or via '--ecl-deck-file-name=CASE.DATA'");
|
{
|
||||||
|
if (fileName == "")
|
||||||
|
throw std::runtime_error("No input deck file has been specified as a command line argument,"
|
||||||
|
" or via '--ecl-deck-file-name=CASE.DATA'");
|
||||||
|
|
||||||
fileName = canonicalDeckPath(fileName).string();
|
fileName = canonicalDeckPath(fileName).string();
|
||||||
|
|
||||||
// compute the base name of the input file name
|
// compute the base name of the input file name
|
||||||
const char directorySeparator = '/';
|
const char directorySeparator = '/';
|
||||||
long int i;
|
long int i;
|
||||||
for (i = fileName.size(); i >= 0; -- i)
|
for (i = fileName.size(); i >= 0; -- i)
|
||||||
if (fileName[i] == directorySeparator)
|
if (fileName[i] == directorySeparator)
|
||||||
break;
|
break;
|
||||||
std::string baseName = fileName.substr(i + 1, fileName.size());
|
std::string baseName = fileName.substr(i + 1, fileName.size());
|
||||||
|
|
||||||
// remove the extension from the input file
|
// remove the extension from the input file
|
||||||
for (i = baseName.size(); i >= 0; -- i)
|
for (i = baseName.size(); i >= 0; -- i)
|
||||||
if (baseName[i] == '.')
|
if (baseName[i] == '.')
|
||||||
break;
|
break;
|
||||||
std::string rawCaseName;
|
std::string rawCaseName;
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
rawCaseName = baseName;
|
rawCaseName = baseName;
|
||||||
else
|
else
|
||||||
rawCaseName = baseName.substr(0, i);
|
rawCaseName = baseName.substr(0, i);
|
||||||
|
|
||||||
// transform the result to ALL_UPPERCASE
|
// transform the result to ALL_UPPERCASE
|
||||||
caseName_ = rawCaseName;
|
caseName_ = rawCaseName;
|
||||||
std::transform(caseName_.begin(), caseName_.end(), caseName_.begin(), ::toupper);
|
std::transform(caseName_.begin(), caseName_.end(), caseName_.begin(), ::toupper);
|
||||||
|
}
|
||||||
|
|
||||||
// create the parser objects for the deck or use their externally specified
|
// create the parser objects for the deck or use their externally specified
|
||||||
// versions (if desired)
|
// versions (if desired)
|
||||||
@@ -319,7 +323,6 @@ public:
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(externalDeck_);
|
assert(externalDeck_);
|
||||||
|
|
||||||
deck_ = externalDeck_;
|
deck_ = externalDeck_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user