triSurfaceMesh: corrected parallel operation of 'file' specification
Patch contributed by Mattijs Janssens Resolves bug-report https://bugs.openfoam.org/view.php?id=2614
This commit is contained in:
@ -64,6 +64,31 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::relativeFilePath
|
||||
(
|
||||
const regIOobject& io,
|
||||
const fileName& f,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName(f);
|
||||
fName.expand();
|
||||
if (!fName.isAbsolute())
|
||||
{
|
||||
// Is the specified file:
|
||||
// - local to the cwd?
|
||||
// - local to the case dir?
|
||||
// - or just another name?
|
||||
fName = fileHandler().filePath
|
||||
(
|
||||
isGlobal,
|
||||
IOobject(io, fName),
|
||||
word::null
|
||||
);
|
||||
}
|
||||
return fName;
|
||||
}
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
(
|
||||
const regIOobject& io,
|
||||
@ -74,11 +99,8 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
fileName fName;
|
||||
if (dict.readIfPresent("file", fName, false, false))
|
||||
{
|
||||
fName.expand();
|
||||
if (!fName.isAbsolute())
|
||||
{
|
||||
fName = io.objectPath().path()/fName;
|
||||
}
|
||||
fName = relativeFilePath(io, fName, isGlobal);
|
||||
|
||||
if (!exists(fName))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -295,7 +317,15 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
surfaceClosed_(-1)
|
||||
{
|
||||
// Reading from supplied file name instead of objectPath/filePath
|
||||
dict.readIfPresent("file", fName_, false, false);
|
||||
if (dict.readIfPresent("file", fName_, false, false))
|
||||
{
|
||||
fName_ = relativeFilePath
|
||||
(
|
||||
static_cast<const searchableSurface&>(*this),
|
||||
fName_,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
scalar scaleFactor = 0;
|
||||
|
||||
@ -385,7 +415,15 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
surfaceClosed_(-1)
|
||||
{
|
||||
// Reading from supplied file name instead of objectPath/filePath
|
||||
dict.readIfPresent("file", fName_, false, false);
|
||||
if (dict.readIfPresent("file", fName_, false, false))
|
||||
{
|
||||
fName_ = relativeFilePath
|
||||
(
|
||||
static_cast<const searchableSurface&>(*this),
|
||||
fName_,
|
||||
isGlobal
|
||||
);
|
||||
}
|
||||
|
||||
scalar scaleFactor = 0;
|
||||
|
||||
|
||||
@ -92,6 +92,15 @@ class triSurfaceMesh
|
||||
//- Return fileName to load IOobject from
|
||||
static fileName checkFile(const regIOobject& io, const bool isGlobal);
|
||||
|
||||
//- Return fileName. If fileName is relative gets treated local to
|
||||
// IOobject
|
||||
static fileName relativeFilePath
|
||||
(
|
||||
const regIOobject&,
|
||||
const fileName&,
|
||||
const bool isGlobal
|
||||
);
|
||||
|
||||
//- Return fileName to load IOobject from. Optional override of fileName
|
||||
static fileName checkFile
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user