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 3ebde94 commit 0353028
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 5 additions & 1 deletion globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,13 @@ inline int opacity_case{}; // 0 grey, 1 for Fe-grp dependence.

// ATOMIC DATA

inline int nlines{-1};
inline std::vector<float> ion_alpha_sp; // alpha_sp for each ion and temperature table value

inline LevelTransition *alltransitions{};

inline std::vector<Element> elements;

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

Expand Down
11 changes: 5 additions & 6 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)));
globals::alltransitions = 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 0353028

Please sign in to comment.