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:
parent
81c4f1ee8a
commit
549337c367
2 changed files with 54 additions and 7 deletions
|
|
@ -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
|
Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||||
(
|
(
|
||||||
const regIOobject& io,
|
const regIOobject& io,
|
||||||
|
|
@ -74,11 +99,8 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||||
fileName fName;
|
fileName fName;
|
||||||
if (dict.readIfPresent("file", fName, false, false))
|
if (dict.readIfPresent("file", fName, false, false))
|
||||||
{
|
{
|
||||||
fName.expand();
|
fName = relativeFilePath(io, fName, isGlobal);
|
||||||
if (!fName.isAbsolute())
|
|
||||||
{
|
|
||||||
fName = io.objectPath().path()/fName;
|
|
||||||
}
|
|
||||||
if (!exists(fName))
|
if (!exists(fName))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
|
@ -295,7 +317,15 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||||
surfaceClosed_(-1)
|
surfaceClosed_(-1)
|
||||||
{
|
{
|
||||||
// Reading from supplied file name instead of objectPath/filePath
|
// 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;
|
scalar scaleFactor = 0;
|
||||||
|
|
||||||
|
|
@ -385,7 +415,15 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||||
surfaceClosed_(-1)
|
surfaceClosed_(-1)
|
||||||
{
|
{
|
||||||
// Reading from supplied file name instead of objectPath/filePath
|
// 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;
|
scalar scaleFactor = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,15 @@ class triSurfaceMesh
|
||||||
//- Return fileName to load IOobject from
|
//- Return fileName to load IOobject from
|
||||||
static fileName checkFile(const regIOobject& io, const bool isGlobal);
|
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
|
//- Return fileName to load IOobject from. Optional override of fileName
|
||||||
static fileName checkFile
|
static fileName checkFile
|
||||||
(
|
(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue