mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
update rapid filling
This commit is contained in:
@ -21,29 +21,63 @@ Licence:
|
||||
#include "error.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "positionFile.hpp"
|
||||
|
||||
|
||||
#include "streams.hpp"
|
||||
// #include "token.hpp"
|
||||
#include "fileSystem.hpp"
|
||||
#include "iFstream.hpp"
|
||||
#include "oFstream.hpp"
|
||||
|
||||
bool pFlow::positionFile::positionPointsFile()
|
||||
{
|
||||
std::cout << "Reading user defined position file....";
|
||||
REPORT(0) << "Reading user defined position file....";
|
||||
|
||||
position_.clear();
|
||||
|
||||
// ToDo: read position data from file.
|
||||
|
||||
std::ifstream inFile(fileName_);
|
||||
|
||||
inFile >> numPoints_;
|
||||
// Read position data from file.
|
||||
iFstream is(fileName_);
|
||||
|
||||
realx3 tempPoint;
|
||||
|
||||
for(int i = 0; i < numPoints_; i++)
|
||||
{
|
||||
inFile >> tempPoint.x_ >> tempPoint.y_ >> tempPoint.z_;
|
||||
token tok;
|
||||
|
||||
while (!is.eof() || !is.bad())
|
||||
{
|
||||
// read position x
|
||||
is >> tempPoint.x_;
|
||||
|
||||
if(commaSeparated_)
|
||||
{
|
||||
is >> tok;
|
||||
if(tok.type() != token::COMMA)
|
||||
{
|
||||
fatalErrorInFunction << "Error datafile format, the data not comma separated!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// read position y
|
||||
is >> tempPoint.y_;
|
||||
|
||||
if(commaSeparated_)
|
||||
{
|
||||
is >> tok;
|
||||
if(tok.type() != token::COMMA)
|
||||
{
|
||||
fatalErrorInFunction << "Error datafile format, the data not comma separated!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// read position z
|
||||
is >> tempPoint.z_;
|
||||
|
||||
// insert position data to vector
|
||||
position_.push_back(tempPoint);
|
||||
}
|
||||
|
||||
std::cout << "Done!" << std::endl;
|
||||
REPORT(0) << "Done!" << END_REPORT;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -63,15 +97,15 @@ pFlow::positionFile::positionFile
|
||||
(
|
||||
poDict_.getVal<word>("name")
|
||||
),
|
||||
numPoints_
|
||||
commaSeparated_
|
||||
(
|
||||
poDict_.getVal<uint64>("numPoints")
|
||||
poDict_.getValOrSet("commaSeparated", Logical("Yes"))
|
||||
),
|
||||
position_
|
||||
(
|
||||
"position",
|
||||
max(maxNumberOfParticles(), numPoints_),
|
||||
numPoints_ ,
|
||||
max(maxNumberOfParticles(), position_.size()),
|
||||
0,
|
||||
RESERVE()
|
||||
)
|
||||
{
|
||||
|
@ -35,12 +35,14 @@ private:
|
||||
|
||||
dictionary poDict_;
|
||||
|
||||
word fileName_;
|
||||
// word fileName_;
|
||||
|
||||
uint32 numPoints_;
|
||||
fileSystem fileName_;
|
||||
|
||||
realx3Vector position_;
|
||||
|
||||
Logical commaSeparated_;
|
||||
|
||||
bool positionPointsFile();
|
||||
|
||||
public:
|
||||
@ -76,6 +78,11 @@ public:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// bool commaSeparated()const
|
||||
// {
|
||||
// return commaSeparated_();
|
||||
// }
|
||||
|
||||
// - const access to position
|
||||
const realx3Vector& position()const final
|
||||
@ -88,8 +95,6 @@ public:
|
||||
{
|
||||
return position_;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user