www.cemf.ir
boundaryField.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 __boundaryField_hpp__
21 #define __boundaryField_hpp__
22 
23 #include "generalBoundary.hpp"
24 #include "internalField.hpp"
25 
26 namespace pFlow
27 {
28 
29 
30 // forward
31 template< class T, class MemorySpace>
33 
34 enum class DataDirection
35 {
38  TwoWay
39 };
40 
41 template< class T, class MemorySpace = void>
43 :
44  public generalBoundary
45 {
46 public:
47 
49 
51 
53 
55 
57 
59 
60 private:
61 
63  friend class boundaryFieldList<T,MemorySpace>;
64 
67 
68  virtual
69  bool updateBoundary(int step, DataDirection direction)
70  {
71  return true;
72  }
73 
74 public:
75 
76  TypeInfoTemplate211("boundaryField","none" ,T, memory_space::name());
77 
79  const boundaryBase& boundary,
80  const pointStructure& pStruct,
81  InternalFieldType& internal);
82 
84  (
87  (
88  const boundaryBase& boundary,
89  const pointStructure& pStruct,
90  InternalFieldType& internal
91  ),
92  (boundary, pStruct, internal)
93  );
94 
95 
96  add_vCtor
97  (
101  );
102 
103  bool hearChanges
104  (
105  real t,
106  real dt,
107  uint32 iter,
108  const message& msg,
109  const anyList& varList
110  ) override
111  {
112 
114  {
115  // do nothing
116  }
118  {
119  //do nothing
120  }
121  return true;
122  }
123 
124  inline
125  InternalFieldType& internal()
126  {
127  return internal_;
128  }
129 
130  inline
131  const InternalFieldType& internal()const
132  {
133  return internal_;
134  }
135 
137  {
138  return internal_.name();
139  }
140 
141  word name()const
142  {
143  return groupNames(fieldName(),boundaryName());
144  }
145 
147  {
148  if constexpr(isDeviceAccessible<execution_space>())
149  return FieldAccessType(
150  this->size(),
151  this->indexList().deviceViewAll(),
153  else
154  return FieldAccessType(
155  this->size(),
156  this->boundary().indexListHost().deviceViewAll(),
158  }
159 
161  {
162  if constexpr(isDeviceAccessible<execution_space>())
163  return FieldAccessType(
164  this->mirrorBoundary().size(),
165  this->mirrorBoundary().indexList().deviceViewAll(),
167  else
168  return FieldAccessType(
169  this->mirrorBoundary().size(),
170  this->mirrorBoundary().indexListHost().deviceViewAll(),
172 
173  }
174 
175  virtual
177 
178  virtual
179  const ProcVectorType& neighborProcField()const;
180 
181  virtual
182  void fill(const T& val)
183  {
184  return;
185  }
186 
187  static
189  const boundaryBase& boundary,
190  const pointStructure& pStruct,
191  InternalFieldType& internal);
192 
193 };
194 
195 }
196 
197 #include "boundaryField.cpp"
198 
199 #endif
200 
pFlow::boundaryField< T, void >::execution_space
typename InternalFieldType::execution_space execution_space
Definition: boundaryField.hpp:54
pFlow::message::equivalentTo
bool equivalentTo(EVENT evnt) const
Definition: message.hpp:131
pFlow::boundaryField::create
static uniquePtr< boundaryField > create(const boundaryBase &boundary, const pointStructure &pStruct, InternalFieldType &internal)
Definition: boundaryField.cpp:62
pFlow::DataDirection::SlaveToMaster
@ SlaveToMaster
pFlow::generalBoundary::indexList
const auto & indexList() const
Definition: generalBoundary.hpp:114
pFlow::boundaryField::fill
virtual void fill(const T &val)
Definition: boundaryField.hpp:182
pFlow::boundaryField
Definition: boundaryField.hpp:42
pFlow::scatteredFieldAccess
Definition: scatteredFieldAccess.hpp:32
pFlow::message
Definition: message.hpp:33
boundaryField.cpp
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::boundaryField::TypeInfoTemplate211
TypeInfoTemplate211("boundaryField","none", T, memory_space::name())
pFlow::boundaryField::updateBoundary
virtual bool updateBoundary(int step, DataDirection direction)
Definition: boundaryField.hpp:69
pFlow::boundaryField::ProcVectorType
VectorSingle< T, MemorySpace > ProcVectorType
Definition: boundaryField.hpp:58
pFlow::boundaryField::InternalFieldType
internalField< T, MemorySpace > InternalFieldType
Definition: boundaryField.hpp:50
pFlow::boundaryField::create_vCtor
create_vCtor(boundaryField, boundaryBase,(const boundaryBase &boundary, const pointStructure &pStruct, InternalFieldType &internal),(boundary, pStruct, internal))
pFlow::internalField::deviceViewAll
const auto & deviceViewAll() const
Definition: internalField.hpp:92
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::boundaryField::BoundaryFieldType
boundaryField< T, MemorySpace > BoundaryFieldType
Definition: boundaryField.hpp:48
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::internalField::memory_space
typename FieldType::memory_space memory_space
Definition: internalField.hpp:49
pFlow::generalBoundary::pStruct
const auto & pStruct() const
Definition: generalBoundary.hpp:138
pFlow::message::BNDR_REARRANGE
@ BNDR_REARRANGE
Definition: message.hpp:46
pFlow::boundaryField::name
word name() const
Definition: boundaryField.hpp:141
pFlow
Definition: demGeometry.hpp:27
pFlow::boundaryFieldList
Definition: boundaryField.hpp:32
pFlow::DataDirection::TwoWay
@ TwoWay
pFlow::message::BNDR_RESET
@ BNDR_RESET
Definition: message.hpp:48
pFlow::boundaryField< T, void >::memory_space
typename InternalFieldType::memory_space memory_space
Definition: boundaryField.hpp:52
pFlow::boundaryField::mirrorField
FieldAccessType mirrorField() const
Definition: boundaryField.hpp:160
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::anyList
Definition: anyList.hpp:35
pFlow::boundaryField::add_vCtor
add_vCtor(BoundaryFieldType, BoundaryFieldType, boundaryBase)
pFlow::boundaryField::internal_
InternalFieldType & internal_
a ref to the internal field
Definition: boundaryField.hpp:66
pFlow::internalField::execution_space
typename FieldType::execution_space execution_space
Definition: internalField.hpp:51
pFlow::boundaryBase
Definition: boundaryBase.hpp:42
pFlow::VectorSingle< T, void >
pFlow::boundaryField::boundaryField
boundaryField(const boundaryBase &boundary, const pointStructure &pStruct, InternalFieldType &internal)
Definition: boundaryField.cpp:23
pFlow::internalField< T, void >
pFlow::boundaryField::thisField
FieldAccessType thisField() const
Definition: boundaryField.hpp:146
pFlow::boundaryField::hearChanges
bool hearChanges(real t, real dt, uint32 iter, const message &msg, const anyList &varList) override
Definition: boundaryField.hpp:104
internalField.hpp
pFlow::DataDirection
DataDirection
Definition: boundaryField.hpp:34
pFlow::uniquePtr
Definition: uniquePtr.hpp:42
generalBoundary.hpp
pFlow::generalBoundary::boundary
const auto & boundary() const
Definition: generalBoundary.hpp:108
pFlow::groupNames
word groupNames(const word &bw, const word &tw, char sep='.')
Group words and output bw.tw.
Definition: bTypesFunctions.cpp:179
pFlow::boundaryField::neighborProcField
virtual ProcVectorType & neighborProcField()
Definition: boundaryField.cpp:41
pFlow::DataDirection::MasterToSlave
@ MasterToSlave
pFlow::boundaryField::fieldName
word fieldName() const
Definition: boundaryField.hpp:136
pFlow::generalBoundary::size
auto size() const
Definition: generalBoundary.hpp:78
pFlow::generalBoundary::mirrorBoundary
const auto & mirrorBoundary() const
Definition: generalBoundary.hpp:120
pFlow::generalBoundary
Definition: generalBoundary.hpp:38
pFlow::internalField::name
word name() const
Definition: internalField.hpp:145
pFlow::generalBoundary::boundaryName
const word & boundaryName() const
Definition: generalBoundary.hpp:126
pFlow::boundaryField::FieldAccessType
scatteredFieldAccess< T, memory_space > FieldAccessType
Definition: boundaryField.hpp:56