Skip to content

Commit

Permalink
Remove float *photoion_xs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Aug 30, 2024
1 parent ea77e26 commit ccd1246
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ struct EnergyLevel {
int nuptrans{0};
int ndowntrans{0};
PhotoionTarget *phixstargets{}; // pointer to table of target states and probabilities
float *photoion_xs{}; // Pointer to a lookup-table providing photoionisation cross-sections for this level.
int phixsstart{-1}; // index to start of photoionisation cross-sections table in global::allphixs
int nphixstargets{0}; // length of phixstargets array:
float stat_weight{0.}; // Statistical weight of this level.
Expand Down
14 changes: 5 additions & 9 deletions input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ void read_phixs_data_table(std::fstream &phixsfile, const int nphixspoints_input
*mem_usage_phixs += globals::NPHIXSPOINTS * sizeof(float);
globals::elements[element].ions[lowerion].levels[lowerlevel].phixsstart = tmpallphixs.size();
tmpallphixs.resize(tmpallphixs.size() + globals::NPHIXSPOINTS);
globals::elements[element].ions[lowerion].levels[lowerlevel].photoion_xs =
static_cast<float *>(malloc(globals::NPHIXSPOINTS * sizeof(float)));
assert_always(globals::elements[element].ions[lowerion].levels[lowerlevel].photoion_xs != nullptr);

auto *levelphixstable = tmpallphixs.data() + globals::elements[element].ions[lowerion].levels[lowerlevel].phixsstart;
if (phixs_file_version == 1) {
Expand Down Expand Up @@ -860,7 +857,6 @@ void read_atomicdata_files() {
for (int level = 0; level < nlevelsmax; level++) {
globals::elements[element].ions[ion].levels[level].nphixstargets = 0;
globals::elements[element].ions[ion].levels[level].phixstargets = nullptr;
globals::elements[element].ions[ion].levels[level].photoion_xs = nullptr;
uniquelevelindex++;
totaldowntrans += get_ndowntrans(element, ion, level);
totaluptrans += get_nuptrans(element, ion, level);
Expand Down Expand Up @@ -1442,14 +1438,14 @@ void setup_phixs_list() {

// different targets share the same cross section table, so don't repeat this process
if (phixstargetindex == 0) {
auto *sourcetable = tmpallphixs.data() + globals::elements[element].ions[ion].levels[level].phixsstart;
auto *blocktablestart = globals::allphixs + (nbftableschanged * globals::NPHIXSPOINTS);
auto &sourcetable = tmpallphixs[globals::elements[element].ions[ion].levels[level].phixsstart];
const int newphixsstart = nbftableschanged * globals::NPHIXSPOINTS;
auto *blocktablestart = globals::allphixs + newphixsstart;
if (globals::rank_in_node == 0) {
memcpy(blocktablestart, sourcetable, globals::NPHIXSPOINTS * sizeof(float));
memcpy(blocktablestart, &sourcetable, globals::NPHIXSPOINTS * sizeof(float));
}

globals::elements[element].ions[ion].levels[level].photoion_xs = blocktablestart;
globals::elements[element].ions[ion].levels[level].phixsstart = nbftableschanged * globals::NPHIXSPOINTS;
globals::elements[element].ions[ion].levels[level].phixsstart = newphixsstart;

nbftableschanged++;
}
Expand Down

0 comments on commit ccd1246

Please sign in to comment.