mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-15 12:28:22 +01:00
fix: calculation of wp_sizes_vector
This commit is contained in:
parent
5429696d89
commit
f7404110ab
@ -264,3 +264,8 @@ StoreSetup <- function(setup) {
|
||||
saveRDS(to_store, file = paste0(fileout, "/setup.rds"))
|
||||
msgm("initialization stored in ", paste0(fileout, "/setup.rds"))
|
||||
}
|
||||
|
||||
GetWorkPackageSizesVector <- function(n_packages, package_size, len) {
|
||||
ids <- rep(1:n_packages, times=package_size, each = 1)[1:len]
|
||||
return(as.integer(table(ids)))
|
||||
}
|
||||
|
||||
2
ext/tug
2
ext/tug
@ -1 +1 @@
|
||||
Subproject commit d4e3ab8544628c72921bf60d4462d6d131b0ffb5
|
||||
Subproject commit 79d7a32fc25fd97b78f320bba854b1db64e059f7
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
#include <Rcpp.h>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -56,13 +57,9 @@ ChemMaster::ChemMaster(SimParams ¶ms, RInside &R_, Grid &grid_)
|
||||
uint32_t n_packages = (uint32_t)(grid.GetTotalCellCount() / this->wp_size) +
|
||||
(mod_pkgs != 0 ? 1 : 0);
|
||||
|
||||
this->wp_sizes_vector = std::vector<uint32_t>(n_packages, this->wp_size);
|
||||
if (mod_pkgs) {
|
||||
auto itEndVector = this->wp_sizes_vector.end() - 1;
|
||||
for (uint32_t i = 0; i < this->wp_size - mod_pkgs; i++) {
|
||||
*(itEndVector - i) -= 1;
|
||||
}
|
||||
}
|
||||
Rcpp::Function wp_f("GetWorkPackageSizesVector");
|
||||
this->wp_sizes_vector = Rcpp::as<std::vector<uint32_t>>(
|
||||
wp_f(n_packages, this->wp_size, grid.GetTotalCellCount()));
|
||||
|
||||
this->state = this->grid.RegisterState(
|
||||
poet::BaseChemModule::CHEMISTRY_MODULE_NAME, this->prop_names);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user