Merge pull request #52 from PhasicFlow/multigridNBS
correction of levels and Istream for underflow doubles
This commit is contained in:
commit
5f1c18e0fd
|
@ -267,6 +267,7 @@ public:
|
||||||
nbsLevels_[lvl].findPairsCountCross(pairs, nbsLevels_[crsLvl]);
|
nbsLevels_[lvl].findPairsCountCross(pairs, nbsLevels_[crsLvl]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return notInsertedCount;
|
return notInsertedCount;
|
||||||
}
|
}
|
||||||
|
@ -401,8 +402,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
auto diameter = nbsLevels_[0].diameter();
|
auto diameter = nbsLevels_[0].diameter();
|
||||||
auto maxSizes = maxSizeLevels_;
|
auto const maxSizes = maxSizeLevels_;
|
||||||
auto particleLevel = particleLevel_;
|
auto particleLevel = particleLevel_;
|
||||||
|
auto const sizeRatio = 0.999*nbsLevels_[0].sizeRatio();
|
||||||
|
|
||||||
int8 maxLvl = sizeRangeLevels_.size();
|
int8 maxLvl = sizeRangeLevels_.size();
|
||||||
|
|
||||||
|
@ -415,7 +417,7 @@ public:
|
||||||
{
|
{
|
||||||
for(int8 lvl = 0; lvl<maxLvl; lvl++)
|
for(int8 lvl = 0; lvl<maxLvl; lvl++)
|
||||||
{
|
{
|
||||||
if( diameter[i]<= maxSizes[lvl] )
|
if( sizeRatio*diameter[i]<= maxSizes[lvl] )
|
||||||
{
|
{
|
||||||
particleLevel[i] = lvl;
|
particleLevel[i] = lvl;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -310,13 +310,17 @@ bool pFlow::readInt8( const char* buf, int8 & val)
|
||||||
word w(buf);
|
word w(buf);
|
||||||
return readInt8(w, val);
|
return readInt8(w, val);
|
||||||
}
|
}
|
||||||
|
#include <iostream>
|
||||||
bool pFlow::readReal( const word& w, real & val)
|
bool pFlow::readReal( const word& w, real & val)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
val = std::stod(w);
|
val = std::stod(w);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
catch (std:: out_of_range& e)
|
||||||
|
{
|
||||||
|
val = static_cast<real>( std::stold(w) );
|
||||||
|
}
|
||||||
catch (...){
|
catch (...){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -325,8 +329,22 @@ bool pFlow::readReal( const word& w, real & val)
|
||||||
|
|
||||||
bool pFlow::readReal( const char* buf, real & val )
|
bool pFlow::readReal( const char* buf, real & val )
|
||||||
{
|
{
|
||||||
word w(buf);
|
char* c;
|
||||||
return readReal(w, val);
|
|
||||||
|
val = std::strtod(buf, &c);
|
||||||
|
if(val == HUGE_VAL)
|
||||||
|
{
|
||||||
|
val = static_cast<real>( std::strtold(buf, &c) );
|
||||||
|
if(val == HUGE_VAL || c==buf)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(c == buf)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue