A simple rapid filling demo
This commit is contained in:
parent
3aa6be6676
commit
29d922e3c5
|
@ -4,6 +4,7 @@ particlesPhasicFlow.cpp
|
|||
positionParticles/positionParticles.cpp
|
||||
positionOrdered/positionOrdered.cpp
|
||||
positionRandom/positionRandom.cpp
|
||||
positionFile/positionFile.cpp
|
||||
empty/empty.cpp
|
||||
)
|
||||
#set(link_lib phasicFlow Kokkos::kokkos Interaction Utilities)
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/*------------------------------- phasicFlow ---------------------------------
|
||||
O C enter of
|
||||
O O E ngineering and
|
||||
O O M ultiscale modeling of
|
||||
OOOOOOO F luid flow
|
||||
------------------------------------------------------------------------------
|
||||
Copyright (C): www.cemf.ir
|
||||
email: hamid.r.norouzi AT gmail.com
|
||||
------------------------------------------------------------------------------
|
||||
Licence:
|
||||
This file is part of phasicFlow code. It is a free software for simulating
|
||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||
the terms of GNU General Public License v3 or any other later versions.
|
||||
|
||||
phasicFlow is distributed to help others in their research in the field of
|
||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "positionFile.hpp"
|
||||
#include "iFstream.hpp"
|
||||
|
||||
bool pFlow::positionFile::positionPointsFile()
|
||||
{
|
||||
std::cout << "Reading user defined position file....";
|
||||
|
||||
position_.clear();
|
||||
|
||||
// ToDo: read position data from file.
|
||||
|
||||
std::ifstream inFile(fileName_);
|
||||
|
||||
inFile >> numPoints_;
|
||||
|
||||
realx3 tempPoint;
|
||||
|
||||
for(int i = 0; i < numPoints_; i++)
|
||||
{
|
||||
inFile >> tempPoint.x_ >> tempPoint.y_ >> tempPoint.z_;
|
||||
position_.push_back(tempPoint);
|
||||
}
|
||||
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::positionFile::positionFile
|
||||
(
|
||||
systemControl& control,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
positionParticles(control, dict),
|
||||
poDict_
|
||||
(
|
||||
dict.subDict("fileInfo")
|
||||
),
|
||||
fileName_
|
||||
(
|
||||
poDict_.getVal<word>("name")
|
||||
),
|
||||
numPoints_
|
||||
(
|
||||
poDict_.getVal<uint64>("numPoints")
|
||||
),
|
||||
position_
|
||||
(
|
||||
"position",
|
||||
max(maxNumberOfParticles(), numPoints_),
|
||||
numPoints_ ,
|
||||
RESERVE()
|
||||
)
|
||||
{
|
||||
if(!positionPointsFile())
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/*------------------------------- phasicFlow ---------------------------------
|
||||
O C enter of
|
||||
O O E ngineering and
|
||||
O O M ultiscale modeling of
|
||||
OOOOOOO F luid flow
|
||||
------------------------------------------------------------------------------
|
||||
Copyright (C): www.cemf.ir
|
||||
email: hamid.r.norouzi AT gmail.com
|
||||
------------------------------------------------------------------------------
|
||||
Licence:
|
||||
This file is part of phasicFlow code. It is a free software for simulating
|
||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||
the terms of GNU General Public License v3 or any other later versions.
|
||||
|
||||
phasicFlow is distributed to help others in their research in the field of
|
||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __positionFile_hpp__
|
||||
#define __positionFile_hpp__
|
||||
|
||||
#include "positionParticles.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
class positionFile
|
||||
:
|
||||
public positionParticles
|
||||
{
|
||||
private:
|
||||
|
||||
dictionary poDict_;
|
||||
|
||||
word fileName_;
|
||||
|
||||
uint32 numPoints_;
|
||||
|
||||
realx3Vector position_;
|
||||
|
||||
bool positionPointsFile();
|
||||
|
||||
public:
|
||||
|
||||
// - type Info
|
||||
TypeInfo("file");
|
||||
|
||||
positionFile(
|
||||
systemControl& control,
|
||||
const dictionary& dict);
|
||||
|
||||
// - add this class to vCtor selection table
|
||||
add_vCtor(
|
||||
positionParticles,
|
||||
positionFile,
|
||||
dictionary);
|
||||
|
||||
~positionFile() final = default;
|
||||
|
||||
//// - Methods
|
||||
|
||||
uint32 numPoints()const final
|
||||
{
|
||||
return static_cast<uint32>(position_.size());
|
||||
}
|
||||
|
||||
uint32 size()const final
|
||||
{
|
||||
return static_cast<uint32>(position_.size());
|
||||
}
|
||||
|
||||
real maxDiameter() const final
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// - const access to position
|
||||
const realx3Vector& position()const final
|
||||
{
|
||||
return position_;
|
||||
}
|
||||
|
||||
// - access to position
|
||||
realx3Vector& position() final
|
||||
{
|
||||
return position_;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // __positionFile_hpp__
|
Loading…
Reference in New Issue