FEATURE: Make sure constant directory is available before writing into it. Author: Hrvoje Jasak. Merge: Dominik Christ.

This commit is contained in:
Dominik Christ 2014-09-30 16:25:19 +01:00
commit cc4804428b
2 changed files with 30 additions and 27 deletions

View file

@ -45,7 +45,7 @@ int main(int argc, char *argv[])
{ {
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
IOdictionary meshDict IOdictionary meshDict
( (
IOobject IOobject
@ -57,7 +57,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE IOobject::NO_WRITE
) )
); );
IOdictionary decomposeParDict IOdictionary decomposeParDict
( (
IOobject IOobject
@ -69,12 +69,12 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE IOobject::NO_WRITE
) )
); );
const label nProcessors const label nProcessors
( (
readLabel(decomposeParDict.lookup("numberOfSubdomains")) readLabel(decomposeParDict.lookup("numberOfSubdomains"))
); );
for(label procI=0;procI<nProcessors;++procI) for(label procI=0;procI<nProcessors;++procI)
{ {
fileName file("processor"); fileName file("processor");
@ -82,17 +82,20 @@ int main(int argc, char *argv[])
ss << procI; ss << procI;
file += ss.str(); file += ss.str();
Info << "Creating " << file << endl; Info << "Creating " << file << endl;
//- create a directory for processor data // create a directory for processor data
mkDir(runTime.path()/file); mkDir(runTime.path()/file);
//- copy the contents of the const directory into processor* // generate constant directories
mkDir(runTime.path()/"constant");
// copy the contents of the const directory into processor*
cp(runTime.path()/"constant", runTime.path()/file); cp(runTime.path()/"constant", runTime.path()/file);
//- generate 0 directories for // generate 0 directories
mkDir(runTime.path()/file/"0"); mkDir(runTime.path()/file/"0");
} }
Info << "End\n" << endl; Info << "End\n" << endl;
return 0; return 0;
} }

View file

@ -8,32 +8,32 @@ cd cartesianMesh
cd asmoOctree cd asmoOctree
cleanCase cleanCase
rm -rf constant/polyMesh > /dev/null 2>&1 \rm -rf constant/polyMesh > /dev/null 2>&1
rm log.* \rm -f log.*
cd .. cd ..
cd bunnyOctree cd bunnyOctree
cleanCase cleanCase
rm -rf constant/polyMesh > /dev/null 2>&1 \rm -rf constant/polyMesh > /dev/null 2>&1
rm log.* \rm -f log.*
cd .. cd ..
cd intakePortOctree cd intakePortOctree
cleanCase cleanCase
rm -rf constant/polyMesh > /dev/null 2>&1 \rm -rf constant/polyMesh > /dev/null 2>&1
rm log.* \rm -f log.*
cd .. cd ..
cd sawOctree cd sawOctree
cleanCase cleanCase
rm -rf processor* > /dev/null 2>&1 \rm -rf processor* > /dev/null 2>&1
rm log.* \rm -f log.*
cd .. cd ..
cd sBendOctree cd sBendOctree
cleanCase cleanCase
rm -rf constant/polyMesh > /dev/null 2>&1 \rm -rf constant/polyMesh > /dev/null 2>&1
rm log.* \rm -f log.*
cd .. cd ..
cd .. cd ..
@ -42,8 +42,8 @@ cd cartesian2DMesh
cd hatOctree cd hatOctree
cleanCase cleanCase
rm -rf constant/polyMesh > /dev/null 2>&1 \rm -rf constant/polyMesh > /dev/null 2>&1
rm log.* \rm -f log.*
cd .. cd ..
cd .. cd ..
@ -52,14 +52,14 @@ cd tetMesh
cd cutCubeOctree cd cutCubeOctree
cleanCase cleanCase
rm -rf constant/polyMesh > /dev/null 2>&1 \rm -rf constant/polyMesh > /dev/null 2>&1
rm log.* \rm -f log.*
cd .. cd ..
cd socketOctree cd socketOctree
cleanCase cleanCase
rm -rf constant/polyMesh > /dev/null 2>&1 \rm -rf constant/polyMesh > /dev/null 2>&1
rm log.* \rm -f log.*
cd .. cd ..
cd .. cd ..