www.cemf.ir
includeMask.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 
22 #include "includeMask.hpp"
23 
25  const dictionary& dict,
26  const word& opType,
28 :
29  operatorType_(opType),
30  timeFolder_(timeFolder)
31 {
33  {
34  fatalExit;
35  }
36 
37 }
38 
39 
40 
42  const dictionary& dict,
44  word& fName,
45  word& fType)
46 {
47 
48  fName = dict.getValOrSet<word>("field", "none");
49 
50  if(fName == "none")
51  {
52  fType = "int8";
53  }
54  else
55  {
56  if( !timeFolder.pointFieldFileGetType(fName, fType) )
57  {
58  fatalErrorInFunction<<"error in reading field type from file "<< fName<<
59  "in folder "<< timeFolder.path()<<endl;
60  return false;
61  }
62  }
63 
64  return true;
65 }
66 
67 
69  const dictionary& dict,
70  const word& opType,
72 {
73 
74  word fType, fName;
75  if(!getFieldType(dict, timeFolder, fName, fType))
76  {
77  fatalExit;
78  return nullptr;
79  }
80 
81  word method = angleBracketsNames2("IncludeMask", fType, opType);
82 
83  if( dictionaryvCtorSelector_.search(method) )
84  {
85  auto objPtr =
86  dictionaryvCtorSelector_[method]
87  (dict, opType, timeFolder);
88  REPORT(2)<< dict.name()<< " with model "<<Green_Text(method)<<" is processed."<<END_REPORT;
89  return objPtr;
90  }
91  else
92  {
93  printKeys
94  (
95  fatalError << "Ctor Selector "<<
96  method << " dose not exist. \n"
97  <<"Avaiable ones are: \n\n"
98  ,
99  dictionaryvCtorSelector_
100  );
101  fatalExit;
102  return nullptr;
103  }
104  return nullptr;
105 }
106 
107 
108 
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