# PhasicFlow: utilities/postprocessPhasicFlow/includeMask.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.

includeMask.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 "includeMask.hpp"
pFlow::includeMask::includeMask(
const dictionary& dict,
const word& opType,
readFromTimeFolder& timeFolder)
:
operatorType_(opType),
timeFolder_(timeFolder)
{
if(!getFieldType(dict, timeFolder, fieldName_, fieldType_))
{
fatalExit;
}
}
bool pFlow::includeMask::getFieldType(
const dictionary& dict,
readFromTimeFolder& timeFolder,
word& fName,
word& fType)
{
fName = dict.getValOrSet<word>("field", "none");
if(fName == "none")
{
fType = "int8";
}
else
{
if( !timeFolder.pointFieldFileGetType(fName, fType) )
{
fatalErrorInFunction<<"error in reading field type from file "<< fName<<
"in folder "<< timeFolder.path()<<endl;
return false;
}
}
return true;
}
pFlow::uniquePtr<pFlow::includeMask> pFlow::includeMask::create(
const dictionary& dict,
const word& opType,
readFromTimeFolder& timeFolder)
{
word fType, fName;
if(!getFieldType(dict, timeFolder, fName, fType))
{
fatalExit;
return nullptr;
}
word method = angleBracketsNames2("IncludeMask", fType, opType);
if( dictionaryvCtorSelector_.search(method) )
{
auto objPtr =
dictionaryvCtorSelector_[method]
(dict, opType, timeFolder);
REPORT(2)<< dict.name()<< " with model "<<Green_Text(method)<<" is processed."<<END_REPORT;
return objPtr;
}
else
{
printKeys
(
fatalError << "Ctor Selector "<<
method << " dose not exist. \n"
<<"Avaiable ones are: \n\n"
,
dictionaryvCtorSelector_
);
fatalExit;
return nullptr;
}
return nullptr;
}
Green_Text
#define Green_Text(text)
Definition: iOstream.hpp:42
pFlow::includeMask::create
static uniquePtr< includeMask > create(const dictionary &dict, const word &opType, readFromTimeFolder &timeFolder)
Definition: includeMask.cpp:68
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::includeMask::fieldName_
word fieldName_
Definition: includeMask.hpp:36
includeMask.hpp
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
REPORT
#define REPORT(n)
Definition: streams.hpp:39
pFlow::readFromTimeFolder
Definition: readFromTimeFolder.hpp:31
pFlow::includeMask::getFieldType
static bool getFieldType(const dictionary &dict, readFromTimeFolder &timeFolder, word &fName, word &fType)
Definition: includeMask.cpp:41
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::printKeys
iOstream & printKeys(iOstream &os, const wordHashMap< T > &m)
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::angleBracketsNames2
word angleBracketsNames2(const word &base, const word &w1, const word &w2)
Output base<w1,w2>
Definition: bTypesFunctions.cpp:162
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
END_REPORT
#define END_REPORT
Definition: streams.hpp:40
fatalError
#define fatalError
Report a fatal error and exit the applicaiton.
Definition: error.hpp:70
pFlow::uniquePtr< pFlow::includeMask >
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
pFlow::includeMask::fieldType_
word fieldType_
Definition: includeMask.hpp:38
pFlow::timeFolder
Definition: timeFolder.hpp:32
pFlow::includeMask::includeMask
includeMask(const dictionary &dict, const word &opType, readFromTimeFolder &timeFolder)
Definition: includeMask.cpp:24