diff --git a/src/interfaces/sapporoG6lib.cpp b/src/interfaces/sapporoG6lib.cpp index a7855d8..1488dca 100644 --- a/src/interfaces/sapporoG6lib.cpp +++ b/src/interfaces/sapporoG6lib.cpp @@ -147,8 +147,11 @@ extern "C" { // return grav.calc_lasthalf2(*cluster_id, *nj, *ni, // index, xi, vi, *eps2, h2, acc, jerk, pot, inn); } - - + + int g6_get_nj_max_() { + return grav.get_nj_max(); + } + void get_j_part_data(int addr, int nj, double *pos, double *vel, diff --git a/src/sapporohostclass.cpp b/src/sapporohostclass.cpp index b610a13..95bd833 100644 --- a/src/sapporohostclass.cpp +++ b/src/sapporohostclass.cpp @@ -159,7 +159,7 @@ int sapporo::open(std::string kernelFile, int *devices, //Allocate initial memory for 16k particles per device sapdevice->allocateMemory(16384, get_n_pipes()); - nj_max = 16384; + nj_max = 262144; //Initial max number of j-particles, can be increased if needed }//end pragma omp parallel //Used to store j-memory particle counters @@ -461,7 +461,8 @@ int sapporo::set_j_particle(int address, //Extra check, if we are still outside nj_max, we quit since particles are not //nicely send in order if (address >= nj_max) { - fprintf(stderr, "Increasing nj_max was not enough! Send particles in order to the library! Exit\n"); + fprintf(stderr, "Increasing nj_max = %d was not enough, address = %d\n", nj_max, address); + fprintf(stderr, "Send particles in order to the library! Exit\n"); exit(-1); } } @@ -1601,3 +1602,8 @@ double sapporo::evaluate_gravity(int ni_total, int nj) return 0.0; } //end evaluate gravity + +int sapporo::get_nj_max() const +{ + return nj_max; +} \ No newline at end of file diff --git a/src/sapporohostclass.h b/src/sapporohostclass.h index 6159338..cb34354 100644 --- a/src/sapporohostclass.h +++ b/src/sapporohostclass.h @@ -32,7 +32,10 @@ struct jCopyInfo int toCopy; } typedef jCopyInfo; - +extern "C" +{ + int g6_get_nj_max_(); +} class sapporo { protected: @@ -126,6 +129,7 @@ class sapporo { int order = FOURTH, int precision = DOUBLESINGLE); int close(); int get_n_pipes(); + int get_nj_max() const; int set_time(double ti); int set_no_time();