Loading...
Searching...
No Matches
grid_transfer_constant.hpp
Go to the documentation of this file.
1
2#pragma once
3#include "dense/vec.hpp"
5
7
8KOKKOS_INLINE_FUNCTION
10{
11 for ( int r = -1; r <= 1; ++r )
12 {
13 const auto index_offset = ( r + 1 ) * 7;
14 offsets[index_offset + 0] = { -1, 0, r };
15 offsets[index_offset + 1] = { -1, 1, r };
16 offsets[index_offset + 2] = { 0, 1, r };
17 offsets[index_offset + 3] = { 1, 0, r };
18 offsets[index_offset + 4] = { 1, -1, r };
19 offsets[index_offset + 5] = { 0, -1, r };
20 offsets[index_offset + 6] = { 0, 0, r };
21 }
22}
23
24template < typename ScalarType >
25KOKKOS_INLINE_FUNCTION constexpr ScalarType prolongation_constant_weight(
26 const int x_fine,
27 const int y_fine,
28 const int r_fine,
29 const int x_coarse,
30 const int y_coarse,
31 const int r_coarse )
32{
33 if ( r_fine == 2 * r_coarse )
34 {
35 if ( x_fine == 2 * x_coarse && y_fine == 2 * y_coarse )
36 {
37 return 1.0;
38 }
39
40 if ( y_fine == 2 * y_coarse && ( x_fine - 2 * x_coarse == 1 || x_fine - 2 * x_coarse == -1 ) )
41 {
42 return 0.5;
43 }
44
45 if ( x_fine == 2 * x_coarse && ( y_fine - 2 * y_coarse == 1 || y_fine - 2 * y_coarse == -1 ) )
46 {
47 return 0.5;
48 }
49
50 if ( x_fine - 2 * x_coarse == -1 && y_fine - 2 * y_coarse == 1 )
51 {
52 return 0.5;
53 }
54
55 if ( x_fine - 2 * x_coarse == 1 && y_fine - 2 * y_coarse == -1 )
56 {
57 return 0.5;
58 }
59 }
60
61 if ( r_fine - 2 * r_coarse == -1 || r_fine - 2 * r_coarse == 1 )
62 {
63 if ( x_fine == 2 * x_coarse && y_fine == 2 * y_coarse )
64 {
65 return 0.5;
66 }
67
68 if ( y_fine == 2 * y_coarse && ( x_fine - 2 * x_coarse == 1 || x_fine - 2 * x_coarse == -1 ) )
69 {
70 return 0.25;
71 }
72
73 if ( x_fine == 2 * x_coarse && ( y_fine - 2 * y_coarse == 1 || y_fine - 2 * y_coarse == -1 ) )
74 {
75 return 0.25;
76 }
77
78 if ( x_fine - 2 * x_coarse == -1 && y_fine - 2 * y_coarse == 1 )
79 {
80 return 0.25;
81 }
82
83 if ( x_fine - 2 * x_coarse == 1 && y_fine - 2 * y_coarse == -1 )
84 {
85 return 0.25;
86 }
87 }
88
89 return 0.0;
90}
91
92} // namespace terra::fe::wedge::shell
Definition grid_transfer_constant.hpp:6
constexpr void prolongation_constant_fine_grid_stencil_offsets_at_coarse_vertex(dense::Vec< int, 3 >(&offsets)[21])
Definition grid_transfer_constant.hpp:9
constexpr ScalarType prolongation_constant_weight(const int x_fine, const int y_fine, const int r_fine, const int x_coarse, const int y_coarse, const int r_coarse)
Definition grid_transfer_constant.hpp:25
Definition vec.hpp:9