www.cemf.ir
pointField copy.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 
21 #ifndef __internalField_hpp__
22 #define __internalField_hpp__
23 
24 #include "pointStructure.hpp"
25 #include "Field.hpp"
26 #include "observer.hpp"
27 
28 
29 namespace pFlow
30 {
31 
32 template<template<class, class> class VectorField, class T, class MemorySpace=void>
33 class internalField
34 :
35  public observer,
36  public Field<VectorField, T, MemorySpace>
37 {
38 public:
39 
41 
43 
45 
47 
48  using iterator = typename FieldType::iterator;
49 
51 
52  using reference = typename FieldType::reference;
53 
55 
57 
58  using pointer = typename FieldType::pointer;
59 
61 
62 protected:
63 
65 
68 
71 
73  T defaultValue_;
74 
75 
76 public:
77 
78  // - type info
79  TypeInfoTemplateNV2("pointField", T, VectorType::memoerySpaceName());
80 
81 
83 
84  // - construct a field from pointStructure and set defaultValue_ and field value to defVal
85  pointField(
86  const objectFile& objf,
88  const T& defVal);
89 
90  // - construct from iIOEntity, pointStructure and a value
91  /*pointField( const pointStructure& pStruct, const T& val, const T& defVal, bool subscribe = true);
92 
93  // - construct from another pointField
94  // subscribe to events if true
95  pointField( const pointField& src, bool subscribe);
96 
97 
98  // - copy construct
99  pointField(const pointField& src);
100 
101  // - no move construct
102  pointField(pointField&& src) = delete;
103 
104 
105  // assignment, only assign the VectorField and preserve other parts of this
106  pointField& operator = (const pointField& rhs);
107 
108  // no move assignment
109  pointField& operator = (pointField&&) = delete;
110 
111 
112  inline uniquePtr<pointFieldType> clone() const
113  {
114  return makeUnique<pointFieldType>(*this);
115  }
116 
117  inline pointFieldType* clonePtr()const
118  {
119  return new pointFieldType(*this);
120  }
121 
123 
124  // - reference to pointStructure
125  inline const pointStructure& pStruct()const {
126  return pStruct_;
127  }
128 
129  // if all points are active
130  INLINE_FUNCTION_H
131  bool allActive()const {
132  return pStruct_.allActive();
133  }
134 
135 
136  INLINE_FUNCTION_H
137  bool isActive(label i)const {
138  return pStruct_.isActive(i);
139  }
140 
141  const auto& pointFlag()const
142  {
143  return pStruct_.pointFlag();
144  }
145 
146  range activeRange()const
147  {
148  return pStruct_.activeRange();
149  }
150 
151  // - update the field if any changes occure in pStruct
152  // for now it checks for deleted points
153  bool update(const eventMessage& msg);
154 
155 
157  bool readPointField(iIstream& is);
158 
159  bool writePointField(iOstream& os)const;
160 
161 
162  bool read(iIstream& is)
163  {
164  return readPointField(is);
165  }
166 
167  bool write(iOstream& os)const
168  {
169  return writePointField(os);
170  }*/
171 };
172 
173 /*template<template<class, class> class VectorField, class T, class MemorySpace>
174 iIstream& operator >> (iIstream & is, pointField<VectorField, T, MemorySpace> & pF )
175 {
176  if( !pF.read(is))
177  {
178  ioErrorInFile( is.name(), is.lineNumber() ) <<
179  "error in reading pointField from file. \n";
180  fatalExit;
181  }
182 
183  return is;
184 }
185 
186 template<template<class, class> class VectorField, class T, class MemorySpace>
187 iOstream& operator << (iOstream& os, const pointField<VectorField, T, MemorySpace>& pF )
188 {
189  if(! pF.write(os) )
190  {
191  ioErrorInFile( os.name(), os.lineNumber() )<<
192  "error in writing pointField into file. \n";
193  fatalExit;
194  }
195 
196  return os;
197 }*/
198 
199 }
200 
201 #include "pointField.cpp"
202 //#include "pointFieldAlgorithms.hpp"
203 
204 #endif // __pointField_hpp__
pFlow::internalField< realx3, void >::const_reference
typename FieldType::const_reference const_reference
Definition: pointField copy.hpp:54
observer.hpp
pFlow::internalField::defaultValue_
T defaultValue_
value when a new item is added to field
Definition: internalField.hpp:59
pFlow::internalField::pointField
pointField(const objectFile &objf, pointStructure &pStruct, const T &defVal)
pFlow::Field< realx3, void >
pFlow::Field::const_pointer
typename VectorType::const_pointer const_pointer
Definition: Field.hpp:64
pFlow
Definition: demGeometry.hpp:27
pFlow::boundaryFieldList< VectorField, realx3, void >
pFlow::pointField
Definition: pointField.hpp:33
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::Field::value_type
typename VectorType::value_type value_type
Definition: Field.hpp:60
pFlow::internalField< realx3, void >::VectorType
typename FieldType::VectorType VectorType
Definition: internalField.hpp:47
pFlow::Field::const_reference
typename VectorType::const_reference const_reference
Definition: Field.hpp:58
pFlow::internalField< realx3, void >::reference
typename FieldType::reference reference
Definition: pointField copy.hpp:52
pFlow::internalField< realx3, void >::iterator
typename FieldType::iterator iterator
Definition: pointField copy.hpp:48
pFlow::Field::const_iterator
typename VectorType::const_iterator const_iterator
Definition: Field.hpp:54
pFlow::internalField< realx3, void >::value_type
typename FieldType::value_type value_type
Definition: pointField copy.hpp:56
pFlow::internalField< realx3, void >::const_iterator
typename FieldType::const_iterator const_iterator
Definition: pointField copy.hpp:50
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::internalField::boundaryFieldList_
boundaryFieldListType boundaryFieldList_
list of boundaries
Definition: pointField copy.hpp:67
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
pFlow::internalField::pStruct_
const pointStructure & pStruct_
refrence to point structure
Definition: pointField copy.hpp:70
pFlow::internalField::TypeInfoTemplateNV2
TypeInfoTemplateNV2("pointField", T, VectorType::memoerySpaceName())
pFlow::Field::pointer
typename VectorType::pointer pointer
Definition: Field.hpp:62
Field.hpp
pFlow::internalField< realx3, void >::const_pointer
typename FieldType::const_pointer const_pointer
Definition: pointField copy.hpp:60
pFlow::Field::iterator
typename VectorType::iterator iterator
Definition: Field.hpp:52
pointField.cpp
pFlow::internalField< realx3, void >::pointer
typename FieldType::pointer pointer
Definition: pointField copy.hpp:58
pointStructure.hpp
pFlow::Field::VectorType
VectorSingle< T, MemorySpace > VectorType
Definition: Field.hpp:42
pFlow::Field::reference
typename VectorType::reference reference
Definition: Field.hpp:56