mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: 'processor' in directory name causes issues (issue #199)
- previously just detected the presence of "processor" in the case
path name. Restrict to checking the final portion.
Does not solve all problems, but solves ones like this:
test-new-processor-generation/....
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,6 +26,38 @@ License
|
||||
#include "TimePaths.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::TimePaths::detectProcessorCase()
|
||||
{
|
||||
if (processorCase_)
|
||||
{
|
||||
return processorCase_;
|
||||
}
|
||||
|
||||
// Look for "processor", but should really check for following digits too
|
||||
const std::string::size_type sep = globalCaseName_.rfind('/');
|
||||
const std::string::size_type pos = globalCaseName_.find
|
||||
(
|
||||
"processor",
|
||||
(sep == string::npos ? 0 : sep)
|
||||
);
|
||||
|
||||
if (pos == 0)
|
||||
{
|
||||
globalCaseName_ = ".";
|
||||
processorCase_ = true;
|
||||
}
|
||||
else if (pos != string::npos && sep != string::npos && sep == pos-1)
|
||||
{
|
||||
globalCaseName_.resize(sep);
|
||||
processorCase_ = true;
|
||||
}
|
||||
|
||||
return processorCase_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::TimePaths::TimePaths
|
||||
@ -38,29 +70,13 @@ Foam::TimePaths::TimePaths
|
||||
:
|
||||
processorCase_(false),
|
||||
rootPath_(rootPath),
|
||||
globalCaseName_(caseName),
|
||||
case_(caseName),
|
||||
system_(systemName),
|
||||
constant_(constantName)
|
||||
{
|
||||
// Find out from case name whether a processor directory
|
||||
std::string::size_type pos = caseName.find("processor");
|
||||
if (pos != string::npos)
|
||||
{
|
||||
processorCase_ = true;
|
||||
|
||||
if (pos == 0)
|
||||
{
|
||||
globalCaseName_ = ".";
|
||||
}
|
||||
else
|
||||
{
|
||||
globalCaseName_ = caseName(pos-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
globalCaseName_ = caseName;
|
||||
}
|
||||
detectProcessorCase();
|
||||
}
|
||||
|
||||
|
||||
@ -81,27 +97,10 @@ Foam::TimePaths::TimePaths
|
||||
system_(systemName),
|
||||
constant_(constantName)
|
||||
{
|
||||
if (!processorCase)
|
||||
{
|
||||
// For convenience: find out from case name whether it is a
|
||||
// processor directory and set processorCase flag so file searching
|
||||
// goes up one level.
|
||||
std::string::size_type pos = caseName.find("processor");
|
||||
|
||||
if (pos != string::npos)
|
||||
{
|
||||
processorCase_ = true;
|
||||
|
||||
if (pos == 0)
|
||||
{
|
||||
globalCaseName_ = ".";
|
||||
}
|
||||
else
|
||||
{
|
||||
globalCaseName_ = caseName(pos-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// For convenience: find out from case name whether it is a
|
||||
// processor directory and set processorCase flag so file searching
|
||||
// goes up one level.
|
||||
detectProcessorCase();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,6 +59,12 @@ class TimePaths
|
||||
const word constant_;
|
||||
|
||||
|
||||
// Private Member functions
|
||||
|
||||
//- Determine from case name whether it is a processor directory
|
||||
bool detectProcessorCase();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
Reference in New Issue
Block a user