www.cemf.ir
multiTriSurface.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 
22 #ifndef __multiTriSurface_hpp__
23 #define __multiTriSurface_hpp__
24 
25 #include "subscriber.hpp"
26 #include "triSurface.hpp"
27 #include "subSurface.hpp"
28 
29 namespace pFlow
30 {
31 
33 :
34  public triSurface,
35  public subscriber
36 {
37 private:
38 
40 
41 public:
42 
43  // - type info
44  TypeInfo("multiTriSurface");
45 
47 
53 
56  const objectFile& objf,
57  repository* owner,
58  const multiTriSurface& surf);
59 
61  multiTriSurface(const multiTriSurface&) = default;
62 
64  multiTriSurface& operator = (const multiTriSurface&) = default;
65 
67  multiTriSurface(multiTriSurface&&) = delete;
68 
71 
73  ~multiTriSurface() override = default;
74 
76 
77  bool appendSurface(
78  const word& name,
79  const realx3x3Vector& vertices);
80 
82  {
83  return static_cast<uint32>(subSurfaces_.size());
84  }
85 
87  {
88  return subSurfaces_;
89  }
90 
92  {
93  if( !(nSub < numSurfaces() ) )
94  {
96  fatalExit;
97  }
98  return {subSurfaces_[nSub].start(),subSurfaces_[nSub].end()};
99  }
100 
102  {
103  if( !(nSub < numSurfaces() ) )
104  {
106  fatalExit;
107  }
108  return {
109  subSurfaces_[nSub].pointStart(),
110  subSurfaces_[nSub].pointEnd()};
111  }
112 
114  void clear()
115  {
117  subSurfaces_.clear();
118  }
119 
120 
122  {
123  if(nSub<numSurfaces())
124  {
125  return subSurfaceRange(nSub).numElements();
126  }
127  else
128  {
129  return 0;
130  }
131  }
132 
134  {
135  if(nSub<numSurfaces())
136  {
137  return subSurfacePointRange(nSub).numElements();
138  }
139  else
140  {
141  return 0;
142  }
143  }
144 
146  {
147  if(nSub<numSurfaces())
148  {
149  return subSurfaces_[nSub].name();
150  }
151  else
152  {
153  return "";
154  }
155  }
156 
158 
159 
160 
161  bool read(iIstream& is, const IOPattern& iop)override;
162 
163 
164  bool write(iOstream& os, const IOPattern& iop)const override;
165 
166 
167 };
168 
169 
171 {
173  {
174  ioErrorInFile(os.name(), os.lineNumber())<<
175  " error in writing multiTriSurface to file.\n";
176  fatalExit;
177  }
178  return os;
179 }
180 
181 } // pFlow
182 
183 
184 #endif
subscriber.hpp
pFlow::List< subSurface >
pFlow::triSurface::clear
void clear()
Definition: triSurface.hpp:212
pFlow::multiTriSurface::appendSurface
bool appendSurface(const word &name, const realx3x3Vector &vertices)
Definition: multiTriSurface.cpp:56
pFlow::triSurface::vertices
const uint32x3Field_D & vertices() const
Definition: triSurface.hpp:192
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::multiTriSurface::operator=
multiTriSurface & operator=(const multiTriSurface &)=default
Copy assignment (default)
pFlow::multiTriSurface::multiTriSurface
multiTriSurface(const objectFile &obj, repository *owner)
Construct from objectFile and owner repository.
Definition: multiTriSurface.cpp:25
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::multiTriSurface::subSurfaceNumPoints
uint32 subSurfaceNumPoints(uint32 nSub) const
Definition: multiTriSurface.hpp:133
pFlow::multiTriSurface::write
bool write(iOstream &os, const IOPattern &iop) const override
Definition: multiTriSurface.cpp:91
pFlow::subscriber
Definition: subscriber.hpp:37
pFlow
Definition: demGeometry.hpp:27
pFlow::multiTriSurface
Definition: multiTriSurface.hpp:32
pFlow::multiTriSurface::subSurfacePointRange
rangeU32 subSurfacePointRange(uint32 nSub) const
Definition: multiTriSurface.hpp:101
pFlow::multiTriSurface::subSurfaces
const subSurfaceList & subSurfaces() const
Definition: multiTriSurface.hpp:86
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::IOPattern::AllProcessorsDifferent
@ AllProcessorsDifferent
Definition: IOPattern.hpp:57
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
pFlow::objectFile::name
virtual const word & name() const
Definition: objectFile.hpp:101
pFlow::multiTriSurface::subSurfaceName
word subSurfaceName(uint32 nSub) const
Definition: multiTriSurface.hpp:145
pFlow::Range::numElements
INLINE_FUNCTION_HD T numElements()
Definition: Range.hpp:119
pFlow::multiTriSurface::subSurfaceSize
uint32 subSurfaceSize(uint32 nSub) const
Definition: multiTriSurface.hpp:121
pFlow::IOPattern
Definition: IOPattern.hpp:32
pFlow::multiTriSurface::subSurfaces_
subSurfaceList subSurfaces_
Definition: multiTriSurface.hpp:39
pFlow::multiTriSurface::read
bool read(iIstream &is, const IOPattern &iop) override
Definition: multiTriSurface.cpp:76
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
subSurface.hpp
pFlow::multiTriSurface::~multiTriSurface
~multiTriSurface() override=default
default destructor
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::multiTriSurface::clear
void clear()
Clear the content of object.
Definition: multiTriSurface.hpp:114
pFlow::Range< uint32 >
pFlow::IOstream::name
virtual const word & name() const
Return the name of the stream.
Definition: IOstream.cpp:31
pFlow::List::size
size_t size() const
Definition: ListI.hpp:82
pFlow::multiTriSurface::TypeInfo
TypeInfo("multiTriSurface")
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::triSurface
Definition: triSurface.hpp:103
pFlow::Vector
Definition: Vector.hpp:48
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
triSurface.hpp
pFlow::multiTriSurface::numSurfaces
uint32 numSurfaces() const
Definition: multiTriSurface.hpp:81
pFlow::multiTriSurface::subSurfaceRange
rangeU32 subSurfaceRange(uint32 nSub) const
Definition: multiTriSurface.hpp:91