box.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 __box_hpp__
22 #define __box_hpp__
23 
24 #include "types.hpp"
25 #include "dictionary.hpp"
26 #include "iIstream.hpp"
27 #include "iOstream.hpp"
28 
29 namespace pFlow
30 {
31 
32 class box
33 {
34 protected:
35 
36  // - min point
37  realx3 min_{0,0,0};
38 
39  // - max point
40  realx3 max_{1,1,1};
41 
42 public:
43 
44  // - type info
45  TypeInfoNV("box");
46 
49  box(){}
50 
52  box(const realx3& minP, const realx3& maxP)
53  :
54  min_(minP),
55  max_(maxP)
56  {}
57 
58 
60  box(const dictionary& dict);
61 
63  box(iIstream& is);
64 
66  box(const box&) = default;
67 
69  box(box&&) = default;
70 
72  box& operator=(const box&) = default;
73 
75  box& operator=(box&&) = default;
76 
77  ~box()=default;
78 
80 
82  bool isInside(const realx3& point)const
83  {
84  return point > min_ && point <max_;
85  }
86 
89  {
90  return min_;
91  }
92 
95  {
96  return max_;
97  }
98 
100  FUNCTION_H
101  bool read(iIstream & is);
102 
103  FUNCTION_H
104  bool write(iOstream& os)const;
105 
106  FUNCTION_H
107  bool read(const dictionary& dict);
108 
109  FUNCTION_H
110  bool write(dictionary& dict)const;
111 };
112 
114 iIstream& operator >>(iIstream& is, box& b);
115 
117 iOstream& operator << (iOstream& os, const box& b);
118 
120 box extendBox(const box& b, const realx3& dl)
121 {
122  return box(b.minPoint()-dl , b.maxPoint()+dl);
123 }
124 
125 }
126 
127 
128 #endif
iIstream.hpp
pFlow::box::box
INLINE_FUNCTION_HD box()
Definition: box.hpp:49
types.hpp
pFlow::box::max_
realx3 max_
Definition: box.hpp:40
pFlow::extendBox
INLINE_FUNCTION_HD box extendBox(const box &b, const realx3 &dl)
Definition: box.hpp:120
pFlow::box::box
INLINE_FUNCTION_HD box(const realx3 &minP, const realx3 &maxP)
Definition: box.hpp:52
pFlow::box::maxPoint
INLINE_FUNCTION_HD realx3 maxPoint() const
Definition: box.hpp:94
pFlow
Definition: demComponent.hpp:28
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::iIstream
Definition: iIstream.hpp:33
pFlow::box::~box
~box()=default
dictionary.hpp
pFlow::operator>>
INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)
Definition: AdamsBashforth3.hpp:41
pFlow::box::write
FUNCTION_H bool write(iOstream &os) const
Definition: box.cpp:65
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
FUNCTION_HD
#define FUNCTION_HD
Definition: pFlowMacros.hpp:57
pFlow::box::operator=
FUNCTION_HD box & operator=(const box &)=default
pFlow::box
Definition: box.hpp:32
pFlow::box::minPoint
INLINE_FUNCTION_HD realx3 minPoint() const
Definition: box.hpp:88
pFlow::box::TypeInfoNV
TypeInfoNV("box")
iOstream.hpp
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< real >
pFlow::box::isInside
INLINE_FUNCTION_HD bool isInside(const realx3 &point) const
Definition: box.hpp:82
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::box::read
FUNCTION_H bool read(iIstream &is)
Definition: box.cpp:57
pFlow::box::min_
realx3 min_
Definition: box.hpp:37
pFlow::dictionary
Definition: dictionary.hpp:38