# PhasicFlow: src/phasicFlow/dictionary/entry/dataEntry.hpp 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.

dataEntry.hpp
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.
-----------------------------------------------------------------------------*/
// based on OpenFOAM dictionary, with some modifications/simplifications
// to be tailored to our needs
#ifndef __dataEntry_hpp__
#define __dataEntry_hpp__
#include "iEntry.hpp"
#include "iTstream.hpp"
#include "oTstream.hpp"
namespace pFlow
{
class dictionary;
class dataEntry
:
public iEntry
{
protected:
const dictionary& parDict_;
iTstream tokenStream_;
bool readDataEntry(iIstream& is);
bool writeDataEntry(iOstream& os) const;
public:
static dataEntry nullDataEntry;
dataEntry();
dataEntry(const word& keyword, const dictionary& parDict);
dataEntry(const word& keyWord, const dictionary& parDict, const iTstream& is);
//- construct from keyword, parDict and input stream
dataEntry(const word& keyWord, const dictionary& parDict, iIstream& is);
dataEntry(const word& keyword, const dictionary& parDict, const token& tok);
template<typename T>
dataEntry(const word& keyword, const dictionary& parDict, const T& v);
dataEntry(const word& keyword, const dictionary& parDict, const dataEntry& entry );
dataEntry(const dataEntry& src )= default;
virtual word globalName()const;
virtual iTstream& stream();
virtual dictionary* dictPtr();
virtual const dictionary* dictPtr() const;
virtual bool isDictionary()const;
virtual const dictionary& parrentDict() const;
virtual dictionary& dict();
virtual const dictionary& dict() const;
// clone the object
virtual iEntry* clonePtr() const;
virtual uniquePtr<iEntry> clone() const;
// clone the object and change its ownership to parDict
virtual iEntry* clonePtr(const dictionary& parDict) const;
virtual uniquePtr<iEntry> clone(const dictionary& parDict)const;
virtual bool read(iIstream& is);
virtual bool write(iOstream& os) const;
};
template<typename T>
dataEntry::dataEntry(const word& keyword, const dictionary& parDict, const T& v)
:
dataEntry(keyword, parDict)
{
oTstream os("oTStream for " + globalName());
os<< v << endStatementToken();
tokenStream_ = std::move(os.tokens());
}
} // pFlow
#endif //__dataEntry_hpp__
pFlow::oTstream
Output token stream.
Definition: oTstream.hpp:48
pFlow::dataEntry::readDataEntry
bool readDataEntry(iIstream &is)
read dataEntry from stream
Definition: dataEntry.cpp:35
iTstream.hpp
pFlow::token
Token class based on OpenFOAM stream, with some modifications/simplifications to be tailored to our n...
Definition: token.hpp:44
pFlow::dataEntry::stream
virtual iTstream & stream()
access to token stream
Definition: dataEntry.cpp:265
pFlow::endStatementToken
token endStatementToken()
Definition: token.hpp:513
pFlow::dataEntry::parrentDict
virtual const dictionary & parrentDict() const
const ref to parrent dictionary
Definition: dataEntry.cpp:301
pFlow::dataEntry::globalName
virtual word globalName() const
global name of entry, separated with dots
Definition: dataEntry.cpp:295
pFlow::dataEntry::writeDataEntry
bool writeDataEntry(iOstream &os) const
write dataEntry to stream
Definition: dataEntry.cpp:98
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
oTstream.hpp
pFlow::iEntry::keyword
virtual const word & keyword() const
return keyword
Definition: iEntry.hpp:88
pFlow::oTstream::tokens
const tokenList & tokens() const
Definition: oTstream.cpp:32
pFlow
Definition: demGeometry.hpp:27
pFlow::dataEntry::parDict_
const dictionary & parDict_
ref to parrent dictionary
Definition: dataEntry.hpp:58
pFlow::dataEntry::dataEntry
dataEntry()
construct null dataEntry
Definition: dataEntry.cpp:163
pFlow::dataEntry
Data entry to be used in dictionries.
Definition: dataEntry.hpp:48
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::dataEntry::tokenStream_
iTstream tokenStream_
list the tokens as input token stream
Definition: dataEntry.hpp:61
pFlow::dataEntry::dictPtr
virtual dictionary * dictPtr()
not permited to be called
Definition: dataEntry.cpp:273
iEntry.hpp
pFlow::dataEntry::nullDataEntry
static dataEntry nullDataEntry
Definition: dataEntry.hpp:74
pFlow::dataEntry::isDictionary
virtual bool isDictionary() const
should returen false;
Definition: dataEntry.cpp:290
pFlow::iTstream
Input token stream.
Definition: iTstream.hpp:27
pFlow::dataEntry::read
virtual bool read(iIstream &is)
read from stream
Definition: dataEntry.cpp:349
pFlow::uniquePtr
Definition: uniquePtr.hpp:42
pFlow::dataEntry::clone
virtual uniquePtr< iEntry > clone() const
Definition: dataEntry.cpp:325
pFlow::iEntry
Interface calss for data entry and dictionary
Definition: iEntry.hpp:42
pFlow::dataEntry::clonePtr
virtual iEntry * clonePtr() const
clone the object
Definition: dataEntry.cpp:331
pFlow::dataEntry::dict
virtual dictionary & dict()
not permited to be called
Definition: dataEntry.cpp:307
pFlow::dataEntry::write
virtual bool write(iOstream &os) const
write to stream
Definition: dataEntry.cpp:370
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
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