STYLE: use readScalar(std::string) and readInt(std::string) wrappers

This commit is contained in:
Mark Olesen
2017-11-28 10:08:36 +01:00
parent c0e86940b0
commit fab9fb4332
4 changed files with 10 additions and 15 deletions

View File

@ -1201,7 +1201,7 @@ Foam::Time& Foam::Time::operator++()
// reinterpretation of the word // reinterpretation of the word
if if
( (
readScalar(dimensionedScalar::name().c_str(), timeNameValue) readScalar(dimensionedScalar::name(), timeNameValue)
&& (mag(timeNameValue - oldTimeValue - userDeltaT) > timeTol) && (mag(timeNameValue - oldTimeValue - userDeltaT) > timeTol)
) )
{ {
@ -1209,7 +1209,7 @@ Foam::Time& Foam::Time::operator++()
while while
( (
precision_ < maxPrecision_ precision_ < maxPrecision_
&& readScalar(dimensionedScalar::name().c_str(), timeNameValue) && readScalar(dimensionedScalar::name(), timeNameValue)
&& (mag(timeNameValue - oldTimeValue - userDeltaT) > timeTol) && (mag(timeNameValue - oldTimeValue - userDeltaT) > timeTol)
) )
{ {
@ -1242,7 +1242,7 @@ Foam::Time& Foam::Time::operator++()
scalar oldTimeNameValue = -VGREAT; scalar oldTimeNameValue = -VGREAT;
if if
( (
readScalar(oldTimeName.c_str(), oldTimeNameValue) readScalar(oldTimeName, oldTimeNameValue)
&& ( && (
sign(timeNameValue - oldTimeNameValue) sign(timeNameValue - oldTimeNameValue)
!= sign(deltaT_) != sign(deltaT_)

View File

@ -105,12 +105,8 @@ Foam::instantList Foam::fileOperation::sortTimes
// Read and parse all the entries in the directory // Read and parse all the entries in the directory
forAll(dirEntries, i) forAll(dirEntries, i)
{ {
//IStringStream timeStream(dirEntries[i]);
//token timeToken(timeStream);
//if (timeToken.isNumber() && timeStream.eof())
scalar timeValue; scalar timeValue;
if (readScalar(dirEntries[i].c_str(), timeValue)) if (readScalar(dirEntries[i], timeValue))
{ {
Times[nTimes].value() = timeValue; Times[nTimes].value() = timeValue;
Times[nTimes].name() = dirEntries[i]; Times[nTimes].name() = dirEntries[i];

View File

@ -291,25 +291,24 @@ Foam::fileOperations::masterUncollatedFileOperation::splitProcessorPath
local = objectPath.substr(pos+9); local = objectPath.substr(pos+9);
} }
label proci;
pos = local.find('/'); pos = local.find('/');
if (pos == string::npos) if (pos == string::npos)
{ {
// processorXXX without local // processorXXX without local
label proci; if (Foam::read(local, proci))
if (Foam::read(local.c_str(), proci))
{ {
local.clear(); local.clear();
return proci; return proci;
} }
return -1;
} }
string procName(local.substr(0, pos)); else if (Foam::read(local.substr(0, pos), proci))
label proci;
if (Foam::read(procName.c_str(), proci))
{ {
local = local.substr(pos+1); local = local.substr(pos+1);
return proci; return proci;
} }
return -1; return -1;
} }

View File

@ -176,7 +176,7 @@ bool Foam::UPstream::init(int& argc, char**& argv)
int bufSize = 0; int bufSize = 0;
const std::string str = Foam::getEnv("MPI_BUFFER_SIZE"); const std::string str = Foam::getEnv("MPI_BUFFER_SIZE");
if (str.empty() || !Foam::read(str.c_str(), bufSize) || bufSize <= 0) if (str.empty() || !Foam::read(str, bufSize) || bufSize <= 0)
{ {
bufSize = mpiBufferSize; bufSize = mpiBufferSize;
} }