# PhasicFlow: utilities/postprocessPhasicFlow/includeMask.cpp Source File

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 "<<greenText(method)<<" is processed."<<endREPORT;
return objPtr;
}
else
{
printKeys
(
fatalError << "Ctor Selector "<<
method << " dose not exist. \n"
<<"Avaiable ones are: \n\n"
,
dictionaryvCtorSelector_
);
fatalExit;
return nullptr;
}
return nullptr;
}
endREPORT
#define endREPORT
Definition: streams.hpp:41
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
Definition: dictionary.hpp:325
pFlow::includeMask::fieldName_
word fieldName_
Definition: includeMask.hpp:36
includeMask.hpp
fatalExit
#define fatalExit
Definition: error.hpp:57
REPORT
#define REPORT(n)
Definition: streams.hpp:40
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:63
pFlow::printKeys
iOstream & printKeys(iOstream &os, const wordHashMap< T > &m)
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
greenText
#define greenText(text)
Definition: streams.hpp:32
pFlow::angleBracketsNames2
word angleBracketsNames2(const word &base, const word &w1, const word &w2)
Definition: bTypesFunctions.cpp:137
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
fatalError
#define fatalError
Definition: error.hpp:36
pFlow::uniquePtr< pFlow::includeMask >
pFlow::dictionary
Definition: dictionary.hpp:38
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