source: src/base/stencil.hpp@ 2fad0e0

Last change on this file since 2fad0e0 was 48b662, checked in by Olaf Lenz <olenz@…>, 14 years ago

Moved files in scafacos_fcs one level up.

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

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * @file stencil.hpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:25:05 2011
5 *
6 * @brief VMG::Stencil
7 *
8 */
9
10
11#ifndef STENCIL_HPP_
12#define STENCIL_HPP_
13
14#include <cstddef>
15#include <vector>
16
17#include "base/defs.hpp"
18
19namespace VMG
20{
21
22class Grid;
23class Index;
24
25struct Displacement
26{
27 int m, n, o;
28 vmg_float val;
29
30 Displacement(int m_, int n_, int o_, vmg_float val_)
31 {
32 m = m_;
33 n = n_;
34 o = o_;
35 val = val_;
36 }
37};
38
39class Stencil
40{
41public:
42 Stencil(vmg_float diag_) :
43 diag(diag_)
44 {}
45
46 Stencil(const Stencil& stencil_)
47 {
48 this->diag = stencil_.GetDiag();
49
50 for (Stencil::iterator iter=stencil_.begin(); iter!=stencil_.end(); iter++)
51 this->push_back(*iter);
52 }
53
54 typedef std::vector<Displacement>::const_iterator iterator;
55
56 void push_back(const Displacement& val)
57 {
58 disp.push_back(val);
59 }
60
61 iterator begin() const
62 {
63 return disp.begin();
64 }
65
66 iterator end() const
67 {
68 return disp.end();
69 }
70
71 size_t size() const
72 {
73 return disp.size();
74 }
75
76 vmg_float GetDiag() const {return diag;}
77 void SetDiag(vmg_float diag_) {diag = diag_;}
78
79 void Clear()
80 {
81 disp.clear();
82 }
83
84 vmg_float Apply(const Grid& grid, const Index& index) const;
85
86private:
87 std::vector<Displacement> disp;
88 vmg_float diag;
89};
90
91}
92
93#endif /* STENCIL_HPP_ */
Note: See TracBrowser for help on using the repository browser.