Skip to content
Snippets Groups Projects
Commit 7e3ebdc1 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

particle code compiles, but not finished

parent a3dc03cd
Branches
Tags
No related merge requests found
...@@ -63,7 +63,8 @@ base_files := \ ...@@ -63,7 +63,8 @@ base_files := \
p3DFFT_to_iR \ p3DFFT_to_iR \
vector_field \ vector_field \
fluid_solver_base \ fluid_solver_base \
fluid_solver fluid_solver \
slab_field_particles
#headers := $(patsubst %, ./src/%.hpp, ${base_files}) #headers := $(patsubst %, ./src/%.hpp, ${base_files})
src := $(patsubst %, ./src/%.cpp, ${base_files}) src := $(patsubst %, ./src/%.cpp, ${base_files})
......
...@@ -31,6 +31,11 @@ static const int message_buffer_length = 1024; ...@@ -31,6 +31,11 @@ static const int message_buffer_length = 1024;
static char debug_message_buffer[message_buffer_length]; static char debug_message_buffer[message_buffer_length];
extern int myrank, nprocs; extern int myrank, nprocs;
int MOD(int a, int n)
{
return ((a%n) + n) % n;
}
#ifndef NDEBUG #ifndef NDEBUG
inline void DEBUG_MSG(const char * format, ...) inline void DEBUG_MSG(const char * format, ...)
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* *
************************************************************************/ ************************************************************************/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <iostream> #include <iostream>
...@@ -35,7 +37,6 @@ class slab_field_particles ...@@ -35,7 +37,6 @@ class slab_field_particles
{ {
public: public:
fluid_solver_base<rnumber> *fs; fluid_solver_base<rnumber> *fs;
int nparticles;
/* is_active is a matrix of shape [nprocs][nparticles], with /* is_active is a matrix of shape [nprocs][nparticles], with
* is_active[r][p] being true if particle p is in the domain * is_active[r][p] being true if particle p is in the domain
...@@ -48,11 +49,17 @@ class slab_field_particles ...@@ -48,11 +49,17 @@ class slab_field_particles
* a general ncomponents is better, since we may change our minds. * a general ncomponents is better, since we may change our minds.
* */ * */
double *state; double *state;
int nparticles;
int ncomponents; int ncomponents;
int array_size;
int buffer_size;
double *lbound;
double *ubound;
/* simulation parameters */ /* simulation parameters */
char name[256]; char name[256];
int iteration; int iteration;
double dt;
/* physical parameters of field */ /* physical parameters of field */
rnumber dx, dy, dz; rnumber dx, dy, dz;
...@@ -60,8 +67,20 @@ class slab_field_particles ...@@ -60,8 +67,20 @@ class slab_field_particles
/* methods */ /* methods */
slab_field_particles( slab_field_particles(
const char *NAME, 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(); ~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();
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment