www.cemf.ir
Time.cpp
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
#include "
Time.hpp
"
22
#include "
dictionary.hpp
"
23
#include "
vocabs.hpp
"
24
25
bool
26
pFlow::Time::readDictionary
(
const
dictionary
& dict)
27
{
28
auto
wF =
toUpper
(dict.
getValOrSet
<
word
>(
"writeFormat"
,
"ASCII"
));
29
30
if
(wF ==
"ASCII"
)
31
outFormatBinary_
=
false
;
32
else
if
(wF ==
"BINARY"
)
33
outFormatBinary_
=
true
;
34
else
35
{
36
fatalErrorInFunction
<<
"Invalid writeFormat in file "
<< dict.
name
()
37
<<
endl
;
38
return
false
;
39
}
40
41
return
true
;
42
}
43
44
pFlow::Time::Time
(
repository
* owner,
const
dictionary
& setiingsDict)
45
:
repository
(
"Time"
,
""
, owner),
46
timeControl
(setiingsDict),
47
geometry_(
geometryRepository_
,
geometryFolder__
, this)
48
{
49
if
(!
readDictionary
(setiingsDict))
50
{
51
fatalExit
;
52
}
53
}
54
55
pFlow::Time::Time
(
56
repository
* owner,
57
dictionary
& setiingsDict,
58
real
startTime,
59
real
endTime,
60
real
saveInterval,
61
word
startTimeName
62
)
63
:
repository
(
"Time"
,
""
, owner),
64
timeControl
(setiingsDict, startTime, endTime, saveInterval, startTimeName),
65
geometry_(
geometryRepository_
,
geometryFolder__
, this)
66
{
67
if
(!
readDictionary
(setiingsDict))
68
{
69
fatalExit
;
70
}
71
}
72
73
pFlow::fileSystem
74
pFlow::Time::localPath
()
const
75
{
76
return
fileSystem
(timeName());
77
}
78
79
pFlow::fileSystem
80
pFlow::Time::integrationFolder
()
const
81
{
82
return
integrationFolder__
;
83
}
84
85
bool
86
pFlow::Time::write
(
bool
verbose)
const
87
{
88
if
(outputToFile())
89
{
90
REPORT
(0) <<
"\nWriting to file at time: "
<<
Cyan_Text
(timeName())
91
<<
END_REPORT
;
92
return
repository::write
(verbose);
93
}
94
return
true
;
95
}
pFlow::dictionary::getValOrSet
T getValOrSet(const word &keyword, const T &setVal) const
get the value of data entry or if not found, set the value to setVal
Definition:
dictionary.hpp:415
pFlow::real
float real
Definition:
builtinTypes.hpp:45
fatalExit
#define fatalExit
Fatal exit.
Definition:
error.hpp:98
Cyan_Text
#define Cyan_Text(text)
Definition:
iOstream.hpp:44
REPORT
#define REPORT(n)
Definition:
streams.hpp:39
pFlow::Time::outFormatBinary_
bool outFormatBinary_
Definition:
Time.hpp:43
pFlow::toUpper
word toUpper(const word &inStr)
convert a word to all caps
Definition:
bTypesFunctions.cpp:43
pFlow::word
std::string word
Definition:
builtinTypes.hpp:64
pFlow::integrationFolder__
const char *const integrationFolder__
Definition:
vocabs.hpp:35
pFlow::Time::localPath
fileSystem localPath() const override
Definition:
Time.cpp:74
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition:
iOstream.hpp:341
pFlow::repository::write
virtual bool write(bool verbose=false) const
Definition:
repository.cpp:278
pFlow::Time::write
virtual bool write(bool verbose=false) const
Definition:
Time.cpp:86
pFlow::fileSystem
Manages file pathes, manupulate and combines them.
Definition:
fileSystem.hpp:71
pFlow::geometryFolder__
const char *const geometryFolder__
Definition:
vocabs.hpp:32
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition:
error.hpp:77
dictionary.hpp
pFlow::timeControl
Definition:
timeControl.hpp:37
Time.hpp
END_REPORT
#define END_REPORT
Definition:
streams.hpp:40
pFlow::iEntry::name
virtual word name() const
name/keyword of entry
Definition:
iEntry.hpp:100
pFlow::geometryRepository_
const char *const geometryRepository_
Definition:
vocabs.hpp:33
pFlow::Time::Time
Time(repository *owner, const dictionary &setiingsDict)
Definition:
Time.cpp:44
pFlow::Time::readDictionary
bool readDictionary(const dictionary &dict)
Definition:
Time.cpp:26
pFlow::repository
Definition:
repository.hpp:34
vocabs.hpp
pFlow::Time::integrationFolder
fileSystem integrationFolder() const
Definition:
Time.cpp:80
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition:
dictionary.hpp:67
src
phasicFlow
repository
Time
Time.cpp
Generated by
1.8.17