www.cemf.ir
boundaryFieldList.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 __boundaryFieldList_hpp__
21 #define __boundaryFieldList_hpp__
22 
23 #include "boundaryField.hpp"
24 #include "boundaryList.hpp"
25 #include "ListPtr.hpp"
26 
27 
28 namespace pFlow
29 {
30 
31 template< class T, class MemorySpace = void >
32 class boundaryFieldList
33 :
34  public ListPtr< boundaryField<T, MemorySpace> >
35 {
36 public:
37 
39 
41 
42 
43 protected:
44 
46 
48 
49 public:
50 
51  boundaryFieldList(const boundaryList& boundaries, InternalFieldType& internal)
52  :
53  ListPtr<BoundaryFieldType>(boundaries.size()),
54  boundaries_(boundaries)
55  {
56  for(auto i=0; i<boundaries.size(); i++)
57  {
58  this->set
59  (
60  i,
62  );
63  }
64  }
65 
66  void updateBoundaries(uint32 iter, DataDirection direction)
67  {
68  if( direction == DataDirection::SlaveToMaster
69  && slaveToMasterUpdateIter_ == iter) return;
70 
71 
72 
73  // first step
74  uint32 i=0;
75  for(auto b:*this)
76  {
77  if(i==0 )
78  {
79  //pOutput<<"request for update boundaries for field "<< b->name()<<endl;
80  i++;
81  }
82  b->updateBoundary(1, direction);
83  }
84 
85  // second step
86  for(auto b:*this)
87  {
88  b->updateBoundary(2, direction);
89  }
90 
91  if(direction == DataDirection::SlaveToMaster)
92  {
94  }
95  }
96 
97  void fill(const T& val)
98  {
99  for(auto& bf: *this)
100  {
101  bf->fill(val);
102  }
103  }
104 
106  {
107  return slaveToMasterUpdateIter_ != static_cast<uint32>(-1);
108  }
109 
110 
111 };
112 
113 }
114 
115 #endif
pFlow::boundaryField::create
static uniquePtr< boundaryField > create(const boundaryBase &boundary, const pointStructure &pStruct, InternalFieldType &internal)
Definition: boundaryField.cpp:62
pFlow::ListPtr::size
size_t size() const
Definition: ListPtrI.hpp:266
pFlow::DataDirection::SlaveToMaster
@ SlaveToMaster
pFlow::boundaryField
Definition: boundaryField.hpp:42
pFlow::ListPtr
Definition: ListPtr.hpp:37
ListPtr.hpp
boundaryField.hpp
pFlow::boundaryField::InternalFieldType
internalField< T, MemorySpace > InternalFieldType
Definition: boundaryField.hpp:50
pFlow::boundaryFieldList::slaveToMasterUpdateIter_
uint32 slaveToMasterUpdateIter_
Definition: boundaryFieldList.hpp:47
pFlow::boundaryList::pStruct
const pointStructure & pStruct() const
Definition: boundaryList.hpp:89
pFlow::boundaryFieldList::updateBoundaries
void updateBoundaries(uint32 iter, DataDirection direction)
Definition: boundaryFieldList.hpp:66
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::boundaryList
Definition: boundaryList.hpp:35
pFlow::boundaryFieldList::slaveToMasterUpdateRequested
bool slaveToMasterUpdateRequested() const
Definition: boundaryFieldList.hpp:105
pFlow
Definition: demGeometry.hpp:27
boundaryList.hpp
pFlow::boundaryFieldList::fill
void fill(const T &val)
Definition: boundaryFieldList.hpp:97
pFlow::boundaryFieldList< VectorField, realx3, void >::InternalFieldType
typename BoundaryFieldType::InternalFieldType InternalFieldType
Definition: boundaryFieldList.hpp:40
pFlow::boundaryFieldList::boundaries_
const boundaryList & boundaries_
Definition: boundaryFieldList.hpp:45
pFlow::DataDirection
DataDirection
Definition: boundaryField.hpp:34
pFlow::boundaryFieldList::boundaryFieldList
boundaryFieldList(const boundaryList &boundaries, InternalFieldType &internal)
Definition: boundaryFieldList.hpp:51