# PhasicFlow: src/MotionModel/entities/vibrating/vibrating.cpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

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
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