source: src/grid/grid_properties.hpp@ 06e153

Last change on this file since 06e153 was 716da7, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Fix energy calculation.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1729 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 8.3 KB
Line 
1/**
2 * @file grid_properties.hpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:54:05 2011
5 *
6 * @brief VMG::GlobalIndices, VMG::LocalIndices and VMG::SpatialExtent
7 *
8 */
9
10#ifndef GRID_PROPERTIES_HPP_
11#define GRID_PROPERTIES_HPP_
12
13#include "base/defs.hpp"
14#include "base/index.hpp"
15#include "base/vector.hpp"
16
17namespace VMG
18{
19
20class GlobalIndices
21{
22public:
23 GlobalIndices() :
24 local_begin(0), local_end(0), local_size(0),
25 global_finer_begin(0), global_finer_end(0), global_finer_size(0),
26 local_finer_begin(0), local_finer_end(0), local_finer_size(0),
27 finest_abs_begin(0), finest_abs_end(0), finest_abs_size(0),
28 global_size(0),
29 boundary(EmptyGrid)
30 {}
31
32 GlobalIndices(const GlobalIndices& other) :
33 local_begin(other.local_begin), local_end(other.local_end), local_size(other.local_size),
34 global_finer_begin(other.global_finer_begin), global_finer_end(other.global_finer_end), global_finer_size(other.global_finer_size),
35 local_finer_begin(other.local_finer_begin), local_finer_end(other.local_finer_end), local_finer_size(other.local_finer_size),
36 finest_abs_begin(other.finest_abs_begin), finest_abs_end(other.finest_abs_end), finest_abs_size(other.finest_abs_size),
37 global_size(other.global_size),
38 boundary(other.boundary)
39 {}
40
41 Index& LocalBegin() {return local_begin;}
42 Index& LocalEnd() {return local_end;}
43 Index& LocalSize() {return local_size;}
44
45 const Index& LocalBegin() const {return local_begin;}
46 const Index& LocalEnd() const {return local_end;}
47 const Index& LocalSize() const {return local_size;}
48
49 Index& GlobalFinerBegin() {return global_finer_begin;}
50 Index& GlobalFinerEnd() {return global_finer_end;}
51 Index& GlobalFinerSize() {return global_finer_size;}
52
53 const Index& GlobalFinerBegin() const {return global_finer_begin;}
54 const Index& GlobalFinerEnd() const {return global_finer_end;}
55 const Index& GlobalFinerSize() const {return global_finer_size;}
56
57 Index& LocalFinerBegin() {return local_finer_begin;}
58 Index& LocalFinerEnd() {return local_finer_end;}
59 Index& LocalFinerSize() {return local_finer_size;}
60
61 const Index& LocalFinerBegin() const {return local_finer_begin;}
62 const Index& LocalFinerEnd() const {return local_finer_end;}
63 const Index& LocalFinerSize() const {return local_finer_size;}
64
65 Index& FinestAbsBegin() {return finest_abs_begin;}
66 Index& FinestAbsEnd() {return finest_abs_end;}
67 Index& FinestAbsSize() {return finest_abs_size;}
68
69 const Index& FinestAbsBegin() const {return finest_abs_begin;}
70 const Index& FinestAbsEnd() const {return finest_abs_end;}
71 const Index& FinestAbsSize() const {return finest_abs_size;}
72
73 Index& GlobalSize() {return global_size;}
74 const Index& GlobalSize() const {return global_size;}
75
76 BT& BoundaryType() {return boundary;}
77 const BT& BoundaryType() const {return boundary;}
78
79private:
80 Index local_begin, local_end, local_size;
81 Index global_finer_begin, global_finer_end, global_finer_size;
82 Index local_finer_begin, local_finer_end, local_finer_size;
83 Index finest_abs_begin, finest_abs_end, finest_abs_size;
84 Index global_size;
85 BT boundary;
86};
87
88class LocalIndices
89{
90public:
91 LocalIndices() :
92 begin(0), end(0), size(0), size_total(0),
93 halo_begin_1(0), halo_end_1(0), halo_size_1(0),
94 halo_begin_2(0), halo_end_2(0), halo_size_2(0),
95 boundary_begin_1(0), boundary_end_1(0), boundary_size_1(0),
96 boundary_begin_2(0), boundary_end_2(0), boundary_size_2(0),
97 finer_begin(0), finer_end(0), finer_size(0)
98 {}
99
100 LocalIndices(const LocalIndices& other) :
101 begin(other.begin), end(other.end), size(other.size), size_total(other.size_total),
102 halo_begin_1(other.halo_begin_1), halo_end_1(other.halo_end_1), halo_size_1(other.halo_size_1),
103 halo_begin_2(other.halo_begin_2), halo_end_2(other.halo_end_2), halo_size_2(other.halo_size_2),
104 boundary_begin_1(other.boundary_begin_1), boundary_end_1(other.boundary_end_1), boundary_size_1(other.boundary_size_1),
105 boundary_begin_2(other.boundary_begin_2), boundary_end_2(other.boundary_end_2), boundary_size_2(other.boundary_size_2),
106 finer_begin(other.finer_begin), finer_end(other.finer_end), finer_size(other.finer_size)
107 {}
108
109 Index& Begin() {return begin;} ///< Index of first local grid point
110 Index& End() {return end;} ///< Index of first non-local grid point
111 Index& Size() {return size;} ///< Local grid size excluding halo
112 Index& SizeTotal() {return size_total;} ///< Local grid size including halo and boundary
113
114 const Index& Begin() const {return begin;} ///< Index of first local grid point
115 const Index& End() const {return end;} ///< Index of first non-local grid point
116 const Index& Size() const {return size;} ///< Local grid size excluding halo
117 const Index& SizeTotal() const {return size_total;} ///< Local grid size including halo and boundary
118
119 Index& HaloBegin1() {return halo_begin_1;} ///< Index of first halo point
120 Index& HaloEnd1() {return halo_end_1;} ///< Index of first non-halo point
121 Index& HaloSize1() {return halo_size_1;} ///< Size of halo
122
123 Index& HaloBegin2() {return halo_begin_2;} ///< Index of first halo point
124 Index& HaloEnd2() {return halo_end_2;} ///< Index of first non-halo point
125 Index& HaloSize2() {return halo_size_2;} ///< Size of halo
126
127 const Index& HaloBegin1() const {return halo_begin_1;} ///< Index of first halo point
128 const Index& HaloEnd1() const {return halo_end_1;} ///< Index of first non-halo point
129 const Index& HaloSize1() const {return halo_size_1;} ///< Size of halo
130
131 const Index& HaloBegin2() const {return halo_begin_2;} ///< Index of first halo point
132 const Index& HaloEnd2() const {return halo_end_2;} ///< Index of first non-halo point
133 const Index& HaloSize2() const {return halo_size_2;} ///< Size of halo
134
135 Index& BoundaryBegin1() {return boundary_begin_1;} ///< Index of first boundary point
136 Index& BoundaryEnd1() {return boundary_end_1;} ///< Index of first non-boundary point
137 Index& BoundarySize1() {return boundary_size_1;} ///< Size of boundary
138
139 Index& BoundaryBegin2() {return boundary_begin_2;} ///< Index of first boundary point
140 Index& BoundaryEnd2() {return boundary_end_2;} ///< Index of first non-boundary point
141 Index& BoundarySize2() {return boundary_size_2;} ///< Size of boundary
142
143 const Index& BoundaryBegin1() const {return boundary_begin_1;} ///< Index of first boundary point
144 const Index& BoundaryEnd1() const {return boundary_end_1;} ///< Index of first non-boundary point
145 const Index& BoundarySize1() const {return boundary_size_1;} ///< Size of boundary
146
147 const Index& BoundaryBegin2() const {return boundary_begin_2;} ///< Index of first boundary point
148 const Index& BoundaryEnd2() const {return boundary_end_2;} ///< Index of first non-boundary point
149 const Index& BoundarySize2() const {return boundary_size_2;} ///< Size of boundary
150
151 Index& FinerBegin() {return finer_begin;}
152 Index& FinerEnd() {return finer_end;}
153 Index& FinerSize() {return finer_size;}
154
155 const Index& FinerBegin() const {return finer_begin;}
156 const Index& FinerEnd() const {return finer_end;}
157 const Index& FinerSize() const {return finer_size;}
158
159 bool HasFinerGrid() const {return static_cast<bool>(finer_size.Product());}
160
161private:
162 Index begin, end, size, size_total;
163 Index halo_begin_1, halo_end_1, halo_size_1;
164 Index halo_begin_2, halo_end_2, halo_size_2;
165 Index boundary_begin_1, boundary_end_1, boundary_size_1;
166 Index boundary_begin_2, boundary_end_2, boundary_size_2;
167 Index finer_begin, finer_end, finer_size;
168};
169
170class SpatialExtent
171{
172public:
173 SpatialExtent() :
174 begin(0.0),
175 end(0.0),
176 size(0.0),
177 mesh_width(0.0)
178 {}
179
180 SpatialExtent(const SpatialExtent& other) :
181 begin(other.begin),
182 end(other.end),
183 size(other.size),
184 mesh_width(other.mesh_width)
185 {}
186
187 Vector& Begin() {return begin;}
188 const Vector& Begin() const {return begin;}
189
190 Vector& End() {return end;}
191 const Vector& End() const {return end;}
192
193 Vector& Size() {return size;}
194 const Vector& Size() const {return size;}
195
196 Vector& MeshWidth() {return mesh_width;}
197 const Vector& MeshWidth() const {return mesh_width;}
198
199private:
200 Vector begin, end, size;
201 Vector mesh_width;
202};
203
204}
205
206#endif /* GRID_PROPERTIES_HPP_ */
Note: See TracBrowser for help on using the repository browser.