www.cemf.ir
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
Report that a function is yet not implemented.
Definition: error.hpp:84
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
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
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
global name of entry, separated with dots
Definition: dictionary.cpp:356
pFlow::dictionary::add
bool add(const word &keyword, const float &v)
add a float dataEntry
Definition: dictionary.cpp:435
pFlow::timeInterval::read
FUNCTION_H bool read(const dictionary &dict)
Definition: timeInterval.cpp:17
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::realx3
triple< real > realx3
Definition: types.hpp:43
vibrating.hpp
pFlow::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.cpp:42
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:62
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
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
get the value of data entry
Definition: dictionary.hpp:379
pFlow::vibrating::write
FUNCTION_H bool write(dictionary &dict) const
Definition: vibrating.cpp:55
pFlow::vibrating::vibrating
FUNCTION_HD vibrating()=default
pFlow::triple< real >
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::iOstream::writeWordEntry
iOstream & writeWordEntry(const word &key, const T &value)
Write a keyword/value entry.
Definition: iOstream.hpp:239
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