multiRotatingAxisMotion.hpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #ifndef __multiRotatingAxisMotion_hpp__
22 #define __multiRotatingAxisMotion_hpp__
23 
24 
25 #include "types.hpp"
26 #include "typeInfo.hpp"
27 #include "VectorDual.hpp"
28 #include "List.hpp"
29 #include "multiRotatingAxis.hpp"
30 
31 
32 namespace pFlow
33 {
34 
35 class dictionary;
36 
38 {
39 public:
40 
41  // - this class shuold be decleared in every motion model with
42  // exact methods
43  class Model
44  {
45  protected:
46 
49 
50  public:
51 
54  axis_(axis),
55  numAxis_(numAxis)
56  {}
57 
59  Model(const Model&) = default;
60 
61 
63  Model& operator=(const Model&) = default;
64 
65 
67  realx3 pointVelocity(int32 n, const realx3& p)const
68  {
69  return axis_[n].pointTangentialVel(p);
70  }
71 
73  realx3 operator()(int32 n, const realx3& p)const
74  {
75  return pointVelocity(n,p);
76  }
77 
79  realx3 transferPoint(int32 n, const realx3 p, real dt)const
80  {
81  return axis_[n].transferPoint(p, dt);
82  }
83 
85  {
86  return numAxis_;
87  }
88  };
89 
90 protected:
91 
93 
95 
97 
99 
101 
102 
103 
104  bool readDictionary(const dictionary& dict);
105 
106  bool writeDictionary(dictionary& dict)const;
107 
108 public:
109 
110  TypeInfoNV("multiRotatingAxisMotion");
111 
112  // empty
113  FUNCTION_H
115 
116  // construct with dictionary
117  FUNCTION_H
118  multiRotatingAxisMotion(const dictionary& dict);
119 
120  // copy
121  FUNCTION_H
123 
125 
126  FUNCTION_H
128 
130 
131  FUNCTION_H
132  ~multiRotatingAxisMotion() = default;
133 
134 
136  {
137  for(int32 i= 0; i<numAxis_; i++ )
138  {
139  axis_[i].setTime(t);
140  axis_[i].setAxisList(getAxisListPtrDevice());
141  }
143  axis_.syncViews();
144 
145  return Model(axis_.deviceVector(), numAxis_);
146  }
147 
150  {
151  return axis_.hostVectorAll().data();
152  }
153 
154 
157  {
158  return axis_.deviceVectorAll().data();
159  }
160 
162  int32 nameToIndex(const word& name)const
163  {
164  if( auto i = axisName_.findi(name); i == -1)
165  {
167  "axis name " << name << " does not exist. \n";
168  fatalExit;
169  return i;
170  }
171  else
172  {
173  return i;
174  }
175 
176  }
177 
180  {
181  if(i < numAxis_ )
182  return axisName_[i];
183  else
184  {
186  "out of range access to the list of axes " << i <<endl<<
187  " size of axes_ is "<<numAxis_<<endl;
188  fatalExit;
189  return "";
190  }
191  }
192 
193 
195  bool isMoving()const
196  {
197  return true;
198  }
199 
200  FUNCTION_H
201  bool move(real t, real dt);
202 
203 
204  FUNCTION_H
205  bool read(iIstream& is);
206 
207  FUNCTION_H
208  bool write(iOstream& os)const;
209 
210 
211 };
212 
213 } // pFlow
214 
215 #endif //__multiRotatingAxisMotion_hpp__
pFlow::multiRotatingAxisMotion::Model::pointVelocity
INLINE_FUNCTION_HD realx3 pointVelocity(int32 n, const realx3 &p) const
Definition: multiRotatingAxisMotion.hpp:67
pFlow::multiRotatingAxisMotion::axis_
axisVector_HD axis_
Definition: multiRotatingAxisMotion.hpp:94
pFlow::List< word >
pFlow::multiRotatingAxisMotion::readDictionary
bool readDictionary(const dictionary &dict)
Definition: multiRotatingAxisMotion.cpp:27
pFlow::VectorDual::syncViews
INLINE_FUNCTION_H void syncViews()
Definition: VectorDual.hpp:875
pFlow::multiRotatingAxisMotion::getAxisListPtrDevice
INLINE_FUNCTION_H multiRotatingAxis * getAxisListPtrDevice()
Definition: multiRotatingAxisMotion.hpp:156
multiRotatingAxis.hpp
pFlow::real
float real
Definition: builtinTypes.hpp:46
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::VectorDual::hostVectorAll
INLINE_FUNCTION_H hostViewType & hostVectorAll()
Definition: VectorDual.hpp:345
types.hpp
pFlow::multiRotatingAxisMotion::indexToName
INLINE_FUNCTION_H word indexToName(label i) const
Definition: multiRotatingAxisMotion.hpp:179
List.hpp
pFlow::multiRotatingAxisMotion::Model::operator=
INLINE_FUNCTION_HD Model & operator=(const Model &)=default
pFlow::multiRotatingAxisMotion::Model::numComponents
INLINE_FUNCTION_HD int32 numComponents() const
Definition: multiRotatingAxisMotion.hpp:84
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::multiRotatingAxisMotion::write
FUNCTION_H bool write(iOstream &os) const
Definition: multiRotatingAxisMotion.cpp:219
pFlow::multiRotatingAxisMotion::numAxis_
label numAxis_
Definition: multiRotatingAxisMotion.hpp:100
pFlow::multiRotatingAxisMotion::nameToIndex
INLINE_FUNCTION_H int32 nameToIndex(const word &name) const
Definition: multiRotatingAxisMotion.hpp:162
pFlow::multiRotatingAxisMotion::~multiRotatingAxisMotion
FUNCTION_H ~multiRotatingAxisMotion()=default
pFlow::multiRotatingAxisMotion::Model::axis_
deviceViewType1D< multiRotatingAxis > axis_
Definition: multiRotatingAxisMotion.hpp:47
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::multiRotatingAxisMotion::sortedIndex_
VectorDual< int32 > sortedIndex_
Definition: multiRotatingAxisMotion.hpp:96
pFlow::VectorDual::modifyOnHost
INLINE_FUNCTION_H void modifyOnHost()
Definition: VectorDual.hpp:796
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
Definition: KokkosTypes.hpp:93
VectorDual.hpp
pFlow
Definition: demComponent.hpp:28
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::List::findi
int32 findi(const T &val) const
Definition: ListI.hpp:109
pFlow::VectorDual::deviceVectorAll
INLINE_FUNCTION_H deviceViewType & deviceVectorAll()
Definition: VectorDual.hpp:335
n
int32 n
Definition: NBSCrossLoop.hpp:24
pFlow::multiRotatingAxis
Definition: multiRotatingAxis.hpp:36
pFlow::iIstream
Definition: iIstream.hpp:33
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::VectorDual< multiRotatingAxis >
pFlow::multiRotatingAxisMotion::isMoving
INLINE_FUNCTION_HD bool isMoving() const
Definition: multiRotatingAxisMotion.hpp:195
pFlow::multiRotatingAxisMotion::writeDictionary
bool writeDictionary(dictionary &dict) const
Definition: multiRotatingAxisMotion.cpp:139
pFlow::multiRotatingAxisMotion::getModel
Model getModel(real t)
Definition: multiRotatingAxisMotion.hpp:135
pFlow::multiRotatingAxisMotion::move
FUNCTION_H bool move(real t, real dt)
Definition: multiRotatingAxisMotion.cpp:178
pFlow::multiRotatingAxisMotion::Model
Definition: multiRotatingAxisMotion.hpp:43
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
pFlow::multiRotatingAxisMotion::TypeInfoNV
TypeInfoNV("multiRotatingAxisMotion")
pFlow::multiRotatingAxisMotion::Model::Model
INLINE_FUNCTION_HD Model(deviceViewType1D< multiRotatingAxis > axis, int32 numAxis)
Definition: multiRotatingAxisMotion.hpp:53
pFlow::multiRotatingAxisMotion::getAxisListPtrHost
INLINE_FUNCTION_H multiRotatingAxis * getAxisListPtrHost()
Definition: multiRotatingAxisMotion.hpp:149
pFlow::multiRotatingAxisMotion::read
FUNCTION_H bool read(iIstream &is)
Definition: multiRotatingAxisMotion.cpp:198
pFlow::multiRotatingAxisMotion::axisName_
wordList axisName_
Definition: multiRotatingAxisMotion.hpp:98
pFlow::multiRotatingAxisMotion::multiRotatingAxisMotion
FUNCTION_H multiRotatingAxisMotion()
Definition: multiRotatingAxisMotion.cpp:163
pFlow::multiRotatingAxisMotion
Definition: multiRotatingAxisMotion.hpp:37
pFlow::VectorDual::deviceVector
INLINE_FUNCTION_H deviceViewType & deviceVector()
Definition: VectorDual.hpp:354
pFlow::multiRotatingAxisMotion::operator=
FUNCTION_H multiRotatingAxisMotion & operator=(const multiRotatingAxisMotion &)=default
typeInfo.hpp
pFlow::label
std::size_t label
Definition: builtinTypes.hpp:61
pFlow::multiRotatingAxisMotion::Model::numAxis_
int32 numAxis_
Definition: multiRotatingAxisMotion.hpp:48
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< real >
pFlow::multiRotatingAxisMotion::Model::transferPoint
INLINE_FUNCTION_HD realx3 transferPoint(int32 n, const realx3 p, real dt) const
Definition: multiRotatingAxisMotion.hpp:79
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::multiRotatingAxisMotion::Model::operator()
INLINE_FUNCTION_HD realx3 operator()(int32 n, const realx3 &p) const
Definition: multiRotatingAxisMotion.hpp:73
pFlow::dictionary
Definition: dictionary.hpp:38