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
+ * @file boxRegionPoints.hpp
23
+ * @brief A class representing a box region for point selection
24
+ *
25
+ * This class provides functionality to select points within a box region
26
+ * and to compute related properties such as volume and equivalent diameter.
27
+ * It inherits from regionPoints and implements all required virtual methods.
28
+ *
29
+ * @see regionPoints
30
+ * @see box
31
+ * @see fieldsDataBase
32
+ */
33
+
34
+ #ifndef __boxRegionPoints_hpp__
35
+ #define __boxRegionPoints_hpp__
36
+
37
+ #include " regionPoints.hpp"
38
+ #include " box.hpp"
39
+ #include " Vectors.hpp"
40
+
41
+ namespace pFlow ::postprocessData
42
+ {
43
+
44
+ class boxRegionPoints
45
+ :
46
+ public regionPoints
47
+ {
48
+ private:
49
+
50
+ // / box object defining the region for point selection
51
+ box boxRegion_;
52
+
53
+ // / Volume of the box region
54
+ real volume_;
55
+
56
+ // / Diameter of the box region
57
+ real diameter_;
58
+
59
+ // / Indices of points that are selected by this region
60
+ uint32Vector selectedPoints_;
61
+
62
+ public:
63
+
64
+ TypeInfo (box::TYPENAME());
65
+
66
+ /* *
67
+ * @brief Construct a box region for point selection
68
+ *
69
+ * @param dict Dictionary containing boxInfo dictionary
70
+ * @param fieldsDataBase Database containing fields data
71
+ */
72
+ boxRegionPoints (
73
+ const dictionary& dict,
74
+ fieldsDataBase& fieldsDataBase);
75
+
76
+ // / Destructor
77
+ ~boxRegionPoints () override = default ;
78
+
79
+ /* *
80
+ * @brief Get the number of regions (always 1 for box)
81
+ * @return Always returns 1
82
+ */
83
+ uint32 size ()const override
84
+ {
85
+ return 1 ;
86
+ }
87
+
88
+ /* *
89
+ * @brief Check if the region is empty
90
+ * @return Always returns false
91
+ */
92
+ bool empty ()const override
93
+ {
94
+ return false ;
95
+ }
96
+
97
+ /* *
98
+ * @brief Get the volume of the box region
99
+ * @return A span containing the volume of the region
100
+ */
101
+ span<const real> volumes ()const override
102
+ {
103
+ return span<const real>(&volume_, 1 );
104
+ }
105
+
106
+ /* *
107
+ * @brief Get the equivalent diameter of the box region
108
+ * @return A span containing the diameter of the region
109
+ */
110
+ span<const real> eqDiameters ()const override
111
+ {
112
+ return span<const real>(&diameter_, 1 );
113
+ }
114
+
115
+ /* *
116
+ * @brief Get the center of the box region
117
+ * @return A span containing the center point of the region
118
+ */
119
+ span<const realx3> centers ()const override
120
+ {
121
+ realx3 center = 0.5 * (boxRegion_.minPoint () + boxRegion_.maxPoint ());
122
+ return span<const realx3>(¢er, 1 );
123
+ }
124
+
125
+ /* *
126
+ * @brief Get the indices of points within the region (const version)
127
+ * @param elem Element index (ignored as there's only one box)
128
+ * @return A span containing indices of points within the region
129
+ */
130
+ span<const uint32> indices (uint32 elem)const override
131
+ {
132
+ return span<const uint32>(selectedPoints_.data (), selectedPoints_.size ());
133
+ }
134
+
135
+ /* *
136
+ * @brief Get the indices of points within the region (non-const version)
137
+ * @param elem Element index (ignored as there's only one box)
138
+ * @return A span containing indices of points within the region
139
+ */
140
+ span<uint32> indices (uint32 elem) override
141
+ {
142
+ return span<uint32>(selectedPoints_.data (), selectedPoints_.size ());
143
+ }
144
+
145
+ /* *
146
+ * @brief Update the points selected by this region
147
+ * @return True if update was successful
148
+ */
149
+ bool update ()override ;
150
+
151
+ /* *
152
+ * @brief Determine if data should be written to the same time file
153
+ * @return Always returns true
154
+ */
155
+ bool writeToSameTimeFile ()const override
156
+ {
157
+ return true ;
158
+ }
159
+
160
+ /* *
161
+ * @brief Write region data to output stream
162
+ * @param os Output stream to write to
163
+ * @return True if write was successful
164
+ */
165
+ bool write (iOstream& os)const override ;
166
+
167
+ };
168
+
169
+ }
170
+
171
+ #endif // __boxRegionPoints_hpp__
0 commit comments