fixed the error when insert particles from file with integer number

This commit is contained in:
wanqing0421
2025-07-17 16:57:05 +08:00
parent b1ec396a1b
commit 3cc3792e08

View File

@ -48,10 +48,17 @@ bool pFlow::positionFile::positionPointsFile()
is >> tok;
if(tok.good()&& tok.isNumber()&& !is.eof())
{
if(tok.isReal())
{
tempPoint.x() = tok.realToken();
}
else
{
tempPoint.x() = static_cast<real>(tok.int64Token());
}
}
else
{
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position x!\n";
return false;
@ -70,10 +77,17 @@ bool pFlow::positionFile::positionPointsFile()
// read position y
is >> tok;
if(tok.good()&& tok.isNumber()&& !is.eof())
{
if(tok.isReal())
{
tempPoint.y() = tok.realToken();
}
else
{
tempPoint.y() = static_cast<real>(tok.int64Token());
}
}
else
{
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position y!\n";
return false;
@ -92,10 +106,17 @@ bool pFlow::positionFile::positionPointsFile()
// read position z
is >> tok;
if(tok.good()&& tok.isNumber()&& !is.eof())
{
if(tok.isReal())
{
tempPoint.z() = tok.realToken();
}
else
{
tempPoint.z() = static_cast<real>(tok.int64Token());
}
}
else
{
ioErrorInFile(is.name(), is.lineNumber())<< "Bad char or end of file in reading position z!\n";
return false;