Commit 906f54b2 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

rename IDX_X etc to IDXC_X etc

I think it's more obvious when we talk about "index of component" and
"index of variable" what is meant, rather than having "FIELD_IDX" and
plain "IDX".
parent 94f89084
Pipeline #37203 canceled with stage
...@@ -62,15 +62,15 @@ public: ...@@ -62,15 +62,15 @@ public:
/// (4 / \tau) \sum_j W_\ell ( | x^i - x^j | ) (p^i \cdot p^j)p^j /// (4 / \tau) \sum_j W_\ell ( | x^i - x^j | ) (p^i \cdot p^j)p^j
/// \f] /// \f]
/// ///
const double dot_product = (pos_part1[3+IDX_X]*pos_part2[3+IDX_X] + const double dot_product = (pos_part1[3+IDXC_X]*pos_part2[3+IDXC_X] +
pos_part1[3+IDX_Y]*pos_part2[3+IDX_Y] + pos_part1[3+IDXC_Y]*pos_part2[3+IDXC_Y] +
pos_part1[3+IDX_Z]*pos_part2[3+IDX_Z]); pos_part1[3+IDXC_Z]*pos_part2[3+IDXC_Z]);
rhs_part1[3+IDX_X] += pos_part2[3+IDX_X] * 4 * ww * dot_product; rhs_part1[3+IDXC_X] += pos_part2[3+IDXC_X] * 4 * ww * dot_product;
rhs_part1[3+IDX_Y] += pos_part2[3+IDX_Y] * 4 * ww * dot_product; rhs_part1[3+IDXC_Y] += pos_part2[3+IDXC_Y] * 4 * ww * dot_product;
rhs_part1[3+IDX_Z] += pos_part2[3+IDX_Z] * 4 * ww * dot_product; rhs_part1[3+IDXC_Z] += pos_part2[3+IDXC_Z] * 4 * ww * dot_product;
rhs_part2[3+IDX_X] += pos_part1[3+IDX_X] * 4 * ww * dot_product; rhs_part2[3+IDXC_X] += pos_part1[3+IDXC_X] * 4 * ww * dot_product;
rhs_part2[3+IDX_Y] += pos_part1[3+IDX_Y] * 4 * ww * dot_product; rhs_part2[3+IDXC_Y] += pos_part1[3+IDXC_Y] * 4 * ww * dot_product;
rhs_part2[3+IDX_Z] += pos_part1[3+IDX_Z] * 4 * ww * dot_product; rhs_part2[3+IDXC_Z] += pos_part1[3+IDXC_Z] * 4 * ww * dot_product;
} }
bool isEnable() const { bool isEnable() const {
......
This diff is collapsed.
...@@ -11,21 +11,21 @@ class p2p_tree{ ...@@ -11,21 +11,21 @@ class p2p_tree{
std::array<long int,3> nb_cell_levels; std::array<long int,3> nb_cell_levels;
long int get_cell_coord_x_from_index(const long int index) const{ long int get_cell_coord_x_from_index(const long int index) const{
return index % nb_cell_levels[IDX_X]; return index % nb_cell_levels[IDXC_X];
} }
long int get_cell_coord_y_from_index(const long int index) const{ long int get_cell_coord_y_from_index(const long int index) const{
return (index % (nb_cell_levels[IDX_X]*nb_cell_levels[IDX_Y])) return (index % (nb_cell_levels[IDXC_X]*nb_cell_levels[IDXC_Y]))
/ nb_cell_levels[IDX_X]; / nb_cell_levels[IDXC_X];
} }
long int get_cell_coord_z_from_index(const long int index) const{ long int get_cell_coord_z_from_index(const long int index) const{
return index / (nb_cell_levels[IDX_X]*nb_cell_levels[IDX_Y]); return index / (nb_cell_levels[IDXC_X]*nb_cell_levels[IDXC_Y]);
} }
long int get_cell_idx(const long int idx_x, const long int idx_y, long int get_cell_idx(const long int idx_x, const long int idx_y,
const long int idx_z) const { const long int idx_z) const {
return (((idx_z*nb_cell_levels[IDX_Y])+idx_y)*nb_cell_levels[IDX_X])+idx_x; return (((idx_z*nb_cell_levels[IDXC_Y])+idx_y)*nb_cell_levels[IDXC_X])+idx_x;
} }
public: public:
...@@ -61,11 +61,11 @@ public: ...@@ -61,11 +61,11 @@ public:
long int neigh_x_pbc = neigh_x+idx_x; long int neigh_x_pbc = neigh_x+idx_x;
ShiftType shift_x = 0; ShiftType shift_x = 0;
if(neigh_x_pbc < 0){ if(neigh_x_pbc < 0){
neigh_x_pbc += nb_cell_levels[IDX_X]; neigh_x_pbc += nb_cell_levels[IDXC_X];
shift_x = 1; shift_x = 1;
} }
else if(nb_cell_levels[IDX_X] <= neigh_x_pbc){ else if(nb_cell_levels[IDXC_X] <= neigh_x_pbc){
neigh_x_pbc -= nb_cell_levels[IDX_X]; neigh_x_pbc -= nb_cell_levels[IDXC_X];
shift_x = -1; shift_x = -1;
} }
...@@ -73,11 +73,11 @@ public: ...@@ -73,11 +73,11 @@ public:
long int neigh_y_pbc = neigh_y+idx_y; long int neigh_y_pbc = neigh_y+idx_y;
ShiftType shift_y = 0; ShiftType shift_y = 0;
if(neigh_y_pbc < 0){ if(neigh_y_pbc < 0){
neigh_y_pbc += nb_cell_levels[IDX_Y]; neigh_y_pbc += nb_cell_levels[IDXC_Y];
shift_y = 1; shift_y = 1;
} }
else if(nb_cell_levels[IDX_Y] <= neigh_y_pbc){ else if(nb_cell_levels[IDXC_Y] <= neigh_y_pbc){
neigh_y_pbc -= nb_cell_levels[IDX_Y]; neigh_y_pbc -= nb_cell_levels[IDXC_Y];
shift_y = -1; shift_y = -1;
} }
...@@ -85,11 +85,11 @@ public: ...@@ -85,11 +85,11 @@ public:
long int neigh_z_pbc = neigh_z+idx_z; long int neigh_z_pbc = neigh_z+idx_z;
ShiftType shift_z = 0; ShiftType shift_z = 0;
if(neigh_z_pbc < 0){ if(neigh_z_pbc < 0){
neigh_z_pbc += nb_cell_levels[IDX_Z]; neigh_z_pbc += nb_cell_levels[IDXC_Z];
shift_z = 1; shift_z = 1;
} }
else if(nb_cell_levels[IDX_Z] <= neigh_z_pbc){ else if(nb_cell_levels[IDXC_Z] <= neigh_z_pbc){
neigh_z_pbc -= nb_cell_levels[IDX_Z]; neigh_z_pbc -= nb_cell_levels[IDXC_Z];
shift_z = -1; shift_z = -1;
} }
...@@ -102,9 +102,9 @@ public: ...@@ -102,9 +102,9 @@ public:
output[nbNeighbors] = &(iter->second); output[nbNeighbors] = &(iter->second);
output_indexes[nbNeighbors] = idx_neigh; output_indexes[nbNeighbors] = idx_neigh;
shift[nbNeighbors][IDX_X] = shift_x; shift[nbNeighbors][IDXC_X] = shift_x;
shift[nbNeighbors][IDX_Y] = shift_y; shift[nbNeighbors][IDXC_Y] = shift_y;
shift[nbNeighbors][IDX_Z] = shift_z; shift[nbNeighbors][IDXC_Z] = shift_z;
nbNeighbors += 1; nbNeighbors += 1;
} }
......
...@@ -127,7 +127,7 @@ public: ...@@ -127,7 +127,7 @@ public:
assert(partition_interval_size_per_proc[idx_proc_involved] != 0); assert(partition_interval_size_per_proc[idx_proc_involved] != 0);
} }
assert(int(field_grid_dim[IDX_Z]) == partition_interval_offset_per_proc[nb_processes_involved]); assert(int(field_grid_dim[IDXC_Z]) == partition_interval_offset_per_proc[nb_processes_involved]);
} }
virtual ~particles_distr_mpi(){} virtual ~particles_distr_mpi(){}
...@@ -522,11 +522,11 @@ public: ...@@ -522,11 +522,11 @@ public:
partsize_t partOffset = 0; partsize_t partOffset = 0;
for(int idxPartition = 0 ; idxPartition < current_partition_size ; ++idxPartition){ for(int idxPartition = 0 ; idxPartition < current_partition_size ; ++idxPartition){
for(partsize_t idx = 0 ; idx < current_my_nb_particles_per_partition[idxPartition] ; ++idx){ for(partsize_t idx = 0 ; idx < current_my_nb_particles_per_partition[idxPartition] ; ++idx){
const int partition_level = in_computer.pbc_field_layer((*inout_positions_particles)[(idx+partOffset)*size_particle_positions+IDX_Z], IDX_Z); const int partition_level = in_computer.pbc_field_layer((*inout_positions_particles)[(idx+partOffset)*size_particle_positions+IDXC_Z], IDXC_Z);
variable_used_only_in_assert(partition_level); variable_used_only_in_assert(partition_level);
assert(partition_level == current_partition_interval.first + idxPartition assert(partition_level == current_partition_interval.first + idxPartition
|| partition_level == (current_partition_interval.first + idxPartition-1+int(field_grid_dim[IDX_Z]))%int(field_grid_dim[IDX_Z]) || partition_level == (current_partition_interval.first + idxPartition-1+int(field_grid_dim[IDXC_Z]))%int(field_grid_dim[IDXC_Z])
|| partition_level == (current_partition_interval.first + idxPartition+1)%int(field_grid_dim[IDX_Z])); || partition_level == (current_partition_interval.first + idxPartition+1)%int(field_grid_dim[IDXC_Z]));
} }
partOffset += current_my_nb_particles_per_partition[idxPartition]; partOffset += current_my_nb_particles_per_partition[idxPartition];
} }
...@@ -543,11 +543,11 @@ public: ...@@ -543,11 +543,11 @@ public:
// Find particles outside my interval // Find particles outside my interval
const partsize_t nbOutLower = particles_utils::partition_extra<partsize_t, size_particle_positions>(&(*inout_positions_particles)[0], current_my_nb_particles_per_partition[0], const partsize_t nbOutLower = particles_utils::partition_extra<partsize_t, size_particle_positions>(&(*inout_positions_particles)[0], current_my_nb_particles_per_partition[0],
[&](const real_number val[]){ [&](const real_number val[]){
const int partition_level = in_computer.pbc_field_layer(val[IDX_Z], IDX_Z); const int partition_level = in_computer.pbc_field_layer(val[IDXC_Z], IDXC_Z);
assert(partition_level == current_partition_interval.first assert(partition_level == current_partition_interval.first
|| partition_level == (current_partition_interval.first-1+int(field_grid_dim[IDX_Z]))%int(field_grid_dim[IDX_Z]) || partition_level == (current_partition_interval.first-1+int(field_grid_dim[IDXC_Z]))%int(field_grid_dim[IDXC_Z])
|| partition_level == (current_partition_interval.first+1)%int(field_grid_dim[IDX_Z])); || partition_level == (current_partition_interval.first+1)%int(field_grid_dim[IDXC_Z]));
const bool isLower = partition_level == (current_partition_interval.first-1+int(field_grid_dim[IDX_Z]))%int(field_grid_dim[IDX_Z]); const bool isLower = partition_level == (current_partition_interval.first-1+int(field_grid_dim[IDXC_Z]))%int(field_grid_dim[IDXC_Z]);
return isLower; return isLower;
}, },
[&](const partsize_t idx1, const partsize_t idx2){ [&](const partsize_t idx1, const partsize_t idx2){
...@@ -569,11 +569,11 @@ public: ...@@ -569,11 +569,11 @@ public:
&(*inout_positions_particles)[(current_offset_particles_for_partition[current_partition_size-1]+offesetOutLow)*size_particle_positions], &(*inout_positions_particles)[(current_offset_particles_for_partition[current_partition_size-1]+offesetOutLow)*size_particle_positions],
myTotalNbParticles - (current_offset_particles_for_partition[current_partition_size-1]+offesetOutLow), myTotalNbParticles - (current_offset_particles_for_partition[current_partition_size-1]+offesetOutLow),
[&](const real_number val[]){ [&](const real_number val[]){
const int partition_level = in_computer.pbc_field_layer(val[IDX_Z], IDX_Z); const int partition_level = in_computer.pbc_field_layer(val[IDXC_Z], IDXC_Z);
assert(partition_level == (current_partition_interval.second-1) assert(partition_level == (current_partition_interval.second-1)
|| partition_level == ((current_partition_interval.second-1)-1+int(field_grid_dim[IDX_Z]))%int(field_grid_dim[IDX_Z]) || partition_level == ((current_partition_interval.second-1)-1+int(field_grid_dim[IDXC_Z]))%int(field_grid_dim[IDXC_Z])
|| partition_level == ((current_partition_interval.second-1)+1)%int(field_grid_dim[IDX_Z])); || partition_level == ((current_partition_interval.second-1)+1)%int(field_grid_dim[IDXC_Z]));
const bool isUpper = (partition_level == ((current_partition_interval.second-1)+1)%int(field_grid_dim[IDX_Z])); const bool isUpper = (partition_level == ((current_partition_interval.second-1)+1)%int(field_grid_dim[IDXC_Z]));
return !isUpper; return !isUpper;
}, },
[&](const partsize_t idx1, const partsize_t idx2){ [&](const partsize_t idx1, const partsize_t idx2){
...@@ -822,7 +822,7 @@ public: ...@@ -822,7 +822,7 @@ public:
myTotalNbParticles,current_partition_size, myTotalNbParticles,current_partition_size,
current_my_nb_particles_per_partition, current_offset_particles_for_partition.get(), current_my_nb_particles_per_partition, current_offset_particles_for_partition.get(),
[&](const real_number& z_pos){ [&](const real_number& z_pos){
const int partition_level = in_computer.pbc_field_layer(z_pos, IDX_Z); const int partition_level = in_computer.pbc_field_layer(z_pos, IDXC_Z);
assert(current_partition_interval.first <= partition_level && partition_level < current_partition_interval.second); assert(current_partition_interval.first <= partition_level && partition_level < current_partition_interval.second);
return partition_level - current_partition_interval.first; return partition_level - current_partition_interval.first;
}, },
...@@ -845,7 +845,7 @@ public: ...@@ -845,7 +845,7 @@ public:
assert(current_my_nb_particles_per_partition[idxPartition] == assert(current_my_nb_particles_per_partition[idxPartition] ==
current_offset_particles_for_partition[idxPartition+1] - current_offset_particles_for_partition[idxPartition]); current_offset_particles_for_partition[idxPartition+1] - current_offset_particles_for_partition[idxPartition]);
for(partsize_t idx = current_offset_particles_for_partition[idxPartition] ; idx < current_offset_particles_for_partition[idxPartition+1] ; ++idx){ for(partsize_t idx = current_offset_particles_for_partition[idxPartition] ; idx < current_offset_particles_for_partition[idxPartition+1] ; ++idx){
assert(in_computer.pbc_field_layer((*inout_positions_particles)[idx*size_particle_positions+IDX_Z], IDX_Z)-current_partition_interval.first == idxPartition); assert(in_computer.pbc_field_layer((*inout_positions_particles)[idx*size_particle_positions+IDXC_Z], IDXC_Z)-current_partition_interval.first == idxPartition);
} }
} }
} }
......
...@@ -44,9 +44,9 @@ public: ...@@ -44,9 +44,9 @@ public:
: 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), 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[IDX_X] = 0; deriv[IDXC_X] = 0;
deriv[IDX_Y] = 0; deriv[IDXC_Y] = 0;
deriv[IDX_Z] = 0; deriv[IDXC_Z] = 0;
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -82,25 +82,25 @@ public: ...@@ -82,25 +82,25 @@ public:
TIMEZONE("particles_field_computer::apply_computation"); TIMEZONE("particles_field_computer::apply_computation");
for(partsize_t idxPart = 0 ; idxPart < nb_particles ; ++idxPart){ for(partsize_t idxPart = 0 ; idxPart < nb_particles ; ++idxPart){
const real_number reltv_x = get_norm_pos_in_cell(particles_positions[idxPart*size_particle_positions+IDX_X], IDX_X); const real_number reltv_x = get_norm_pos_in_cell(particles_positions[idxPart*size_particle_positions+IDXC_X], IDXC_X);
const real_number reltv_y = get_norm_pos_in_cell(particles_positions[idxPart*size_particle_positions+IDX_Y], IDX_Y); const real_number reltv_y = get_norm_pos_in_cell(particles_positions[idxPart*size_particle_positions+IDXC_Y], IDXC_Y);
const real_number reltv_z = get_norm_pos_in_cell(particles_positions[idxPart*size_particle_positions+IDX_Z], IDX_Z); const real_number reltv_z = get_norm_pos_in_cell(particles_positions[idxPart*size_particle_positions+IDXC_Z], IDXC_Z);
typename interpolator_class::real_number typename interpolator_class::real_number
bx[interp_neighbours*2+2], bx[interp_neighbours*2+2],
by[interp_neighbours*2+2], by[interp_neighbours*2+2],
bz[interp_neighbours*2+2]; bz[interp_neighbours*2+2];
interpolator.compute_beta(deriv[IDX_X], reltv_x, bx); interpolator.compute_beta(deriv[IDXC_X], reltv_x, bx);
interpolator.compute_beta(deriv[IDX_Y], reltv_y, by); interpolator.compute_beta(deriv[IDXC_Y], reltv_y, by);
interpolator.compute_beta(deriv[IDX_Z], reltv_z, bz); interpolator.compute_beta(deriv[IDXC_Z], reltv_z, bz);
const int partGridIdx_x = pbc_field_layer(particles_positions[idxPart*size_particle_positions+IDX_X], IDX_X); const int partGridIdx_x = pbc_field_layer(particles_positions[idxPart*size_particle_positions+IDXC_X], IDXC_X);
const int partGridIdx_y = pbc_field_layer(particles_positions[idxPart*size_particle_positions+IDX_Y], IDX_Y); const int partGridIdx_y = pbc_field_layer(particles_positions[idxPart*size_particle_positions+IDXC_Y], IDXC_Y);
const int partGridIdx_z = pbc_field_layer(particles_positions[idxPart*size_particle_positions+IDX_Z], IDX_Z); const int partGridIdx_z = pbc_field_layer(particles_positions[idxPart*size_particle_positions+IDXC_Z], IDXC_Z);
assert(0 <= partGridIdx_x && partGridIdx_x < int(field_grid_dim[IDX_X])); assert(0 <= partGridIdx_x && partGridIdx_x < int(field_grid_dim[IDXC_X]));
assert(0 <= partGridIdx_y && partGridIdx_y < int(field_grid_dim[IDX_Y])); assert(0 <= partGridIdx_y && partGridIdx_y < int(field_grid_dim[IDXC_Y]));
assert(0 <= partGridIdx_z && partGridIdx_z < int(field_grid_dim[IDX_Z])); assert(0 <= partGridIdx_z && partGridIdx_z < int(field_grid_dim[IDXC_Z]));
const int interp_limit_mx = partGridIdx_x-interp_neighbours; const int interp_limit_mx = partGridIdx_x-interp_neighbours;
const int interp_limit_x = partGridIdx_x+interp_neighbours+1; const int interp_limit_x = partGridIdx_x+interp_neighbours+1;
...@@ -113,8 +113,8 @@ public: ...@@ -113,8 +113,8 @@ public:
int nb_z_intervals; int nb_z_intervals;
if((partGridIdx_z-interp_neighbours) < 0){ if((partGridIdx_z-interp_neighbours) < 0){
assert(partGridIdx_z+interp_neighbours+1 < int(field_grid_dim[IDX_Z])); assert(partGridIdx_z+interp_neighbours+1 < int(field_grid_dim[IDXC_Z]));
interp_limit_mz[0] = std::max(current_partition_interval.first, partGridIdx_z-interp_neighbours+int(field_grid_dim[IDX_Z])); interp_limit_mz[0] = std::max(current_partition_interval.first, partGridIdx_z-interp_neighbours+int(field_grid_dim[IDXC_Z]));
interp_limit_z[0] = current_partition_interval.second-1; interp_limit_z[0] = current_partition_interval.second-1;
interp_limit_mz[1] = std::max(0, current_partition_interval.first); interp_limit_mz[1] = std::max(0, current_partition_interval.first);
...@@ -122,12 +122,12 @@ public: ...@@ -122,12 +122,12 @@ public:
nb_z_intervals = 2; nb_z_intervals = 2;
} }
else if(int(field_grid_dim[IDX_Z]) <= (partGridIdx_z+interp_neighbours+1)){ else if(int(field_grid_dim[IDXC_Z]) <= (partGridIdx_z+interp_neighbours+1)){
interp_limit_mz[0] = std::max(current_partition_interval.first, partGridIdx_z-interp_neighbours); interp_limit_mz[0] = std::max(current_partition_interval.first, partGridIdx_z-interp_neighbours);
interp_limit_z[0] = std::min(int(field_grid_dim[IDX_Z])-1,current_partition_interval.second-1); interp_limit_z[0] = std::min(int(field_grid_dim[IDXC_Z])-1,current_partition_interval.second-1);
interp_limit_mz[1] = std::max(0, current_partition_interval.first); interp_limit_mz[1] = std::max(0, current_partition_interval.first);
interp_limit_z[1] = std::min(partGridIdx_z+interp_neighbours+1-int(field_grid_dim[IDX_Z]), current_partition_interval.second-1); interp_limit_z[1] = std::min(partGridIdx_z+interp_neighbours+1-int(field_grid_dim[IDXC_Z]), current_partition_interval.second-1);
nb_z_intervals = 2; nb_z_intervals = 2;
} }
...@@ -139,19 +139,19 @@ public: ...@@ -139,19 +139,19 @@ public:
for(int idx_inter = 0 ; idx_inter < nb_z_intervals ; ++idx_inter){ for(int idx_inter = 0 ; idx_inter < nb_z_intervals ; ++idx_inter){
for(int idx_z = interp_limit_mz[idx_inter] ; idx_z <= interp_limit_z[idx_inter] ; ++idx_z ){ for(int idx_z = interp_limit_mz[idx_inter] ; idx_z <= interp_limit_z[idx_inter] ; ++idx_z ){
const int idx_z_pbc = (idx_z + field_grid_dim[IDX_Z])%field_grid_dim[IDX_Z]; const int idx_z_pbc = (idx_z + field_grid_dim[IDXC_Z])%field_grid_dim[IDXC_Z];
assert(current_partition_interval.first <= idx_z_pbc && idx_z_pbc < current_partition_interval.second); assert(current_partition_interval.first <= idx_z_pbc && idx_z_pbc < current_partition_interval.second);
assert(((idx_z+field_grid_dim[IDX_Z]-interp_limit_mz_bz)%field_grid_dim[IDX_Z]) < interp_neighbours*2+2); assert(((idx_z+field_grid_dim[IDXC_Z]-interp_limit_mz_bz)%field_grid_dim[IDXC_Z]) < interp_neighbours*2+2);
for(int idx_x = interp_limit_mx ; idx_x <= interp_limit_x ; ++idx_x ){ for(int idx_x = interp_limit_mx ; idx_x <= interp_limit_x ; ++idx_x ){
const int idx_x_pbc = (idx_x + field_grid_dim[IDX_X])%field_grid_dim[IDX_X]; const int idx_x_pbc = (idx_x + field_grid_dim[IDXC_X])%field_grid_dim[IDXC_X];
assert(idx_x-interp_limit_mx < interp_neighbours*2+2); assert(idx_x-interp_limit_mx < interp_neighbours*2+2);
for(int idx_y = interp_limit_my ; idx_y <= interp_limit_y ; ++idx_y ){ for(int idx_y = interp_limit_my ; idx_y <= interp_limit_y ; ++idx_y ){
const int idx_y_pbc = (idx_y + field_grid_dim[IDX_Y])%field_grid_dim[IDX_Y]; const int idx_y_pbc = (idx_y + field_grid_dim[IDXC_Y])%field_grid_dim[IDXC_Y];
assert(idx_y-interp_limit_my < interp_neighbours*2+2); assert(idx_y-interp_limit_my < interp_neighbours*2+2);
const real_number coef = (bz[((idx_z+field_grid_dim[IDX_Z]-interp_limit_mz_bz)%field_grid_dim[IDX_Z])] const real_number coef = (bz[((idx_z+field_grid_dim[IDXC_Z]-interp_limit_mz_bz)%field_grid_dim[IDXC_Z])]
* by[idx_y-interp_limit_my] * by[idx_y-interp_limit_my]
* bx[idx_x-interp_limit_mx]); * bx[idx_x-interp_limit_mx]);
......
...@@ -240,7 +240,7 @@ public: ...@@ -240,7 +240,7 @@ public:
&split_particles_positions[previousOffset*size_particle_positions], &split_particles_positions[previousOffset*size_particle_positions],
partsize_t(load_splitter.getMySize())-previousOffset, partsize_t(load_splitter.getMySize())-previousOffset,
[&](const real_number val[]){ [&](const real_number val[]){
const real_number shiftPos = val[IDX_Z]-spatial_box_offset; const real_number shiftPos = val[IDXC_Z]-spatial_box_offset;
const real_number nbRepeat = floor(shiftPos/spatial_box_width); const real_number nbRepeat = floor(shiftPos/spatial_box_width);
const real_number posInBox = shiftPos - (spatial_box_width*nbRepeat); const real_number posInBox = shiftPos - (spatial_box_width*nbRepeat);
return posInBox < limitPartitionShifted; return posInBox < limitPartitionShifted;
......
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
particles_inner_computer_class in_computer_particules_inner, particles_inner_computer_class in_computer_particules_inner,
const int in_current_iteration = 1) const int in_current_iteration = 1)
: mpi_com(in_mpi_com), : mpi_com(in_mpi_com),
current_partition_interval({in_local_field_offset[IDX_Z], in_local_field_offset[IDX_Z] + in_local_field_dims[IDX_Z]}), current_partition_interval({in_local_field_offset[IDXC_Z], in_local_field_offset[IDXC_Z] + in_local_field_dims[IDXC_Z]}),
partition_interval_size(current_partition_interval.second - current_partition_interval.first), partition_interval_size(current_partition_interval.second - current_partition_interval.first),
interpolator(), interpolator(),
particles_distr(in_mpi_com, current_partition_interval,field_grid_dim), particles_distr(in_mpi_com, current_partition_interval,field_grid_dim),
...@@ -100,7 +100,7 @@ public: ...@@ -100,7 +100,7 @@ public:
my_nb_particles = particles_input.getLocalNbParticles(); my_nb_particles = particles_input.getLocalNbParticles();
for(partsize_t idx_part = 0 ; idx_part < my_nb_particles ; ++idx_part){ // TODO remove me for(partsize_t idx_part = 0 ; idx_part < my_nb_particles ; ++idx_part){ // TODO remove me
const int partition_level = computer.pbc_field_layer(my_particles_positions[idx_part*size_particle_positions+IDX_Z], IDX_Z); const int partition_level = computer.pbc_field_layer(my_particles_positions[idx_part*size_particle_positions+IDXC_Z], IDXC_Z);
variable_used_only_in_assert(partition_level); variable_used_only_in_assert(partition_level);
assert(partition_level >= current_partition_interval.first); assert(partition_level >= current_partition_interval.first);
assert(partition_level < current_partition_interval.second); assert(partition_level < current_partition_interval.second);
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
particles_utils::partition_extra_z<partsize_t, size_particle_positions>(&my_particles_positions[0], my_nb_particles, partition_interval_size, particles_utils::partition_extra_z<partsize_t, size_particle_positions>(&my_particles_positions[0], my_nb_particles, partition_interval_size,
current_my_nb_particles_per_partition.get(), current_offset_particles_for_partition.get(), current_my_nb_particles_per_partition.get(), current_offset_particles_for_partition.get(),
[&](const real_number& z_pos){ [&](const real_number& z_pos){
const int partition_level = computer.pbc_field_layer(z_pos, IDX_Z); const int partition_level = computer.pbc_field_layer(z_pos, IDXC_Z);
assert(current_partition_interval.first <= partition_level && partition_level < current_partition_interval.second); assert(current_partition_interval.first <= partition_level && partition_level < current_partition_interval.second);
return partition_level - current_partition_interval.first; return partition_level - current_partition_interval.first;
}, },
...@@ -128,7 +128,7 @@ public: ...@@ -128,7 +128,7 @@ public:
assert(current_my_nb_particles_per_partition[idxPartition] == assert(current_my_nb_particles_per_partition[idxPartition] ==
current_offset_particles_for_partition[idxPartition+1] - current_offset_particles_for_partition[idxPartition]); current_offset_particles_for_partition[idxPartition+1] - current_offset_particles_for_partition[idxPartition]);
for(partsize_t idx = current_offset_particles_for_partition[idxPartition] ; idx < current_offset_particles_for_partition[idxPartition+1] ; ++idx){ for(partsize_t idx = current_offset_particles_for_partition[idxPartition] ; idx < current_offset_particles_for_partition[idxPartition+1] ; ++idx){
assert(computer.pbc_field_layer(my_particles_positions[idx*size_particle_positions+IDX_Z], IDX_Z)-current_partition_interval.first == idxPartition); assert(computer.pbc_field_layer(my_particles_positions[idx*size_particle_positions+IDXC_Z], IDXC_Z)-current_partition_interval.first == idxPartition);
} }
} }
} }
...@@ -331,9 +331,9 @@ public: ...@@ -331,9 +331,9 @@ public:
void checkNan() const { // TODO remove void checkNan() const { // TODO remove
for(partsize_t idx_part = 0 ; idx_part < my_nb_particles ; ++idx_part){ // TODO remove me for(partsize_t idx_part = 0 ; idx_part < my_nb_particles ; ++idx_part){ // TODO remove me
assert(std::isnan(my_particles_positions[idx_part*size_particle_positions+IDX_X]) == false); assert(std::isnan(my_particles_positions[idx_part*size_particle_positions+IDXC_X]) == false);
assert(std::isnan(my_particles_positions[idx_part*size_particle_positions+IDX_Y]) == false); assert(std::isnan(my_particles_positions[idx_part*size_particle_positions+IDXC_Y]) == false);
assert(std::isnan(my_particles_positions[idx_part*size_particle_positions+IDX_Z]) == false); assert(std::isnan(my_particles_positions[idx_part*size_particle_positions+IDXC_Z]) == false);
for(int idx_rhs = 0 ; idx_rhs < my_particles_rhs.size() ; ++idx_rhs){ for(int idx_rhs = 0 ; idx_rhs < my_particles_rhs.size() ; ++idx_rhs){
for(int idx_rhs_val = 0 ; idx_rhs_val < size_particle_rhs ; ++idx_rhs_val){ for(int idx_rhs_val = 0 ; idx_rhs_val < size_particle_rhs ; ++idx_rhs_val){
......
...@@ -130,21 +130,21 @@ struct particles_system_build_container { ...@@ -130,21 +130,21 @@ struct particles_system_build_container {
// The size of the field grid (global size) all_size seems // The size of the field grid (global size) all_size seems
std::array<size_t,3> field_grid_dim; std::array<size_t,3> field_grid_dim;
field_grid_dim[IDX_X] = fs_field->rlayout->sizes[FIELD_IDX_X];// nx field_grid_dim[IDXC_X] = fs_field->rlayout->sizes[IDXV_X];// nx
field_grid_dim[IDX_Y] = fs_field->rlayout->sizes[FIELD_IDX_Y];// nx field_grid_dim[IDXC_Y] = fs_field->rlayout->sizes[IDXV_Y];// nx
field_grid_dim[IDX_Z] = fs_field->rlayout->sizes[FIELD_IDX_Z];// nz field_grid_dim[IDXC_Z] = fs_field->rlayout->sizes[IDXV_Z];// nz
// The size of the local field grid (the field nodes that belong to current process) // The size of the local field grid (the field nodes that belong to current process)
std::array<size_t,3> local_field_dims; std::array<size_t,3> local_field_dims;
local_field_dims[IDX_X] = fs_field->rlayout->subsizes[FIELD_IDX_X]; local_field_dims[IDXC_X] = fs_field->rlayout->subsizes[IDXV_X];
local_field_dims[IDX_Y] = fs_field->rlayout->subsizes[FIELD_IDX_Y]; local_field_dims[IDXC_Y] = fs_field->rlayout->subsizes[IDXV_Y];
local_field_dims[IDX_Z] = fs_field->rlayout->subsizes[FIELD_IDX_Z]; local_field_dims[IDXC_Z] = fs_field->rlayout->subsizes[IDXV_Z];
// The offset of the local field grid // The offset of the local field grid
std::array<size_t,3> local_field_offset; std::array<size_t,3> local_field_offset;
local_field_offset[IDX_X] = fs_field->rlayout->starts[FIELD_IDX_X]; local_field_offset[IDXC_X] = fs_field->rlayout->starts[IDXV_X];
local_field_offset[IDX_Y] = fs_field->rlayout->starts[FIELD_IDX_Y]; local_field_offset[IDXC_Y] = fs_field->rlayout->starts[IDXV_Y];
local_field_offset[IDX_Z] = fs_field->rlayout->starts[FIELD_IDX_Z]; local_field_offset[IDXC_Z] = fs_field->rlayout->starts[IDXV_Z];
// Retreive split from fftw to know processes that have no work // Retreive split from fftw to know processes that have no work
...@@ -152,51 +152,51 @@ struct particles_system_build_container { ...@@ -152,51 +152,51 @@ struct particles_system_build_container {
AssertMpi(MPI_Comm_rank(mpi_comm, &my_rank)); AssertMpi(MPI_Comm_rank(mpi_comm, &my_rank));
AssertMpi(MPI_Comm_size(mpi_comm, &nb_processes)); AssertMpi(MPI_Comm_size(mpi_comm, &nb_processes));
const int split_step = (int(field_grid_dim[IDX_Z])+nb_processes-1)/nb_processes; const int split_step = (int(field_grid_dim[IDXC_Z])+nb_processes-1)/nb_processes;
const int nb_processes_involved = (int(field_grid_dim[IDX_Z])+split_step-1)/split_step; const int nb_processes_involved = (int(field_grid_dim[IDXC_Z])+split_step-1)/split_step;
assert((my_rank < nb_processes_involved && local_field_dims[IDX_Z] != 0) assert((my_rank < nb_processes_involved && local_field_dims[IDXC_Z] != 0)
|| (nb_processes_involved <= my_rank && local_field_dims[IDX_Z] == 0)); || (nb_processes_involved <= my_rank && local_field_dims[IDXC_Z] == 0));
assert(nb_processes_involved <= int(field_grid_dim[IDX_Z])); assert(nb_processes_involved <= int(field_grid_dim[IDXC_Z]));
// Make the idle processes starting from the limit (and not 0 as set by fftw) // Make the idle processes starting from the limit (and not 0 as set by fftw)
if(nb_processes_involved <= my_rank){ if(nb_processes_involved <= my_rank){
local_field_offset[IDX_Z] = field_grid_dim[IDX_Z]; local_field_offset[IDXC_Z] = field_grid_dim[IDXC_Z];
} }
// Ensure that 1D partitioning is used // Ensure that 1D partitioning is used
{ {
assert(local_field_offset[IDX_X] == 0); assert(local_field_offset[IDXC_X] == 0);
assert(local_field_offset[IDX_Y] == 0); assert(local_field_offset[IDXC_Y] == 0);
assert(local_field_dims[IDX_X] == field_grid_dim[IDX_X]); assert(local_field_dims[IDXC_X] == field_grid_dim[IDXC_X]);
assert(local_field_dims[IDX_Y] == field_grid_dim[IDX_Y]); assert(local_field_dims[IDXC_Y] == field_grid_dim[IDXC_Y]);
assert(my_rank >= nb_processes_involved || ((my_rank == 0 && local_field_offset[IDX_Z] == 0)