source: ThirdParty/vmg/src/grid/grid_properties.hpp@ 775f3f

Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChemicalSpaceEvaluator Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Exclude_Hydrogens_annealWithBondGraph ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_contraction-expansion Gui_displays_atomic_force_velocity JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters StoppableMakroAction TremoloParser_IncreasedPrecision
Last change on this file since 775f3f was 7faa5c, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit 'de061d9d851257a04e924d4472df4523d33bb08b' as 'ThirdParty/vmg'

  • Property mode set to 100644
File size: 7.7 KB
Line 
1/*
2 * vmg - a versatile multigrid solver
3 * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn
4 *
5 * vmg is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * vmg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * @file grid_properties.hpp
21 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
22 * @date Mon Apr 18 12:54:05 2011
23 *
24 * @brief VMG::GlobalIndices, VMG::LocalIndices and VMG::SpatialExtent
25 *
26 */
27
28#ifndef GRID_PROPERTIES_HPP_
29#define GRID_PROPERTIES_HPP_
30
31#include "base/defs.hpp"
32#include "base/index.hpp"
33#include "base/vector.hpp"
34
35namespace VMG
36{
37
38class GlobalIndices
39{
40public:
41 GlobalIndices() :
42 local_begin(0), local_end(0), local_size(0),
43 global_begin(0), global_end(0), global_size(0),
44 global_begin_finest(0), global_end_finest(0), global_size_finest(0),
45 boundary(EmptyGrid)
46 {}
47
48 GlobalIndices(const GlobalIndices& other) :
49 local_begin(other.local_begin), local_end(other.local_end), local_size(other.local_size),
50 global_begin(other.global_begin), global_end(other.global_end), global_size(other.global_size),
51 global_begin_finest(other.global_begin_finest), global_end_finest(other.global_end_finest), global_size_finest(other.global_size_finest),
52 boundary(other.boundary)
53 {}
54
55 Index& LocalBegin() {return local_begin;}
56 Index& LocalEnd() {return local_end;}
57 Index& LocalSize() {return local_size;}
58
59 const Index& LocalBegin() const {return local_begin;}
60 const Index& LocalEnd() const {return local_end;}
61 const Index& LocalSize() const {return local_size;}
62
63 Index& GlobalBegin() {return global_begin;}
64 Index& GlobalEnd() {return global_end;}
65 Index& GlobalSize() {return global_size;}
66
67 const Index& GlobalBegin() const {return global_begin;}
68 const Index& GlobalEnd() const {return global_end;}
69 const Index& GlobalSize() const {return global_size;}
70
71 Index& GlobalBeginFinest() {return global_begin_finest;}
72 Index& GlobalEndFinest() {return global_end_finest;}
73 Index& GlobalSizeFinest() {return global_size_finest;}
74
75 const Index& GlobalBeginFinest() const {return global_begin_finest;}
76 const Index& GlobalEndFinest() const {return global_end_finest;}
77 const Index& GlobalSizeFinest() const {return global_size_finest;}
78
79 BT& BoundaryType() {return boundary;}
80 const BT& BoundaryType() const {return boundary;}
81
82private:
83 Index local_begin, local_end, local_size;
84 Index global_begin, global_end, global_size;
85 Index global_begin_finest, global_end_finest, global_size_finest;
86 BT boundary;
87};
88
89class LocalIndices
90{
91public:
92 LocalIndices() :
93 begin(0), end(0), size(0), size_total(0),
94 halo_begin_1(0), halo_end_1(0), halo_size_1(0),
95 halo_begin_2(0), halo_end_2(0), halo_size_2(0),
96 boundary_begin_1(0), boundary_end_1(0), boundary_size_1(0),
97 boundary_begin_2(0), boundary_end_2(0), boundary_size_2(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 {}
107
108 Index& Begin() {return begin;} ///< Index of first local grid point
109 Index& End() {return end;} ///< Index of first non-local grid point
110 Index& Size() {return size;} ///< Local grid size excluding halo
111 Index& SizeTotal() {return size_total;} ///< Local grid size including halo and boundary
112
113 const Index& Begin() const {return begin;} ///< Index of first local grid point
114 const Index& End() const {return end;} ///< Index of first non-local grid point
115 const Index& Size() const {return size;} ///< Local grid size excluding halo
116 const Index& SizeTotal() const {return size_total;} ///< Local grid size including halo and boundary
117
118 Index& HaloBegin1() {return halo_begin_1;} ///< Index of first halo point
119 Index& HaloEnd1() {return halo_end_1;} ///< Index of first non-halo point
120 Index& HaloSize1() {return halo_size_1;} ///< Size of halo
121
122 Index& HaloBegin2() {return halo_begin_2;} ///< Index of first halo point
123 Index& HaloEnd2() {return halo_end_2;} ///< Index of first non-halo point
124 Index& HaloSize2() {return halo_size_2;} ///< Size of halo
125
126 const Index& HaloBegin1() const {return halo_begin_1;} ///< Index of first halo point
127 const Index& HaloEnd1() const {return halo_end_1;} ///< Index of first non-halo point
128 const Index& HaloSize1() const {return halo_size_1;} ///< Size of halo
129
130 const Index& HaloBegin2() const {return halo_begin_2;} ///< Index of first halo point
131 const Index& HaloEnd2() const {return halo_end_2;} ///< Index of first non-halo point
132 const Index& HaloSize2() const {return halo_size_2;} ///< Size of halo
133
134 Index& BoundaryBegin1() {return boundary_begin_1;} ///< Index of first boundary point
135 Index& BoundaryEnd1() {return boundary_end_1;} ///< Index of first non-boundary point
136 Index& BoundarySize1() {return boundary_size_1;} ///< Size of boundary
137
138 Index& BoundaryBegin2() {return boundary_begin_2;} ///< Index of first boundary point
139 Index& BoundaryEnd2() {return boundary_end_2;} ///< Index of first non-boundary point
140 Index& BoundarySize2() {return boundary_size_2;} ///< Size of boundary
141
142 const Index& BoundaryBegin1() const {return boundary_begin_1;} ///< Index of first boundary point
143 const Index& BoundaryEnd1() const {return boundary_end_1;} ///< Index of first non-boundary point
144 const Index& BoundarySize1() const {return boundary_size_1;} ///< Size of boundary
145
146 const Index& BoundaryBegin2() const {return boundary_begin_2;} ///< Index of first boundary point
147 const Index& BoundaryEnd2() const {return boundary_end_2;} ///< Index of first non-boundary point
148 const Index& BoundarySize2() const {return boundary_size_2;} ///< Size of boundary
149
150private:
151 Index begin, end, size, size_total;
152 Index halo_begin_1, halo_end_1, halo_size_1;
153 Index halo_begin_2, halo_end_2, halo_size_2;
154 Index boundary_begin_1, boundary_end_1, boundary_size_1;
155 Index boundary_begin_2, boundary_end_2, boundary_size_2;
156};
157
158class SpatialExtent
159{
160public:
161 SpatialExtent() :
162 begin(0.0),
163 end(0.0),
164 size(0.0),
165 mesh_width(0.0)
166 {}
167
168 SpatialExtent(const SpatialExtent& other) :
169 begin(other.begin),
170 end(other.end),
171 size(other.size),
172 mesh_width(other.mesh_width)
173 {}
174
175 Vector& Begin() {return begin;}
176 const Vector& Begin() const {return begin;}
177
178 Vector& End() {return end;}
179 const Vector& End() const {return end;}
180
181 Vector& Size() {return size;}
182 const Vector& Size() const {return size;}
183
184 Vector& MeshWidth() {return mesh_width;}
185 const Vector& MeshWidth() const {return mesh_width;}
186
187private:
188 Vector begin, end, size;
189 Vector mesh_width;
190};
191
192}
193
194#endif /* GRID_PROPERTIES_HPP_ */
Note: See TracBrowser for help on using the repository browser.