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 
32 {
33 protected:
34 
36 
37 
39 
40 
42 
43 public:
44 
45  TypeInfo("demComponent");
46 
48  :
49  componentName_(name),
51  timers_(name, &control.timers())
52  {}
53 
54  virtual ~demComponent() = default;
55 
56 
57  const auto& control()const
58  {
59  return control_;
60  }
61 
62  auto& control()
63  {
64  return control_;
65  }
66 
67  inline
68  real dt()const
69  {
70  return control_.time().dt();
71  }
72 
73  inline
75  {
76  return control_.time().currentTime();
77  }
78 
79  auto& timers(){
80  return timers_;
81  }
82 
83  const auto& timers() const{
84  return timers_;
85  }
86 
87 
88  virtual bool beforeIteration() = 0;
89 
90 
91  virtual bool iterate() = 0;
92 
93 
94  virtual bool afterIteration() = 0;
95 
96 };
97 
98 }
99 
100 #endif
pFlow::demComponent::demComponent
demComponent(const word &name, systemControl &control)
Definition: demComponent.hpp:47
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::demComponent::control
const auto & control() const
Definition: demComponent.hpp:57
pFlow::timeControl::dt
real dt() const
Definition: timeControl.hpp:102
systemControl.hpp
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
pFlow::demComponent::timers
const auto & timers() const
Definition: demComponent.hpp:83
pFlow::demComponent::control
auto & control()
Definition: demComponent.hpp:62
pFlow::demComponent::control_
systemControl & control_
Definition: demComponent.hpp:38
pFlow
Definition: demComponent.hpp:28
pFlow::demComponent::timers_
Timers timers_
Definition: demComponent.hpp:41
pFlow::demComponent::dt
real dt() const
Definition: demComponent.hpp:68
pFlow::demComponent
Definition: demComponent.hpp:31
pFlow::systemControl::time
const Time & time() const
Definition: systemControl.hpp:123
pFlow::demComponent::beforeIteration
virtual bool beforeIteration()=0
pFlow::timeControl::currentTime
real currentTime() const
Definition: timeControl.hpp:131
pFlow::demComponent::currentTime
real currentTime() const
Definition: demComponent.hpp:74
pFlow::demComponent::componentName_
word componentName_
Definition: demComponent.hpp:35
pFlow::demComponent::~demComponent
virtual ~demComponent()=default
pFlow::demComponent::TypeInfo
TypeInfo("demComponent")
pFlow::demComponent::timers
auto & timers()
Definition: demComponent.hpp:79
pFlow::demComponent::iterate
virtual bool iterate()=0