source: src/interface/interface.cpp@ e7e9a6

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

Major vmg update.

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

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[48b662]1/**
2 * @file interface.cpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:55:48 2011
5 *
6 * @brief VMG::Interface
7 *
8 */
9
10#ifdef HAVE_CONFIG_H
11#include <config.h>
12#endif
13
[dfed1c]14#include <algorithm>
[48b662]15#include <cmath>
16
17#include "base/helper.hpp"
18#include "interface/interface.hpp"
19
20using namespace VMG;
21
[dfed1c]22void Interface::InitInterface(const Vector& box_offset, const vmg_float& box_size,
23 const int& coarseningSteps, const vmg_float& alpha)
[48b662]24{
[dfed1c]25 Index size_factor_max = 1;
26 int num_cells;
[48b662]27
[dfed1c]28 const Vector box_center = box_offset + 0.5 * box_size;
[48b662]29
[dfed1c]30 for (int i=levelMax; i>=levelMin; --i) {
[48b662]31
32 global.push_back(GlobalIndices());
33 extent.push_back(SpatialExtent());
34
[dfed1c]35 num_cells = Helper::intpow(2, i);
[48b662]36
[dfed1c]37 extent.back().SizeFactor() = 1;
38 extent.back().Size() = box_size;
39 extent.back().Begin() = box_offset;
40 extent.back().End() = box_offset + box_size;
41 extent.back().MeshWidth() = box_size / num_cells;
[48b662]42
[dfed1c]43 global.back().SizeGlobal() = num_cells + 1;
44 global.back().SizeLocal() = num_cells + 1;
45 global.back().BeginFinest() = 0;
46 global.back().BeginLocal() = 0;
47 global.back().EndLocal() = num_cells + 1;
[48b662]48
[dfed1c]49 if (i == levelMax) {
50 global.back().SizeFinest() = num_cells + 1;
51 global.back().EndFinest() = num_cells + 1;
52 global.back().BoundaryType() = GlobalMax;
[48b662]53 }else {
[dfed1c]54 global.back().SizeFinest() = (++global.rbegin())->SizeFinest();
55 global.back().EndFinest() = (++global.rbegin())->SizeFinest();
[48b662]56 global.back().BoundaryType() = GlobalCoarsened;
[dfed1c]57 }
[48b662]58
59 }
60
[dfed1c]61 for (int i=0; i<3; ++i)
62 if (bc[i] == Periodic)
63 for (unsigned int j=0; j<global.size(); ++j) {
64 global[j].SizeGlobal()[i] -= 1;
65 global[j].SizeFinest()[i] -= Helper::intpow(2, j);
66 global[j].SizeLocal()[i] -= 1;
67 global[j].EndLocal()[i] -= 1;
68 global[j].EndFinest()[i] -= Helper::intpow(2, j);
69 }
[48b662]70
71 levelMin = levelMax - global.size() + 1;
72}
Note: See TracBrowser for help on using the repository browser.