runner_doiact_stars.h 62 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) {
Loic Hausammann's avatar
Loic Hausammann committed
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
89
 
}

/**
Loic Hausammann's avatar
Loic Hausammann committed
90
 * @brief Calculate the number density of cj #part around the ci #spart
91
92
93
94
95
 *
 * @param r runner task
 * @param c cell
 * @param timer 1 if the time is to be recorded.
 */
Loic Hausammann's avatar
Loic Hausammann committed
96
void runner_dosubpair_stars_density(struct runner *r, struct cell *restrict ci,
97
98
99
100
101
102
				   struct cell *restrict cj) {

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

  /* Anything to do here? */
Loic Hausammann's avatar
Loic Hausammann committed
103
  if (!cell_is_active_stars(ci, e) && !cell_is_active_stars(cj, e)) return;
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
154

  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)
Loic Hausammann's avatar
Loic Hausammann committed
155
	runner_iact_nonsym_stars_density(r2, dx, hi, hj, si, pj, a, H);
156
157
158
159
160
161
162

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

}


Loic Hausammann's avatar
Loic Hausammann committed
163
void runner_dopair_stars_density(struct runner *r, struct cell *restrict ci,
164
165
166
167
				   struct cell *restrict cj, int timer) {

  TIMER_TIC;
  
Loic Hausammann's avatar
Loic Hausammann committed
168
169
  runner_dosubpair_stars_density(r, ci, cj);
  runner_dosubpair_stars_density(r, cj, ci);
170

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


/**
 * @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.
 */
Loic Hausammann's avatar
Loic Hausammann committed
189
void runner_dopair_subset_stars_density(struct runner *r, struct cell *restrict ci,
Loic Hausammann's avatar
Loic Hausammann committed
190
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
240
241
				       struct spart *restrict sparts_i, int *restrict ind,
				       int scount, struct cell *restrict cj,
				       const double *shift) {

  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
242
        runner_iact_nonsym_stars_density(r2, dx, hi, pj->h, spi, pj, a, H);
Loic Hausammann's avatar
Loic Hausammann committed
243
244
245
246
247
248
      }
    } /* loop over the parts in cj. */
  }   /* loop over the parts in ci. */

  TIMER_TOC(timer_dopair_subset_naive);
}
Loic Hausammann's avatar
Loic Hausammann committed
249
250
251
252
253
254
255
256
257
258
259
260


/**
 * @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.
 */
Loic Hausammann's avatar
Loic Hausammann committed
261
void runner_doself_subset_stars_density(struct runner *r, struct cell *restrict ci,
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
                   struct spart *restrict sparts, int *restrict ind, int scount) {

  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]),
			   (float)(spi->x[1] - ci->loc[1]),
			   (float)(spi->x[2] - ci->loc[2])};
    const float hi = spi->h;
    const float hig2 = hi * hi * kernel_gamma2;

#ifdef SWIFT_DEBUG_CHECKS
    if (!spart_is_active(spi, e)) error("Inactive particle in subset function!");
#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) {
Loic Hausammann's avatar
Loic Hausammann committed
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
327
328
329
330
331
}


 /**
 * @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.
 * @param parts 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.
 */
Loic Hausammann's avatar
Loic Hausammann committed
332
void runner_doself_subset_branch_stars_density(struct runner *r, struct cell *restrict ci,
Loic Hausammann's avatar
Loic Hausammann committed
333
334
335
                          struct spart *restrict sparts, int *restrict ind,
                          int scount) {

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
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.
 */
Loic Hausammann's avatar
Loic Hausammann committed
351
 void runner_dopair_subset_branch_stars_density(struct runner *r, struct cell *restrict ci,
Loic Hausammann's avatar
Loic Hausammann committed
352
353
354
355
356
357
358
359
360
361
362
363
364
365
                          struct spart *restrict sparts_i, int *restrict ind,
                          int scount, struct cell *restrict cj) {

  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
366
  runner_dopair_subset_stars_density(r, ci, sparts_i, ind, scount, cj, shift);
Loic Hausammann's avatar
Loic Hausammann committed
367
368
}

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

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

  TIMER_TIC;

  /* Should we even bother? */
Loic Hausammann's avatar
Loic Hausammann committed
378
379
  if (!cell_is_active_stars(ci, e) &&
      (cj == NULL || !cell_is_active_stars(cj, e)))
Loic Hausammann's avatar
Loic Hausammann committed
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
    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? */
401
    if (cell_can_recurse_in_self_stars_task(ci)) {
Loic Hausammann's avatar
Loic Hausammann committed
402
403

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

    }

    /* Otherwise, compute self-interaction. */
    else
Loic Hausammann's avatar
Loic Hausammann committed
413
      runner_doself_subset_branch_stars_density(r, ci, sparts, ind, scount);
Loic Hausammann's avatar
Loic Hausammann committed
414
415
416
417
418
419
  } /* self-interaction. */

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

    /* Recurse? */
420
421
    if (cell_can_recurse_in_pair_stars_task(ci) &&
        cell_can_recurse_in_pair_stars_task(cj)) {
Loic Hausammann's avatar
Loic Hausammann committed
422
423
424
425
426
427
428
429
430
431
432

      /* 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)
Loic Hausammann's avatar
Loic Hausammann committed
433
            runner_dosub_subset_stars_density(r, ci->progeny[7], sparts, ind, scount, cj->progeny[0],
Loic Hausammann's avatar
Loic Hausammann committed
434
435
                         -1, 0);
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
Loic Hausammann's avatar
Loic Hausammann committed
436
            runner_dosub_subset_stars_density(r, cj->progeny[0], sparts, ind, scount, ci->progeny[7],
Loic Hausammann's avatar
Loic Hausammann committed
437
438
439
440
441
                         -1, 0);
          break;

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

        case 2: /* (  1 ,  1 , -1 ) */
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
Loic Hausammann's avatar
Loic Hausammann committed
469
            runner_dosub_subset_stars_density(r, ci->progeny[6], sparts, ind, scount, cj->progeny[1],
Loic Hausammann's avatar
Loic Hausammann committed
470
471
                         -1, 0);
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
Loic Hausammann's avatar
Loic Hausammann committed
472
            runner_dosub_subset_stars_density(r, cj->progeny[1], sparts, ind, scount, ci->progeny[6],
Loic Hausammann's avatar
Loic Hausammann committed
473
474
475
476
477
                         -1, 0);
          break;

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

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

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

        case 6: /* (  1 , -1 ,  1 ) */
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
Loic Hausammann's avatar
Loic Hausammann committed
631
            runner_dosub_subset_stars_density(r, ci->progeny[5], sparts, ind, scount, cj->progeny[2],
Loic Hausammann's avatar
Loic Hausammann committed
632
633
                         -1, 0);
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
Loic Hausammann's avatar
Loic Hausammann committed
634
            runner_dosub_subset_stars_density(r, cj->progeny[2], sparts, ind, scount, ci->progeny[5],
Loic Hausammann's avatar
Loic Hausammann committed
635
636
637
638
639
                         -1, 0);
          break;

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

        case 8: /* (  1 , -1 , -1 ) */
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
Loic Hausammann's avatar
Loic Hausammann committed
667
            runner_dosub_subset_stars_density(r, ci->progeny[4], sparts, ind, scount, cj->progeny[3],
Loic Hausammann's avatar
Loic Hausammann committed
668
669
                         -1, 0);
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
Loic Hausammann's avatar
Loic Hausammann committed
670
            runner_dosub_subset_stars_density(r, cj->progeny[3], sparts, ind, scount, ci->progeny[4],
Loic Hausammann's avatar
Loic Hausammann committed
671
672
673
674
675
                         -1, 0);
          break;

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

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

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

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