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 
22 #include "Time.hpp"
23 #include "dictionary.hpp"
24 #include "vocabs.hpp"
25 
26 
28 {
29  auto wF = toUpper(dict.getValOrSet<word>("writeFormat", "ASCII"));
30 
31  if(wF == "ASCII")
32  outFormatBinary_ = false;
33  else if(wF == "BINARY")
34  outFormatBinary_ = true;
35  else
36  {
38  "Invalid writeFormat in file "<< dict.name()<<endl;
39  return false;
40  }
41 
42  return true;
43 }
44 
46 (
47  repository* owner,
48  const dictionary& setiingsDict
49 )
50 :
51  repository("Time", "", owner),
52  timeControl(setiingsDict),
53  geometry_
54  (
57  this
58  ),
59  integration_
60  (
63  this
64  )
65 {
66 
67  if(!readDictionary(setiingsDict))
68  {
69  fatalExit;
70  }
71 }
72 
74  repository* owner,
75  dictionary& setiingsDict,
76  real startTime,
77  real endTime,
78  real saveInterval,
79  word startTimeName)
80 :
81  repository("Time", "", owner),
83  setiingsDict,
84  startTime,
85  endTime,
86  saveInterval,
87  startTimeName),
88  geometry_
89  (
92  this
93  ),
94  integration_
95  (
98  this
99  )
100 {
101  if(!readDictionary(setiingsDict))
102  {
103  fatalExit;
104  }
105 }
106 
108 (
109  bool verbose
110 ) const
111 {
112  if(outputToFile())
113  {
114  REPORT(0)<<"\nWriting to file at time: "<< cyanText(timeName())<<endREPORT;
115  return repository::write(verbose);
116  }
117  return true;
118 }
endREPORT
#define endREPORT
Definition: streams.hpp:41
pFlow::dictionary::getValOrSet
T getValOrSet(const word &keyword, const T &setVal) const
Definition: dictionary.hpp:325
pFlow::real
float real
Definition: builtinTypes.hpp:46
fatalExit
#define fatalExit
Definition: error.hpp:57
REPORT
#define REPORT(n)
Definition: streams.hpp:40
cyanText
#define cyanText(text)
Definition: streams.hpp:34
pFlow::Time::outFormatBinary_
bool outFormatBinary_
Definition: Time.hpp:47
pFlow::toUpper
word toUpper(const word &inStr)
Definition: bTypesFunctions.cpp:107
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:320
pFlow::repository::write
virtual bool write(bool verbose=false) const
Definition: repository.cpp:239
pFlow::Time::write
virtual bool write(bool verbose=false) const
Definition: Time.cpp:108
pFlow::geometryFolder__
const char * geometryFolder__
Definition: vocabs.hpp:33
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
dictionary.hpp
pFlow::timeControl
Definition: timeControl.hpp:37
Time.hpp
pFlow::iEntry::name
virtual word name() const
Definition: iEntry.hpp:95
pFlow::integrationRepository__
const char * integrationRepository__
Definition: vocabs.hpp:35
pFlow::Time::Time
Time(repository *owner, const dictionary &setiingsDict)
Definition: Time.cpp:46
pFlow::integrationFolder__
const char * integrationFolder__
Definition: vocabs.hpp:36
pFlow::Time::readDictionary
bool readDictionary(const dictionary &dict)
Definition: Time.cpp:27
pFlow::repository
Definition: repository.hpp:34
vocabs.hpp
pFlow::geometryRepository_
const char * geometryRepository_
Definition: vocabs.hpp:34
pFlow::dictionary
Definition: dictionary.hpp:38