# PhasicFlow: src/MotionModel/entities/vibrating/vibrating.cpp Source File

vibrating.cpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "vibrating.hpp"
#include "dictionary.hpp"
FUNCTION_H
pFlow::vibrating::vibrating(const dictionary& dict)
{
if(!read(dict))
{
fatalErrorInFunction<<
" error in reading vibrating from dictionary "<< dict.globalName()<<endl;
fatalExit;
}
}
FUNCTION_H
bool pFlow::vibrating::read(const dictionary& dict)
{
if(!timeInterval::read(dict))return false;
angularFreq_ = dict.getVal<realx3>("angularFreq");
phaseAngle_ = dict.getValOrSet<realx3>("phaseAngle", realx3(0));
amplitude_ = dict.getVal<realx3>("amplitude");
return true;
}
FUNCTION_H
bool pFlow::vibrating::write(dictionary& dict) const
{
if(!timeInterval::write(dict)) return false;
if( !dict.add("angularFreq", angularFreq_) )
{
fatalErrorInFunction<<
" error in writing angularFreq to dictionary "<< dict.globalName()<<endl;
return false;
}
if( !dict.add("phaseAngle", phaseAngle_) )
{
fatalErrorInFunction<<
" error in writing phaseAngle to dictionary "<< dict.globalName()<<endl;
return false;
}
if( !dict.add("amplitude", amplitude_) )
{
fatalErrorInFunction<<
" error in writing amplitude to dictionary "<< dict.globalName()<<endl;
return false;
}
return true;
}
FUNCTION_H
bool pFlow::vibrating::read(iIstream& is)
{
notImplementedFunction;
return true;
}
FUNCTION_H
bool pFlow::vibrating::write(iOstream& os)const
{
if(!timeInterval::write(os)) return false;
os.writeWordEntry("angularFreq", angularFreq_);
os.writeWordEntry("phaseAngle", phaseAngle_);
os.writeWordEntry("amplitude", amplitude_);
return os.check(FUNCTION_NAME);
}
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:98