setFieldEntry.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 "setFieldEntry.hpp"
23 
25 (
26  const dataEntry& entry
27 )
28 :
29  entry_(entry)
30 {}
31 
33 {
34  return entry_.keyword();
35 }
36 
38 {
39  if(
40  !(
41  checkForTypeAndValue<int8>() ||
42  checkForTypeAndValue<int16>() ||
43  checkForTypeAndValue<int32>() ||
44  checkForTypeAndValue<int64>() ||
45  checkForTypeAndValue<uint32>() ||
46  checkForTypeAndValue<label>() ||
47  checkForTypeAndValue<real>() ||
48  checkForTypeAndValue<realx3>()
49  )
50  )
51  {
53  " un-supported data type "<<entry_.firstPart() << " in setField for field " << fieldName() <<endl;
54  return false;
55  }
56 
57  return true;
58 }
59 
61 (
62  repository& owner,
64  bool verbose
65 )
66 {
67  if( void* res = setPointFieldDefaultValueNew<int8> (owner, pStruct, verbose) ; res)
68  {
69  return res;
70  }else if(void* res = setPointFieldDefaultValueNew<int16>(owner, pStruct, verbose); res)
71  {
72  return res;
73  }else if(void* res = setPointFieldDefaultValueNew<int32> (owner, pStruct, verbose); res)
74  {
75  return res;
76  }else if(void* res = setPointFieldDefaultValueNew<int64> (owner, pStruct, verbose); res)
77  {
78  return res;
79  }else if(void* res = setPointFieldDefaultValueNew<uint32> (owner, pStruct, verbose); res)
80  {
81  return res;
82  }else if(void* res = setPointFieldDefaultValueNew<label>(owner, pStruct, verbose); res)
83  {
84  return res;
85  }else if(void* res = setPointFieldDefaultValueNew<real>(owner, pStruct, verbose); res)
86  {
87  return res;
88  }else if(void* res = setPointFieldDefaultValueNew<realx3>(owner, pStruct, verbose); res)
89  {
90  return res;
91  }else if(void* res = setPointFieldDefaultValueStdNew<word>(owner, pStruct, verbose); res)
92  {
93  return res;
94  }else
95  {
97  " un-supported data type "<<entry_.firstPart() << " in setField for field " << fieldName() <<endl;
98  return nullptr;
99  }
100 
101 }
102 
104 (
105  repository& owner,
106  int32IndexContainer& selected,
107  bool verbose
108 )
109 {
110 
111  if( void* res = setPointFieldSelected<int8> (owner, selected, verbose) ; res)
112  {
113  return res;
114  }else if(void* res = setPointFieldSelected<int16>(owner, selected, verbose); res)
115  {
116  return res;
117  }else if(void* res = setPointFieldSelected<int32> (owner, selected, verbose); res)
118  {
119  return res;
120  }else if(void* res = setPointFieldSelected<int64> (owner, selected, verbose); res)
121  {
122  return res;
123  }else if(void* res = setPointFieldSelected<uint32> (owner, selected, verbose); res)
124  {
125  return res;
126  }else if(void* res = setPointFieldSelected<label>(owner, selected, verbose); res)
127  {
128  return res;
129  }else if(void* res = setPointFieldSelected<real>(owner, selected, verbose); res)
130  {
131  return res;
132  }else if(void* res = setPointFieldSelected<realx3>(owner, selected, verbose); res)
133  {
134  return res;
135  }else if(void* res = setPointFieldSelectedStd<word>(owner, selected, verbose); res)
136  {
137  return res;
138  }else
139  {
141  " un-supported data type "<<entry_.firstPart() << " in setField for field " << fieldName() <<endl;
142  return nullptr;
143  }
144 
145 }
pFlow::setFieldEntry::checkForTypeAndValueAll
bool checkForTypeAndValueAll() const
Definition: setFieldEntry.cpp:37
setFieldEntry.hpp
pFlow::setFieldEntry::setPointFieldDefaultValueNewAll
void * setPointFieldDefaultValueNewAll(repository &owner, pointStructure &pStruct, bool verbose=false)
Definition: setFieldEntry.cpp:61
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::setFieldEntry::fieldName
word fieldName() const
Definition: setFieldEntry.cpp:32
pFlow::pointStructure
Definition: pointStructure.hpp:44
pFlow::dataEntry
Definition: dataEntry.hpp:40
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
pFlow::twoPartEntry::keyword
const word & keyword() const
Definition: twoPartEntry.hpp:46
pFlow::setFieldEntry::entry_
twoPartEntry entry_
Definition: setFieldEntry.hpp:37
pFlow::setFieldEntry::setPointFieldSelectedAll
void * setPointFieldSelectedAll(repository &owner, int32IndexContainer &selected, bool verbose=false)
Definition: setFieldEntry.cpp:104
pFlow::repository
Definition: repository.hpp:34
pFlow::setFieldEntry::setFieldEntry
setFieldEntry(const dataEntry &entry)
Definition: setFieldEntry.cpp:25
pFlow::indexContainer< int32 >