diff --git a/makefile b/makefile index 89b34da558be2bf8b85474e9603dd629eb30ed0a..23b36053dddb05ed70e2aada4a045f4e451f9ede 100644 --- a/makefile +++ b/makefile @@ -63,7 +63,8 @@ base_files := \ p3DFFT_to_iR \ vector_field \ fluid_solver_base \ - fluid_solver + fluid_solver \ + slab_field_particles #headers := $(patsubst %, ./src/%.hpp, ${base_files}) src := $(patsubst %, ./src/%.cpp, ${base_files}) diff --git a/src/base.hpp b/src/base.hpp index 350106435134b1d04cf16b8a4e10ee02ba621cc8..c808f08f5d9589d4a9bf26052d6b5f232cf6d690 100644 --- a/src/base.hpp +++ b/src/base.hpp @@ -31,6 +31,11 @@ static const int message_buffer_length = 1024; static char debug_message_buffer[message_buffer_length]; extern int myrank, nprocs; +int MOD(int a, int n) +{ + return ((a%n) + n) % n; +} + #ifndef NDEBUG inline void DEBUG_MSG(const char * format, ...) diff --git a/src/slab_field_particles.hpp b/src/slab_field_particles.hpp index 2cbf742b7e47bd45e53eb6eecb3a61aa5886ea0b..723ded57cd9f33a197ff94c50718a9d13cc40da3 100644 --- a/src/slab_field_particles.hpp +++ b/src/slab_field_particles.hpp @@ -18,6 +18,8 @@ * ************************************************************************/ + + #include <stdio.h> #include <stdlib.h> #include <iostream> @@ -35,7 +37,6 @@ class slab_field_particles { public: fluid_solver_base<rnumber> *fs; - int nparticles; /* is_active is a matrix of shape [nprocs][nparticles], with * is_active[r][p] being true if particle p is in the domain @@ -48,11 +49,17 @@ class slab_field_particles * a general ncomponents is better, since we may change our minds. * */ double *state; + int nparticles; int ncomponents; + int array_size; + int buffer_size; + double *lbound; + double *ubound; /* simulation parameters */ char name[256]; int iteration; + double dt; /* physical parameters of field */ rnumber dx, dy, dz; @@ -60,8 +67,20 @@ class slab_field_particles /* methods */ slab_field_particles( const char *NAME, - fluid_solver_base<rnumber> *FSOLVER); + fluid_solver_base<rnumber> *FSOLVER, + const int NPARTICLES, + const int NCOMPONENTS, + const int BUFFERSIZE); ~slab_field_particles(); + + /* an Euler step is needed to compute an estimate of future positions, + * which is needed for synchronization. + * function is virtual since we want children to do different things, + * depending on the type of particle. this particular function just + * copies the old state into the new state. + * */ + virtual void jump_estimate(double *jump_length); + void synchronize(); };