From a0c5fc8c2bdd75dca73c7684ae229a8a0443c90d Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Fri, 30 Aug 2024 13:09:20 +0100 Subject: [PATCH] Move alltransblock to globals::alltransitions --- globals.h | 4 +++- input.cc | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/globals.h b/globals.h index 43fef43e2..f8625b466 100644 --- a/globals.h +++ b/globals.h @@ -254,9 +254,11 @@ inline int opacity_case{}; // 0 grey, 1 for Fe-grp dependence. inline std::vector ion_alpha_sp; // alpha_sp for each ion and temperature table value -inline int nlines{-1}; +inline LevelTransition *alltransitions{}; + inline std::vector elements; +inline int nlines{-1}; inline const TransitionLine *linelist{}; inline std::vector bflist; diff --git a/input.cc b/input.cc index db6acd72a..fee71c357 100644 --- a/input.cc +++ b/input.cc @@ -484,7 +484,6 @@ void add_transitions_to_unsorted_linelist(const int element, const int ion, cons lineindex = lineindex_initial; if (pass == 1) { int alltransindex = 0; - LevelTransition *alltransblock{}; #ifdef MPI_ON MPI_Barrier(MPI_COMM_WORLD); @@ -494,19 +493,19 @@ void add_transitions_to_unsorted_linelist(const int element, const int ion, cons auto size = static_cast(noderank_trans * sizeof(LevelTransition)); int disp_unit = sizeof(LevelTransition); - MPI_Win_allocate_shared(size, disp_unit, MPI_INFO_NULL, globals::mpi_comm_node, &alltransblock, + MPI_Win_allocate_shared(size, disp_unit, MPI_INFO_NULL, globals::mpi_comm_node, &globals::alltransitions, &win_alltransblock); - MPI_Win_shared_query(win_alltransblock, 0, &size, &disp_unit, &alltransblock); + MPI_Win_shared_query(win_alltransblock, 0, &size, &disp_unit, &globals::alltransitions); #else alltransblock = static_cast(malloc(totupdowntrans * sizeof(LevelTransition))); #endif for (int level = 0; level < nlevelsmax; level++) { - globals::elements[element].ions[ion].levels[level].downtrans = &alltransblock[alltransindex]; + globals::elements[element].ions[ion].levels[level].downtrans = &globals::alltransitions[alltransindex]; alltransindex += get_ndowntrans(element, ion, level); - globals::elements[element].ions[ion].levels[level].uptrans = &alltransblock[alltransindex]; + globals::elements[element].ions[ion].levels[level].uptrans = &globals::alltransitions[alltransindex]; alltransindex += get_nuptrans(element, ion, level); set_ndowntrans(element, ion, level, 0);