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