source: ThirdParty/vmg/src/grid/grid_iterator_suite.cpp@ 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: 4.4 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 <libvmg_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 complete_grid.SetBounds(0, local_.SizeTotal());
41 inner_local_grid.SetBounds(local_.Begin()+local_.HaloSize1(), local_.End()-local_.HaloSize2());
42
43 halo_1.X().SetBounds(Index(local_.HaloBegin1().X(), 0, 0),
44 Index(local_.HaloEnd1().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
45
46 halo_1.Y().SetBounds(Index(local_.Begin().X(), local_.HaloBegin1().Y(), 0),
47 Index(local_.End().X(), local_.HaloEnd1().Y(), local_.SizeTotal().Z()));
48
49 halo_1.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.HaloBegin1().Z()),
50 Index(local_.End().X(), local_.End().Y(), local_.HaloEnd1().Z()));
51
52 halo_2.X().SetBounds(Index(local_.HaloBegin2().X(), 0, 0),
53 Index(local_.HaloEnd2().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
54
55 halo_2.Y().SetBounds(Index(local_.Begin().X(), local_.HaloBegin2().Y(), 0),
56 Index(local_.End().X(), local_.HaloEnd2().Y(), local_.SizeTotal().Z()));
57
58 halo_2.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.HaloBegin2().Z()),
59 Index(local_.End().X(), local_.End().Y(), local_.HaloEnd2().Z()));
60
61 boundary_1.X().SetBounds(Index(local_.BoundaryBegin1().X(), 0, 0),
62 Index(local_.BoundaryEnd1().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
63
64 boundary_1.Y().SetBounds(Index(local_.Begin().X(), local_.BoundaryBegin1().Y(), 0),
65 Index(local_.End().X(), local_.BoundaryEnd1().Y(), local_.SizeTotal().Z()));
66
67 boundary_1.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.BoundaryBegin1().Z()),
68 Index(local_.End().X(), local_.End().Y(), local_.BoundaryEnd1().Z()));
69
70 boundary_2.X().SetBounds(Index(local_.BoundaryBegin2().X(), 0, 0),
71 Index(local_.BoundaryEnd2().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
72
73
74 boundary_2.Y().SetBounds(Index(local_.Begin().X(), local_.BoundaryBegin2().Y(), 0),
75 Index(local_.End().X(), local_.BoundaryEnd2().Y(), local_.SizeTotal().Z()));
76
77 boundary_2.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.BoundaryBegin2().Z()),
78 Index(local_.End().X(), local_.End().Y(), local_.BoundaryEnd2().Z()));
79
80 near_boundary_1.X().SetBounds(Index(local_.Begin().X(), 0, 0),
81 Index(local_.Begin().X()+local_.HaloSize1().X(),
82 local_.SizeTotal().Y(),
83 local_.SizeTotal().Z()));
84
85 near_boundary_1.Y().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), 0),
86 Index(local_.End().X(),
87 local_.Begin().Y()+local_.HaloSize1().Y(),
88 local_.SizeTotal().Z()));
89
90 near_boundary_1.Z().SetBounds(Index(local_.Begin().X(), local_.Begin().Y(), local_.Begin().Z()),
91 Index(local_.End().X(),
92 local_.End().Y(),
93 local_.Begin().Z()+local_.HaloSize1().Z()));
94
95 near_boundary_2.X().SetBounds(Index(local_.End().X()-local_.HaloSize2().X(),
96 0,
97 0),
98 Index(local_.End().X(), local_.SizeTotal().Y(), local_.SizeTotal().Z()));
99
100 near_boundary_2.Y().SetBounds(Index(local_.Begin().X(),
101 local_.End().Y()-local_.HaloSize2().Y(),
102 0),
103 Index(local_.End().X(), local_.End().Y(), local_.SizeTotal().Z()));
104
105 near_boundary_2.Z().SetBounds(Index(local_.Begin().X(),
106 local_.Begin().Y(),
107 local_.End().Z()-local_.HaloSize2().Z()),
108 local_.End());
109}
Note: See TracBrowser for help on using the repository browser.