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 "systemControl.hpp"
25 
26 
27 
28 namespace pFlow
29 {
30 
40 {
41 protected:
42 
43  // - Protected data members
44 
47 
50 
53 
54 public:
55 
57  TypeInfo("demComponent");
58 
59  // - Constructors
60 
63  :
64  componentName_(name),
66  timers_(name, &control.timers())
67  {}
68 
70  demComponent(const demComponent&) = delete;
71 
73  demComponent(demComponent&&) = delete;
74 
76  demComponent& operator = (const demComponent&) = delete;
77 
80 
82  virtual ~demComponent() = default;
83 
84 
85  // - Member functions
86 
88  inline
89  const auto& control()const
90  {
91  return control_;
92  }
93 
95  inline
96  auto& control()
97  {
98  return control_;
99  }
100 
102  inline
103  real dt()const
104  {
105  return control_.time().dt();
106  }
107 
109  inline
111  {
112  return control_.time().currentTime();
113  }
114 
116  inline
117  const auto& timers() const
118  {
119  return timers_;
120  }
121 
123  inline
124  auto& timers()
125  {
126  return timers_;
127  }
128 
130  virtual
132  {
134  return false;
135  }
136 
138  virtual
139  bool beforeIteration() = 0;
140 
143  virtual
144  bool iterate() = 0;
145 
147  virtual
148  bool afterIteration() = 0;
149 
151  virtual
153  {
155  return false;
156  }
157 
158 };
159 
160 }
161 
162 #endif
pFlow::demComponent::demComponent
demComponent(const word &name, systemControl &control)
construct from components
Definition: demComponent.hpp:62
notImplementedFunction
#define notImplementedFunction
Definition: error.hpp:47
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::demComponent::control
const auto & control() const
Const ref to systemControl.
Definition: demComponent.hpp:89
pFlow::timeControl::dt
real dt() const
Definition: timeControl.hpp:106
pFlow::demComponent::afterTimeLoop
virtual bool afterTimeLoop()
This is called after the time loop.
Definition: demComponent.hpp:152
systemControl.hpp
pFlow::demComponent::operator=
demComponent & operator=(const demComponent &)=delete
No copy assignment.
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::Timers
Definition: Timers.hpp:33
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:117
pFlow::demComponent::control
auto & control()
Ref to systemControl.
Definition: demComponent.hpp:96
pFlow::demComponent::control_
systemControl & control_
Reference to systemControl.
Definition: demComponent.hpp:49
pFlow
Definition: demComponent.hpp:28
pFlow::demComponent::timers_
Timers timers_
All timers (if any) of this component.
Definition: demComponent.hpp:52
pFlow::demComponent::dt
real dt() const
Time step of integration.
Definition: demComponent.hpp:103
pFlow::demComponent
A base class for every main component of DEM system.
Definition: demComponent.hpp:39
pFlow::systemControl::time
const Time & time() const
Definition: systemControl.hpp:123
pFlow::demComponent::beforeTimeLoop
virtual bool beforeTimeLoop()
This is called before the start of time loop.
Definition: demComponent.hpp:131
pFlow::demComponent::beforeIteration
virtual bool beforeIteration()=0
This is called in time loop, before iterate.
pFlow::timeControl::currentTime
real currentTime() const
Definition: timeControl.hpp:135
pFlow::demComponent::currentTime
real currentTime() const
Current simulation time.
Definition: demComponent.hpp:110
pFlow::demComponent::componentName_
word componentName_
Name of the DEM component.
Definition: demComponent.hpp:46
pFlow::demComponent::~demComponent
virtual ~demComponent()=default
destructor
pFlow::demComponent::TypeInfo
TypeInfo("demComponent")
Type info.
pFlow::demComponent::timers
auto & timers()
Ref to timers.
Definition: demComponent.hpp:124
pFlow::demComponent::iterate
virtual bool iterate()=0
This is called in time loop.