@@ -14,13 +14,6 @@ enum CenterStyle
1414 CC , // cell-centered
1515};
1616
17- enum Component
18- {
19- X,
20- Y,
21- Z
22- };
23-
2417/* Centering Guide
2518 X Y Z
2619 -------------
@@ -31,15 +24,19 @@ CC | ccc ccc ccc
3124*/
3225
3326template <typename PATCH >
34- Double3 get_pos (PATCH patch, Int3 index, int style, int comp = X )
27+ Double3 get_pos (PATCH patch, Int3 index, int style, int component = - 1 )
3528{
29+ if (component == -1 ) {
30+ assert (style == NC || style == CC );
31+ }
32+
3633 Double3 pos;
37- for (int a = 0 ; a < 3 ; a ++) {
38- if (style == CC || (style == FC && a != comp ) ||
39- (style == EC && a == comp )) {
40- pos[a ] = patch.get_cc (index[a ], a );
34+ for (int d = 0 ; d < 3 ; d ++) {
35+ if (style == CC || (style == FC && d != component ) ||
36+ (style == EC && d == component )) {
37+ pos[d ] = patch.get_cc (index[d ], d );
4138 } else {
42- pos[a ] = patch.get_nc (index[a ], a );
39+ pos[d ] = patch.get_nc (index[d ], d );
4340 }
4441 }
4542 return pos;
@@ -51,9 +48,9 @@ struct Centerer
5148 Centerer (CenterStyle style) : style(style) {}
5249
5350 template <typename PATCH >
54- inline Double3 get_pos (PATCH patch, Int3 index, int comp = X ) const
51+ inline Double3 get_pos (PATCH patch, Int3 index, int component = - 1 ) const
5552 {
56- return centering::get_pos (patch, index, style, comp );
53+ return centering::get_pos (patch, index, style, component );
5754 }
5855};
5956
0 commit comments