Revert "adapt the multiRotatingAxisMotion to v-1.0"
This reverts commit bf02309569
.
This commit is contained in:
parent
7779b4a341
commit
5c499f1eee
|
@ -28,4 +28,4 @@ template class pFlow::geometryMotion<pFlow::stationaryWall>;
|
||||||
|
|
||||||
template class pFlow::geometryMotion<pFlow::conveyorBeltMotion>;
|
template class pFlow::geometryMotion<pFlow::conveyorBeltMotion>;
|
||||||
|
|
||||||
template class pFlow::geometryMotion<pFlow::multiRotatingAxisMotion>;
|
//template class pFlow::geometryMotion<pFlow::multiRotatingAxisMotion>;
|
||||||
|
|
|
@ -25,7 +25,7 @@ Licence:
|
||||||
#include "stationaryWall.hpp"
|
#include "stationaryWall.hpp"
|
||||||
#include "rotatingAxisMotion.hpp"
|
#include "rotatingAxisMotion.hpp"
|
||||||
#include "conveyorBeltMotion.hpp"
|
#include "conveyorBeltMotion.hpp"
|
||||||
#include "multiRotatingAxisMotion.hpp"
|
//#include "multiRotatingAxisMotion.hpp"
|
||||||
#include "vibratingMotion.hpp"
|
#include "vibratingMotion.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,10 @@ using stationaryGeometry = geometryMotion<stationaryWall>;
|
||||||
|
|
||||||
using conveyorBeltMotionGeometry = geometryMotion<conveyorBeltMotion>;
|
using conveyorBeltMotionGeometry = geometryMotion<conveyorBeltMotion>;
|
||||||
|
|
||||||
using multiRotationAxisMotionGeometry = geometryMotion<multiRotatingAxisMotion>;
|
//typedef geometryMotion<multiRotatingAxisMotion> multiRotationAxisMotionGeometry;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ entities/stationary/stationary.cpp
|
||||||
conveyorBeltMotion/conveyorBeltMotion.cpp
|
conveyorBeltMotion/conveyorBeltMotion.cpp
|
||||||
entities/conveyorBelt/conveyorBelt.cpp
|
entities/conveyorBelt/conveyorBelt.cpp
|
||||||
|
|
||||||
entities/multiRotatingAxis/multiRotatingAxis.cpp
|
#entities/multiRotatingAxis/multiRotatingAxis.cpp
|
||||||
multiRotatingAxisMotion/multiRotatingAxisMotion.cpp
|
#multiRotatingAxisMotion/multiRotatingAxisMotion.cpp
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -22,18 +22,6 @@ Licence:
|
||||||
#include "multiRotatingAxisMotion.hpp"
|
#include "multiRotatingAxisMotion.hpp"
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
/// Construct from dictionary
|
|
||||||
FUNCTION_H
|
|
||||||
pFlow::multiRotatingAxis::multiRotatingAxis(const dictionary& dict)
|
|
||||||
{
|
|
||||||
if(!read(nullptr, dict))
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<
|
|
||||||
" error in reading multiRotatingAxis from dictionary "<< dict.globalName()<<endl;
|
|
||||||
fatalExit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
pFlow::multiRotatingAxis::multiRotatingAxis
|
pFlow::multiRotatingAxis::multiRotatingAxis
|
||||||
(
|
(
|
||||||
|
@ -81,7 +69,7 @@ bool pFlow::multiRotatingAxis::read
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool result = axisMotion-> nameToIndex(rotAxis, parentAxisIndex_);
|
parentAxisIndex_ = axisMotion-> nameToIndex(rotAxis);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -102,33 +90,10 @@ bool pFlow::multiRotatingAxis::write
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
word rotAxis;
|
auto rotAxis = axisMotion->indexToName(parentAxisIndex_);
|
||||||
bool result = axisMotion->indexToName(parentAxisIndex_, rotAxis);
|
|
||||||
dict.add("rotationAxis", rotAxis);
|
dict.add("rotationAxis", rotAxis);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FUNCTION_H
|
|
||||||
bool pFlow::multiRotatingAxis::write
|
|
||||||
(
|
|
||||||
dictionary& dict
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if( !rotatingAxis::write(dict) ) return false;
|
|
||||||
|
|
||||||
if(parentAxisIndex_ == 0)
|
|
||||||
{
|
|
||||||
dict.add("rotationAxis", "none");
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// word rotAxis;
|
|
||||||
// bool result = axisMotion->indexToName(parentAxisIndex_, rotAxis);
|
|
||||||
// dict.add("rotationAxis", rotAxis);
|
|
||||||
// }
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -82,22 +82,16 @@ protected:
|
||||||
multiRotatingAxis* axisList_;
|
multiRotatingAxis* axisList_;
|
||||||
|
|
||||||
/// Index of parent axis
|
/// Index of parent axis
|
||||||
uint32 parentAxisIndex_ = static_cast<uint32>(-1);
|
int32 parentAxisIndex_ = -1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfoNV("multiRotatingAxis");
|
|
||||||
|
|
||||||
// - Constructors
|
// - Constructors
|
||||||
|
|
||||||
/// Empty Constructor
|
/// Empty Constructor
|
||||||
INLINE_FUNCTION_HD
|
INLINE_FUNCTION_HD
|
||||||
multiRotatingAxis(){}
|
multiRotatingAxis(){}
|
||||||
|
|
||||||
/// Construct from dictionary
|
|
||||||
FUNCTION_H
|
|
||||||
explicit multiRotatingAxis(const dictionary& dict);
|
|
||||||
|
|
||||||
/// Empty with list of axes
|
/// Empty with list of axes
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
multiRotatingAxis(multiRotatingAxisMotion* axisMotion);
|
multiRotatingAxis(multiRotatingAxisMotion* axisMotion);
|
||||||
|
@ -129,11 +123,11 @@ public:
|
||||||
while(parIndex != -1)
|
while(parIndex != -1)
|
||||||
{
|
{
|
||||||
auto& ax = axisList_[parIndex];
|
auto& ax = axisList_[parIndex];
|
||||||
parentVel += ax.linVelocityPoint(p);
|
parentVel += ax.linTangentialVelocityPoint(p);
|
||||||
parIndex = ax.parentAxisIndex();
|
parIndex = ax.parentAxisIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parentVel + rotatingAxis::linVelocityPoint(p);
|
return parentVel + rotatingAxis::linTangentialVelocityPoint(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translate point p for dt seconds based on the axis information
|
/// Translate point p for dt seconds based on the axis information
|
||||||
|
@ -213,10 +207,6 @@ public:
|
||||||
FUNCTION_H
|
FUNCTION_H
|
||||||
bool write(const multiRotatingAxisMotion* axisMotion, dictionary& dict) const;
|
bool write(const multiRotatingAxisMotion* axisMotion, dictionary& dict) const;
|
||||||
|
|
||||||
/// Write to dictionary
|
|
||||||
FUNCTION_H
|
|
||||||
bool write(dictionary& dict) const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,70 +19,220 @@ Licence:
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "multiRotatingAxisMotion.hpp"
|
#include "multiRotatingAxisMotion.hpp"
|
||||||
|
#include "dictionary.hpp"
|
||||||
|
#include "vocabs.hpp"
|
||||||
|
|
||||||
void pFlow::multiRotatingAxisMotion::impl_setTime
|
|
||||||
|
bool pFlow::multiRotatingAxisMotion::readDictionary
|
||||||
(
|
(
|
||||||
uint32 iter,
|
const dictionary& dict
|
||||||
real t,
|
)
|
||||||
real dt
|
{
|
||||||
|
|
||||||
|
auto motionModel = dict.getVal<word>("motionModel");
|
||||||
|
|
||||||
|
if(motionModel != "multiRotatingAxisMotion")
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" motionModel should be multiRotatingAxisMotion, but found "
|
||||||
|
<< motionModel <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& motionInfo = dict.subDict("multiRotatingAxisMotionInfo");
|
||||||
|
auto axisNames = motionInfo.dictionaryKeywords();
|
||||||
|
wordList rotationAxis;
|
||||||
|
|
||||||
|
// first check if
|
||||||
|
|
||||||
|
|
||||||
|
for(auto& aName: axisNames)
|
||||||
|
{
|
||||||
|
auto& axDict = motionInfo.subDict(aName);
|
||||||
|
|
||||||
|
if(auto axPtr = makeUnique<rotatingAxis>(axDict); axPtr)
|
||||||
|
{
|
||||||
|
rotationAxis.push_back(
|
||||||
|
axDict.getValOrSet<word>("rotationAxis", "none"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"could not read rotating axis from "<< axDict.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !axisNames.search("none") )
|
||||||
|
{
|
||||||
|
axisNames.push_back("none");
|
||||||
|
rotationAxis.push_back("none");
|
||||||
|
}
|
||||||
|
|
||||||
|
using intPair = std::pair<int32, int32>;
|
||||||
|
|
||||||
|
std::vector<intPair> numRotAxis;
|
||||||
|
|
||||||
|
for(size_t i=0; i< axisNames.size(); i++)
|
||||||
|
{
|
||||||
|
word rotAxis = rotationAxis[i];
|
||||||
|
int32 n=0;
|
||||||
|
while(rotAxis != "none")
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
if(int32 iAxis = axisNames.findi(rotAxis) ; iAxis != -1)
|
||||||
|
{
|
||||||
|
rotAxis = rotationAxis[iAxis];
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"rotation axis name "<< rotAxis << "is does not exist!"<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
numRotAxis.push_back({n,i});
|
||||||
|
}
|
||||||
|
|
||||||
|
auto compareFunc = [](const intPair& a, const intPair& b)
|
||||||
|
{ return a.first > b.first; };
|
||||||
|
|
||||||
|
algorithms::STD::sort(numRotAxis.data(), numRotAxis.size(), compareFunc);
|
||||||
|
|
||||||
|
sortedIndex_.clear();
|
||||||
|
axisName_.clear();
|
||||||
|
|
||||||
|
|
||||||
|
for(auto ax:numRotAxis)
|
||||||
|
{
|
||||||
|
axisName_.push_back(axisNames[ax.second]);
|
||||||
|
sortedIndex_.push_back(ax.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
numAxis_ = axisName_.size();
|
||||||
|
axis_.clear();
|
||||||
|
axis_.reserve(numAxis_);
|
||||||
|
|
||||||
|
|
||||||
|
// create the actual axis vector
|
||||||
|
for(auto& aName: axisName_)
|
||||||
|
{
|
||||||
|
if(aName != "none")
|
||||||
|
{
|
||||||
|
auto& axDict = motionInfo.subDict(aName);
|
||||||
|
axis_.push_back(
|
||||||
|
multiRotatingAxis(this, axDict));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
axis_.push_back(
|
||||||
|
multiRotatingAxis(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::multiRotatingAxisMotion::writeDictionary
|
||||||
|
(
|
||||||
|
dictionary& dict
|
||||||
)const
|
)const
|
||||||
{
|
{
|
||||||
auto motion = motionComponents_.deviceViewAll();
|
dict.add("motionModel", "multiRotatingAxisMotion");
|
||||||
Kokkos::parallel_for(
|
|
||||||
"multiRotatingAxisMotion::impl_setTime",
|
auto& motionInfo = dict.subDictOrCreate("multiRotatingAxisMotionInfo");
|
||||||
deviceRPolicyStatic(0, numComponents_),
|
|
||||||
LAMBDA_HD(uint32 i){
|
ForAll(i, axis_)
|
||||||
motion[i].setTime(t);
|
{
|
||||||
});
|
|
||||||
Kokkos::fence();
|
auto& axDict = motionInfo.subDictOrCreate(axisName_[i]);
|
||||||
|
if( !axis_.hostVectorAll()[i].write(this,axDict))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
" error in writing axis "<< axisName_[i] << " to dicrionary "
|
||||||
|
<< motionInfo.globalName()<<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pFlow::multiRotatingAxisMotion::multiRotatingAxisMotion(
|
pFlow::multiRotatingAxisMotion::multiRotatingAxisMotion()
|
||||||
const objectFile &objf,
|
{}
|
||||||
repository *owner)
|
|
||||||
: fileDictionary(objf, owner)
|
|
||||||
{
|
|
||||||
|
|
||||||
// if(! impl_readDictionary(*this) )
|
|
||||||
// {
|
|
||||||
// fatalErrorInFunction;
|
|
||||||
// fatalExit;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
pFlow::multiRotatingAxisMotion::multiRotatingAxisMotion
|
pFlow::multiRotatingAxisMotion::multiRotatingAxisMotion
|
||||||
(
|
(
|
||||||
const objectFile &objf,
|
const dictionary& dict
|
||||||
const dictionary &dict,
|
|
||||||
repository *owner
|
|
||||||
)
|
)
|
||||||
:
|
|
||||||
fileDictionary(objf, dict, owner)
|
|
||||||
{
|
{
|
||||||
if(!impl_readDictionary(*this) )
|
if(! readDictionary(dict) )
|
||||||
{
|
{
|
||||||
fatalErrorInFunction;
|
|
||||||
fatalExit;
|
fatalExit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FUNCTION_H
|
||||||
|
bool pFlow::multiRotatingAxisMotion::move(real t, real dt)
|
||||||
|
{
|
||||||
|
|
||||||
|
// every thing is done on host
|
||||||
|
for(int32 i=0; i<numAxis_; i++)
|
||||||
|
{
|
||||||
|
auto& ax = axis_[sortedIndex_[i]];
|
||||||
|
ax.setTime(t);
|
||||||
|
ax.setAxisList(getAxisListPtrHost());
|
||||||
|
ax.move(dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// transfer to device
|
||||||
|
axis_.modifyOnHost();
|
||||||
|
axis_.syncViews();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::multiRotatingAxisMotion::read
|
||||||
|
(
|
||||||
|
iIstream& is
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// create an empty file dictionary
|
||||||
|
dictionary motionInfo(motionModelFile__, true);
|
||||||
|
|
||||||
|
// read dictionary from stream
|
||||||
|
if( !motionInfo.read(is) )
|
||||||
|
{
|
||||||
|
ioErrorInFile(is.name(), is.lineNumber()) <<
|
||||||
|
" error in reading dictionray " << motionModelFile__ <<" from file. \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !readDictionary(motionInfo) ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool pFlow::multiRotatingAxisMotion::write
|
bool pFlow::multiRotatingAxisMotion::write
|
||||||
(
|
(
|
||||||
iOstream &os,
|
iOstream& os
|
||||||
const IOPattern &iop
|
)const
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
// a global dictionary
|
// create an empty file dictionary
|
||||||
dictionary newDict(fileDictionary::dictionary::name(), true);
|
dictionary motionInfo(motionModelFile__, true);
|
||||||
if( iop.thisProcWriteData() )
|
|
||||||
|
if( !writeDictionary(motionInfo))
|
||||||
{
|
{
|
||||||
if( !this->impl_writeDictionary(newDict) ||
|
return false;
|
||||||
!newDict.write(os))
|
|
||||||
{
|
|
||||||
fatalErrorInFunction<<
|
|
||||||
" error in writing to dictionary "<< newDict.globalName()<<endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
if( !motionInfo.write(os) )
|
||||||
|
{
|
||||||
|
ioErrorInFile( os.name(), os.lineNumber() )<<
|
||||||
|
" error in writing dictionray to file. \n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
|
@ -22,22 +22,18 @@ Licence:
|
||||||
#define __multiRotatingAxisMotion_hpp__
|
#define __multiRotatingAxisMotion_hpp__
|
||||||
|
|
||||||
|
|
||||||
// #include "types.hpp"
|
#include "types.hpp"
|
||||||
// #include "typeInfo.hpp"
|
#include "typeInfo.hpp"
|
||||||
// #include "VectorSingle.hpp"
|
#include "VectorDual.hpp"
|
||||||
// #include "List.hpp"
|
#include "List.hpp"
|
||||||
// #include "multiRotatingAxis.hpp"
|
|
||||||
|
|
||||||
#include "MotionModel.hpp"
|
|
||||||
#include "multiRotatingAxis.hpp"
|
#include "multiRotatingAxis.hpp"
|
||||||
#include "fileDictionary.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
// forward
|
// forward
|
||||||
// class dictionary;
|
class dictionary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotating axis motion model for walls
|
* Rotating axis motion model for walls
|
||||||
|
@ -67,49 +63,200 @@ multiRotatingAxisMotionInfo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class multiRotatingAxisMotion
|
class multiRotatingAxisMotion
|
||||||
:
|
|
||||||
public fileDictionary,
|
|
||||||
public MotionModel<multiRotatingAxisMotion, multiRotatingAxis>
|
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** Motion model class to be passed to computational units/kernels for
|
||||||
|
* transfing points and returning velocities at various positions
|
||||||
|
*/
|
||||||
|
class Model
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
deviceViewType1D<multiRotatingAxis> axis_;
|
||||||
|
int32 numAxis_=0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
Model(deviceViewType1D<multiRotatingAxis> axis, int32 numAxis):
|
||||||
|
axis_(axis),
|
||||||
|
numAxis_(numAxis)
|
||||||
|
{}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
Model(const Model&) = default;
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
Model& operator=(const Model&) = default;
|
||||||
|
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 pointVelocity(int32 n, const realx3& p)const
|
||||||
|
{
|
||||||
|
return axis_[n].pointTangentialVel(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 operator()(int32 n, const realx3& p)const
|
||||||
|
{
|
||||||
|
return pointVelocity(n,p);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
realx3 transferPoint(int32 n, const realx3 p, real dt)const
|
||||||
|
{
|
||||||
|
return axis_[n].transferPoint(p, dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE_FUNCTION_HD int32 numComponents()const
|
||||||
|
{
|
||||||
|
return numAxis_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
friend MotionModel<multiRotatingAxisMotion, multiRotatingAxis>;
|
using axisVector_HD = VectorDual<multiRotatingAxis>;
|
||||||
|
|
||||||
/// is the geometry attached to this component moving
|
/// Vector of multiRotaingAxis axes
|
||||||
bool impl_isMoving()const
|
axisVector_HD axis_;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// move the component itself
|
/// Sorted index based on number of parrents each axis ha
|
||||||
bool impl_move(uint32, real, real)const
|
VectorDual<int32> sortedIndex_;
|
||||||
{
|
|
||||||
return true;
|
/// List of axes names
|
||||||
}
|
wordList axisName_;
|
||||||
|
|
||||||
|
/// Number of axes
|
||||||
|
label numAxis_= 0;
|
||||||
|
|
||||||
|
/// Read from a dictionary
|
||||||
|
bool readDictionary(const dictionary& dict);
|
||||||
|
|
||||||
|
/// Write to a dictionary
|
||||||
|
bool writeDictionary(dictionary& dict)const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfo("multiRotatingAxisMotion");
|
/// Type info
|
||||||
|
TypeInfoNV("multiRotatingAxisMotion");
|
||||||
|
|
||||||
multiRotatingAxisMotion(const objectFile& objf, repository* owner);
|
// - Constructor
|
||||||
|
|
||||||
multiRotatingAxisMotion(
|
/// Empty constructor
|
||||||
const objectFile& objf,
|
FUNCTION_H
|
||||||
const dictionary& dict,
|
multiRotatingAxisMotion();
|
||||||
repository* owner);
|
|
||||||
|
|
||||||
using fileDictionary::write;
|
/// Construct with dictionary
|
||||||
|
FUNCTION_H
|
||||||
|
multiRotatingAxisMotion(const dictionary& dict);
|
||||||
|
|
||||||
bool write(iOstream& os, const IOPattern& iop)const override;
|
/// Copy constructor
|
||||||
|
FUNCTION_H
|
||||||
|
multiRotatingAxisMotion(const multiRotatingAxisMotion&) = default;
|
||||||
|
|
||||||
|
/// No Move
|
||||||
|
multiRotatingAxisMotion(multiRotatingAxisMotion&&) = delete;
|
||||||
|
|
||||||
|
/// Copy assignment
|
||||||
|
FUNCTION_H
|
||||||
|
multiRotatingAxisMotion& operator=(const multiRotatingAxisMotion&) = default;
|
||||||
|
|
||||||
|
/// No move assignment
|
||||||
|
multiRotatingAxisMotion& operator=(multiRotatingAxisMotion&&) = delete;
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
FUNCTION_H
|
||||||
|
~multiRotatingAxisMotion() = default;
|
||||||
|
|
||||||
|
// - Methods
|
||||||
|
|
||||||
|
/// Retrun motion model at time t
|
||||||
|
Model getModel(real t)
|
||||||
|
{
|
||||||
|
for(int32 i= 0; i<numAxis_; i++ )
|
||||||
|
{
|
||||||
|
axis_[i].setTime(t);
|
||||||
|
axis_[i].setAxisList(getAxisListPtrDevice());
|
||||||
|
}
|
||||||
|
axis_.modifyOnHost();
|
||||||
|
axis_.syncViews();
|
||||||
|
|
||||||
|
return Model(axis_.deviceVector(), numAxis_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pointer to axis list on host side
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
multiRotatingAxis* getAxisListPtrHost()
|
||||||
|
{
|
||||||
|
return axis_.hostVectorAll().data();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pointer to axis list on device
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
multiRotatingAxis* getAxisListPtrDevice()
|
||||||
|
{
|
||||||
|
return axis_.deviceVectorAll().data();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Name of motion component to index
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
int32 nameToIndex(const word& name)const
|
||||||
|
{
|
||||||
|
if( auto i = axisName_.findi(name); i == -1)
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"axis name " << name << " does not exist. \n";
|
||||||
|
fatalExit;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Index of motion component to component name
|
||||||
|
INLINE_FUNCTION_H
|
||||||
|
word indexToName(label i)const
|
||||||
|
{
|
||||||
|
if(i < numAxis_ )
|
||||||
|
return axisName_[i];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"out of range access to the list of axes " << i <<endl<<
|
||||||
|
" size of axes_ is "<<numAxis_<<endl;
|
||||||
|
fatalExit;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Is moving
|
||||||
|
INLINE_FUNCTION_HD
|
||||||
|
bool isMoving()const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Move points
|
||||||
|
FUNCTION_H
|
||||||
|
bool move(real t, real dt);
|
||||||
|
|
||||||
|
// - IO operation
|
||||||
|
|
||||||
|
/// Read from input stream is
|
||||||
|
FUNCTION_H
|
||||||
|
bool read(iIstream& is);
|
||||||
|
|
||||||
|
/// Write to output stream os
|
||||||
|
FUNCTION_H
|
||||||
|
bool write(iOstream& os)const;
|
||||||
|
|
||||||
static
|
|
||||||
auto noneComponent()
|
|
||||||
{
|
|
||||||
return multiRotatingAxis{};
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: make this method protected
|
|
||||||
void impl_setTime(uint32 iter, real t, real dt)const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // pFlow
|
} // pFlow
|
||||||
|
|
Loading…
Reference in New Issue