www.cemf.ir
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<uint8>() ||
43  checkForTypeAndValue<int32>() ||
44  checkForTypeAndValue<int64>() ||
45  checkForTypeAndValue<uint32>() ||
46  checkForTypeAndValue<uint64>() ||
47  checkForTypeAndValue<real>() ||
48  checkForTypeAndValue<realx3>() ||
49  checkForTypeAndValue<realx4>() ||
50  checkForTypeAndValue<word>()
51  )
52  )
53  {
55  " un-supported data type "<<entry_.firstPart() << " in setField for field " << fieldName() <<endl;
56  return false;
57  }
58 
59  return true;
60 }
61 
64 (
66  bool verbose
67 )
68 {
69  uniquePtr<IOobject> Ptr = nullptr;
70 
71  if( Ptr = setPointFieldDefaultValueNew<int8>(pStruct, verbose) ; Ptr)
72  {
73  return Ptr;
74  }
75  else if(Ptr = setPointFieldDefaultValueNew<uint8>(pStruct, verbose); Ptr)
76  {
77  return Ptr;
78  }
79  else if(Ptr = setPointFieldDefaultValueNew<int32> (pStruct, verbose); Ptr)
80  {
81  return Ptr;
82  }
83  else if(Ptr = setPointFieldDefaultValueNew<int64> (pStruct, verbose); Ptr)
84  {
85  return Ptr;
86  }
87  else if(Ptr = setPointFieldDefaultValueNew<uint32> (pStruct, verbose); Ptr)
88  {
89  return Ptr;
90  }
91  else if(Ptr = setPointFieldDefaultValueNew<int64>(pStruct, verbose); Ptr)
92  {
93  return Ptr;
94  }
95  else if(Ptr = setPointFieldDefaultValueNew<uint64>(pStruct, verbose); Ptr)
96  {
97  return Ptr;
98  }
99  else if(Ptr = setPointFieldDefaultValueNew<real>(pStruct, verbose); Ptr)
100  {
101  return Ptr;
102  }
103  else if(Ptr = setPointFieldDefaultValueNew<realx3>(pStruct, verbose); Ptr)
104  {
105  return Ptr;
106  }
107  else if(Ptr = setPointFieldDefaultValueNew<realx4>(pStruct, verbose); Ptr)
108  {
109  return Ptr;
110  }
111  else if(Ptr = setPointFieldDefaultValueNew<word>(pStruct, verbose); Ptr)
112  {
113  return Ptr;
114  }else
115  {
117  " un-supported data type "<<entry_.firstPart() << " in setField for field " << fieldName() <<endl;
118  return nullptr;
119  }
120 
121 }
122 
124 (
125  repository& owner,
126  uint32IndexContainer& selected,
127  bool verbose
128 )
129 {
130 
131  if( setPointFieldSelected<int8> (owner, selected, verbose))
132  {
133  return true;
134  }
135  else if( setPointFieldSelected<uint8>(owner, selected, verbose))
136  {
137  return true;
138  }
139  else if( setPointFieldSelected<int32>(owner, selected, verbose))
140  {
141  return true;
142  }
143  else if( setPointFieldSelected<uint32>(owner, selected, verbose))
144  {
145  return true;
146  }
147  else if( setPointFieldSelected<int64>(owner, selected, verbose))
148  {
149  return true;
150  }
151  else if( setPointFieldSelected<uint64>(owner, selected, verbose))
152  {
153  return true;
154  }
155  else if( setPointFieldSelected<real>(owner, selected, verbose))
156  {
157  return true;
158  }
159  else if( setPointFieldSelected<realx3>(owner, selected, verbose))
160  {
161  return true;
162  }
163  else if( setPointFieldSelected<realx4>(owner, selected, verbose))
164  {
165  return true;
166  }
167  else if( setPointFieldSelected<word>(owner, selected, verbose))
168  {
169  return true;
170  }
171  else
172  {
174  " un-supported data type "<<entry_.firstPart() << " in setField for field " << fieldName() <<endl;
175  return false;
176  }
177 
178 }
pFlow::setFieldEntry::checkForTypeAndValueAll
bool checkForTypeAndValueAll() const
Definition: setFieldEntry.cpp:37
pFlow::setFieldEntry::setPointFieldSelectedAll
bool setPointFieldSelectedAll(repository &owner, uint32IndexContainer &selected, bool verbose=false)
Definition: setFieldEntry.cpp:124
setFieldEntry.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::setFieldEntry::fieldName
word fieldName() const
Definition: setFieldEntry.cpp:32
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::dataEntry
Data entry to be used in dictionries.
Definition: dataEntry.hpp:48
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
pFlow::twoPartEntry::keyword
const word & keyword() const
Definition: twoPartEntry.hpp:46
pFlow::uniquePtr
Definition: uniquePtr.hpp:42
pFlow::setFieldEntry::setPointFieldDefaultValueNewAll
uniquePtr< IOobject > setPointFieldDefaultValueNewAll(pointStructure &pStruct, bool verbose=false)
Definition: setFieldEntry.cpp:64
pFlow::setFieldEntry::entry_
twoPartEntry entry_
Definition: setFieldEntry.hpp:37
pFlow::repository
Definition: repository.hpp:34
pFlow::setFieldEntry::setFieldEntry
setFieldEntry(const dataEntry &entry)
Definition: setFieldEntry.cpp:25
pFlow::indexContainer
It holds two vectors of indecis on Host and Device.
Definition: indexContainer.hpp:39