vibrating.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 "vibrating.hpp"
22 #include "dictionary.hpp"
23 
24 
27 {
28 
29  if(!read(dict))
30  {
32  " error in reading vibrating from dictionary "<< dict.globalName()<<endl;
33  fatalExit;
34  }
35 }
36 
37 
38 
41 {
42 
43  if(!timeInterval::read(dict))return false;
44 
45  angularFreq_ = dict.getVal<realx3>("angularFreq");
46 
47  phaseAngle_ = dict.getValOrSet<realx3>("phaseAngle", realx3(0));
48 
49  amplitude_ = dict.getVal<realx3>("amplitude");
50 
51  return true;
52 }
53 
56 {
57 
58  if(!timeInterval::write(dict)) return false;
59 
60  if( !dict.add("angularFreq", angularFreq_) )
61  {
63  " error in writing angularFreq to dictionary "<< dict.globalName()<<endl;
64  return false;
65  }
66 
67  if( !dict.add("phaseAngle", phaseAngle_) )
68  {
70  " error in writing phaseAngle to dictionary "<< dict.globalName()<<endl;
71  return false;
72  }
73 
74  if( !dict.add("amplitude", amplitude_) )
75  {
77  " error in writing amplitude to dictionary "<< dict.globalName()<<endl;
78  return false;
79  }
80 
81  return true;
82 }
83 
86 {
87 
89 
90  return true;
91 }
92 
95 {
96  if(!timeInterval::write(os)) return false;
97 
98  os.writeWordEntry("angularFreq", angularFreq_);
99  os.writeWordEntry("phaseAngle", phaseAngle_);
100  os.writeWordEntry("amplitude", amplitude_);
101  return os.check(FUNCTION_NAME);
102 }
notImplementedFunction
#define notImplementedFunction
Definition: error.hpp:47
pFlow::dictionary::getValOrSet
T getValOrSet(const word &keyword, const T &setVal) const
Definition: dictionary.hpp:325
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::timeInterval::write
FUNCTION_H bool write(dictionary &dict) const
Definition: timeInterval.cpp:26
FUNCTION_NAME
#define FUNCTION_NAME
Definition: pFlowMacros.hpp:29
pFlow::dictionary::globalName
virtual word globalName() const
Definition: dictionary.cpp:349
pFlow::dictionary::add
bool add(const word &keyword, const float &v)
Definition: dictionary.cpp:422
pFlow::timeInterval::read
FUNCTION_H bool read(const dictionary &dict)
Definition: timeInterval.cpp:17
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::realx3
triple< real > realx3
Definition: types.hpp:48
vibrating.hpp
pFlow::IOstream::check
virtual bool check(const char *operation) const
Definition: IOstream.cpp:42
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::iIstream
Definition: iIstream.hpp:33
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
dictionary.hpp
pFlow::vibrating::read
FUNCTION_H bool read(const dictionary &dict)
Definition: vibrating.cpp:40
pFlow::dictionary::getVal
T getVal(const word &keyword) const
Definition: dictionary.hpp:309
pFlow::vibrating::write
FUNCTION_H bool write(dictionary &dict) const
Definition: vibrating.cpp:55
pFlow::triple< real >
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::iOstream::writeWordEntry
iOstream & writeWordEntry(const word &key, const T &value)
Definition: iOstream.hpp:217
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::vibrating::vibrating
FUNCTION_HD vibrating()
Definition: vibrating.hpp:69