systemControl.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 
22 #ifndef __systemControl_hpp__
23 #define __systemControl_hpp__
24 
25 
26 // top-level entity repository for the whole application
27 // Each application that is executed in pFlow, should have
28 // settings/systemControl file in it.
29 
30 
31 #include "types.hpp"
32 #include "Time.hpp"
33 #include "dictionary.hpp"
34 #include "box.hpp"
35 #include "Timers.hpp"
36 #include "dynamicLinkLibs.hpp"
37 
38 namespace pFlow
39 {
40 
42 :
43  public repository
44 {
45 protected:
46 
47  // run name
48  const word runName_;
49 
50  // - path to top-level folder
52 
53 
54 
55  // - settings folder repository
57 
58  // - caseSetup folder repository
60 
61  // - settingsDict fileDictionary
63 
64  // - extra libs to be loaded
66 
67  // - precision for writing to file
68  size_t outFilePrecision_ = 6;
69 
70  // - time repository
72 
73  // - if time control is managed externaly
74 
75  bool externalTimeControl_ = false;
76 
77  // - acceleration
79 
80  // - domain for dem world
82 
83  // all timers
85 
87 
89 
90  static word getRunName( const fileSystem& path);
91 
92  static word getTopFolder(const fileSystem& path);
93 
94 
95 public:
96 
97  systemControl(const fileSystem path = CWD());
98 
100  const real startTime,
101  const real endTime,
102  const real saveInterval,
103  const word startTimeName,
104  const fileSystem path = CWD() );
105 
106  const repository& settings() const{
107  return settings_;
108  }
109 
111  return settings_;
112  }
113 
114  const repository& caseSetup()const{
115  return caseSetup_;
116  }
117 
119  return caseSetup_;
120  }
121 
122 
123  const Time& time() const
124  {
125  return const_cast<Time&>(Time_);
126  }
127 
129  {
130  return Time_;
131  }
132 
133  const repository& geometry()const
134  {
135  return Time_.geometry();
136  }
137 
139  {
140  return Time_.geometry();
141  }
142 
143  const Timers& timers()const
144  {
145  return timers_;
146  }
147 
149  {
150  return timers_;
151  }
152 
153  inline bool timersReport()const
154  {
155  return timersReport_();
156  }
157 
158  const dictionary& settingsDict()const{
159  return settingsDict_;
160  }
161 
163  return settingsDict_;
164  }
165 
166  virtual word runName() const
167  {
168  return runName_;
169  }
170 
171  inline const realx3& g()const
172  {
173  return g_;
174  }
175 
176  inline const box& domain()const
177  {
178  return domain_;
179  }
180 
181  bool operator ++(int);
182 
184  bool saveToFile,
185  const word& timeName = "wrongTimeFolder")
186  {
187  Time_.setSaveTimeFolder(saveToFile, timeName);
188  }
189 
190  size_t outFilePrecision() const override
191  {
192  return outFilePrecision_;
193  }
194 
195 };
196 
197 
198 
199 } // pFlow
200 
201 
202 #endif // __systemControl_hpp__
pFlow::systemControl::settingsDict
const dictionary & settingsDict() const
Definition: systemControl.hpp:158
pFlow::systemControl::domain_
box domain_
Definition: systemControl.hpp:81
pFlow::systemControl::settings
repository & settings()
Definition: systemControl.hpp:110
pFlow::systemControl::settings_
repository settings_
Definition: systemControl.hpp:56
pFlow::systemControl::setSaveTimeFolder
void setSaveTimeFolder(bool saveToFile, const word &timeName="wrongTimeFolder")
Definition: systemControl.hpp:183
pFlow::systemControl::writeToFileTimer_
Timer writeToFileTimer_
Definition: systemControl.hpp:88
pFlow::systemControl::topLevelFolder_
const fileSystem topLevelFolder_
Definition: systemControl.hpp:51
pFlow::systemControl::timers
Timers & timers()
Definition: systemControl.hpp:148
pFlow::systemControl::caseSetup
repository & caseSetup()
Definition: systemControl.hpp:118
pFlow::real
float real
Definition: builtinTypes.hpp:46
pFlow::systemControl::settingsDict
dictionary & settingsDict()
Definition: systemControl.hpp:162
pFlow::systemControl::timersReport
bool timersReport() const
Definition: systemControl.hpp:153
types.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
box.hpp
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::systemControl::timers_
Timers timers_
Definition: systemControl.hpp:84
pFlow::systemControl::outFilePrecision_
size_t outFilePrecision_
Definition: systemControl.hpp:68
pFlow::Time::geometry
const repository & geometry() const
Definition: Time.hpp:74
pFlow::Timers
Definition: Timers.hpp:33
pFlow::systemControl::outFilePrecision
size_t outFilePrecision() const override
Definition: systemControl.hpp:190
pFlow::systemControl::caseSetup
const repository & caseSetup() const
Definition: systemControl.hpp:114
pFlow
Definition: demComponent.hpp:28
pFlow::systemControl::runName_
const word runName_
Definition: systemControl.hpp:48
pFlow::systemControl::geometry
repository & geometry()
Definition: systemControl.hpp:138
pFlow::fileSystem
Definition: fileSystem.hpp:63
pFlow::systemControl::settingsDict_
dictionary & settingsDict_
Definition: systemControl.hpp:62
pFlow::systemControl::getTopFolder
static word getTopFolder(const fileSystem &path)
Definition: systemControl.cpp:61
pFlow::systemControl::g_
realx3 g_
Definition: systemControl.hpp:78
pFlow::systemControl::systemControl
systemControl(const fileSystem path=CWD())
Definition: systemControl.cpp:93
pFlow::systemControl::timersReport_
Logical timersReport_
Definition: systemControl.hpp:86
pFlow::systemControl::time
const Time & time() const
Definition: systemControl.hpp:123
pFlow::Timer
Definition: Timer.hpp:39
dictionary.hpp
Time.hpp
pFlow::systemControl::getRunName
static word getRunName(const fileSystem &path)
Definition: systemControl.cpp:30
pFlow::systemControl::time
Time & time()
Definition: systemControl.hpp:128
pFlow::dynamicLinkLibs
Definition: dynamicLinkLibs.hpp:32
pFlow::systemControl::settings
const repository & settings() const
Definition: systemControl.hpp:106
pFlow::systemControl::caseSetup_
repository caseSetup_
Definition: systemControl.hpp:59
pFlow::repository::path
virtual fileSystem path() const
Definition: repository.cpp:61
pFlow::systemControl::Time_
Time Time_
Definition: systemControl.hpp:71
pFlow::systemControl::operator++
bool operator++(int)
Definition: systemControl.cpp:235
pFlow::Logical
Definition: Logical.hpp:35
Timers.hpp
pFlow::box
Definition: box.hpp:32
pFlow::systemControl::geometry
const repository & geometry() const
Definition: systemControl.hpp:133
dynamicLinkLibs.hpp
pFlow::systemControl::runName
virtual word runName() const
Definition: systemControl.hpp:166
pFlow::CWD
fileSystem CWD()
Definition: fileSystem.hpp:186
pFlow::systemControl::g
const realx3 & g() const
Definition: systemControl.hpp:171
pFlow::repository
Definition: repository.hpp:34
pFlow::timeControl::setSaveTimeFolder
void setSaveTimeFolder(bool saveToFile, const word &timeName="wrongTimeFolder")
Definition: timeControl.cpp:163
pFlow::triple< real >
pFlow::systemControl::libs_
dynamicLinkLibs libs_
Definition: systemControl.hpp:65
pFlow::systemControl::domain
const box & domain() const
Definition: systemControl.hpp:176
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::systemControl::externalTimeControl_
bool externalTimeControl_
Definition: systemControl.hpp:75
pFlow::systemControl::timers
const Timers & timers() const
Definition: systemControl.hpp:143
pFlow::Time
Definition: Time.hpp:39