Commit 3acf8ab5 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

switches some temp variables to int

parent bb869885
......@@ -61,14 +61,28 @@ public:
particles_field_computer(const std::array<size_t,3>& in_field_grid_dim,
const std::pair<int,int>& in_current_partitions,
const interpolator_class& in_interpolator,
const std::array<real_number,3>& in_spatial_box_width, const std::array<real_number,3>& in_spatial_box_offset,
const std::array<real_number,3>& in_spatial_box_width,
const std::array<real_number,3>& in_spatial_box_offset,
const std::array<real_number,3>& in_box_step_width)
: field_grid_dim({{int(in_field_grid_dim[0]),int(in_field_grid_dim[1]),int(in_field_grid_dim[2])}}), current_partition_interval(in_current_partitions),
: field_grid_dim({{int(in_field_grid_dim[0]),
int(in_field_grid_dim[1]),
int(in_field_grid_dim[2])}}),
current_partition_interval(in_current_partitions),
interpolator(in_interpolator),
spatial_box_width(in_spatial_box_width), spatial_box_offset(in_spatial_box_offset), box_step_width(in_box_step_width){
spatial_box_width(in_spatial_box_width),
spatial_box_offset(in_spatial_box_offset),
box_step_width(in_box_step_width){
deriv[IDXC_X] = 0;
deriv[IDXC_Y] = 0;
deriv[IDXC_Z] = 0;
DEBUG_MSG("particles_field_computer::particles_field_computer, spatial_box_offset is %g %g %g\n",
spatial_box_offset[0], spatial_box_offset[1], spatial_box_offset[2]);
DEBUG_MSG("particles_field_computer::particles_field_computer, spatial_box_width is %g %g %g\n",
spatial_box_width[0], spatial_box_width[1], spatial_box_width[2]);
DEBUG_MSG("particles_field_computer::particles_field_computer, box_step_width is %g %g %g\n",
box_step_width[0], box_step_width[1], box_step_width[2]);
DEBUG_MSG("particles_field_computer::particles_field_computer, field_grid_dim is %ld %ld %ld\n",
field_grid_dim[0], field_grid_dim[1], field_grid_dim[2]);
}
////////////////////////////////////////////////////////////////////////
......@@ -110,12 +124,12 @@ public:
real_number get_norm_pos_in_cell(const real_number in_pos, const int idx_pos) const {
const real_number shifted_pos = in_pos - spatial_box_offset[idx_pos];
DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, shifted_pos = %g\n", shifted_pos);
const real_number nb_box_repeat = floor(shifted_pos/spatial_box_width[idx_pos]);
DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, nb_box_repeat = %g\n", nb_box_repeat);
const int nb_box_repeat = int(floor(shifted_pos/spatial_box_width[idx_pos]));
DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, nb_box_repeat = %d\n", nb_box_repeat);
const real_number pos_in_box = shifted_pos - nb_box_repeat*spatial_box_width[idx_pos];
DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, pos_in_box = %g\n", pos_in_box);
const real_number cell_idx = floor(pos_in_box/box_step_width[idx_pos]);
DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, cell_idx = %g\n", cell_idx);
const int cell_idx = int(floor(pos_in_box/box_step_width[idx_pos]));
DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, cell_idx = %d\n", cell_idx);
const real_number pos_in_cell = (pos_in_box - cell_idx*box_step_width[idx_pos]) / box_step_width[idx_pos];
DEBUG_MSG("particles_field_computer::get_norm_pos_in_cell, pos_in_cell = %g\n", pos_in_cell);
assert(0 <= pos_in_cell && pos_in_cell < 1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment