mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
rename Foam::size() -> Foam::fileSize() for carity
This commit is contained in:
@ -491,7 +491,7 @@ bool Foam::dir(const fileName& name)
|
|||||||
|
|
||||||
|
|
||||||
// Return size of file
|
// Return size of file
|
||||||
off_t Foam::size(const fileName& name)
|
off_t Foam::fileSize(const fileName& name)
|
||||||
{
|
{
|
||||||
fileStat fileStatus(name);
|
fileStat fileStatus(name);
|
||||||
if (fileStatus.isValid())
|
if (fileStatus.isValid())
|
||||||
@ -541,7 +541,7 @@ Foam::fileNameList Foam::readDir
|
|||||||
// Setup empty string list MAXTVALUES long
|
// Setup empty string list MAXTVALUES long
|
||||||
fileNameList dirEntries(maxNnames);
|
fileNameList dirEntries(maxNnames);
|
||||||
|
|
||||||
// Pointers to the Unix director system
|
// Pointers to the directory entries
|
||||||
DIR *source;
|
DIR *source;
|
||||||
struct dirent *list;
|
struct dirent *list;
|
||||||
|
|
||||||
@ -806,7 +806,7 @@ bool Foam::rmDir(const fileName& directory)
|
|||||||
<< "removing directory " << directory << endl;
|
<< "removing directory " << directory << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pointers to the Unix director system
|
// Pointers to the directory entries
|
||||||
DIR *source;
|
DIR *source;
|
||||||
struct dirent *list;
|
struct dirent *list;
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ InNamespace
|
|||||||
Foam
|
Foam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Functions used by OpenFOAM which are specific to the UNIX operating system
|
Functions used by OpenFOAM that are specific to the UNIX operating system
|
||||||
and need to be replaced or emulated on other systems.
|
and need to be replaced or emulated on other systems.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -118,7 +118,7 @@ mode_t mode(const fileName&);
|
|||||||
//- Return the file type: FILE or DIRECTORY
|
//- Return the file type: FILE or DIRECTORY
|
||||||
fileName::Type type(const fileName&);
|
fileName::Type type(const fileName&);
|
||||||
|
|
||||||
//- Does the name exist in the filing system?
|
//- Does the name exist in the file system?
|
||||||
bool exists(const fileName& name);
|
bool exists(const fileName& name);
|
||||||
|
|
||||||
//- Does the file exist?
|
//- Does the file exist?
|
||||||
@ -128,7 +128,7 @@ bool file(const fileName&);
|
|||||||
bool dir(const fileName&);
|
bool dir(const fileName&);
|
||||||
|
|
||||||
//- Return size of file
|
//- Return size of file
|
||||||
off_t size(const fileName&);
|
off_t fileSize(const fileName&);
|
||||||
|
|
||||||
//- Return time of last file modification
|
//- Return time of last file modification
|
||||||
time_t lastModified(const fileName&);
|
time_t lastModified(const fileName&);
|
||||||
|
|||||||
@ -405,12 +405,12 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
|
|||||||
bool Foam::fileFormats::STLsurfaceFormatCore::readASCII
|
bool Foam::fileFormats::STLsurfaceFormatCore::readASCII
|
||||||
(
|
(
|
||||||
IFstream& ifs,
|
IFstream& ifs,
|
||||||
const off_t fileSize
|
const off_t dataFileSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Create the lexer with the approximate number of vertices in the STL
|
// Create the lexer with the approximate number of vertices in the STL
|
||||||
// from the file size
|
// from the file size
|
||||||
STLASCIILexer lexer(&ifs.stdStream(), fileSize/400);
|
STLASCIILexer lexer(&ifs.stdStream(), dataFileSize/400);
|
||||||
while (lexer.lex() != 0) {}
|
while (lexer.lex() != 0) {}
|
||||||
|
|
||||||
sorted_ = lexer.sorted();
|
sorted_ = lexer.sorted();
|
||||||
|
|||||||
@ -45,7 +45,7 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY
|
|||||||
const fileName& filename
|
const fileName& filename
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
off_t fileSize = Foam::size(filename);
|
off_t dataFileSize = Foam::fileSize(filename);
|
||||||
|
|
||||||
IFstream ifs(filename, IOstream::BINARY);
|
IFstream ifs(filename, IOstream::BINARY);
|
||||||
istream& is = ifs.stdStream();
|
istream& is = ifs.stdStream();
|
||||||
@ -74,8 +74,8 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY
|
|||||||
(
|
(
|
||||||
!is
|
!is
|
||||||
|| nTris < 0
|
|| nTris < 0
|
||||||
|| nTris < (fileSize - headerSize)/50
|
|| nTris < (dataFileSize - headerSize)/50
|
||||||
|| nTris > (fileSize - headerSize)/25
|
|| nTris > (dataFileSize - headerSize)/25
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -89,7 +89,7 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY
|
|||||||
bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
|
bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
|
||||||
(
|
(
|
||||||
IFstream& ifs,
|
IFstream& ifs,
|
||||||
const off_t fileSize
|
const off_t dataFileSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
sorted_ = true;
|
sorted_ = true;
|
||||||
@ -124,8 +124,8 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
|
|||||||
(
|
(
|
||||||
!is
|
!is
|
||||||
|| nTris < 0
|
|| nTris < 0
|
||||||
|| nTris < (fileSize - headerSize)/50
|
|| nTris < (dataFileSize - headerSize)/50
|
||||||
|| nTris > (fileSize - headerSize)/25
|
|| nTris > (dataFileSize - headerSize)/25
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
@ -224,16 +224,16 @@ Foam::fileFormats::STLsurfaceFormatCore::STLsurfaceFormatCore
|
|||||||
names_(0),
|
names_(0),
|
||||||
sizes_(0)
|
sizes_(0)
|
||||||
{
|
{
|
||||||
off_t fileSize = Foam::size(filename);
|
off_t dataFileSize = Foam::fileSize(filename);
|
||||||
|
|
||||||
// auto-detect ascii/binary
|
// auto-detect ascii/binary
|
||||||
if (detectBINARY(filename))
|
if (detectBINARY(filename))
|
||||||
{
|
{
|
||||||
readBINARY(IFstream(filename, IOstream::BINARY)(), fileSize);
|
readBINARY(IFstream(filename, IOstream::BINARY)(), dataFileSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readASCII(IFstream(filename)(), fileSize);
|
readASCII(IFstream(filename)(), dataFileSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
@ -398,7 +398,7 @@ bool triSurface::readSTLASCII(const fileName& STLfileName)
|
|||||||
|
|
||||||
// Create the lexer obtaining the approximate number of vertices in the STL
|
// Create the lexer obtaining the approximate number of vertices in the STL
|
||||||
// from the file size
|
// from the file size
|
||||||
STLLexer lexer(&STLstream.stdStream(), Foam::size(STLfileName)/400);
|
STLLexer lexer(&STLstream.stdStream(), Foam::fileSize(STLfileName)/400);
|
||||||
while(lexer.lex() != 0)
|
while(lexer.lex() != 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -89,9 +89,9 @@ bool triSurface::readSTLBINARY(const fileName& STLfileName)
|
|||||||
// If the comparison is not sensible then it maybe an ASCII file
|
// If the comparison is not sensible then it maybe an ASCII file
|
||||||
if (!compressed)
|
if (!compressed)
|
||||||
{
|
{
|
||||||
label triDataSize = Foam::size(STLfileName) - 80;
|
label dataFileSize = Foam::fileSize(STLfileName) - 80;
|
||||||
|
|
||||||
if (nTris < triDataSize/50 || nTris > triDataSize/25)
|
if (nTris < dataFileSize/50 || nTris > dataFileSize/25)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user