-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStencil.h
145 lines (117 loc) · 4.88 KB
/
Stencil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#ifndef _STENCIL_H_
#define _STENCIL_H_
#include "Parameters.h"
/** Stencil class
*
* Abstrat class for the definition of stencils and operations on the grids
*/
template<class FlowField>
class FieldStencil {
protected:
const Parameters & _parameters; //! Reference to the parameters
public:
FieldStencil ( const Parameters & parameters ): _parameters(parameters){}
virtual ~FieldStencil(){}
/** Performs the operation in 2D in a given position
* @param flowField Flow field data
* @param parameters Parameters of the problem
* @param i Position in the x direction
* @param j Position in the y direction
*/
virtual void apply ( FlowField & flowField, int i, int j) = 0;
/** Performs the operation in 3D in a given position
* @param flowField Flow field data
* @param parameters Parameters of the problem
* @param i Position in the x direction
* @param j Position in the y direction
* @param k Position in the z direction
*/
virtual void apply ( FlowField & flowField, int i, int j, int k) = 0;
};
/** Interface for operations on the global (or parallel) boundary
*/
template<class FlowField>
class BoundaryStencil {
protected:
const Parameters & _parameters; //! Reference to the parameters
public:
BoundaryStencil ( const Parameters & parameters ): _parameters(parameters){}
virtual ~BoundaryStencil(){}
/** Represents an operation in the left wall of a 2D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
*/
virtual void applyLeftWall (FlowField & flowField, int i, int j) = 0;
/** Represents an operation in the right wall of a 2D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
*/
virtual void applyRightWall (FlowField & flowField, int i, int j) = 0;
/** Represents an operation in the bottom wall of a 2D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
*/
virtual void applyBottomWall (FlowField & flowField, int i, int j) = 0;
/** Represents an operation in the top wall of a 2D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
*/
virtual void applyTopWall (FlowField & flowField, int i, int j) = 0;
/** Represents an operation in the left wall of a 3D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
* @param k Index in the z direction
*/
virtual void applyLeftWall (FlowField & flowField, int i, int j, int k) = 0;
/** Represents an operation in the right wall of a 3D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
* @param k Index in the z direction
*/
virtual void applyRightWall (FlowField & flowField, int i, int j, int k) = 0;
/** Represents an operation in the bottom wall of a 3D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
* @param k Index in the z direction
*/
virtual void applyBottomWall (FlowField & flowField, int i, int j, int k) = 0;
/** Represents an operation in the top wall of a 3D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
* @param k Index in the z direction
*/
virtual void applyTopWall (FlowField & flowField, int i, int j, int k) = 0;
/** Represents an operation in the front wall of a 3D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
* @param k Index in the z direction
*/
virtual void applyFrontWall (FlowField & flowField, int i, int j, int k) = 0;
/** Represents an operation in the back wall of a 3D domain.
*
* @param flowField State of the flow field
* @param i Index in the x direction
* @param j Index in the y direction
* @param k Index in the z direction
*/
virtual void applyBackWall (FlowField & flowField, int i, int j, int k) = 0;
};
#endif