runner_doiact_stars.h 69.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*******************************************************************************
 * This file is part of SWIFT.
 * Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
 *               2018 Loic Hausammann (loic.hausammann@epfl.ch)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 ******************************************************************************/

#include "swift.h"

/**
 * @brief Calculate the number density of #part around the #spart
 *
 * @param r runner task
 * @param c cell
 * @param timer 1 if the time is to be recorded.
 */
Loic Hausammann's avatar
Loic Hausammann committed
30
void runner_doself_stars_density(struct runner *r, struct cell *c, int timer) {
31
32
33
34
35
36
  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

  TIMER_TIC;

  /* Anything to do here? */
Loic Hausammann's avatar
Loic Hausammann committed
37
  if (!cell_is_active_stars(c, e)) return;
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

  /* Cosmological terms */
  const float a = cosmo->a;
  const float H = cosmo->H;

  const int scount = c->scount;
  const int count = c->count;
  struct spart *restrict sparts = c->sparts;
  struct part *restrict parts = c->parts;

  /* Loop over the sparts in ci. */
  for (int sid = 0; sid < scount; sid++) {

    /* Get a hold of the ith spart in ci. */
    struct spart *restrict si = &sparts[sid];
    const float hi = si->h;
    const float hig2 = hi * hi * kernel_gamma2;
    const float six[3] = {(float)(si->x[0] - c->loc[0]),
                          (float)(si->x[1] - c->loc[1]),
                          (float)(si->x[2] - c->loc[2])};

    /* Loop over the parts in cj. */
    for (int pjd = 0; pjd < count; pjd++) {

      /* Get a pointer to the jth particle. */
      struct part *restrict pj = &parts[pjd];
      const float hj = pj->h;

      /* Compute the pairwise distance. */
      const float pjx[3] = {(float)(pj->x[0] - c->loc[0]),
                            (float)(pj->x[1] - c->loc[1]),
                            (float)(pj->x[2] - c->loc[2])};
      float dx[3] = {six[0] - pjx[0], six[1] - pjx[1], six[2] - pjx[2]};
      const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2];

#ifdef SWIFT_DEBUG_CHECKS
      /* Check that particles have been drifted to the current time */
      if (pj->ti_drift != e->ti_current)
        error("Particle pj not drifted to current time");
#endif

Loic Hausammann's avatar
Loic Hausammann committed
79
      if (r2 > 0.f && r2 < hig2) {
80
        runner_iact_nonsym_stars_density(r2, dx, hi, hj, si, pj, a, H);
81
      }
82
83
84
    } /* loop over the parts in ci. */
  }   /* loop over the sparts in ci. */

Loic Hausammann's avatar
Loic Hausammann committed
85
  TIMER_TOC(timer_doself_stars_density);
86
87
88
}

/**
Loic Hausammann's avatar
Loic Hausammann committed
89
 * @brief Calculate the number density of cj #part around the ci #spart
90
91
 *
 * @param r runner task
Matthieu Schaller's avatar
Matthieu Schaller committed
92
93
 * @param ci The first #cell
 * @param cj The second #cell
94
 */
Loic Hausammann's avatar
Loic Hausammann committed
95
void runner_dosubpair_stars_density(struct runner *r, struct cell *restrict ci,
96
                                    struct cell *restrict cj) {
97
98
99
100
101

  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

  /* Anything to do here? */
Loic Hausammann's avatar
Loic Hausammann committed
102
  if (!cell_is_active_stars(ci, e) && !cell_is_active_stars(cj, e)) return;
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153

  const int scount_i = ci->scount;
  const int count_j = cj->count;
  struct spart *restrict sparts_i = ci->sparts;
  struct part *restrict parts_j = cj->parts;

  /* Cosmological terms */
  const float a = cosmo->a;
  const float H = cosmo->H;

  /* Get the relative distance between the pairs, wrapping. */
  double shift[3] = {0.0, 0.0, 0.0};
  for (int k = 0; k < 3; k++) {
    if (cj->loc[k] - ci->loc[k] < -e->s->dim[k] / 2)
      shift[k] = e->s->dim[k];
    else if (cj->loc[k] - ci->loc[k] > e->s->dim[k] / 2)
      shift[k] = -e->s->dim[k];
  }

  /* Loop over the sparts in ci. */
  for (int sid = 0; sid < scount_i; sid++) {

    /* Get a hold of the ith spart in ci. */
    struct spart *restrict si = &sparts_i[sid];
    const float hi = si->h;
    const float hig2 = hi * hi * kernel_gamma2;
    const float six[3] = {(float)(si->x[0] - (cj->loc[0] + shift[0])),
                          (float)(si->x[1] - (cj->loc[1] + shift[1])),
                          (float)(si->x[2] - (cj->loc[2] + shift[2]))};

    /* Loop over the parts in cj. */
    for (int pjd = 0; pjd < count_j; pjd++) {

      /* Get a pointer to the jth particle. */
      struct part *restrict pj = &parts_j[pjd];
      const float hj = pj->h;

      /* Compute the pairwise distance. */
      const float pjx[3] = {(float)(pj->x[0] - cj->loc[0]),
                            (float)(pj->x[1] - cj->loc[1]),
                            (float)(pj->x[2] - cj->loc[2])};
      float dx[3] = {six[0] - pjx[0], six[1] - pjx[1], six[2] - pjx[2]};
      const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2];

#ifdef SWIFT_DEBUG_CHECKS
      /* Check that particles have been drifted to the current time */
      if (pj->ti_drift != e->ti_current)
        error("Particle pj not drifted to current time");
#endif

      if (r2 < hig2)
154
        runner_iact_nonsym_stars_density(r2, dx, hi, hj, si, pj, a, H);
155
156
157
158
159

    } /* loop over the parts in cj. */
  }   /* loop over the parts in ci. */
}

Loic Hausammann's avatar
Loic Hausammann committed
160
void runner_dopair_stars_density(struct runner *r, struct cell *restrict ci,
161
                                 struct cell *restrict cj, int timer) {
162
163

  TIMER_TIC;
164

Loic Hausammann's avatar
Loic Hausammann committed
165
166
  runner_dosubpair_stars_density(r, ci, cj);
  runner_dosubpair_stars_density(r, cj, ci);
167

Loic Hausammann's avatar
Loic Hausammann committed
168
  if (timer) TIMER_TOC(timer_dopair_stars_density);
169
}
Loic Hausammann's avatar
Loic Hausammann committed
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

/**
 * @brief Compute the interactions between a cell pair, but only for the
 *      given indices in ci.
 *
 * Version using a brute-force algorithm.
 *
 * @param r The #runner.
 * @param ci The first #cell.
 * @param sparts_i The #part to interact with @c cj.
 * @param ind The list of indices of particles in @c ci to interact with.
 * @param scount The number of particles in @c ind.
 * @param cj The second #cell.
 * @param shift The shift vector to apply to the particles in ci.
 */
185
186
187
188
189
190
void runner_dopair_subset_stars_density(struct runner *r,
                                        struct cell *restrict ci,
                                        struct spart *restrict sparts_i,
                                        int *restrict ind, int scount,
                                        struct cell *restrict cj,
                                        const double *shift) {
Loic Hausammann's avatar
Loic Hausammann committed
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239

  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

  TIMER_TIC;

  const int count_j = cj->count;
  struct part *restrict parts_j = cj->parts;

  /* Cosmological terms */
  const float a = cosmo->a;
  const float H = cosmo->H;

  /* Loop over the parts_i. */
  for (int pid = 0; pid < scount; pid++) {

    /* Get a hold of the ith part in ci. */
    struct spart *restrict spi = &sparts_i[ind[pid]];
    double spix[3];
    for (int k = 0; k < 3; k++) spix[k] = spi->x[k] - shift[k];
    const float hi = spi->h;
    const float hig2 = hi * hi * kernel_gamma2;

#ifdef SWIFT_DEBUG_CHECKS
    if (!spart_is_active(spi, e))
      error("Trying to correct smoothing length of inactive particle !");
#endif

    /* Loop over the parts in cj. */
    for (int pjd = 0; pjd < count_j; pjd++) {

      /* Get a pointer to the jth particle. */
      struct part *restrict pj = &parts_j[pjd];

      /* Compute the pairwise distance. */
      float r2 = 0.0f;
      float dx[3];
      for (int k = 0; k < 3; k++) {
        dx[k] = spix[k] - pj->x[k];
        r2 += dx[k] * dx[k];
      }

#ifdef SWIFT_DEBUG_CHECKS
      /* Check that particles have been drifted to the current time */
      if (pj->ti_drift != e->ti_current)
        error("Particle pj not drifted to current time");
#endif
      /* Hit or miss? */
      if (r2 < hig2) {
Loic Hausammann's avatar
Loic Hausammann committed
240
        runner_iact_nonsym_stars_density(r2, dx, hi, pj->h, spi, pj, a, H);
Loic Hausammann's avatar
Loic Hausammann committed
241
242
243
244
      }
    } /* loop over the parts in cj. */
  }   /* loop over the parts in ci. */

Loic Hausammann's avatar
Loic Hausammann committed
245
  TIMER_TOC(timer_dopair_subset_stars_density);
Loic Hausammann's avatar
Loic Hausammann committed
246
}
Loic Hausammann's avatar
Loic Hausammann committed
247
248
249
250
251
252
253
254
255
256
257

/**
 * @brief Compute the interactions between a cell pair, but only for the
 *      given indices in ci.
 *
 * @param r The #runner.
 * @param ci The first #cell.
 * @param sparts The #spart to interact.
 * @param ind The list of indices of particles in @c ci to interact with.
 * @param scount The number of particles in @c ind.
 */
258
259
260
261
void runner_doself_subset_stars_density(struct runner *r,
                                        struct cell *restrict ci,
                                        struct spart *restrict sparts,
                                        int *restrict ind, int scount) {
Loic Hausammann's avatar
Loic Hausammann committed
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280

  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

  TIMER_TIC;

  /* Cosmological terms */
  const float a = cosmo->a;
  const float H = cosmo->H;

  const int count_i = ci->count;
  struct part *restrict parts_j = ci->parts;

  /* Loop over the parts in ci. */
  for (int spid = 0; spid < scount; spid++) {

    /* Get a hold of the ith part in ci. */
    struct spart *spi = &sparts[ind[spid]];
    const float spix[3] = {(float)(spi->x[0] - ci->loc[0]),
281
282
                           (float)(spi->x[1] - ci->loc[1]),
                           (float)(spi->x[2] - ci->loc[2])};
Loic Hausammann's avatar
Loic Hausammann committed
283
284
285
286
    const float hi = spi->h;
    const float hig2 = hi * hi * kernel_gamma2;

#ifdef SWIFT_DEBUG_CHECKS
287
288
    if (!spart_is_active(spi, e))
      error("Inactive particle in subset function!");
Loic Hausammann's avatar
Loic Hausammann committed
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#endif

    /* Loop over the parts in cj. */
    for (int pjd = 0; pjd < count_i; pjd++) {

      /* Get a pointer to the jth particle. */
      struct part *restrict pj = &parts_j[pjd];
      const float hj = pj->h;

      /* Compute the pairwise distance. */
      const float pjx[3] = {(float)(pj->x[0] - ci->loc[0]),
                            (float)(pj->x[1] - ci->loc[1]),
                            (float)(pj->x[2] - ci->loc[2])};
      float dx[3] = {spix[0] - pjx[0], spix[1] - pjx[1], spix[2] - pjx[2]};
      const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2];

#ifdef SWIFT_DEBUG_CHECKS
      /* Check that particles have been drifted to the current time */
      if (pj->ti_drift != e->ti_current)
        error("Particle pj not drifted to current time");
#endif

      /* Hit or miss? */
      if (r2 > 0.f && r2 < hig2) {
313
        runner_iact_nonsym_stars_density(r2, dx, hi, hj, spi, pj, a, H);
Loic Hausammann's avatar
Loic Hausammann committed
314
315
316
317
      }
    } /* loop over the parts in cj. */
  }   /* loop over the parts in ci. */

Loic Hausammann's avatar
Loic Hausammann committed
318
  TIMER_TOC(timer_doself_subset_stars_density);
Loic Hausammann's avatar
Loic Hausammann committed
319
320
}

321
322
323
324
325
326
/**
* @brief Determine which version of DOSELF_SUBSET needs to be called depending
* on the optimisation level.

* @param r The #runner.
* @param ci The first #cell.
Matthieu Schaller's avatar
Matthieu Schaller committed
327
* @param sparts The #spart to interact.
328
329
330
331
332
333
334
* @param ind The list of indices of particles in @c ci to interact with.
* @param scount The number of particles in @c ind.
*/
void runner_doself_subset_branch_stars_density(struct runner *r,
                                               struct cell *restrict ci,
                                               struct spart *restrict sparts,
                                               int *restrict ind, int scount) {
Loic Hausammann's avatar
Loic Hausammann committed
335

Loic Hausammann's avatar
Loic Hausammann committed
336
  runner_doself_subset_stars_density(r, ci, sparts, ind, scount);
Loic Hausammann's avatar
Loic Hausammann committed
337
338
}

339
/**
Loic Hausammann's avatar
Loic Hausammann committed
340
341
342
343
344
345
346
347
348
349
350
 * @brief Determine which version of DOPAIR_SUBSET needs to be called depending
 * on the
 * orientation of the cells or whether DOPAIR_SUBSET needs to be called at all.
 *
 * @param r The #runner.
 * @param ci The first #cell.
 * @param sparts_i The #spart to interact with @c cj.
 * @param ind The list of indices of particles in @c ci to interact with.
 * @param scount The number of particles in @c ind.
 * @param cj The second #cell.
 */
351
352
353
354
355
void runner_dopair_subset_branch_stars_density(struct runner *r,
                                               struct cell *restrict ci,
                                               struct spart *restrict sparts_i,
                                               int *restrict ind, int scount,
                                               struct cell *restrict cj) {
Loic Hausammann's avatar
Loic Hausammann committed
356
357
358
359
360
361
362
363
364
365
366
367

  const struct engine *e = r->e;

  /* Get the relative distance between the pairs, wrapping. */
  double shift[3] = {0.0, 0.0, 0.0};
  for (int k = 0; k < 3; k++) {
    if (cj->loc[k] - ci->loc[k] < -e->s->dim[k] / 2)
      shift[k] = e->s->dim[k];
    else if (cj->loc[k] - ci->loc[k] > e->s->dim[k] / 2)
      shift[k] = -e->s->dim[k];
  }

Loic Hausammann's avatar
Loic Hausammann committed
368
  runner_dopair_subset_stars_density(r, ci, sparts_i, ind, scount, cj, shift);
Loic Hausammann's avatar
Loic Hausammann committed
369
370
}

371
372
373
374
void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci,
                                       struct spart *sparts, int *ind,
                                       int scount, struct cell *cj, int sid,
                                       int gettimer) {
Loic Hausammann's avatar
Loic Hausammann committed
375
376
377
378
379
380
381

  const struct engine *e = r->e;
  struct space *s = e->s;

  TIMER_TIC;

  /* Should we even bother? */
Loic Hausammann's avatar
Loic Hausammann committed
382
383
  if (!cell_is_active_stars(ci, e) &&
      (cj == NULL || !cell_is_active_stars(cj, e)))
Loic Hausammann's avatar
Loic Hausammann committed
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
    return;
  if (ci->scount == 0 || (cj != NULL && cj->scount == 0)) return;

  /* Find out in which sub-cell of ci the parts are. */
  struct cell *sub = NULL;
  if (ci->split) {
    for (int k = 0; k < 8; k++) {
      if (ci->progeny[k] != NULL) {
        if (&sparts[ind[0]] >= &ci->progeny[k]->sparts[0] &&
            &sparts[ind[0]] < &ci->progeny[k]->sparts[ci->progeny[k]->scount]) {
          sub = ci->progeny[k];
          break;
        }
      }
    }
  }

  /* Is this a single cell? */
  if (cj == NULL) {

    /* Recurse? */
405
    if (cell_can_recurse_in_self_stars_task(ci)) {
Loic Hausammann's avatar
Loic Hausammann committed
406
407

      /* Loop over all progeny. */
408
409
      runner_dosub_subset_stars_density(r, sub, sparts, ind, scount, NULL, -1,
                                        0);
Loic Hausammann's avatar
Loic Hausammann committed
410
411
      for (int j = 0; j < 8; j++)
        if (ci->progeny[j] != sub && ci->progeny[j] != NULL)
412
413
          runner_dosub_subset_stars_density(r, sub, sparts, ind, scount,
                                            ci->progeny[j], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
414
415
416
417
418

    }

    /* Otherwise, compute self-interaction. */
    else
Loic Hausammann's avatar
Loic Hausammann committed
419
      runner_doself_subset_branch_stars_density(r, ci, sparts, ind, scount);
Loic Hausammann's avatar
Loic Hausammann committed
420
421
422
423
424
425
  } /* self-interaction. */

  /* Otherwise, it's a pair interaction. */
  else {

    /* Recurse? */
426
427
    if (cell_can_recurse_in_pair_stars_task(ci) &&
        cell_can_recurse_in_pair_stars_task(cj)) {
Loic Hausammann's avatar
Loic Hausammann committed
428
429
430
431
432
433
434
435
436
437
438

      /* Get the type of pair if not specified explicitly. */
      double shift[3] = {0.0, 0.0, 0.0};
      sid = space_getsid(s, &ci, &cj, shift);

      /* Different types of flags. */
      switch (sid) {

        /* Regular sub-cell interactions of a single cell. */
        case 0: /* (  1 ,  1 ,  1 ) */
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
439
440
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
441
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
442
443
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
444
445
446
447
          break;

        case 1: /* (  1 ,  1 ,  0 ) */
          if (ci->progeny[6] == sub && cj->progeny[0] != NULL)
448
449
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
450
          if (ci->progeny[6] != NULL && cj->progeny[0] == sub)
451
452
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
453
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
454
455
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
456
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
457
458
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
459
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
460
461
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
462
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
463
464
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
465
          if (ci->progeny[7] == sub && cj->progeny[1] != NULL)
466
467
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
468
          if (ci->progeny[7] != NULL && cj->progeny[1] == sub)
469
470
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
471
472
473
474
          break;

        case 2: /* (  1 ,  1 , -1 ) */
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
475
476
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
477
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
478
479
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
480
481
482
483
          break;

        case 3: /* (  1 ,  0 ,  1 ) */
          if (ci->progeny[5] == sub && cj->progeny[0] != NULL)
484
485
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
486
          if (ci->progeny[5] != NULL && cj->progeny[0] == sub)
487
488
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
489
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
490
491
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
492
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
493
494
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
495
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
496
497
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
498
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
499
500
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
501
          if (ci->progeny[7] == sub && cj->progeny[2] != NULL)
502
503
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
504
          if (ci->progeny[7] != NULL && cj->progeny[2] == sub)
505
506
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
507
508
509
510
          break;

        case 4: /* (  1 ,  0 ,  0 ) */
          if (ci->progeny[4] == sub && cj->progeny[0] != NULL)
511
512
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
513
          if (ci->progeny[4] != NULL && cj->progeny[0] == sub)
514
515
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
516
          if (ci->progeny[4] == sub && cj->progeny[1] != NULL)
517
518
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
519
          if (ci->progeny[4] != NULL && cj->progeny[1] == sub)
520
521
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
522
          if (ci->progeny[4] == sub && cj->progeny[2] != NULL)
523
524
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
525
          if (ci->progeny[4] != NULL && cj->progeny[2] == sub)
526
527
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
528
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
529
530
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
531
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
532
533
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
534
          if (ci->progeny[5] == sub && cj->progeny[0] != NULL)
535
536
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
537
          if (ci->progeny[5] != NULL && cj->progeny[0] == sub)
538
539
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
540
          if (ci->progeny[5] == sub && cj->progeny[1] != NULL)
541
542
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
543
          if (ci->progeny[5] != NULL && cj->progeny[1] == sub)
544
545
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
546
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
547
548
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
549
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
550
551
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
552
          if (ci->progeny[5] == sub && cj->progeny[3] != NULL)
553
554
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
555
          if (ci->progeny[5] != NULL && cj->progeny[3] == sub)
556
557
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
558
          if (ci->progeny[6] == sub && cj->progeny[0] != NULL)
559
560
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
561
          if (ci->progeny[6] != NULL && cj->progeny[0] == sub)
562
563
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
564
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
565
566
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
567
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
568
569
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
570
          if (ci->progeny[6] == sub && cj->progeny[2] != NULL)
571
572
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
573
          if (ci->progeny[6] != NULL && cj->progeny[2] == sub)
574
575
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
576
          if (ci->progeny[6] == sub && cj->progeny[3] != NULL)
577
578
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
579
          if (ci->progeny[6] != NULL && cj->progeny[3] == sub)
580
581
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
582
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
583
584
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
585
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
586
587
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
588
          if (ci->progeny[7] == sub && cj->progeny[1] != NULL)
589
590
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
591
          if (ci->progeny[7] != NULL && cj->progeny[1] == sub)
592
593
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
594
          if (ci->progeny[7] == sub && cj->progeny[2] != NULL)
595
596
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
597
          if (ci->progeny[7] != NULL && cj->progeny[2] == sub)
598
599
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
600
          if (ci->progeny[7] == sub && cj->progeny[3] != NULL)
601
602
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
603
          if (ci->progeny[7] != NULL && cj->progeny[3] == sub)
604
605
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
606
607
608
609
          break;

        case 5: /* (  1 ,  0 , -1 ) */
          if (ci->progeny[4] == sub && cj->progeny[1] != NULL)
610
611
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
612
          if (ci->progeny[4] != NULL && cj->progeny[1] == sub)
613
614
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
615
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
616
617
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
618
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
619
620
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
621
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
622
623
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
624
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
625
626
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
627
          if (ci->progeny[6] == sub && cj->progeny[3] != NULL)
628
629
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
630
          if (ci->progeny[6] != NULL && cj->progeny[3] == sub)
631
632
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
633
634
635
636
          break;

        case 6: /* (  1 , -1 ,  1 ) */
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
637
638
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
639
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
640
641
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
642
643
644
645
          break;

        case 7: /* (  1 , -1 ,  0 ) */
          if (ci->progeny[4] == sub && cj->progeny[2] != NULL)
646
647
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
648
          if (ci->progeny[4] != NULL && cj->progeny[2] == sub)
649
650
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
651
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
652
653
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
654
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
655
656
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
657
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
658
659
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
660
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
661
662
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
663
          if (ci->progeny[5] == sub && cj->progeny[3] != NULL)
664
665
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
666
          if (ci->progeny[5] != NULL && cj->progeny[3] == sub)
667
668
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
669
670
671
672
          break;

        case 8: /* (  1 , -1 , -1 ) */
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
673
674
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind,
                                              scount, cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
675
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
676
677
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind,
                                              scount, ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
678
679
680
681
          break;

        case 9: /* (  0 ,  1 ,  1 ) */
          if (ci->progeny[3] == sub && cj->progeny[0] != NULL)
682
683
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
684
          if (ci->progeny[3] != NULL && cj->progeny[0] == sub)
685
686
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
687
          if (ci->progeny[3] == sub && cj->progeny[4] != NULL)
688
689
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
690
          if (ci->progeny[3] != NULL && cj->progeny[4] == sub)
691
692
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
693
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
694
695
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
696
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
697
698
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
699
          if (ci->progeny[7] == sub && cj->progeny[4] != NULL)
700
701
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
702
          if (ci->progeny[7] != NULL && cj->progeny[4] == sub)
703
704
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
705
706
707
708
          break;

        case 10: /* (  0 ,  1 ,  0 ) */
          if (ci->progeny[2] == sub && cj->progeny[0] != NULL)
709
710
            runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
711
          if (ci->progeny[2] != NULL && cj->progeny[0] == sub)
712
713
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
714
          if (ci->progeny[2] == sub && cj->progeny[1] != NULL)
715
716
            runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
717
          if (ci->progeny[2] != NULL && cj->progeny[1] == sub)
718
719
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
720
          if (ci->progeny[2] == sub && cj->progeny[4] != NULL)
721
722
            runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
723
          if (ci->progeny[2] != NULL && cj->progeny[4] == sub)
724
725
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
726
          if (ci->progeny[2] == sub && cj->progeny[5] != NULL)
727
728
            runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind,
                                              scount, cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
729
          if (ci->progeny[2] != NULL && cj->progeny[5] == sub)
730
731
            runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind,
                                              scount, ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
732
          if (ci->progeny[3] == sub && cj->progeny[0] != NULL)
733
734
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
735
          if (ci->progeny[3] != NULL && cj->progeny[0] == sub)
736
737
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
738
          if (ci->progeny[3] == sub && cj->progeny[1] != NULL)
739
740
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
741
          if (ci->progeny[3] != NULL && cj->progeny[1] == sub)
742
743
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
744
          if (ci->progeny[3] == sub && cj->progeny[4] != NULL)
745
746
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
747
          if (ci->progeny[3] != NULL && cj->progeny[4] == sub)
748
749
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
750
          if (ci->progeny[3] == sub && cj->progeny[5] != NULL)
751
752
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
753
          if (ci->progeny[3] != NULL && cj->progeny[5] == sub)
754
755
            runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
756
          if (ci->progeny[6] == sub && cj->progeny[0] != NULL)
757
758
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
759
          if (ci->progeny[6] != NULL && cj->progeny[0] == sub)
760
761
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
762
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
763
764
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
765
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
766
767
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
768
          if (ci->progeny[6] == sub && cj->progeny[4] != NULL)
769
770
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
771
          if (ci->progeny[6] != NULL && cj->progeny[4] == sub)
772
773
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
774
          if (ci->progeny[6] == sub && cj->progeny[5] != NULL)
775
776
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
777
          if (ci->progeny[6] != NULL && cj->progeny[5] == sub)
778
779
            runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
780
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
781
782
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
783
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
784
785
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
786
          if (ci->progeny[7] == sub && cj->progeny[1] != NULL)
787
788
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
789
          if (ci->progeny[7] != NULL && cj->progeny[1] == sub)
790
791
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
792
          if (ci->progeny[7] == sub && cj->progeny[4] != NULL)
793
794
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
795
          if (ci->progeny[7] != NULL && cj->progeny[4] == sub)
796
797
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
798
          if (ci->progeny[7] == sub && cj->progeny[5] != NULL)
799
800
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind,
                                              scount, cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
801
          if (ci->progeny[7] != NULL && cj->progeny[5] == sub)
802
803
            runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind,
                                              scount, ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
804
805
806
807
          break;

        case 11: /* (  0 ,  1 , -1 ) */
          if (ci->progeny[2] == sub && cj->progeny[1] != NULL)
808
809
            runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
810
          if (ci->progeny[2] != NULL && cj->progeny[1] == sub)
811
812
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
813
          if (ci->progeny[2] == sub && cj->progeny[5] != NULL)
814
815
            runner_dosub_subset_stars_density(r, ci->progeny[2], sparts, ind,
                                              scount, cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
816
          if (ci->progeny[2] != NULL && cj->progeny[5] == sub)
817
818
            runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind,
                                              scount, ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
819
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
820
821
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
822
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
823
824
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
825
          if (ci->progeny[6] == sub && cj->progeny[5] != NULL)
826
827
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind,
                                              scount, cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
828
          if (ci->progeny[6] != NULL && cj->progeny[5] == sub)
829
830
            runner_dosub_subset_stars_density(r, cj->progeny[5], sparts, ind,
                                              scount, ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
831
832
833
834
          break;

        case 12: /* (  0 ,  0 ,  1 ) */
          if (ci->progeny[1] == sub && cj->progeny[0] != NULL)
835
836
            runner_dosub_subset_stars_density(r, ci->progeny[1], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
837
          if (ci->progeny[1] != NULL && cj->progeny[0] == sub)
838
839
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
840
          if (ci->progeny[1] == sub && cj->progeny[2] != NULL)
841
842
            runner_dosub_subset_stars_density(r, ci->progeny[1], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
843
          if (ci->progeny[1] != NULL && cj->progeny[2] == sub)
844
845
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
846
          if (ci->progeny[1] == sub && cj->progeny[4] != NULL)
847
848
            runner_dosub_subset_stars_density(r, ci->progeny[1], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
849
          if (ci->progeny[1] != NULL && cj->progeny[4] == sub)
850
851
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
852
          if (ci->progeny[1] == sub && cj->progeny[6] != NULL)
853
854
            runner_dosub_subset_stars_density(r, ci->progeny[1], sparts, ind,
                                              scount, cj->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
855
          if (ci->progeny[1] != NULL && cj->progeny[6] == sub)
856
857
            runner_dosub_subset_stars_density(r, cj->progeny[6], sparts, ind,
                                              scount, ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
858
          if (ci->progeny[3] == sub && cj->progeny[0] != NULL)
859
860
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
861
          if (ci->progeny[3] != NULL && cj->progeny[0] == sub)
862
863
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
864
          if (ci->progeny[3] == sub && cj->progeny[2] != NULL)
865
866
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
867
          if (ci->progeny[3] != NULL && cj->progeny[2] == sub)
868
869
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
870
          if (ci->progeny[3] == sub && cj->progeny[4] != NULL)
871
872
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
873
          if (ci->progeny[3] != NULL && cj->progeny[4] == sub)
874
875
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
876
          if (ci->progeny[3] == sub && cj->progeny[6] != NULL)
877
878
            runner_dosub_subset_stars_density(r, ci->progeny[3], sparts, ind,
                                              scount, cj->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
879
          if (ci->progeny[3] != NULL && cj->progeny[6] == sub)
880
881
            runner_dosub_subset_stars_density(r, cj->progeny[6], sparts, ind,
                                              scount, ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
882
          if (ci->progeny[5] == sub && cj->progeny[0] != NULL)
883
884
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
885
          if (ci->progeny[5] != NULL && cj->progeny[0] == sub)
886
887
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
888
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
889
890
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
891
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
892
893
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
894
          if (ci->progeny[5] == sub && cj->progeny[4] != NULL)
895
896
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
897
          if (ci->progeny[5] != NULL && cj->progeny[4] == sub)
898
899
            runner_dosub_subset_stars_density(r, cj->progeny[4], sparts, ind,
                                              scount, ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
900
          if (ci->progeny[5] == sub && cj->progeny[6] != NULL)
901
902
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind,
                                              scount, cj->progeny[6], -1, 0);