runner_doiact_stars.h 63.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*******************************************************************************
 * 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/>.
 *
 ******************************************************************************/

21
22
/* Before including this file, define FUNCTION, which is the
   name of the interaction function. This creates the interaction functions
Loic Hausammann's avatar
Loic Hausammann committed
23
24
   runner_dopair_FUNCTION, runner_doself_FUNCTION and runner_dosub_FUNCTION
   calling the pairwise interaction function runner_iact_FUNCTION. */
25
26
27

#define PASTE(x, y) x##_##y

28
29
#define _DOSELF1_STARS(f) PASTE(runner_doself_stars, f)
#define DOSELF1_STARS _DOSELF1_STARS(FUNCTION)
30

31
32
#define _DO_NONSYM_PAIR1_STARS(f) PASTE(runner_do_nonsym_pair_stars, f)
#define DO_NONSYM_PAIR1_STARS _DO_NONSYM_PAIR1_STARS(FUNCTION)
33

34
35
#define _DOPAIR1_STARS(f) PASTE(runner_dopair_stars, f)
#define DOPAIR1_STARS _DOPAIR1_STARS(FUNCTION)
36

37
38
#define _DOPAIR1_SUBSET_STARS(f) PASTE(runner_dopair_subset_stars, f)
#define DOPAIR1_SUBSET_STARS _DOPAIR1_SUBSET_STARS(FUNCTION)
39

40
41
#define _DOSELF1_SUBSET_STARS(f) PASTE(runner_doself_subset_stars, f)
#define DOSELF1_SUBSET_STARS _DOSELF1_SUBSET_STARS(FUNCTION)
42

43
44
#define _DOSELF1_SUBSET_BRANCH_STARS(f) \
  PASTE(runner_doself_subset_branch_stars, f)
45
#define DOSELF1_SUBSET_BRANCH_STARS _DOSELF1_SUBSET_BRANCH_STARS(FUNCTION)
46

47
48
#define _DOPAIR1_SUBSET_BRANCH_STARS(f) \
  PASTE(runner_dopair_subset_branch_stars, f)
49
#define DOPAIR1_SUBSET_BRANCH_STARS _DOPAIR1_SUBSET_BRANCH_STARS(FUNCTION)
50
51
52
53

#define _DOSUB_SUBSET_STARS(f) PASTE(runner_dosub_subset_stars, f)
#define DOSUB_SUBSET_STARS _DOSUB_SUBSET_STARS(FUNCTION)

54
55
#define _DOSELF1_BRANCH_STARS(f) PASTE(runner_doself_branch_stars, f)
#define DOSELF1_BRANCH_STARS _DOSELF1_BRANCH_STARS(FUNCTION)
56

57
58
#define _DOPAIR1_BRANCH_STARS(f) PASTE(runner_dopair_branch_stars, f)
#define DOPAIR1_BRANCH_STARS _DOPAIR1_BRANCH_STARS(FUNCTION)
59

60
61
#define _DOSUB_PAIR1_STARS(f) PASTE(runner_dosub_pair_stars, f)
#define DOSUB_PAIR1_STARS _DOSUB_PAIR1_STARS(FUNCTION)
62

63
64
#define _DOSUB_SELF1_STARS(f) PASTE(runner_dosub_self_stars, f)
#define DOSUB_SELF1_STARS _DOSUB_SELF1_STARS(FUNCTION)
65
66
67
68

#define _IACT_STARS(f) PASTE(runner_iact_nonsym_stars, f)
#define IACT_STARS _IACT_STARS(FUNCTION)

69
70
71
72
73
74
75
/**
 * @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.
 */
76
void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) {
77
78
79
80
  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

  /* Anything to do here? */
Loic Hausammann's avatar
Loic Hausammann committed
81
  if (!cell_is_active_stars(c, e)) return;
Loic Hausammann's avatar
Loic Hausammann committed
82
  if (c->hydro.count == 0 && c->stars.count == 0) return;
83
84
85
86
87

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

88
  const int scount = c->stars.count;
89
  const int count = c->hydro.count;
90
  struct spart *restrict sparts = c->stars.parts;
91
  struct part *restrict parts = c->hydro.parts;
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

  /* 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
124
      if (r2 > 0.f && r2 < hig2) {
125
        IACT_STARS(r2, dx, hi, hj, si, pj, a, H);
126
      }
127
128
129
130
131
    } /* loop over the parts in ci. */
  }   /* loop over the sparts in ci. */
}

/**
Loic Hausammann's avatar
Loic Hausammann committed
132
 * @brief Calculate the number density of cj #part around the ci #spart
133
134
 *
 * @param r runner task
Matthieu Schaller's avatar
Matthieu Schaller committed
135
136
 * @param ci The first #cell
 * @param cj The second #cell
137
 */
138
139
void DO_NONSYM_PAIR1_STARS(struct runner *r, struct cell *restrict ci,
                           struct cell *restrict cj) {
140
141
142
143
144

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

  /* Anything to do here? */
Loic Hausammann's avatar
Loic Hausammann committed
145
  if (!cell_is_active_stars(ci, e)) return;
146

147
  const int scount_i = ci->stars.count;
148
  const int count_j = cj->hydro.count;
149
  struct spart *restrict sparts_i = ci->stars.parts;
150
  struct part *restrict parts_j = cj->hydro.parts;
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

  /* 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

196
      if (r2 < hig2) IACT_STARS(r2, dx, hi, hj, si, pj, a, H);
197
198
199
200
201

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

202
void DOPAIR1_STARS(struct runner *r, struct cell *restrict ci,
203
                   struct cell *restrict cj, int timer) {
204

Loic Hausammann's avatar
Loic Hausammann committed
205
  if (ci->stars.count != 0 && cj->hydro.count != 0)
206
    DO_NONSYM_PAIR1_STARS(r, ci, cj);
Loic Hausammann's avatar
Loic Hausammann committed
207
  if (cj->stars.count != 0 && ci->hydro.count != 0)
208
    DO_NONSYM_PAIR1_STARS(r, cj, ci);
209
}
Loic Hausammann's avatar
Loic Hausammann committed
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224

/**
 * @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.
 */
225
226
227
228
void DOPAIR1_SUBSET_STARS(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
229
230
231
232

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

233
234
  const int count_j = cj->hydro.count;
  struct part *restrict parts_j = cj->hydro.parts;
Loic Hausammann's avatar
Loic Hausammann committed
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

  /* 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) {
276
        IACT_STARS(r2, dx, hi, pj->h, spi, pj, a, H);
Loic Hausammann's avatar
Loic Hausammann committed
277
278
279
280
      }
    } /* loop over the parts in cj. */
  }   /* loop over the parts in ci. */
}
Loic Hausammann's avatar
Loic Hausammann committed
281
282
283
284
285
286
287
288
289
290
291

/**
 * @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.
 */
292
void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci,
293
294
                          struct spart *restrict sparts, int *restrict ind,
                          int scount) {
Loic Hausammann's avatar
Loic Hausammann committed
295
296
297
298
299
300
301
302

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

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

303
304
  const int count_i = ci->hydro.count;
  struct part *restrict parts_j = ci->hydro.parts;
Loic Hausammann's avatar
Loic Hausammann committed
305
306
307
308
309
310
311

  /* 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]),
312
313
                           (float)(spi->x[1] - ci->loc[1]),
                           (float)(spi->x[2] - ci->loc[2])};
Loic Hausammann's avatar
Loic Hausammann committed
314
315
316
317
    const float hi = spi->h;
    const float hig2 = hi * hi * kernel_gamma2;

#ifdef SWIFT_DEBUG_CHECKS
318
319
    if (!spart_is_active(spi, e))
      error("Inactive particle in subset function!");
Loic Hausammann's avatar
Loic Hausammann committed
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
#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) {
344
        IACT_STARS(r2, dx, hi, hj, spi, pj, a, H);
Loic Hausammann's avatar
Loic Hausammann committed
345
346
347
348
349
      }
    } /* loop over the parts in cj. */
  }   /* loop over the parts in ci. */
}

350
/**
351
352
353
354
355
356
357
358
359
360
361
362
 * @brief Determine which version of DOSELF1_SUBSET_STARS needs to be called
 * depending on the optimisation level.
 *
 * @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.
 */
void DOSELF1_SUBSET_BRANCH_STARS(struct runner *r, struct cell *restrict ci,
                                 struct spart *restrict sparts,
                                 int *restrict ind, int scount) {
Loic Hausammann's avatar
Loic Hausammann committed
363

364
  DOSELF1_SUBSET_STARS(r, ci, sparts, ind, scount);
Loic Hausammann's avatar
Loic Hausammann committed
365
366
}

367
/**
368
369
370
 * @brief Determine which version of DOPAIR1_SUBSET_STARS needs to be called
 * depending on the orientation of the cells or whether DOPAIR1_SUBSET_STARS
 * needs to be called at all.
Loic Hausammann's avatar
Loic Hausammann committed
371
372
373
374
375
376
377
378
 *
 * @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.
 */
379
380
381
382
void DOPAIR1_SUBSET_BRANCH_STARS(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
383
384
385
386
387
388
389
390
391
392
393
394

  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];
  }

395
  DOPAIR1_SUBSET_STARS(r, ci, sparts_i, ind, scount, cj, shift);
Loic Hausammann's avatar
Loic Hausammann committed
396
397
}

398
399
400
void DOSUB_SUBSET_STARS(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
401
402
403
404
405

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

  /* Should we even bother? */
Loic Hausammann's avatar
Loic Hausammann committed
406
407
  if (!cell_is_active_stars(ci, e) &&
      (cj == NULL || !cell_is_active_stars(cj, e)))
Loic Hausammann's avatar
Loic Hausammann committed
408
409
410
411
412
413
414
    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) {
415
416
417
        if (&sparts[ind[0]] >= &ci->progeny[k]->stars.parts[0] &&
            &sparts[ind[0]] <
                &ci->progeny[k]->stars.parts[ci->progeny[k]->stars.count]) {
Loic Hausammann's avatar
Loic Hausammann committed
418
419
420
421
422
423
424
425
426
427
428
          sub = ci->progeny[k];
          break;
        }
      }
    }
  }

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

    /* Recurse? */
429
    if (cell_can_recurse_in_self_stars_task(ci)) {
Loic Hausammann's avatar
Loic Hausammann committed
430
431

      /* Loop over all progeny. */
432
      DOSUB_SUBSET_STARS(r, sub, sparts, ind, scount, NULL, -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
433
434
      for (int j = 0; j < 8; j++)
        if (ci->progeny[j] != sub && ci->progeny[j] != NULL)
435
436
          DOSUB_SUBSET_STARS(r, sub, sparts, ind, scount, ci->progeny[j], -1,
                             0);
Loic Hausammann's avatar
Loic Hausammann committed
437
438
439
440
441

    }

    /* Otherwise, compute self-interaction. */
    else
442
      DOSELF1_SUBSET_BRANCH_STARS(r, ci, sparts, ind, scount);
Loic Hausammann's avatar
Loic Hausammann committed
443
444
445
446
447
448
  } /* self-interaction. */

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

    /* Recurse? */
449
450
    if (cell_can_recurse_in_pair_stars_task(ci) &&
        cell_can_recurse_in_pair_stars_task(cj)) {
Loic Hausammann's avatar
Loic Hausammann committed
451
452
453
454
455
456
457
458
459
460
461

      /* 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)
462
463
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
464
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
465
466
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
467
468
469
470
          break;

        case 1: /* (  1 ,  1 ,  0 ) */
          if (ci->progeny[6] == sub && cj->progeny[0] != NULL)
471
472
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
473
          if (ci->progeny[6] != NULL && cj->progeny[0] == sub)
474
475
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
476
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
477
478
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
479
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
480
481
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
482
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
483
484
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
485
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
486
487
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
488
          if (ci->progeny[7] == sub && cj->progeny[1] != NULL)
489
490
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
491
          if (ci->progeny[7] != NULL && cj->progeny[1] == sub)
492
493
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
494
495
496
497
          break;

        case 2: /* (  1 ,  1 , -1 ) */
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
498
499
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
500
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
501
502
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
503
504
505
506
          break;

        case 3: /* (  1 ,  0 ,  1 ) */
          if (ci->progeny[5] == sub && cj->progeny[0] != NULL)
507
508
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
509
          if (ci->progeny[5] != NULL && cj->progeny[0] == sub)
510
511
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
512
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
513
514
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
515
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
516
517
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
518
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
519
520
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
521
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
522
523
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
524
          if (ci->progeny[7] == sub && cj->progeny[2] != NULL)
525
526
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
527
          if (ci->progeny[7] != NULL && cj->progeny[2] == sub)
528
529
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
530
531
532
533
          break;

        case 4: /* (  1 ,  0 ,  0 ) */
          if (ci->progeny[4] == sub && cj->progeny[0] != NULL)
534
535
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
536
          if (ci->progeny[4] != NULL && cj->progeny[0] == sub)
537
538
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
539
          if (ci->progeny[4] == sub && cj->progeny[1] != NULL)
540
541
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
542
          if (ci->progeny[4] != NULL && cj->progeny[1] == sub)
543
544
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
545
          if (ci->progeny[4] == sub && cj->progeny[2] != NULL)
546
547
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
548
          if (ci->progeny[4] != NULL && cj->progeny[2] == sub)
549
550
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
551
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
552
553
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
554
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
555
556
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
557
          if (ci->progeny[5] == sub && cj->progeny[0] != NULL)
558
559
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
560
          if (ci->progeny[5] != NULL && cj->progeny[0] == sub)
561
562
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
563
          if (ci->progeny[5] == sub && cj->progeny[1] != NULL)
564
565
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
566
          if (ci->progeny[5] != NULL && cj->progeny[1] == sub)
567
568
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
569
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
570
571
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
572
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
573
574
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
575
          if (ci->progeny[5] == sub && cj->progeny[3] != NULL)
576
577
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
578
          if (ci->progeny[5] != NULL && cj->progeny[3] == sub)
579
580
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
581
          if (ci->progeny[6] == sub && cj->progeny[0] != NULL)
582
583
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
584
          if (ci->progeny[6] != NULL && cj->progeny[0] == sub)
585
586
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
587
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
588
589
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
590
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
591
592
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
593
          if (ci->progeny[6] == sub && cj->progeny[2] != NULL)
594
595
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
596
          if (ci->progeny[6] != NULL && cj->progeny[2] == sub)
597
598
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
599
          if (ci->progeny[6] == sub && cj->progeny[3] != NULL)
600
601
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
602
          if (ci->progeny[6] != NULL && cj->progeny[3] == sub)
603
604
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
605
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
606
607
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
608
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
609
610
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
611
          if (ci->progeny[7] == sub && cj->progeny[1] != NULL)
612
613
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
614
          if (ci->progeny[7] != NULL && cj->progeny[1] == sub)
615
616
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
617
          if (ci->progeny[7] == sub && cj->progeny[2] != NULL)
618
619
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
620
          if (ci->progeny[7] != NULL && cj->progeny[2] == sub)
621
622
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
623
          if (ci->progeny[7] == sub && cj->progeny[3] != NULL)
624
625
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
626
          if (ci->progeny[7] != NULL && cj->progeny[3] == sub)
627
628
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
629
630
631
632
          break;

        case 5: /* (  1 ,  0 , -1 ) */
          if (ci->progeny[4] == sub && cj->progeny[1] != NULL)
633
634
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
635
          if (ci->progeny[4] != NULL && cj->progeny[1] == sub)
636
637
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
638
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
639
640
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
641
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
642
643
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
644
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
645
646
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
647
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
648
649
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
650
          if (ci->progeny[6] == sub && cj->progeny[3] != NULL)
651
652
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
653
          if (ci->progeny[6] != NULL && cj->progeny[3] == sub)
654
655
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
656
657
658
659
          break;

        case 6: /* (  1 , -1 ,  1 ) */
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
660
661
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
662
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
663
664
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
665
666
667
668
          break;

        case 7: /* (  1 , -1 ,  0 ) */
          if (ci->progeny[4] == sub && cj->progeny[2] != NULL)
669
670
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
671
          if (ci->progeny[4] != NULL && cj->progeny[2] == sub)
672
673
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
674
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
675
676
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
677
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
678
679
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
680
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
681
682
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
683
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
684
685
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
686
          if (ci->progeny[5] == sub && cj->progeny[3] != NULL)
687
688
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
689
          if (ci->progeny[5] != NULL && cj->progeny[3] == sub)
690
691
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
692
693
694
695
          break;

        case 8: /* (  1 , -1 , -1 ) */
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
696
697
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
698
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
699
700
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
701
702
703
704
          break;

        case 9: /* (  0 ,  1 ,  1 ) */
          if (ci->progeny[3] == sub && cj->progeny[0] != NULL)
705
706
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
707
          if (ci->progeny[3] != NULL && cj->progeny[0] == sub)
708
709
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
710
          if (ci->progeny[3] == sub && cj->progeny[4] != NULL)
711
712
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
713
          if (ci->progeny[3] != NULL && cj->progeny[4] == sub)
714
715
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
716
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
717
718
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
719
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
720
721
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
722
          if (ci->progeny[7] == sub && cj->progeny[4] != NULL)
723
724
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
725
          if (ci->progeny[7] != NULL && cj->progeny[4] == sub)
726
727
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
728
729
730
731
          break;

        case 10: /* (  0 ,  1 ,  0 ) */
          if (ci->progeny[2] == sub && cj->progeny[0] != NULL)
732
733
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
734
          if (ci->progeny[2] != NULL && cj->progeny[0] == sub)
735
736
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
737
          if (ci->progeny[2] == sub && cj->progeny[1] != NULL)
738
739
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
740
          if (ci->progeny[2] != NULL && cj->progeny[1] == sub)
741
742
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
743
          if (ci->progeny[2] == sub && cj->progeny[4] != NULL)
744
745
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
746
          if (ci->progeny[2] != NULL && cj->progeny[4] == sub)
747
748
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
749
          if (ci->progeny[2] == sub && cj->progeny[5] != NULL)
750
751
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
752
          if (ci->progeny[2] != NULL && cj->progeny[5] == sub)
753
754
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
755
          if (ci->progeny[3] == sub && cj->progeny[0] != NULL)
756
757
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
758
          if (ci->progeny[3] != NULL && cj->progeny[0] == sub)
759
760
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
761
          if (ci->progeny[3] == sub && cj->progeny[1] != NULL)
762
763
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
764
          if (ci->progeny[3] != NULL && cj->progeny[1] == sub)
765
766
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
767
          if (ci->progeny[3] == sub && cj->progeny[4] != NULL)
768
769
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
770
          if (ci->progeny[3] != NULL && cj->progeny[4] == sub)
771
772
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
773
          if (ci->progeny[3] == sub && cj->progeny[5] != NULL)
774
775
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
776
          if (ci->progeny[3] != NULL && cj->progeny[5] == sub)
777
778
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
779
          if (ci->progeny[6] == sub && cj->progeny[0] != NULL)
780
781
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
782
          if (ci->progeny[6] != NULL && cj->progeny[0] == sub)
783
784
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
785
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
786
787
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
788
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
789
790
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
791
          if (ci->progeny[6] == sub && cj->progeny[4] != NULL)
792
793
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
794
          if (ci->progeny[6] != NULL && cj->progeny[4] == sub)
795
796
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
797
          if (ci->progeny[6] == sub && cj->progeny[5] != NULL)
798
799
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
800
          if (ci->progeny[6] != NULL && cj->progeny[5] == sub)
801
802
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
803
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
804
805
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
806
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
807
808
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
809
          if (ci->progeny[7] == sub && cj->progeny[1] != NULL)
810
811
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
812
          if (ci->progeny[7] != NULL && cj->progeny[1] == sub)
813
814
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
815
          if (ci->progeny[7] == sub && cj->progeny[4] != NULL)
816
817
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
818
          if (ci->progeny[7] != NULL && cj->progeny[4] == sub)
819
820
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
821
          if (ci->progeny[7] == sub && cj->progeny[5] != NULL)
822
823
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
824
          if (ci->progeny[7] != NULL && cj->progeny[5] == sub)
825
826
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
827
828
829
830
          break;

        case 11: /* (  0 ,  1 , -1 ) */
          if (ci->progeny[2] == sub && cj->progeny[1] != NULL)
831
832
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
833
          if (ci->progeny[2] != NULL && cj->progeny[1] == sub)
834
835
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
836
          if (ci->progeny[2] == sub && cj->progeny[5] != NULL)
837
838
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
839
          if (ci->progeny[2] != NULL && cj->progeny[5] == sub)
840
841
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
842
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
843
844
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
845
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
846
847
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
848
          if (ci->progeny[6] == sub && cj->progeny[5] != NULL)
849
850
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
851
          if (ci->progeny[6] != NULL && cj->progeny[5] == sub)
852
853
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
854
855
856
857
          break;

        case 12: /* (  0 ,  0 ,  1 ) */
          if (ci->progeny[1] == sub && cj->progeny[0] != NULL)
858
859
            DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
860
          if (ci->progeny[1] != NULL && cj->progeny[0] == sub)
861
862
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
863
          if (ci->progeny[1] == sub && cj->progeny[2] != NULL)
864
865
            DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
866
          if (ci->progeny[1] != NULL && cj->progeny[2] == sub)
867
868
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
869
          if (ci->progeny[1] == sub && cj->progeny[4] != NULL)
870
871
            DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
872
          if (ci->progeny[1] != NULL && cj->progeny[4] == sub)
873
874
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
875
          if (ci->progeny[1] == sub && cj->progeny[6] != NULL)
876
877
            DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount,
                               cj->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
878
          if (ci->progeny[1] != NULL && cj->progeny[6] == sub)
879
880
            DOSUB_SUBSET_STARS(r, cj->progeny[6], sparts, ind, scount,
                               ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
881
          if (ci->progeny[3] == sub && cj->progeny[0] != NULL)
882
883
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
884
          if (ci->progeny[3] != NULL && cj->progeny[0] == sub)
885
886
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
887
          if (ci->progeny[3] == sub && cj->progeny[2] != NULL)
888
889
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
890
          if (ci->progeny[3] != NULL && cj->progeny[2] == sub)
891
892
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,