feat(grid): enable cell_ID integration in chemistry data flow

This commit is contained in:
Max Lübke 2025-09-25 15:08:13 +02:00
parent c10d35fabe
commit 1af661527d
2 changed files with 14 additions and 2 deletions

View File

@ -60,6 +60,9 @@ pqc_to_grid <- function(pqc_mat, grid) {
# Convert the result matrix to a data frame
res_df <- as.data.frame(result_mat)
# Add cell_ID column to beginning of res_df
res_df <- cbind(cell_ID = seq(0, nrow(res_df) - 1), res_df)
# Remove all columns which only contain NaN
# res_df <- res_df[, colSums(is.na(res_df)) != nrow(res_df)]

View File

@ -421,14 +421,23 @@ namespace poet
{
to_ignore.push_back(wp_id);
}
}
// HACK: remove the first element (cell_id) before sending to phreeqc
inout_chem[wp_id].erase(
inout_chem[wp_id].begin(), inout_chem[wp_id].begin() + 1);
}
this->pqc_runner->run(inout_chem, dTimestep, to_ignore);
for (std::size_t wp_id = 0; wp_id < work_package.size; wp_id++)
{
if (work_package.mapping[wp_id] == CHEM_PQC)
{
work_package.output[wp_id] = inout_chem[wp_id];
// HACK: as we removed the first element (cell_id) before sending to phreeqc,
// copy back with an offset of 1
work_package.output[wp_id] = work_package.input[wp_id];
std::copy(inout_chem[wp_id].begin(), inout_chem[wp_id].end(),
work_package.output[wp_id].begin() + 1);
}
}
}