OpenFOAM: Rationalised naming convention for file path
pathName, pathname -> filePath
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -50,16 +50,16 @@ int main()
|
|||||||
wrdList[3] = "hello3";
|
wrdList[3] = "hello3";
|
||||||
wrdList[4] = "hello4.hmm";
|
wrdList[4] = "hello4.hmm";
|
||||||
|
|
||||||
fileName pathName(wrdList);
|
fileName filePath(wrdList);
|
||||||
|
|
||||||
Info<< "pathName = " << pathName << nl
|
Info<< "filePath = " << filePath << nl
|
||||||
<< "pathName.name() = >" << pathName.name() << "<\n"
|
<< "filePath.name() = >" << filePath.name() << "<\n"
|
||||||
<< "pathName.path() = " << pathName.path() << nl
|
<< "filePath.path() = " << filePath.path() << nl
|
||||||
<< "pathName.ext() = >" << pathName.ext() << "<\n"
|
<< "filePath.ext() = >" << filePath.ext() << "<\n"
|
||||||
<< "pathName.name(true) = >" << pathName.name(true) << "<\n";
|
<< "filePath.name(true) = >" << filePath.name(true) << "<\n";
|
||||||
|
|
||||||
Info<< "pathName.components() = " << pathName.components() << nl
|
Info<< "filePath.components() = " << filePath.components() << nl
|
||||||
<< "pathName.component(2) = " << pathName.component(2) << nl
|
<< "filePath.component(2) = " << filePath.component(2) << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// try with different combination
|
// try with different combination
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -38,19 +38,19 @@ Description
|
|||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
void printCleaning(fileName& pathName)
|
void printCleaning(fileName& filePath)
|
||||||
{
|
{
|
||||||
Info<< "fileName = " << pathName << nl
|
Info<< "fileName = " << filePath << nl
|
||||||
<< " path() = " << pathName.path() << nl
|
<< " path() = " << filePath.path() << nl
|
||||||
<< " name() = " << pathName.name() << nl
|
<< " name() = " << filePath.name() << nl
|
||||||
<< " joined = " << pathName.path()/pathName.name() << nl << nl;
|
<< " joined = " << filePath.path()/filePath.name() << nl << nl;
|
||||||
|
|
||||||
pathName.clean();
|
filePath.clean();
|
||||||
|
|
||||||
Info<< "cleaned = " << pathName << nl
|
Info<< "cleaned = " << filePath << nl
|
||||||
<< " path() = " << pathName.path() << nl
|
<< " path() = " << filePath.path() << nl
|
||||||
<< " name() = " << pathName.name() << nl
|
<< " name() = " << filePath.name() << nl
|
||||||
<< " joined = " << pathName.path()/pathName.name() << nl << nl;
|
<< " joined = " << filePath.path()/filePath.name() << nl << nl;
|
||||||
|
|
||||||
IOobject::writeDivider(Info);
|
IOobject::writeDivider(Info);
|
||||||
}
|
}
|
||||||
@ -74,8 +74,8 @@ int main(int argc, char *argv[])
|
|||||||
args.printUsage();
|
args.printUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName pathName;
|
fileName filePath;
|
||||||
if (args.optionReadIfPresent("case", pathName))
|
if (args.optionReadIfPresent("case", filePath))
|
||||||
{
|
{
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "-case" << nl
|
<< "-case" << nl
|
||||||
@ -86,18 +86,18 @@ int main(int argc, char *argv[])
|
|||||||
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
|
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
printCleaning(pathName);
|
printCleaning(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (label argI=1; argI < args.size(); ++argI)
|
for (label argI=1; argI < args.size(); ++argI)
|
||||||
{
|
{
|
||||||
pathName = args[argI];
|
filePath = args[argI];
|
||||||
printCleaning(pathName);
|
printCleaning(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("istream"))
|
if (args.optionFound("istream"))
|
||||||
{
|
{
|
||||||
args.optionLookup("istream")() >> pathName;
|
args.optionLookup("istream")() >> filePath;
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "-case" << nl
|
<< "-case" << nl
|
||||||
@ -108,7 +108,7 @@ int main(int argc, char *argv[])
|
|||||||
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
|
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
printCleaning(pathName);
|
printCleaning(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "\nEnd\n" << endl;
|
Info<< "\nEnd\n" << endl;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -287,11 +287,11 @@ bool Foam::chDir(const fileName& dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
bool Foam::mkDir(const fileName& filePath, mode_t mode)
|
||||||
{
|
{
|
||||||
if (POSIX::debug)
|
if (POSIX::debug)
|
||||||
{
|
{
|
||||||
Pout<< FUNCTION_NAME << " : pathName:" << pathName << " mode:" << mode
|
Pout<< FUNCTION_NAME << " : filePath:" << filePath << " mode:" << mode
|
||||||
<< endl;
|
<< endl;
|
||||||
if ((POSIX::debug & 2) && !Pstream::master())
|
if ((POSIX::debug & 2) && !Pstream::master())
|
||||||
{
|
{
|
||||||
@ -300,13 +300,13 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Empty names are meaningless
|
// Empty names are meaningless
|
||||||
if (pathName.empty())
|
if (filePath.empty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct instance path directory if does not exist
|
// Construct instance path directory if does not exist
|
||||||
if (::mkdir(pathName.c_str(), mode) == 0)
|
if (::mkdir(filePath.c_str(), mode) == 0)
|
||||||
{
|
{
|
||||||
// Directory made OK so return true
|
// Directory made OK so return true
|
||||||
return true;
|
return true;
|
||||||
@ -318,7 +318,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
case EPERM:
|
case EPERM:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "The filesystem containing " << pathName
|
<< "The filesystem containing " << filePath
|
||||||
<< " does not support the creation of directories."
|
<< " does not support the creation of directories."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
case EFAULT:
|
case EFAULT:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "" << pathName
|
<< "" << filePath
|
||||||
<< " points outside your accessible address space."
|
<< " points outside your accessible address space."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "The parent directory does not allow write "
|
<< "The parent directory does not allow write "
|
||||||
"permission to the process,"<< nl
|
"permission to the process,"<< nl
|
||||||
<< "or one of the directories in " << pathName
|
<< "or one of the directories in " << filePath
|
||||||
<< " did not allow search (execute) permission."
|
<< " did not allow search (execute) permission."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
case ENAMETOOLONG:
|
case ENAMETOOLONG:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "" << pathName << " is too long."
|
<< "" << filePath << " is too long."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -365,14 +365,14 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
case ENOENT:
|
case ENOENT:
|
||||||
{
|
{
|
||||||
// Part of the path does not exist so try to create it
|
// Part of the path does not exist so try to create it
|
||||||
if (pathName.path().size() && mkDir(pathName.path(), mode))
|
if (filePath.path().size() && mkDir(filePath.path(), mode))
|
||||||
{
|
{
|
||||||
return mkDir(pathName, mode);
|
return mkDir(filePath, mode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Couldn't create directory " << pathName
|
<< "Couldn't create directory " << filePath
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -382,7 +382,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
case ENOTDIR:
|
case ENOTDIR:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "A component used as a directory in " << pathName
|
<< "A component used as a directory in " << filePath
|
||||||
<< " is not, in fact, a directory."
|
<< " is not, in fact, a directory."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Insufficient kernel memory was available to make "
|
<< "Insufficient kernel memory was available to make "
|
||||||
"directory " << pathName << '.'
|
"directory " << filePath << '.'
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -402,7 +402,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
case EROFS:
|
case EROFS:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "" << pathName
|
<< "" << filePath
|
||||||
<< " refers to a file on a read-only filesystem."
|
<< " refers to a file on a read-only filesystem."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Too many symbolic links were encountered in resolving "
|
<< "Too many symbolic links were encountered in resolving "
|
||||||
<< pathName << '.'
|
<< filePath << '.'
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -422,7 +422,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
case ENOSPC:
|
case ENOSPC:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "The device containing " << pathName
|
<< "The device containing " << filePath
|
||||||
<< " has no room for the new directory or "
|
<< " has no room for the new directory or "
|
||||||
<< "the user's disk quota is exhausted."
|
<< "the user's disk quota is exhausted."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -433,7 +433,7 @@ bool Foam::mkDir(const fileName& pathName, mode_t mode)
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Couldn't create directory " << pathName
|
<< "Couldn't create directory " << filePath
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -37,12 +37,12 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
|
Foam::IFstreamAllocator::IFstreamAllocator(const fileName& filePath)
|
||||||
:
|
:
|
||||||
ifPtr_(nullptr),
|
ifPtr_(nullptr),
|
||||||
compression_(IOstream::UNCOMPRESSED)
|
compression_(IOstream::UNCOMPRESSED)
|
||||||
{
|
{
|
||||||
if (pathname.empty())
|
if (filePath.empty())
|
||||||
{
|
{
|
||||||
if (IFstream::debug)
|
if (IFstream::debug)
|
||||||
{
|
{
|
||||||
@ -50,32 +50,32 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ifPtr_ = new ifstream(pathname.c_str());
|
ifPtr_ = new ifstream(filePath.c_str());
|
||||||
|
|
||||||
// If the file is compressed, decompress it before reading.
|
// If the file is compressed, decompress it before reading.
|
||||||
if (!ifPtr_->good())
|
if (!ifPtr_->good())
|
||||||
{
|
{
|
||||||
if (isFile(pathname + ".gz", false, false))
|
if (isFile(filePath + ".gz", false, false))
|
||||||
{
|
{
|
||||||
delete ifPtr_;
|
delete ifPtr_;
|
||||||
|
|
||||||
if (IFstream::debug)
|
if (IFstream::debug)
|
||||||
{
|
{
|
||||||
InfoInFunction << "Decompressing " << pathname + ".gz" << endl;
|
InfoInFunction << "Decompressing " << filePath + ".gz" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
ifPtr_ = new igzstream((pathname + ".gz").c_str());
|
ifPtr_ = new igzstream((filePath + ".gz").c_str());
|
||||||
|
|
||||||
if (ifPtr_->good())
|
if (ifPtr_->good())
|
||||||
{
|
{
|
||||||
compression_ = IOstream::COMPRESSED;
|
compression_ = IOstream::COMPRESSED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isFile(pathname + ".orig", false, false))
|
else if (isFile(filePath + ".orig", false, false))
|
||||||
{
|
{
|
||||||
delete ifPtr_;
|
delete ifPtr_;
|
||||||
|
|
||||||
ifPtr_ = new ifstream((pathname + ".orig").c_str());
|
ifPtr_ = new ifstream((filePath + ".orig").c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,12 +91,12 @@ Foam::IFstreamAllocator::~IFstreamAllocator()
|
|||||||
|
|
||||||
Foam::IFstream::IFstream
|
Foam::IFstream::IFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
streamFormat format,
|
streamFormat format,
|
||||||
versionNumber version
|
versionNumber version
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
IFstreamAllocator(pathname),
|
IFstreamAllocator(filePath),
|
||||||
ISstream
|
ISstream
|
||||||
(
|
(
|
||||||
*ifPtr_,
|
*ifPtr_,
|
||||||
@ -105,7 +105,7 @@ Foam::IFstream::IFstream
|
|||||||
version,
|
version,
|
||||||
IFstreamAllocator::compression_
|
IFstreamAllocator::compression_
|
||||||
),
|
),
|
||||||
pathname_(pathname)
|
filePath_(filePath)
|
||||||
{
|
{
|
||||||
setClosed();
|
setClosed();
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ Foam::IFstream& Foam::IFstream::operator()() const
|
|||||||
if (!good())
|
if (!good())
|
||||||
{
|
{
|
||||||
// also checks variants
|
// also checks variants
|
||||||
if (isFile(pathname_, true, true))
|
if (isFile(filePath_, true, true))
|
||||||
{
|
{
|
||||||
check("IFstream::operator()");
|
check("IFstream::operator()");
|
||||||
FatalIOError.exit();
|
FatalIOError.exit();
|
||||||
@ -183,7 +183,7 @@ Foam::IFstream& Foam::IFstream::operator()() const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(*this)
|
FatalIOErrorInFunction(*this)
|
||||||
<< "file " << pathname_ << " does not exist"
|
<< "file " << filePath_ << " does not exist"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -66,8 +66,8 @@ class IFstreamAllocator
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from pathname
|
//- Construct from filePath
|
||||||
IFstreamAllocator(const fileName& pathname);
|
IFstreamAllocator(const fileName& filePath);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -86,7 +86,7 @@ class IFstream
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
fileName pathname_;
|
fileName filePath_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -96,10 +96,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from pathname
|
//- Construct from filePath
|
||||||
IFstream
|
IFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
streamFormat format=ASCII,
|
streamFormat format=ASCII,
|
||||||
versionNumber version=currentVersion
|
versionNumber version=currentVersion
|
||||||
);
|
);
|
||||||
@ -116,13 +116,13 @@ public:
|
|||||||
//- Return the name of the stream
|
//- Return the name of the stream
|
||||||
const fileName& name() const
|
const fileName& name() const
|
||||||
{
|
{
|
||||||
return pathname_;
|
return filePath_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return non-const access to the name of the stream
|
//- Return non-const access to the name of the stream
|
||||||
fileName& name()
|
fileName& name()
|
||||||
{
|
{
|
||||||
return pathname_;
|
return filePath_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -39,14 +39,14 @@ namespace Foam
|
|||||||
|
|
||||||
Foam::OFstreamAllocator::OFstreamAllocator
|
Foam::OFstreamAllocator::OFstreamAllocator
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
IOstream::compressionType compression,
|
IOstream::compressionType compression,
|
||||||
const bool append
|
const bool append
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ofPtr_(nullptr)
|
ofPtr_(nullptr)
|
||||||
{
|
{
|
||||||
if (pathname.empty())
|
if (filePath.empty())
|
||||||
{
|
{
|
||||||
if (OFstream::debug)
|
if (OFstream::debug)
|
||||||
{
|
{
|
||||||
@ -62,43 +62,43 @@ Foam::OFstreamAllocator::OFstreamAllocator
|
|||||||
if (compression == IOstream::COMPRESSED)
|
if (compression == IOstream::COMPRESSED)
|
||||||
{
|
{
|
||||||
// Get identically named uncompressed version out of the way
|
// Get identically named uncompressed version out of the way
|
||||||
fileType pathType = Foam::type(pathname, false, false);
|
fileType pathType = Foam::type(filePath, false, false);
|
||||||
if (pathType == fileType::file || pathType == fileType::link)
|
if (pathType == fileType::file || pathType == fileType::link)
|
||||||
{
|
{
|
||||||
rm(pathname);
|
rm(filePath);
|
||||||
}
|
}
|
||||||
fileName gzPathName(pathname + ".gz");
|
fileName gzfilePath(filePath + ".gz");
|
||||||
|
|
||||||
if (!append && Foam::type(gzPathName) == fileType::link)
|
if (!append && Foam::type(gzfilePath) == fileType::link)
|
||||||
{
|
{
|
||||||
// Disallow writing into softlink to avoid any problems with
|
// Disallow writing into softlink to avoid any problems with
|
||||||
// e.g. softlinked initial fields
|
// e.g. softlinked initial fields
|
||||||
rm(gzPathName);
|
rm(gzfilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
ofPtr_ = new ogzstream(gzPathName.c_str(), mode);
|
ofPtr_ = new ogzstream(gzfilePath.c_str(), mode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get identically named compressed version out of the way
|
// get identically named compressed version out of the way
|
||||||
fileName gzPathName(pathname + ".gz");
|
fileName gzfilePath(filePath + ".gz");
|
||||||
fileType gzType = Foam::type(gzPathName, false, false);
|
fileType gzType = Foam::type(gzfilePath, false, false);
|
||||||
if (gzType == fileType::file || gzType == fileType::link)
|
if (gzType == fileType::file || gzType == fileType::link)
|
||||||
{
|
{
|
||||||
rm(gzPathName);
|
rm(gzfilePath);
|
||||||
}
|
}
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!append
|
!append
|
||||||
&& Foam::type(pathname, false, false) == fileType::link
|
&& Foam::type(filePath, false, false) == fileType::link
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Disallow writing into softlink to avoid any problems with
|
// Disallow writing into softlink to avoid any problems with
|
||||||
// e.g. softlinked initial fields
|
// e.g. softlinked initial fields
|
||||||
rm(pathname);
|
rm(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
ofPtr_ = new ofstream(pathname.c_str(), mode);
|
ofPtr_ = new ofstream(filePath.c_str(), mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,16 +113,16 @@ Foam::OFstreamAllocator::~OFstreamAllocator()
|
|||||||
|
|
||||||
Foam::OFstream::OFstream
|
Foam::OFstream::OFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
streamFormat format,
|
streamFormat format,
|
||||||
versionNumber version,
|
versionNumber version,
|
||||||
compressionType compression,
|
compressionType compression,
|
||||||
const bool append
|
const bool append
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
OFstreamAllocator(pathname, compression, append),
|
OFstreamAllocator(filePath, compression, append),
|
||||||
OSstream(*ofPtr_, "OFstream.sinkFile_", format, version, compression),
|
OSstream(*ofPtr_, "OFstream.sinkFile_", format, version, compression),
|
||||||
pathname_(pathname)
|
filePath_(filePath)
|
||||||
{
|
{
|
||||||
setClosed();
|
setClosed();
|
||||||
setState(ofPtr_->rdstate());
|
setState(ofPtr_->rdstate());
|
||||||
@ -132,7 +132,7 @@ Foam::OFstream::OFstream
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
InfoInFunction
|
InfoInFunction
|
||||||
<< "Could not open file " << pathname
|
<< "Could not open file " << filePath
|
||||||
<< "for input\n"
|
<< "for input\n"
|
||||||
"in stream " << info() << Foam::endl;
|
"in stream " << info() << Foam::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -62,10 +62,10 @@ class OFstreamAllocator
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from pathname
|
//- Construct from filePath
|
||||||
OFstreamAllocator
|
OFstreamAllocator
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
||||||
const bool append = false
|
const bool append = false
|
||||||
);
|
);
|
||||||
@ -87,7 +87,7 @@ class OFstream
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
fileName pathname_;
|
fileName filePath_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -98,10 +98,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from pathname
|
//- Construct from filePath
|
||||||
OFstream
|
OFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
streamFormat format=ASCII,
|
streamFormat format=ASCII,
|
||||||
versionNumber version=currentVersion,
|
versionNumber version=currentVersion,
|
||||||
compressionType compression=UNCOMPRESSED,
|
compressionType compression=UNCOMPRESSED,
|
||||||
@ -120,13 +120,13 @@ public:
|
|||||||
//- Return the name of the stream
|
//- Return the name of the stream
|
||||||
const fileName& name() const
|
const fileName& name() const
|
||||||
{
|
{
|
||||||
return pathname_;
|
return filePath_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return non-const access to the name of the stream
|
//- Return non-const access to the name of the stream
|
||||||
fileName& name()
|
fileName& name()
|
||||||
{
|
{
|
||||||
return pathname_;
|
return filePath_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -70,7 +70,7 @@ void Foam::masterOFstream::checkWrite
|
|||||||
|
|
||||||
Foam::masterOFstream::masterOFstream
|
Foam::masterOFstream::masterOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathName,
|
const fileName& filePath,
|
||||||
streamFormat format,
|
streamFormat format,
|
||||||
versionNumber version,
|
versionNumber version,
|
||||||
compressionType compression,
|
compressionType compression,
|
||||||
@ -79,7 +79,7 @@ Foam::masterOFstream::masterOFstream
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
OStringStream(format, version),
|
OStringStream(format, version),
|
||||||
pathName_(pathName),
|
filePath_(filePath),
|
||||||
compression_(compression),
|
compression_(compression),
|
||||||
append_(append),
|
append_(append),
|
||||||
write_(write)
|
write_(write)
|
||||||
@ -93,7 +93,7 @@ Foam::masterOFstream::~masterOFstream()
|
|||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
List<fileName> filePaths(Pstream::nProcs());
|
List<fileName> filePaths(Pstream::nProcs());
|
||||||
filePaths[Pstream::myProcNo()] = pathName_;
|
filePaths[Pstream::myProcNo()] = filePath_;
|
||||||
Pstream::gatherList(filePaths);
|
Pstream::gatherList(filePaths);
|
||||||
|
|
||||||
bool uniform =
|
bool uniform =
|
||||||
@ -108,7 +108,7 @@ Foam::masterOFstream::~masterOFstream()
|
|||||||
{
|
{
|
||||||
if (Pstream::master() && write_)
|
if (Pstream::master() && write_)
|
||||||
{
|
{
|
||||||
checkWrite(pathName_, str());
|
checkWrite(filePath_, str());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ Foam::masterOFstream::~masterOFstream()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
checkWrite(pathName_, str());
|
checkWrite(filePath_, str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -52,7 +52,7 @@ class masterOFstream
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
const fileName pathName_;
|
const fileName filePath_;
|
||||||
|
|
||||||
const IOstream::compressionType compression_;
|
const IOstream::compressionType compression_;
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ public:
|
|||||||
//- Construct and set stream status
|
//- Construct and set stream status
|
||||||
masterOFstream
|
masterOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
streamFormat format=ASCII,
|
streamFormat format=ASCII,
|
||||||
versionNumber version=currentVersion,
|
versionNumber version=currentVersion,
|
||||||
compressionType compression=UNCOMPRESSED,
|
compressionType compression=UNCOMPRESSED,
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -215,7 +215,7 @@ void* Foam::OFstreamCollator::writeAll(void *threadarg)
|
|||||||
(
|
(
|
||||||
ptr->comm_,
|
ptr->comm_,
|
||||||
ptr->typeName_,
|
ptr->typeName_,
|
||||||
ptr->pathName_,
|
ptr->filePath_,
|
||||||
ptr->data_,
|
ptr->data_,
|
||||||
ptr->sizes_,
|
ptr->sizes_,
|
||||||
slaveData,
|
slaveData,
|
||||||
@ -226,8 +226,8 @@ void* Foam::OFstreamCollator::writeAll(void *threadarg)
|
|||||||
);
|
);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(ptr->pathName_)
|
FatalIOErrorInFunction(ptr->filePath_)
|
||||||
<< "Failed writing " << ptr->pathName_
|
<< "Failed writing " << ptr->filePath_
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class OFstreamCollator
|
|||||||
|
|
||||||
const label comm_;
|
const label comm_;
|
||||||
const word typeName_;
|
const word typeName_;
|
||||||
const fileName pathName_;
|
const fileName filePath_;
|
||||||
const string data_;
|
const string data_;
|
||||||
const labelList sizes_;
|
const labelList sizes_;
|
||||||
PtrList<List<char>> slaveData_;
|
PtrList<List<char>> slaveData_;
|
||||||
@ -101,7 +101,7 @@ class OFstreamCollator
|
|||||||
:
|
:
|
||||||
comm_(comm),
|
comm_(comm),
|
||||||
typeName_(typeName),
|
typeName_(typeName),
|
||||||
pathName_(filePath),
|
filePath_(filePath),
|
||||||
data_(data),
|
data_(data),
|
||||||
sizes_(sizes),
|
sizes_(sizes),
|
||||||
slaveData_(0),
|
slaveData_(0),
|
||||||
|
|||||||
@ -41,7 +41,7 @@ Foam::threadedCollatedOFstream::threadedCollatedOFstream
|
|||||||
:
|
:
|
||||||
OStringStream(format, version),
|
OStringStream(format, version),
|
||||||
writer_(writer),
|
writer_(writer),
|
||||||
pathName_(filePath),
|
filePath_(filePath),
|
||||||
compression_(compression),
|
compression_(compression),
|
||||||
useThread_(useThread)
|
useThread_(useThread)
|
||||||
{}
|
{}
|
||||||
@ -54,7 +54,7 @@ Foam::threadedCollatedOFstream::~threadedCollatedOFstream()
|
|||||||
writer_.write
|
writer_.write
|
||||||
(
|
(
|
||||||
decomposedBlockData::typeName,
|
decomposedBlockData::typeName,
|
||||||
pathName_,
|
filePath_,
|
||||||
str(),
|
str(),
|
||||||
IOstream::BINARY,
|
IOstream::BINARY,
|
||||||
version(),
|
version(),
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class threadedCollatedOFstream
|
|||||||
|
|
||||||
OFstreamCollator& writer_;
|
OFstreamCollator& writer_;
|
||||||
|
|
||||||
const fileName pathName_;
|
const fileName filePath_;
|
||||||
|
|
||||||
const IOstream::compressionType compression_;
|
const IOstream::compressionType compression_;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -247,7 +247,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Assemble words and fileNames as pathnames by adding a '/' separator
|
//- Assemble words and fileNames as filePaths by adding a '/' separator
|
||||||
fileName operator/(const string&, const string&);
|
fileName operator/(const string&, const string&);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -83,11 +83,11 @@ Foam::label Foam::ensightFile::subDirWidth()
|
|||||||
|
|
||||||
Foam::ensightFile::ensightFile
|
Foam::ensightFile::ensightFile
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
IOstream::streamFormat format
|
IOstream::streamFormat format
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
OFstream(pathname, format)
|
OFstream(filePath, format)
|
||||||
{
|
{
|
||||||
// ascii formatting specs
|
// ascii formatting specs
|
||||||
setf
|
setf
|
||||||
|
|||||||
@ -68,10 +68,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from pathname
|
//- Construct from filePath
|
||||||
ensightFile
|
ensightFile
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
IOstream::streamFormat format=IOstream::BINARY
|
IOstream::streamFormat format=IOstream::BINARY
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -29,11 +29,11 @@ License
|
|||||||
|
|
||||||
Foam::ensightGeoFile::ensightGeoFile
|
Foam::ensightGeoFile::ensightGeoFile
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
IOstream::streamFormat format
|
IOstream::streamFormat format
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ensightFile(pathname, format)
|
ensightFile(filePath, format)
|
||||||
{
|
{
|
||||||
writeBinaryHeader();
|
writeBinaryHeader();
|
||||||
write("Ensight Geometry File"); newline();
|
write("Ensight Geometry File"); newline();
|
||||||
|
|||||||
@ -51,10 +51,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from pathname
|
//- Construct from filePath
|
||||||
ensightGeoFile
|
ensightGeoFile
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
IOstream::streamFormat format=IOstream::BINARY
|
IOstream::streamFormat format=IOstream::BINARY
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -58,13 +58,13 @@ void Foam::OBJstream::writeAndCheck(const char c)
|
|||||||
|
|
||||||
Foam::OBJstream::OBJstream
|
Foam::OBJstream::OBJstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
streamFormat format,
|
streamFormat format,
|
||||||
versionNumber version,
|
versionNumber version,
|
||||||
compressionType compression
|
compressionType compression
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
OFstream(pathname, format, version, compression),
|
OFstream(filePath, format, version, compression),
|
||||||
startOfLine_(true),
|
startOfLine_(true),
|
||||||
nVertices_(0)
|
nVertices_(0)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -74,10 +74,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from pathname
|
//- Construct from filePath
|
||||||
OBJstream
|
OBJstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& filePath,
|
||||||
streamFormat format=ASCII,
|
streamFormat format=ASCII,
|
||||||
versionNumber version=currentVersion,
|
versionNumber version=currentVersion,
|
||||||
compressionType compression=UNCOMPRESSED
|
compressionType compression=UNCOMPRESSED
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration | Website: https://openfoam.org
|
# \\ / O peration | Website: https://openfoam.org
|
||||||
# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -63,11 +63,11 @@ echo >> Make/files
|
|||||||
for file in `find . -name "*.[cCylLfF]" -type f -print`
|
for file in `find . -name "*.[cCylLfF]" -type f -print`
|
||||||
do
|
do
|
||||||
fileName=`echo ${file##*/}`
|
fileName=`echo ${file##*/}`
|
||||||
pathName=`echo ${file%/*} | sed 's%^\.%%' | sed 's%^/%%' | $dirToString`
|
filePath=`echo ${file%/*} | sed 's%^\.%%' | sed 's%^/%%' | $dirToString`
|
||||||
|
|
||||||
if [ -n "$pathName" ]
|
if [ -n "$filePath" ]
|
||||||
then
|
then
|
||||||
echo '$('$pathName')/'$fileName >> Make/files
|
echo '$('$filePath')/'$fileName >> Make/files
|
||||||
else
|
else
|
||||||
echo $fileName >> Make/files
|
echo $fileName >> Make/files
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -94,11 +94,11 @@ const char* currentPath = NULL;
|
|||||||
|
|
||||||
void nextFile(const char* fileName);
|
void nextFile(const char* fileName);
|
||||||
int lookUp(struct HashEntry** hashTable, const char* p);
|
int lookUp(struct HashEntry** hashTable, const char* p);
|
||||||
void addFile(char* pathName);
|
void addFile(char* filePath);
|
||||||
void openFile(const char* pathName);
|
void openFile(const char* filePath);
|
||||||
char* strRep(char* str, struct searchReplace* sr);
|
char* strRep(char* str, struct searchReplace* sr);
|
||||||
char* substitutePath(char* pathName);
|
char* substitutePath(char* filePath);
|
||||||
void printFile(FILE* file, const char* pathName);
|
void printFile(FILE* file, const char* filePath);
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
@ -285,17 +285,17 @@ int main(int argc, char* argv[])
|
|||||||
/* Add a directory name to the file name */
|
/* Add a directory name to the file name */
|
||||||
char* addDirectoryName(const char* dirName, const char* fileName)
|
char* addDirectoryName(const char* dirName, const char* fileName)
|
||||||
{
|
{
|
||||||
char* pathName = (char*)malloc(strlen(dirName) + strlen(fileName) + 2);
|
char* filePath = (char*)malloc(strlen(dirName) + strlen(fileName) + 2);
|
||||||
strcpy(pathName, dirName);
|
strcpy(filePath, dirName);
|
||||||
|
|
||||||
if (dirName[strlen(dirName)-1] != '/')
|
if (dirName[strlen(dirName)-1] != '/')
|
||||||
{
|
{
|
||||||
strcat(pathName, "/");
|
strcat(filePath, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(pathName, fileName);
|
strcat(filePath, fileName);
|
||||||
|
|
||||||
return pathName;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -317,17 +317,17 @@ void nextFile(const char* fileName)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nDirectories; i++)
|
for (i = 0; i < nDirectories; i++)
|
||||||
{
|
{
|
||||||
char* pathName = addDirectoryName(directories[i], fileName);
|
char* filePath = addDirectoryName(directories[i], fileName);
|
||||||
|
|
||||||
if (access(pathName, R_OK ) != -1)
|
if (access(filePath, R_OK ) != -1)
|
||||||
{
|
{
|
||||||
addFile(pathName);
|
addFile(filePath);
|
||||||
currentPath = directories[i];
|
currentPath = directories[i];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pathName);
|
free(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nDirectories == 0)
|
if (nDirectories == 0)
|
||||||
@ -393,7 +393,7 @@ int lookUp(struct HashEntry** hashTable, const char* p)
|
|||||||
|
|
||||||
|
|
||||||
/* Add file to list */
|
/* Add file to list */
|
||||||
void addFile(char* pathName)
|
void addFile(char* filePath)
|
||||||
{
|
{
|
||||||
if (nFiles == maxNfiles - 1)
|
if (nFiles == maxNfiles - 1)
|
||||||
{
|
{
|
||||||
@ -401,20 +401,20 @@ void addFile(char* pathName)
|
|||||||
files = (char**)realloc(files, sizeof(char*)*maxNfiles);
|
files = (char**)realloc(files, sizeof(char*)*maxNfiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
files[nFiles++] = pathName;
|
files[nFiles++] = filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Open file and set yyin */
|
/* Open file and set yyin */
|
||||||
void openFile(const char* pathName)
|
void openFile(const char* filePath)
|
||||||
{
|
{
|
||||||
if (!(yyin = fopen(pathName, "r")))
|
if (!(yyin = fopen(filePath, "r")))
|
||||||
{
|
{
|
||||||
fprintf
|
fprintf
|
||||||
(
|
(
|
||||||
stderr,
|
stderr,
|
||||||
"could not open file %s for source file %s due to %s\n",
|
"could not open file %s for source file %s due to %s\n",
|
||||||
pathName, sourceFile, strerror(errno)
|
filePath, sourceFile, strerror(errno)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,25 +455,25 @@ char* strRep(char* str, struct searchReplace* sr)
|
|||||||
|
|
||||||
|
|
||||||
/* Substitute path components with command-line replacements */
|
/* Substitute path components with command-line replacements */
|
||||||
char* substitutePath(char* pathName)
|
char* substitutePath(char* filePath)
|
||||||
{
|
{
|
||||||
if (nReplacements)
|
if (nReplacements)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nReplacements; i++)
|
for (i = 0; i < nReplacements; i++)
|
||||||
{
|
{
|
||||||
pathName = strRep(pathName, &replacements[i]);
|
filePath = strRep(filePath, &replacements[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pathName;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print file path to the dependencies file */
|
/* Print file path to the dependencies file */
|
||||||
void printFile(FILE* file, const char* pathName)
|
void printFile(FILE* file, const char* filePath)
|
||||||
{
|
{
|
||||||
fprintf(file, "%s \\\n", pathName);
|
fprintf(file, "%s \\\n", filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user