source: src/grid/grid_iterator_suite.cpp@ f57182

Last change on this file since f57182 was f57182, checked in by Julian Iseringhausen <isering@…>, 13 years ago

Open boundary conditions.

Conflicts:

lib/vmg/src/Makefile.am
lib/vmg/src/base/factory.cpp
lib/vmg/test/unit_test/library/dirichlet_fas_lr_mpi.cpp

  • Property mode set to 100644
File size: 4.5 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_iterator_suite.cpp
21 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
22 * @date Thu Apr 21 18:52:43 2011
23 *
24 * @brief Some useful grid iterators.
25 *
26 */
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32#include "grid/grid_iterator_suite.hpp"
33#include "grid/grid_properties.hpp"
34
35using namespace VMG;
36
37void GridIteratorSuite::SetSubgrids(const LocalIndices& local_)
38{
39 local.SetBounds(local_.Begin(), local_.End());
40 local_finer.SetBounds(local_.FinerBegin(), local_.FinerEnd());
41 complete_grid.SetBounds(0, local_.SizeTotal());
42 inner_local_grid.SetBounds(local_.Begin()+local_.HaloSize1(), local_.End()-local_.HaloSize2());
43
44 halo_1.X().SetBounds(Index(local_.HaloBegin1().X(), 0, 0),
45 Index(local_.HaloEnd1().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
46
47 halo_1.Y().SetBounds(Index(local_.Begin().X(), local_.HaloBegin1().Y(), 0),
48 Index(local_.End().X(), local_.HaloEnd1().Y(), local_.SizeTotal().Z()));
49
50 halo_1.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.HaloBegin1().Z()),
51 Index(local_.End().X(), local_.End().Y(), local_.HaloEnd1().Z()));
52
53 halo_2.X().SetBounds(Index(local_.HaloBegin2().X(), 0, 0),
54 Index(local_.HaloEnd2().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
55
56 halo_2.Y().SetBounds(Index(local_.Begin().X(), local_.HaloBegin2().Y(), 0),
57 Index(local_.End().X(), local_.HaloEnd2().Y(), local_.SizeTotal().Z()));
58
59 halo_2.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.HaloBegin2().Z()),
60 Index(local_.End().X(), local_.End().Y(), local_.HaloEnd2().Z()));
61
62 boundary_1.X().SetBounds(Index(local_.BoundaryBegin1().X(), 0, 0),
63 Index(local_.BoundaryEnd1().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
64
65 boundary_1.Y().SetBounds(Index(local_.Begin().X(), local_.BoundaryBegin1().Y(), 0),
66 Index(local_.End().X(), local_.BoundaryEnd1().Y(), local_.SizeTotal().Z()));
67
68 boundary_1.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.BoundaryBegin1().Z()),
69 Index(local_.End().X(), local_.End().Y(), local_.BoundaryEnd1().Z()));
70
71 boundary_2.X().SetBounds(Index(local_.BoundaryBegin2().X(), 0, 0),
72 Index(local_.BoundaryEnd2().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
73
74
75 boundary_2.Y().SetBounds(Index(local_.Begin().X(), local_.BoundaryBegin2().Y(), 0),
76 Index(local_.End().X(), local_.BoundaryEnd2().Y(), local_.SizeTotal().Z()));
77
78 boundary_2.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.BoundaryBegin2().Z()),
79 Index(local_.End().X(), local_.End().Y(), local_.BoundaryEnd2().Z()));
80
81 near_boundary_1.X().SetBounds(Index(local_.Begin().X(), 0, 0),
82 Index(local_.Begin().X()+local_.HaloSize1().X(),
83 local_.SizeTotal().Y(),
84 local_.SizeTotal().Z()));
85
86 near_boundary_1.Y().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), 0),
87 Index(local_.End().X(),
88 local_.Begin().Y()+local_.HaloSize1().Y(),
89 local_.SizeTotal().Z()));
90
91 near_boundary_1.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.Begin().Z()),
92 Index(local_.End().X(),
93 local_.End().Y(),
94 local_.Begin().Z()+local_.HaloSize1().Z()));
95
96 near_boundary_2.X().SetBounds(Index(local_.End().X()-local_.HaloSize2().X(),
97 0,
98 0),
99 Index(local_.End().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
100
101 near_boundary_2.Y().SetBounds(Index(local_.Begin().X(),
102 local_.End().Y()-local_.HaloSize2().Y(),
103 0),
104 Index(local_.End().X(), local_.End().Y(), local_.SizeTotal().Z()));
105
106 near_boundary_2.Z().SetBounds(Index(local_.Begin().X(),
107 local_.Begin().Y(),
108 local_.End().Z()-local_.HaloSize2().Z()),
109 local_.End());
110}
Note: See TracBrowser for help on using the repository browser.