Commit 7fac9be5 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Only copy the multipole information that is required and not the full gravity information.

parent d986be96
......@@ -178,8 +178,6 @@ int cell_pack(struct cell *restrict c, struct pcell *restrict pc,
#ifdef WITH_MPI
/* Start by packing the data of the current cell. */
if(with_gravity)
pc->multipole = *(c->multipole);
pc->h_max = c->h_max;
pc->ti_hydro_end_min = c->ti_hydro_end_min;
pc->ti_hydro_end_max = c->ti_hydro_end_max;
......@@ -192,6 +190,22 @@ int cell_pack(struct cell *restrict c, struct pcell *restrict pc,
pc->gcount = c->gcount;
pc->scount = c->scount;
/* Copy the Multipole related information */
if(with_gravity) {
const struct gravity_tensors *mp = c->multipole;
pc->m_pole = mp->m_pole;
pc->CoM[0] = mp->CoM[0];
pc->CoM[1] = mp->CoM[1];
pc->CoM[2] = mp->CoM[2];
pc->CoM_rebuild[0] = mp->CoM_rebuild[0];
pc->CoM_rebuild[1] = mp->CoM_rebuild[1];
pc->CoM_rebuild[2] = mp->CoM_rebuild[2];
pc->r_max = mp->r_max;
pc->r_max_rebuild = mp->r_max_rebuild;
}
#ifdef SWIFT_DEBUG_CHECKS
pc->cellID = c->cellID;
#endif
......@@ -267,8 +281,6 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
#ifdef WITH_MPI
/* Unpack the current pcell. */
if(with_gravity)
*(c->multipole) = pc->multipole;
c->h_max = pc->h_max;
c->ti_hydro_end_min = pc->ti_hydro_end_min;
c->ti_hydro_end_max = pc->ti_hydro_end_max;
......@@ -284,6 +296,22 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
c->cellID = pc->cellID;
#endif
/* Copy the Multipole related information */
if(with_gravity) {
struct gravity_tensors *mp = c->multipole;
mp->m_pole = pc->m_pole;
mp->CoM[0] = pc->CoM[0];
mp->CoM[1] = pc->CoM[1];
mp->CoM[2] = pc->CoM[2];
mp->CoM_rebuild[0] = pc->CoM_rebuild[0];
mp->CoM_rebuild[1] = pc->CoM_rebuild[1];
mp->CoM_rebuild[2] = pc->CoM_rebuild[2];
mp->r_max = pc->r_max;
mp->r_max_rebuild = pc->r_max_rebuild;
}
/* Number of new cells created. */
int count = 1;
......
......@@ -78,7 +78,19 @@ struct link {
struct pcell {
/*! This cell's gravity-related tensors */
struct gravity_tensors multipole;
struct multipole m_pole;
/*! Centre of mass. */
double CoM[3];
/*! Centre of mass at rebuild time. */
double CoM_rebuild[3];
/*! Upper limit of the CoM<->gpart distance. */
double r_max;
/*! Upper limit of the CoM<->gpart distance at last rebuild. */
double r_max_rebuild;
/*! Relative indices of the cell's progeny. */
int progeny[8];
......
......@@ -186,12 +186,12 @@ struct gravity_tensors {
/*! The actual content */
struct {
/*! Multipole mass */
struct multipole m_pole;
/*! Field tensor for the potential */
struct grav_tensor pot;
/*! Multipole mass */
struct multipole m_pole;
/*! Centre of mass of the matter dsitribution */
double CoM[3];
......
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