mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-16 04:48:23 +01:00
removed RRuntime and grid as a function parameter
This commit is contained in:
parent
a6e3aa4fe3
commit
ea15c1e23d
@ -220,6 +220,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
cout << "CPP: R Init (RInside) on process " << params.world_rank << endl;
|
||||
RRuntime R(argc, argv);
|
||||
params.R = &R;
|
||||
|
||||
// if local_rank == 0 then master else worker
|
||||
R["local_rank"] = params.world_rank;
|
||||
@ -269,6 +270,7 @@ int main(int argc, char *argv[]) {
|
||||
R.parseEval(init_chemistry_code);
|
||||
|
||||
Grid grid(R);
|
||||
params.grid = &grid;
|
||||
grid.init();
|
||||
/* Retrieve state_C from R context for MPI buffer generation */
|
||||
// Rcpp::DataFrame state_C = R.parseEval("mysetup$state_C");
|
||||
@ -820,7 +822,7 @@ int main(int argc, char *argv[]) {
|
||||
std::cout.flush();
|
||||
}
|
||||
}
|
||||
worker_function(R, grid, ¶ms);
|
||||
worker_function(¶ms);
|
||||
free(mpi_buffer_results);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "RRuntime.h"
|
||||
|
||||
typedef struct {
|
||||
int world_size;
|
||||
@ -21,6 +22,9 @@ typedef struct {
|
||||
unsigned int wp_size;
|
||||
|
||||
std::string out_dir;
|
||||
|
||||
void* R;
|
||||
void* grid;
|
||||
} t_simparams;
|
||||
|
||||
#endif // SIMPARAMS_H
|
||||
|
||||
@ -10,7 +10,9 @@
|
||||
using namespace poet;
|
||||
using namespace Rcpp;
|
||||
|
||||
void worker_function(RRuntime &R, Grid &grid, t_simparams *params) {
|
||||
void worker_function(t_simparams *params) {
|
||||
RRuntime R = *(static_cast<RRuntime *>(params->R));
|
||||
Grid grid = *(static_cast<Grid *>(params->grid));
|
||||
int world_rank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
|
||||
MPI_Status probe_status;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
using namespace std;
|
||||
using namespace poet;
|
||||
/*Functions*/
|
||||
void worker_function(RRuntime &R, Grid &grid, t_simparams *params);
|
||||
void worker_function(t_simparams *params);
|
||||
|
||||
|
||||
/*Globals*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user