Commit 50893d6e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Re-organise the cell structure. Make it more light weight.

parent d4721fbe
......@@ -79,132 +79,191 @@ struct pcell {
} SWIFT_STRUCT_ALIGN;
/* Structure to store the data of a single cell. */
/**
* @brief Cell within the tree structure.
*
* Contains particles, links to tasks, a multipole object and counters.
*/
struct cell {
/* The cell location on the grid. */
/*! This cell's multipole. */
struct multipole multipole;
/*! The cell location on the grid. */
double loc[3];
/* The cell dimensions. */
/*! The cell dimensions. */
double width[3];
/* Max smoothing length in this cell. */
/*! Max smoothing length in this cell. */
double h_max;
/* Minimum and maximum end of time step in this cell. */
int ti_end_min, ti_end_max;
/* Last time the cell's content was drifted forward in time. */
int ti_old;
/* Minimum dimension, i.e. smallest edge of this cell. */
float dmin;
/* Maximum slack allowed for particle movement. */
float slack;
/* Maximum particle movement in this cell since last construction. */
float dx_max;
/* The depth of this cell in the tree. */
int depth, split, maxdepth;
/* Nr of parts. */
int count, gcount;
/*! Linking pointer for "memory management". */
struct cell *next;
/* Pointers to the particle data. */
/*! Pointer to the #part data. */
struct part *parts;
/* Pointers to the extra particle data. */
/*! Pointer to the #xpart data. */
struct xpart *xparts;
/* Pointers to the gravity particle data. */
/*! Pointer to the #gpart data. */
struct gpart *gparts;
/* Pointers for the sorted indices. */
/*! Pointer for the sorted indices. */
struct entry *sort;
unsigned int sorted;
/* Pointers to the next level of cells. */
/*! Pointers to the next level of cells. */
struct cell *progeny[8];
/* Parent cell. */
/*! Parent cell. */
struct cell *parent;
/* Super cell, i.e. the highest-level supercell that has pair/self tasks */
/*! Super cell, i.e. the highest-level parent cell that has pair/self tasks */
struct cell *super;
/* The task computing this cell's sorts. */
/*! The task computing this cell's sorts. */
struct task *sorts;
int sortsize;
/* The tasks computing this cell's density. */
struct link *density, *gradient, *force, *grav;
/*! Linked list of the tasks computing this cell's hydro density. */
struct link *density;
/* The hierarchical tasks. */
struct task *extra_ghost, *ghost, *init, *kick;
/* Linked list of the tasks computing this cell's hydro gradients. */
struct link *gradient;
#ifdef WITH_MPI
/*! Linked list of the tasks computing this cell's hydro forces. */
struct link *force;
/* Task receiving data. */
struct task *recv_xv, *recv_rho, *recv_gradient, *recv_ti;
/*! Linked list of the tasks computing this cell's gravity forces. */
struct link *grav;
/* Task send data. */
struct link *send_xv, *send_rho, *send_gradient, *send_ti;
/*! The initialistation task */
struct task *init;
#endif
/*! The ghost task */
struct task *ghost;
/* Tasks for gravity tree. */
struct task *grav_up, *grav_down;
/*! The extra ghost task for complex hydro schemes */
struct task *extra_ghost;
/* Task for cooling */
struct task *cooling;
/*! The kick task */
struct task *kick;
/* Task for source terms */
struct task *sourceterms;
/*! Task constructing the multipole from the particles */
struct task *grav_up;
/* Number of tasks that are associated with this cell. */
int nr_tasks;
/*! Task propagating the multipole to the particles */
struct task *grav_down;
/* Is the data of this cell being used in a sub-cell? */
int hold, ghold;
/*! Task for cooling */
struct task *cooling;
/* Spin lock for various uses. */
swift_lock_type lock, glock;
/*! Task for source terms */
struct task *sourceterms;
/* ID of the previous owner, e.g. runner. */
int owner;
#ifdef WITH_MPI
/* Momentum of particles in cell. */
double mom[3], ang_mom[3];
/* Task receiving data (positions). */
struct task *recv_xv;
/* Mass, potential, internal and kinetic energy of particles in this cell. */
double mass, e_pot, e_int, e_kin, e_rad, entropy;
/* Task receiving data (density). */
struct task *recv_rho;
/* Number of particles updated in this cell. */
int updated, g_updated;
/* Task receiving data (gradient). */
struct task *recv_gradient;
/* Linking pointer for "memory management". */
struct cell *next;
/* Task receiving data (time-step). */
struct task *recv_ti;
/* This cell's multipole. */
struct multipole multipole;
/* Linked list for sending data (positions). */
struct link *send_xv;
/* ID of the node this cell lives on. */
int nodeID;
/* Linked list for sending data (density). */
struct link *send_rho;
#ifdef WITH_MPI
/* Linked list for sending data (gradient). */
struct link *send_gradient;
/* Linked list for sending data (time-step). */
struct link *send_ti;
/* Bit mask of the proxies this cell is registered with. */
/*! Bit mask of the proxies this cell is registered with. */
unsigned long long int sendto;
/* Pointer to this cell's packed representation. */
/*! Pointer to this cell's packed representation. */
struct pcell *pcell;
/*! Size of the packed representation */
int pcell_size;
/*! MPI tag associated with this cell */
int tag;
#endif
/*! Minimum end of (integer) time step in this cell. */
int ti_end_min;
/*! Maximum end of (integer) time step in this cell. */
int ti_end_max;
/*! Last (integer) time the cell's content was drifted forward in time. */
int ti_old;
/*! Minimum dimension, i.e. smallest edge of this cell (min(width)). */
float dmin;
/*! Maximum particle movement in this cell since last construction. */
float dx_max;
/*! Nr of #part in this cell. */
int count;
/*! Nr of #gpart in this cell. */
int gcount;
/*! The size of the sort array */
int sortsize;
/*! Bit-mask indicating the sorted directions */
unsigned int sorted;
/*! Spin lock for various uses (#part case). */
swift_lock_type lock;
/*! Spin lock for various uses (#gpart case). */
swift_lock_type glock;
/*! ID of the previous owner, e.g. runner. */
int owner;
/*! Number of #part updated in this cell. */
int updated;
/*! Number of #gpart updated in this cell. */
int g_updated;
/*! ID of the node this cell lives on. */
int nodeID;
/*! Number of tasks that are associated with this cell. */
short int nr_tasks;
/*! The depth of this cell in the tree. */
char depth;
/*! Is this cell split ? */
char split;
/*! The maximal depth of this cell and its progenies */
char maxdepth;
/*! Is the #part data of this cell being used in a sub-cell? */
char hold;
/*! Is the #gpart data of this cell being used in a sub-cell? */
char ghold;
} SWIFT_STRUCT_ALIGN;
/* Convert cell location to ID. */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment