Skip to content

Commit

Permalink
Move alltransblock to globals::alltransitions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Aug 30, 2024
1 parent 2e1cbe9 commit a0c5fc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,11 @@ inline int opacity_case{}; // 0 grey, 1 for Fe-grp dependence.

inline std::vector<float> ion_alpha_sp; // alpha_sp for each ion and temperature table value

inline int nlines{-1};
inline LevelTransition *alltransitions{};

inline std::vector<Element> elements;

inline int nlines{-1};
inline const TransitionLine *linelist{};
inline std::vector<BFListEntry> bflist;

Expand Down
9 changes: 4 additions & 5 deletions input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -494,19 +493,19 @@ void add_transitions_to_unsorted_linelist(const int element, const int ion, cons

auto size = static_cast<MPI_Aint>(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<LevelTransition *>(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);
Expand Down

0 comments on commit a0c5fc8

Please sign in to comment.