# PhasicFlow: src/phasicFlow/repository/Time/Time.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.

Time.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 "Time.hpp"
#include "dictionary.hpp"
#include "vocabs.hpp"
bool
pFlow::Time::readDictionary(const dictionary& dict)
{
auto wF = toUpper(dict.getValOrSet<word>("writeFormat", "ASCII"));
if (wF == "ASCII")
outFormatBinary_ = false;
else if (wF == "BINARY")
outFormatBinary_ = true;
else
{
fatalErrorInFunction << "Invalid writeFormat in file " << dict.name()
<< endl;
return false;
}
return true;
}
pFlow::Time::Time(repository* owner, const dictionary& setiingsDict)
: repository("Time", "", owner),
timeControl(setiingsDict),
geometry_(geometryRepository_, geometryFolder__, this)
{
if (!readDictionary(setiingsDict))
{
fatalExit;
}
}
pFlow::Time::Time(
repository* owner,
dictionary& setiingsDict,
real startTime,
real endTime,
real saveInterval,
word startTimeName
)
: repository("Time", "", owner),
timeControl(setiingsDict, startTime, endTime, saveInterval, startTimeName),
geometry_(geometryRepository_, geometryFolder__, this)
{
if (!readDictionary(setiingsDict))
{
fatalExit;
}
}
pFlow::fileSystem
pFlow::Time::localPath() const
{
return fileSystem(timeName());
}
pFlow::fileSystem
pFlow::Time::integrationFolder() const
{
return integrationFolder__;
}
bool
pFlow::Time::write(bool verbose) const
{
if (outputToFile())
{
REPORT(0) << "\nWriting to file at time: " << Cyan_Text(timeName())
<< END_REPORT;
return repository::write(verbose);
}
return true;
}
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
pFlow::real
float real
Definition: builtinTypes.hpp:45
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
Cyan_Text
#define Cyan_Text(text)
Definition: iOstream.hpp:44
REPORT
#define REPORT(n)
Definition: streams.hpp:39
pFlow::Time::outFormatBinary_
bool outFormatBinary_
Definition: Time.hpp:43
pFlow::toUpper
word toUpper(const word &inStr)
convert a word to all caps
Definition: bTypesFunctions.cpp:43
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::integrationFolder__
const char *const integrationFolder__
Definition: vocabs.hpp:35
pFlow::Time::localPath
fileSystem localPath() const override
Definition: Time.cpp:74
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::repository::write
virtual bool write(bool verbose=false) const
Definition: repository.cpp:278
pFlow::Time::write
virtual bool write(bool verbose=false) const
Definition: Time.cpp:86
pFlow::fileSystem
Manages file pathes, manupulate and combines them.
Definition: fileSystem.hpp:71
pFlow::geometryFolder__
const char *const geometryFolder__
Definition: vocabs.hpp:32
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
dictionary.hpp
pFlow::timeControl
Definition: timeControl.hpp:37
Time.hpp
END_REPORT
#define END_REPORT
Definition: streams.hpp:40
pFlow::iEntry::name
virtual word name() const
name/keyword of entry
Definition: iEntry.hpp:100
pFlow::geometryRepository_
const char *const geometryRepository_
Definition: vocabs.hpp:33
pFlow::Time::Time
Time(repository *owner, const dictionary &setiingsDict)
Definition: Time.cpp:44
pFlow::Time::readDictionary
bool readDictionary(const dictionary &dict)
Definition: Time.cpp:26
pFlow::repository
Definition: repository.hpp:34
vocabs.hpp
pFlow::Time::integrationFolder
fileSystem integrationFolder() const
Definition: Time.cpp:80
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