Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
e5c58292
Commit
e5c58292
authored
Feb 02, 2009
by
Mark Olesen
Browse files
OSspecific: isDir(), isFile() instead of dir(), file()
parent
91e12bc5
Changes
30
Hide whitespace changes
Inline
Side-by-side
applications/utilities/parallelProcessing/decomposePar/decomposePar.C
View file @
e5c58292
...
...
@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
// determine the existing processor count directly
label
nProcs
=
0
;
while
(
d
ir
(
runTime
.
path
()
/
(
word
(
"processor"
)
+
name
(
nProcs
))))
while
(
isD
ir
(
runTime
.
path
()
/
(
word
(
"processor"
)
+
name
(
nProcs
))))
{
++
nProcs
;
}
...
...
@@ -480,7 +480,7 @@ int main(int argc, char *argv[])
// Any uniform data to copy/link?
fileName
uniformDir
(
"uniform"
);
if
(
d
ir
(
runTime
.
timePath
()
/
uniformDir
))
if
(
isD
ir
(
runTime
.
timePath
()
/
uniformDir
))
{
Info
<<
"Detected additional non-decomposed files in "
<<
runTime
.
timePath
()
/
uniformDir
...
...
applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
View file @
e5c58292
...
...
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
// determine the processor count directly
label
nProcs
=
0
;
while
(
d
ir
(
args
.
path
()
/
(
word
(
"processor"
)
+
name
(
nProcs
))))
while
(
isD
ir
(
args
.
path
()
/
(
word
(
"processor"
)
+
name
(
nProcs
))))
{
++
nProcs
;
}
...
...
@@ -383,7 +383,7 @@ int main(int argc, char *argv[])
// the master processor.
fileName
uniformDir0
=
databases
[
0
].
timePath
()
/
"uniform"
;
if
(
d
ir
(
uniformDir0
))
if
(
isD
ir
(
uniformDir0
))
{
cp
(
uniformDir0
,
runTime
.
timePath
());
}
...
...
applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C
View file @
e5c58292
...
...
@@ -503,7 +503,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
// Create processor directory if non-existing
if
(
!
Pstream
::
master
()
&&
!
d
ir
(
args
.
path
()))
if
(
!
Pstream
::
master
()
&&
!
isD
ir
(
args
.
path
()))
{
Pout
<<
"Creating case directory "
<<
args
.
path
()
<<
endl
;
mkDir
(
args
.
path
());
...
...
@@ -525,7 +525,7 @@ int main(int argc, char *argv[])
const
fileName
meshDir
=
runTime
.
path
()
/
masterInstDir
/
polyMesh
::
meshSubDir
;
boolList
haveMesh
(
Pstream
::
nProcs
(),
false
);
haveMesh
[
Pstream
::
myProcNo
()]
=
d
ir
(
meshDir
);
haveMesh
[
Pstream
::
myProcNo
()]
=
isD
ir
(
meshDir
);
Pstream
::
gatherList
(
haveMesh
);
Pstream
::
scatterList
(
haveMesh
);
Info
<<
"Per processor mesh availability : "
<<
haveMesh
<<
endl
;
...
...
applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
View file @
e5c58292
...
...
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
if
(
Pstream
::
master
())
{
if
(
d
ir
(
postProcPath
))
if
(
isD
ir
(
postProcPath
))
{
rmDir
(
postProcPath
);
}
...
...
applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
View file @
e5c58292
...
...
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
// Ensight and Ensight/data directories must exist
// do not remove old data - we might wish to convert new results
// or a particular time interval
if
(
d
ir
(
ensightDir
))
if
(
isD
ir
(
ensightDir
))
{
Info
<<
"Warning: reusing existing directory"
<<
nl
<<
" "
<<
ensightDir
<<
endl
;
...
...
@@ -324,7 +324,7 @@ int main(int argc, char *argv[])
{
const
word
&
cloudName
=
cloudIter
.
key
();
if
(
!
d
ir
(
runTime
.
timePath
()
/
regionPrefix
/
"lagrangian"
/
cloudName
))
if
(
!
isD
ir
(
runTime
.
timePath
()
/
regionPrefix
/
"lagrangian"
/
cloudName
))
{
continue
;
}
...
...
applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C
View file @
e5c58292
...
...
@@ -260,7 +260,7 @@ int main(int argc, char *argv[])
// make a directory called FieldView in the case
fileName
fvPath
(
runTime
.
path
()
/
"Fieldview"
);
if
(
d
ir
(
fvPath
))
if
(
isD
ir
(
fvPath
))
{
rmDir
(
fvPath
);
}
...
...
@@ -346,7 +346,7 @@ int main(int argc, char *argv[])
// Output the magic number.
writeInt
(
fvFile
,
FV_MAGIC
);
// Output file header and version number.
writeStr80
(
fvFile
,
"FIELDVIEW"
);
...
...
@@ -417,7 +417,7 @@ int main(int argc, char *argv[])
{
if
(
volFieldPtrs
[
fieldI
]
==
NULL
)
{
Info
<<
" dummy field for "
Info
<<
" dummy field for "
<<
volFieldNames
[
fieldI
].
c_str
()
<<
endl
;
}
...
...
applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
View file @
e5c58292
...
...
@@ -333,7 +333,7 @@ int main(int argc, char *argv[])
regionPrefix
=
regionName
;
}
if
(
d
ir
(
fvPath
))
if
(
isD
ir
(
fvPath
))
{
if
(
...
...
applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
View file @
e5c58292
...
...
@@ -228,7 +228,7 @@ Foam::vtkPV3Foam::vtkPV3Foam
// avoid argList and get rootPath/caseName directly from the file
fileName
fullCasePath
(
fileName
(
FileName
).
path
());
if
(
!
d
ir
(
fullCasePath
))
if
(
!
isD
ir
(
fullCasePath
))
{
return
;
}
...
...
@@ -518,7 +518,7 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
if
(
f
ile
(
runTime
.
path
()
/
timeName
/
meshDir_
/
"points"
)
isF
ile
(
runTime
.
path
()
/
timeName
/
meshDir_
/
"points"
)
&&
IOobject
(
"points"
,
timeName
,
meshDir_
,
runTime
).
headerOk
()
)
{
...
...
applications/utilities/postProcessing/graphics/PVFoamReader/vtkFoam/vtkFoam.C
View file @
e5c58292
...
...
@@ -194,7 +194,7 @@ void Foam::vtkFoam::updateSelectedRegions()
// Read the selected patches and add to the region list
for
(
int
i
=
0
;
i
<
nRegions
;
i
++
)
{
selectedRegions_
[
i
]
=
selectedRegions_
[
i
]
=
reader_
->
GetRegionSelection
()
->
GetArraySetting
(
i
);
}
}
...
...
@@ -282,7 +282,7 @@ void Foam::vtkFoam::convertMesh()
else
{
// A patch already existent in the list and which
// continues to exist found
// continues to exist found
regioni
++
;
}
}
...
...
@@ -391,7 +391,7 @@ Foam::vtkFoam::vtkFoam(const char* const FileName, vtkFoamReader* reader)
{
fileName
fullCasePath
(
fileName
(
FileName
).
path
());
if
(
!
d
ir
(
fullCasePath
))
if
(
!
isD
ir
(
fullCasePath
))
{
return
;
}
...
...
@@ -572,7 +572,7 @@ void Foam::vtkFoam::Update()
{
Info
<<
"Reading Mesh"
<<
endl
;
}
meshPtr_
=
meshPtr_
=
new
fvMesh
(
IOobject
...
...
applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H
View file @
e5c58292
...
...
@@ -47,7 +47,7 @@ int USERD_set_filenames
}
caseDir
=
tmp
;
if
(
!
d
ir
(
rootDir
/
caseDir
))
if
(
!
isD
ir
(
rootDir
/
caseDir
))
{
Info
<<
rootDir
/
caseDir
<<
" is not a valid directory."
<<
endl
;
...
...
@@ -144,7 +144,7 @@ int USERD_set_filenames
}
isTensor
[
n
]
=
isitTensor
;
}
bool
lagrangianNamesFound
=
false
;
label
n
=
0
;
while
(
!
lagrangianNamesFound
&&
n
<
Num_time_steps
)
...
...
@@ -176,7 +176,7 @@ int USERD_set_filenames
Info
<<
"[Found lagrangian]"
<<
endl
;
delete
sprayPtr
;
sprayPtr
=
new
Cloud
<
passiveParticle
>
(
*
meshPtr
);
IOobjectList
objects
(
*
meshPtr
,
runTime
.
timeName
(),
"lagrangian"
);
...
...
applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C
View file @
e5c58292
...
...
@@ -132,8 +132,8 @@ static void errorMsg(const string& msg)
// Simple check if directory is valid case directory.
static
bool
validCase
(
const
fileName
&
rootAndCase
)
{
//if (
d
ir(rootAndCase/"system") &&
d
ir(rootAndCase/"constant"))
if
(
d
ir
(
rootAndCase
/
"constant"
))
//if (
isD
ir(rootAndCase/"system") &&
isD
ir(rootAndCase/"constant"))
if
(
isD
ir
(
rootAndCase
/
"constant"
))
{
return
true
;
}
...
...
@@ -528,7 +528,7 @@ void user_query_file_function
return
;
}
}
fileName
rootDir
(
rootAndCase
.
path
());
...
...
applications/utilities/postProcessing/velocityField/Mach/Mach.C
View file @
e5c58292
...
...
@@ -63,7 +63,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
volVectorField
U
(
Uheader
,
mesh
);
if
(
f
ile
(
runTime
.
constantPath
()
/
"thermophysicalProperties"
))
if
(
isF
ile
(
runTime
.
constantPath
()
/
"thermophysicalProperties"
))
{
// thermophysical Mach
autoPtr
<
basicThermo
>
thermo
...
...
src/OSspecific/Unix/Unix.C
View file @
e5c58292
...
...
@@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
UNIX versions of the functions declared in OSspecific.H
.
UNIX versions of the functions declared in OSspecific.H
\*---------------------------------------------------------------------------*/
...
...
@@ -218,7 +218,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
// Search user files:
// ~~~~~~~~~~~~~~~~~~
fileName
searchDir
=
home
()
/
".OpenFOAM"
;
if
(
d
ir
(
searchDir
))
if
(
isD
ir
(
searchDir
))
{
// Check for user file in ~/.OpenFOAM/VERSION
fileName
fullName
=
searchDir
/
FOAMversion
/
name
;
...
...
@@ -239,7 +239,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
// Search site files:
// ~~~~~~~~~~~~~~~~~~
searchDir
=
getEnv
(
"WM_PROJECT_INST_DIR"
);
if
(
d
ir
(
searchDir
))
if
(
isD
ir
(
searchDir
))
{
// Check for site file in $WM_PROJECT_INST_DIR/site/VERSION
fileName
fullName
=
searchDir
/
"site"
/
FOAMversion
/
name
;
...
...
@@ -259,7 +259,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
// Search installation files:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
searchDir
=
getEnv
(
"WM_PROJECT_DIR"
);
if
(
d
ir
(
searchDir
))
if
(
isD
ir
(
searchDir
))
{
// Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc
fileName
fullName
=
searchDir
/
"etc"
/
name
;
...
...
@@ -476,21 +476,21 @@ Foam::fileName::Type Foam::type(const fileName& name)
// Does the name exist in the filing system?
bool
Foam
::
exists
(
const
fileName
&
name
)
{
return
mode
(
name
)
||
f
ile
(
name
);
return
mode
(
name
)
||
isF
ile
(
name
);
}
// Does the
file
exist
bool
Foam
::
file
(
const
fileName
&
name
)
// Does the
directory
exist
bool
Foam
::
isDir
(
const
fileName
&
name
)
{
return
S_IS
REG
(
mode
(
name
))
||
S_ISREG
(
mode
(
name
+
".gz"
));
return
S_IS
DIR
(
mode
(
name
));
}
// Does the
directory
exist
bool
Foam
::
dir
(
const
fileName
&
name
)
// Does the
file
exist
bool
Foam
::
isFile
(
const
fileName
&
name
)
{
return
S_IS
DIR
(
mode
(
name
));
return
S_IS
REG
(
mode
(
name
))
||
S_ISREG
(
mode
(
name
+
".gz"
));
}
...
...
@@ -641,7 +641,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
}
// Make sure the destination directory exists.
if
(
!
d
ir
(
destFile
.
path
())
&&
!
mkDir
(
destFile
.
path
()))
if
(
!
isD
ir
(
destFile
.
path
())
&&
!
mkDir
(
destFile
.
path
()))
{
return
false
;
}
...
...
@@ -681,7 +681,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
}
// Make sure the destination directory exists.
if
(
!
d
ir
(
destFile
)
&&
!
mkDir
(
destFile
))
if
(
!
isD
ir
(
destFile
)
&&
!
mkDir
(
destFile
))
{
return
false
;
}
...
...
@@ -806,7 +806,7 @@ bool Foam::rmDir(const fileName& directory)
{
if
(
Unix
::
debug
)
{
Info
<<
"rm
d
ir(const fileName&) : "
Info
<<
"rm
D
ir(const fileName&) : "
<<
"removing directory "
<<
directory
<<
endl
;
}
...
...
@@ -817,7 +817,7 @@ bool Foam::rmDir(const fileName& directory)
// Attempt to open directory and set the structure pointer
if
((
source
=
opendir
(
directory
.
c_str
()))
==
NULL
)
{
WarningIn
(
"rm
d
ir(const fileName&)"
)
WarningIn
(
"rm
D
ir(const fileName&)"
)
<<
"cannot open directory "
<<
directory
<<
endl
;
return
false
;
...
...
@@ -837,7 +837,7 @@ bool Foam::rmDir(const fileName& directory)
{
if
(
!
rmDir
(
path
))
{
WarningIn
(
"rm
d
ir(const fileName&)"
)
WarningIn
(
"rm
D
ir(const fileName&)"
)
<<
"failed to remove directory "
<<
fName
<<
" while removing directory "
<<
directory
<<
endl
;
...
...
@@ -851,7 +851,7 @@ bool Foam::rmDir(const fileName& directory)
{
if
(
!
rm
(
path
))
{
WarningIn
(
"rm
d
ir(const fileName&)"
)
WarningIn
(
"rm
D
ir(const fileName&)"
)
<<
"failed to remove file "
<<
fName
<<
" while removing directory "
<<
directory
<<
endl
;
...
...
@@ -867,7 +867,7 @@ bool Foam::rmDir(const fileName& directory)
if
(
!
rm
(
directory
))
{
WarningIn
(
"rm
d
ir(const fileName&)"
)
WarningIn
(
"rm
D
ir(const fileName&)"
)
<<
"failed to remove directory "
<<
directory
<<
endl
;
closedir
(
source
);
...
...
src/OpenFOAM/db/IOobject/IOobject.C
View file @
e5c58292
...
...
@@ -61,7 +61,7 @@ bool Foam::IOobject::IOobject::fileNameComponents
name
.
clear
();
// called with directory
if
(
::
Foam
::
d
ir
(
path
))
if
(
::
Foam
::
isD
ir
(
path
))
{
WarningIn
(
"IOobject::fileNameComponents(const fileName&, ...)"
)
<<
" called with directory: "
<<
path
<<
"
\n
"
;
...
...
@@ -269,7 +269,7 @@ Foam::fileName Foam::IOobject::filePath() const
fileName
path
=
this
->
path
();
fileName
objectPath
=
path
/
name
();
if
(
f
ile
(
objectPath
))
if
(
isF
ile
(
objectPath
))
{
return
objectPath
;
}
...
...
@@ -288,13 +288,13 @@ Foam::fileName Foam::IOobject::filePath() const
rootPath
()
/
caseName
()
/
".."
/
instance
()
/
db_
.
dbDir
()
/
local
()
/
name
();
if
(
f
ile
(
parentObjectPath
))
if
(
isF
ile
(
parentObjectPath
))
{
return
parentObjectPath
;
}
}
if
(
!
d
ir
(
path
))
if
(
!
isD
ir
(
path
))
{
word
newInstancePath
=
time
().
findInstancePath
(
instant
(
instance
()));
...
...
@@ -306,7 +306,7 @@ Foam::fileName Foam::IOobject::filePath() const
/
newInstancePath
/
db_
.
dbDir
()
/
local
()
/
name
()
);
if
(
f
ile
(
fName
))
if
(
isF
ile
(
fName
))
{
return
fName
;
}
...
...
src/OpenFOAM/db/IOobjectList/IOobjectList.C
View file @
e5c58292
...
...
@@ -48,7 +48,7 @@ Foam::IOobjectList::IOobjectList
{
word
newInstance
=
instance
;
if
(
!
d
ir
(
db
.
path
(
instance
)))
if
(
!
isD
ir
(
db
.
path
(
instance
)))
{
newInstance
=
db
.
time
().
findInstancePath
(
instant
(
instance
));
...
...
@@ -59,7 +59,7 @@ Foam::IOobjectList::IOobjectList
}
// Create list file names in directory
fileNameList
ObjectNames
=
fileNameList
ObjectNames
=
readDir
(
db
.
path
(
newInstance
,
db
.
dbDir
()
/
local
),
fileName
::
FILE
);
forAll
(
ObjectNames
,
i
)
...
...
src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C
View file @
e5c58292
...
...
@@ -54,7 +54,7 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
ifPtr_
=
new
ifstream
(
pathname
.
c_str
());
// If the file is compressed, decompress it before reading.
if
(
!
ifPtr_
->
good
()
&&
f
ile
(
pathname
+
".gz"
))
if
(
!
ifPtr_
->
good
()
&&
isF
ile
(
pathname
+
".gz"
))
{
if
(
IFstream
::
debug
)
{
...
...
@@ -159,7 +159,7 @@ Foam::IFstream& Foam::IFstream::operator()() const
{
if
(
!
good
())
{
if
(
!
f
ile
(
pathname_
)
&&
!
f
ile
(
pathname_
+
".gz"
))
if
(
!
isF
ile
(
pathname_
)
&&
!
isF
ile
(
pathname_
+
".gz"
))
{
FatalIOErrorIn
(
"IFstream::operator()"
,
*
this
)
<<
"file "
<<
pathname_
<<
" does not exist"
...
...
src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C
View file @
e5c58292
...
...
@@ -57,7 +57,7 @@ Foam::OFstreamAllocator::OFstreamAllocator
if
(
compression
==
IOstream
::
COMPRESSED
)
{
if
(
f
ile
(
pathname
))
if
(
isF
ile
(
pathname
))
{
rm
(
pathname
);
}
...
...
@@ -66,7 +66,7 @@ Foam::OFstreamAllocator::OFstreamAllocator
}
else
{
if
(
f
ile
(
pathname
+
".gz"
))
if
(
isF
ile
(
pathname
+
".gz"
))
{
rm
(
pathname
+
".gz"
);
}
...
...
src/OpenFOAM/db/Time/findInstance.C
View file @
e5c58292
...
...
@@ -43,7 +43,7 @@ Foam::word Foam::Time::findInstance
// Is the mesh data in the current time directory ?
if
(
f
ile
(
path
()
/
timeName
()
/
dir
/
name
)
isF
ile
(
path
()
/
timeName
()
/
dir
/
name
)
&&
IOobject
(
name
,
timeName
(),
dir
,
*
this
).
headerOk
()
)
{
...
...
@@ -81,7 +81,7 @@ Foam::word Foam::Time::findInstance
{
if
(
f
ile
(
path
()
/
ts
[
j
].
name
()
/
dir
/
name
)
isF
ile
(
path
()
/
ts
[
j
].
name
()
/
dir
/
name
)
&&
IOobject
(
name
,
ts
[
j
].
name
(),
dir
,
*
this
).
headerOk
()
)
{
...
...
@@ -109,7 +109,7 @@ Foam::word Foam::Time::findInstance
if
(
f
ile
(
path
()
/
constant
()
/
dir
/
name
)
isF
ile
(
path
()
/
constant
()
/
dir
/
name
)
&&
IOobject
(
name
,
constant
(),
dir
,
*
this
).
headerOk
()
)
{
...
...
src/OpenFOAM/global/JobInfo/JobInfo.C
View file @
e5c58292
...
...
@@ -65,14 +65,14 @@ Foam::JobInfo::JobInfo()
<<
Foam
::
exit
(
FatalError
);
}
if
(
!
d
ir
(
runningDir
)
&&
!
mkDir
(
runningDir
))
if
(
!
isD
ir
(
runningDir
)
&&
!
mkDir
(
runningDir
))
{
FatalErrorIn
(
"JobInfo::JobInfo()"
)
<<
"Cannot make JobInfo directory "
<<
runningDir
<<
Foam
::
exit
(
FatalError
);
}
if
(
!
d
ir
(
finishedDir
)
&&
!
mkDir
(
finishedDir
))
if
(
!
isD
ir
(
finishedDir
)
&&
!
mkDir
(
finishedDir
))
{
FatalErrorIn
(
"JobInfo::JobInfo()"
)
<<
"Cannot make JobInfo directory "
<<
finishedDir
...
...
src/OpenFOAM/global/argList/argList.C
View file @
e5c58292
...
...
@@ -409,7 +409,7 @@ Foam::argList::argList
label
nProcDirs
=
0
;
while
(
d
ir
isD
ir
(
rootPath_
/
globalCase_
/
"processor"
+
name
(
++
nProcDirs
)
...
...
@@ -697,7 +697,7 @@ bool Foam::argList::check(bool checkArgs, bool checkOpts) const
bool
Foam
::
argList
::
checkRootCase
()
const
{
if
(
!
d
ir
(
rootPath
()))
if
(
!
isD
ir
(
rootPath
()))
{
FatalError
<<
executable_
...
...
@@ -707,7 +707,7 @@ bool Foam::argList::checkRootCase() const
return
false
;
}
if
(
!
d
ir
(
path
())
&&
Pstream
::
master
())
if
(
!
isD
ir
(
path
())
&&
Pstream
::
master
())
{
// Allow slaves on non-existing processor directories, created later
FatalError
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment