fileOperation: Corrected processor counting for moving mesh cases
Also resolves bug-report https://bugs.openfoam.org/view.php?id=2774
This commit is contained in:
@ -272,6 +272,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
bool region = args.optionFound("region");
|
||||||
bool allRegions = args.optionFound("allRegions");
|
bool allRegions = args.optionFound("allRegions");
|
||||||
bool writeCellDist = args.optionFound("cellDist");
|
bool writeCellDist = args.optionFound("cellDist");
|
||||||
bool copyZero = args.optionFound("copyZero");
|
bool copyZero = args.optionFound("copyZero");
|
||||||
@ -403,6 +404,12 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Using existing processor directories" << nl;
|
Info<< "Using existing processor directories" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (region || allRegions)
|
||||||
|
{
|
||||||
|
procDirsProblem = false;
|
||||||
|
forceOverwrite = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (forceOverwrite)
|
if (forceOverwrite)
|
||||||
{
|
{
|
||||||
Info<< "Removing " << nProcs
|
Info<< "Removing " << nProcs
|
||||||
|
|||||||
@ -827,6 +827,32 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* realSrcPath = realpath(src.c_str(), nullptr);
|
||||||
|
char* realDestPath = realpath(destFile.c_str(), nullptr);
|
||||||
|
const bool samePath = strcmp(realSrcPath, realDestPath) == 0;
|
||||||
|
|
||||||
|
if (POSIX::debug && samePath)
|
||||||
|
{
|
||||||
|
InfoInFunction
|
||||||
|
<< "Attempt to copy " << realSrcPath << " to itself" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (realSrcPath)
|
||||||
|
{
|
||||||
|
free(realSrcPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (realDestPath)
|
||||||
|
{
|
||||||
|
free(realDestPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not copy over self when src is actually a link to dest
|
||||||
|
if (samePath)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Copy files
|
// Copy files
|
||||||
fileNameList contents = readDir(src, fileName::FILE, false, followLink);
|
fileNameList contents = readDir(src, fileName::FILE, false, followLink);
|
||||||
forAll(contents, i)
|
forAll(contents, i)
|
||||||
|
|||||||
@ -591,14 +591,7 @@ Foam::label Foam::fileOperation::nProcs
|
|||||||
label nProcs = 0;
|
label nProcs = 0;
|
||||||
while
|
while
|
||||||
(
|
(
|
||||||
isDir
|
isDir(dir/(word("processor") + name(nProcs)))
|
||||||
(
|
|
||||||
dir
|
|
||||||
/(word("processor") + name(nProcs))
|
|
||||||
/"constant"
|
|
||||||
/local
|
|
||||||
/polyMesh::meshSubDir
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
++nProcs;
|
++nProcs;
|
||||||
|
|||||||
Reference in New Issue
Block a user