www.cemf.ir
demComponent.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 __demComponent_hpp__
22 #define __demComponent_hpp__
23 
24 #include "types.hpp"
25 #include "typeInfo.hpp"
26 #include "timeInfo.hpp"
27 #include "Timers.hpp"
28 
29 namespace pFlow
30 {
31 
32 class systemControl;
33 class Time;
43 {
44 private:
45  // - Protected data members
46 
49 
51 
54 
57 
58 public:
59 
61  TypeInfo("demComponent");
62 
63  // - Constructors
64 
66  demComponent(const word& name, systemControl& control);
67 
69  demComponent(const demComponent&) = delete;
70 
72  demComponent(demComponent&&) = delete;
73 
75  demComponent& operator = (const demComponent&) = delete;
76 
79 
81  virtual ~demComponent() = default;
82 
83 
84  // - Member functions
85 
87  inline
88  const auto& control()const
89  {
90  return control_;
91  }
92 
94  inline
95  auto& control()
96  {
97  return control_;
98  }
99 
101  real dt()const;
102 
104  real currentTime()const;
105 
107  uint32 currentIter()const;
108 
110  timeInfo TimeInfo()const;
111 
112  inline
113  const auto& time()const
114  {
115  return time_;
116  }
117 
118  inline
119  auto& time()
120  {
121  return time_;
122  }
123 
124 
126  inline
127  const auto& timers() const
128  {
129  return timers_;
130  }
131 
133  inline
134  auto& timers()
135  {
136  return timers_;
137  }
138 
140  virtual
142  {
144  return false;
145  }
146 
148  virtual
149  bool beforeIteration() = 0;
150 
153  virtual
154  bool iterate() = 0;
155 
157  virtual
158  bool afterIteration() = 0;
159 
161  virtual
163  {
165  return false;
166  }
167 
168 };
169 
170 }
171 
172 #endif
pFlow::demComponent::demComponent
demComponent(const word &name, systemControl &control)
construct from components
Definition: demComponent.cpp:25
notImplementedFunction
#define notImplementedFunction
Report that a function is yet not implemented.
Definition: error.hpp:84
pFlow::real
float real
Definition: builtinTypes.hpp:45
timeInfo.hpp
pFlow::demComponent::control
const auto & control() const
Const ref to systemControl.
Definition: demComponent.hpp:88
pFlow::demComponent::TimeInfo
timeInfo TimeInfo() const
return time info of the simulaiton
Definition: demComponent.cpp:48
types.hpp
pFlow::demComponent::afterTimeLoop
virtual bool afterTimeLoop()
This is called after the time loop.
Definition: demComponent.hpp:162
pFlow::demComponent::time
const auto & time() const
Definition: demComponent.hpp:113
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::demComponent::operator=
demComponent & operator=(const demComponent &)=delete
No copy assignment.
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::Timers
Definition: Timers.hpp:32
pFlow::demComponent::afterIteration
virtual bool afterIteration()=0
This is called in time loop, after iterate.
pFlow::demComponent::timers
const auto & timers() const
Const ref to timers.
Definition: demComponent.hpp:127
pFlow::demComponent::control
auto & control()
Ref to systemControl.
Definition: demComponent.hpp:95
pFlow::timeInfo
Definition: timeInfo.hpp:28
pFlow::demComponent::control_
systemControl & control_
Reference to systemControl.
Definition: demComponent.hpp:48
pFlow
Definition: demGeometry.hpp:27
pFlow::demComponent::timers_
Timers timers_
All timers (if any) of this component.
Definition: demComponent.hpp:53
pFlow::demComponent::currentIter
uint32 currentIter() const
return current iteration number
Definition: demComponent.cpp:43
pFlow::demComponent::time_
Time & time_
Definition: demComponent.hpp:50
pFlow::demComponent
A base class for every main component of DEM system.
Definition: demComponent.hpp:42
pFlow::demComponent::beforeTimeLoop
virtual bool beforeTimeLoop()
This is called before the start of time loop.
Definition: demComponent.hpp:141
pFlow::demComponent::beforeIteration
virtual bool beforeIteration()=0
This is called in time loop, before iterate.
pFlow::demComponent::currentTime
real currentTime() const
Current simulation time.
Definition: demComponent.cpp:38
pFlow::demComponent::componentName_
word componentName_
Name of the DEM component.
Definition: demComponent.hpp:56
pFlow::demComponent::time
auto & time()
Definition: demComponent.hpp:119
Timers.hpp
pFlow::demComponent::~demComponent
virtual ~demComponent()=default
destructor
pFlow::demComponent::TypeInfo
TypeInfo("demComponent")
Type info.
typeInfo.hpp
pFlow::demComponent::dt
real dt() const
Time step of integration.
Definition: demComponent.cpp:33
pFlow::demComponent::timers
auto & timers()
Ref to timers.
Definition: demComponent.hpp:134
pFlow::demComponent::iterate
virtual bool iterate()=0
This is called in time loop.
pFlow::Time
Definition: Time.hpp:37