www.cemf.ir
pointField.hpp
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 #ifndef __pointField_hpp__
21 #define __pointField_hpp__
22 
23 
24 #include "pointStructure.hpp"
25 #include "internalField.hpp"
26 #include "boundaryFieldList.hpp"
27 #include "Time.hpp"
28 
29 namespace pFlow
30 {
31 
32 template<class T, class MemorySpace=void>
34 :
35  public IOobject,
36  public internalField<T, MemorySpace>
37 {
38 public:
39 
41 
43 
45 
47 
49 
51 
53 
54 private:
55 
57 
60 
63 
64 
65 public:
66 
67 
68  // - type info
69  TypeInfoTemplate111("pointField", T, VectorType::memoerySpaceName());
70 
71 
73 
74  // - construct a field from pointStructure and set defaultValue_ and field value to defVal
75  pointField(
76  const objectFile& objf,
78  const T& defVal);
79 
80  pointField(
81  const objectFile& objf,
84  const T& defVal);
85 
86  pointField(
87  const objectFile& objf,
89  const T& defVal,
90  const T& val);
91 
92 
93 
95 
96  const word& name() const final
97  {
98  return IOobject::name();
99  }
100 
101  const auto& internal()const
102  {
103  return static_cast<const InternalFieldType&>(*this);
104  }
105 
106  void updateBoundaries(DataDirection direction)const
107  {
108  uint32 iter = this->time().currentIter();
109  auto& bList = const_cast<boundaryFieldListType&>(boundaryFieldList_);
110  bList.updateBoundaries(iter, direction);
111  }
112 
116  {
118  {
120  }
121  }
122 
123  const auto& boundaryFields()const
124  {
125  return boundaryFieldList_;
126  }
127 
128  const auto& BoundaryField(uint32 i)const
129  {
130  return boundaryFieldList_[i];
131  }
132 
133  // - reference to pointStructure
134  inline const pointStructure& pStruct()const {
135  return pStruct_;
136  }
137 
138  void fill(const T& val)
139  {
142  }
143 
145  bool readPointField(iIstream& is, const IOPattern& iop);
146 
147  bool writePointField(iOstream& os, const IOPattern& iop)const;
148 
149 
150  bool read(iIstream& is, const IOPattern& iop)override
151  {
152  return readPointField(is, iop);
153  }
154 
155  bool write(iOstream& os, const IOPattern& iop)const override
156  {
157  return writePointField(os, iop);
158  }
159 };
160 
161 /*template<template<class, class> class VectorField, class T, class MemorySpace>
162 iIstream& operator >> (iIstream & is, pointField<VectorField, T, MemorySpace> & pF )
163 {
164  if( !pF.read(is))
165  {
166  ioErrorInFile( is.name(), is.lineNumber() ) <<
167  "error in reading pointField from file. \n";
168  fatalExit;
169  }
170 
171  return is;
172 }*/
173 
174 template<class T, class MemorySpace>
176 {
178  {
179  ioErrorInFile( os.name(), os.lineNumber() )<<
180  "error in writing pointField into file. \n";
181  fatalExit;
182  }
183 
184  return os;
185 }
186 
187 }
188 
189 #include "pointField.cpp"
190 //#include "pointFieldAlgorithms.hpp"
191 
192 #endif // __pointField_hpp__
pFlow::pointField::boundaryFieldList_
boundaryFieldListType boundaryFieldList_
list of boundaries
Definition: pointField.hpp:59
pFlow::internalField::FieldType
Field< T, MemorySpace > FieldType
Definition: internalField.hpp:43
pFlow::DataDirection::SlaveToMaster
@ SlaveToMaster
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::pointField::pStruct
const pointStructure & pStruct() const
Definition: pointField.hpp:134
pFlow::boundaryFieldList::updateBoundaries
void updateBoundaries(uint32 iter, DataDirection direction)
Definition: boundaryFieldList.hpp:66
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::pointField::pStruct_
const pointStructure & pStruct_
refrence to point structure
Definition: pointField.hpp:62
pFlow::internalField< pFlow::VectorSingle, pFlow::AB3History >::memory_space
typename FieldType::memory_space memory_space
Definition: internalField.hpp:49
pFlow::pointField::TypeInfoTemplate111
TypeInfoTemplate111("pointField", T, VectorType::memoerySpaceName())
pFlow::pointField::BoundaryField
const auto & BoundaryField(uint32 i) const
Definition: pointField.hpp:128
pFlow::pointField::pointField
pointField(const objectFile &objf, pointStructure &pStruct, const T &defVal)
Definition: pointField.cpp:22
pFlow::Field< pFlow::VectorSingle, pFlow::AB3History >
pFlow::boundaryFieldList::slaveToMasterUpdateRequested
bool slaveToMasterUpdateRequested() const
Definition: boundaryFieldList.hpp:105
pFlow
Definition: demGeometry.hpp:27
pFlow::IOobject
Definition: IOobject.hpp:35
pFlow::boundaryFieldList< VectorField, pFlow::VectorSingle, pFlow::AB3History >
pFlow::internalField::fillInternal
void fillInternal(const T &val)
Definition: internalField.hpp:175
pFlow::pointField
Definition: pointField.hpp:33
pFlow::boundaryFieldList::fill
void fill(const T &val)
Definition: boundaryFieldList.hpp:97
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::pointField::writePointField
bool writePointField(iOstream &os, const IOPattern &iop) const
Definition: pointField.cpp:283
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::IOPattern::AllProcessorsDifferent
@ AllProcessorsDifferent
Definition: IOPattern.hpp:57
pFlow::internalField< pFlow::VectorSingle, pFlow::AB3History >::VectorType
typename FieldType::VectorType VectorType
Definition: internalField.hpp:47
pFlow::objectFile::name
virtual const word & name() const
Definition: objectFile.hpp:101
pFlow::internalField< pFlow::VectorSingle, pFlow::AB3History >::execution_space
typename FieldType::execution_space execution_space
Definition: internalField.hpp:51
pFlow::internalField< T, void >::time
const Time & time() const
Definition: internalField.hpp:186
pFlow::IOPattern
Definition: IOPattern.hpp:32
pFlow::pointField::name
const word & name() const final
Definition: pointField.hpp:96
Time.hpp
pFlow::IOobject::owner
const repository * owner() const override
Definition: IOobject.hpp:76
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
pFlow::pointField::boundaryFields
const auto & boundaryFields() const
Definition: pointField.hpp:123
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::pointField::fill
void fill(const T &val)
Definition: pointField.hpp:138
pFlow::IOstream::name
virtual const word & name() const
Return the name of the stream.
Definition: IOstream.cpp:31
pFlow::internalField
Definition: internalField.hpp:34
pFlow::timeControl::currentIter
int32 currentIter() const
Definition: timeControl.hpp:148
internalField.hpp
pFlow::pointField::updateBoundariesSlaveToMasterIfRequested
void updateBoundariesSlaveToMasterIfRequested()
update boundaries if it is requested previousely (slave to master).
Definition: pointField.hpp:115
pFlow::DataDirection
DataDirection
Definition: boundaryField.hpp:34
pFlow::pointField::readPointField
bool readPointField(iIstream &is, const IOPattern &iop)
Definition: pointField.cpp:236
ioErrorInFile
#define ioErrorInFile(fileName, lineNumber)
Report an error in file operation with supplied fileName and lineNumber.
Definition: error.hpp:87
pFlow::repository
Definition: repository.hpp:34
pFlow::IOstream::lineNumber
int32 lineNumber() const
Const access to the current stream line number.
Definition: IOstream.hpp:223
pFlow::pointField::read
bool read(iIstream &is, const IOPattern &iop) override
Definition: pointField.hpp:150
pointField.cpp
pointStructure.hpp
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::pointField::updateBoundaries
void updateBoundaries(DataDirection direction) const
Definition: pointField.hpp:106
boundaryFieldList.hpp
pFlow::pointField::write
bool write(iOstream &os, const IOPattern &iop) const override
Definition: pointField.hpp:155