Made ETICS blocks work with the vector structures

This commit is contained in:
Yohai Meiron 2020-10-28 21:40:46 -04:00
parent 54231b8537
commit b6c55a30da

View file

@ -184,7 +184,7 @@ public:
#ifdef ETICS
if (grapite_active_search_flag) {
int n_act_loc;
grapite_active_search(min_t, ind_act_loc, &n_act_loc);
grapite_active_search(min_t, ind_act_loc.data(), &n_act_loc);
if (myRank > 0)
for (int i=0; i<n_act_loc; i++)
ind_act_loc[i] += myRank*n_loc;
@ -196,7 +196,7 @@ public:
displs[0] = 0;
for (int i=1; i<n_proc; i++)
displs[i]=displs[i-1]+n_act_arr[i-1];
MPI_Allgatherv(ind_act_loc, n_act_loc, MPI_INT, ind_act, n_act_arr, displs, MPI_INT, MPI_COMM_WORLD);
MPI_Allgatherv(ind_act_loc.data(), n_act_loc, MPI_INT, ind_act.data(), n_act_arr, displs, MPI_INT, MPI_COMM_WORLD);
} else
#endif
{
@ -396,14 +396,14 @@ int main(int argc, char *argv[])
#ifdef ETICS
double etics_length_scale;
if (myRank == rootRank) etics_length_scale = grapite_get_length_scale(N, m, (double(*)[3])x, (double(*)[3])v); // We don't want all ranks to do it, because they need to write a file and might confuse each other
if (myRank == rootRank) etics_length_scale = grapite_get_length_scale(N, m.data(), (double(*)[3])x.data(), (double(*)[3])v.data()); // We don't want all ranks to do it, because they need to write a file and might confuse each other
MPI_Bcast(&etics_length_scale, 1, MPI_DOUBLE, rootRank, MPI_COMM_WORLD);
grapite_set_length_scale(etics_length_scale);
int grapite_cep_index = grapite_get_cep_index();
if (grapite_cep_index >= 0) {
double3 xcm, vcm, xdc, vdc;
grapite_calc_center(N, m, (double(*)[3])x, (double(*)[3])v, xcm, vcm, xdc, vdc);
grapite_calc_center(N, m.data(), (double(*)[3])x.data(), (double(*)[3])v.data(), xcm, vcm, xdc, vdc);
x[grapite_cep_index] = xdc;
v[grapite_cep_index] = vdc;
grapite_update_cep(time_cur, xdc, vdc, zeros, zeros);
@ -447,7 +447,7 @@ int main(int argc, char *argv[])
if (grapite_cep_index >= 0) {
double3 xcm, vcm, xdc, vdc;
grapite_calc_center(N, m, (double(*)[3])x, (double(*)[3])v, xcm, vcm, xdc, vdc);
grapite_calc_center(N, m.data(), (double(*)[3])x.data(), (double(*)[3])v.data(), xcm, vcm, xdc, vdc);
x[grapite_cep_index] = xdc;
v[grapite_cep_index] = vdc;
grapite_update_cep(time_cur, xdc, vdc, a[grapite_cep_index], adot[grapite_cep_index]);