24 uint i_block, uint i_cell, uint j_block, uint j_cell,
38 for (uint
k=0;
k<
WID* (blocks_per_dim + 2); ++
k){
57 for (
unsigned int k_block = 0; k_block<blocks_per_dim;k_block++){
58 for (uint k_cell=0; k_cell<
WID; ++k_cell){
64 const int target_gk_l = (int)((v_l - intersection_min)/
intersection_dk);
65 const int target_gk_r = (int)((v_r - intersection_min)/
intersection_dk);
67 for(
int gk = target_gk_l; gk <= target_gk_r; gk++){
73 const Real v_int_norm_l = (v_int_l - v_l)/
dv;
75 const Real v_int_norm_r = (v_int_r - v_l)/
dv;
79 Real target_density_l =
80 v_int_norm_l * a[k_block *
WID + k_cell][0] +
81 v_int_norm_l * v_int_norm_l * a[k_block *
WID + k_cell][1];
82 Real target_density_r =
83 v_int_norm_r * a[k_block *
WID + k_cell][0] +
84 v_int_norm_r * v_int_norm_r * a[k_block *
WID + k_cell][1];
87 Real target_density_l =
88 v_int_norm_l * a[k_block *
WID + k_cell][0] +
89 v_int_norm_l * v_int_norm_l * a[k_block *
WID + k_cell][1] +
90 v_int_norm_l * v_int_norm_l * v_int_norm_l * a[k_block *
WID + k_cell][2];
91 Real target_density_r =
92 v_int_norm_r * a[k_block *
WID + k_cell][0] +
93 v_int_norm_r * v_int_norm_r * a[k_block *
WID + k_cell][1] +
94 v_int_norm_r * v_int_norm_r * v_int_norm_r * a[k_block *
WID + k_cell][2];
97 if ( gk >= 0 && gk <= blocks_per_dim *
WID )
98 target[gk +
WID] += target_density_r - target_density_l;
103 for (
unsigned int k_block = 0; k_block<blocks_per_dim;k_block++){
104 for (uint
k=0;
k<
WID; ++
k){
105 values[k_block *
WID +
k +
WID] = target[k_block *
WID +
k +
WID];
112 const int dv = 20000;
114 const int blocks_per_dim_x = 10;
115 const int blocks_per_dim_y = 10;
116 const int blocks_per_dim_z = 50;
119 Real *values =
new Real[(blocks_per_dim_z+2) * blocks_per_dim_x * blocks_per_dim_z *
WID3];
127 const int iterations=1000;
130 for (uint
k=0;
k< (blocks_per_dim_z+2) * blocks_per_dim_x * blocks_per_dim_z *
WID3; ++
k){
135 for(
int i=0;
i < blocks_per_dim_x *
WID;
i++){
136 for(
int j=0;
j < blocks_per_dim_y *
WID;
j++){
137 for(
int k=0;
k < blocks_per_dim_z *
WID;
k++){
139 if (v >
v_min + 0.8 * (blocks_per_dim_z *
WID *
dv) &&
140 v <
v_min + 0.9 * (blocks_per_dim_z *
WID *
dv))
147 for(
int step = 0; step < iterations; step++){
150 for(
int i = 0;
i < blocks_per_dim_x *
WID;
i++){
151 for(
int j = 0;
j < blocks_per_dim_y *
WID;
j++){
152 const int i_block =
i /
WID;
153 const int i_cell =
i %
WID;
154 const int j_block =
j /
WID;
155 const int j_cell =
j %
WID;
158 i_block, i_cell, j_block, j_cell,
void propagate(Real *values, uint blocks_per_dim, Real v_min, Real dv, uint i_block, uint i_cell, uint j_block, uint j_cell, Real intersection, Real intersection_di, Real intersection_dj, Real intersection_dk)