runner_doiact_stars.h 65.5 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
81

#ifdef SWIFT_DEBUG_CHECKS
  if (c->nodeID != engine_rank) error("Should be run on a different node");
#endif

82
83
84
85
  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

  /* Anything to do here? */
Loic Hausammann's avatar
Loic Hausammann committed
86
  if (!cell_is_active_stars(c, e)) return;
Loic Hausammann's avatar
Loic Hausammann committed
87
  if (c->hydro.count == 0 && c->stars.count == 0) return;
88
89
90
91
92

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

93
  const int scount = c->stars.count;
94
  const int count = c->hydro.count;
95
  struct spart *restrict sparts = c->stars.parts;
96
  struct part *restrict parts = c->hydro.parts;
97
98
99
100
101
102

  /* 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];
103
    if (!spart_is_active(si, e) || spart_is_inhibited(si, e)) continue;
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
    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
131
      if (r2 > 0.f && r2 < hig2) {
132
        IACT_STARS(r2, dx, hi, hj, si, pj, a, H);
133
      }
134
135
136
137
138
    } /* loop over the parts in ci. */
  }   /* loop over the sparts in ci. */
}

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

148
#ifdef SWIFT_DEBUG_CHECKS
Loic Hausammann's avatar
Loic Hausammann committed
149
#ifdef UPDATE_STARS
150
  if (ci->nodeID != engine_rank) error("Should be run on a different node");
Loic Hausammann's avatar
Loic Hausammann committed
151
152
#else
  if (cj->nodeID != engine_rank) error("Should be run on a different node");
153
154
155
#endif
#endif

156
157
158
159
  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

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

162
  const int scount_i = ci->stars.count;
163
  const int count_j = cj->hydro.count;
164
  struct spart *restrict sparts_i = ci->stars.parts;
165
  struct part *restrict parts_j = cj->hydro.parts;
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

  /* 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];
185
    if (!spart_is_active(si, e) || spart_is_inhibited(si, e)) continue;
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
    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

212
      if (r2 < hig2) IACT_STARS(r2, dx, hi, hj, si, pj, a, H);
213
214
215
216
217

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

218
void DOPAIR1_STARS(struct runner *r, struct cell *restrict ci,
219
                   struct cell *restrict cj, int timer) {
220

Loic Hausammann's avatar
Loic Hausammann committed
221
#ifdef UPDATE_STARS
222
223
224
  const int ci_local = ci->nodeID == engine_rank;
  const int cj_local = cj->nodeID == engine_rank;
#else
Loic Hausammann's avatar
Loic Hausammann committed
225
226
227
  /* here we are updating the hydro -> switch ci, cj */
  const int ci_local = cj->nodeID == engine_rank;
  const int cj_local = ci->nodeID == engine_rank;
228
229
#endif
  if (ci_local && ci->stars.count != 0 && cj->hydro.count != 0)
230
    DO_NONSYM_PAIR1_STARS(r, ci, cj);
231
  if (cj_local && cj->stars.count != 0 && ci->hydro.count != 0)
232
    DO_NONSYM_PAIR1_STARS(r, cj, ci);
233
}
Loic Hausammann's avatar
Loic Hausammann committed
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248

/**
 * @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.
 */
249
250
251
252
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
253

254
255
256
#ifdef SWIFT_DEBUG_CHECKS
  if (ci->nodeID != engine_rank) error("Should be run on a different node");
#endif
Loic Hausammann's avatar
Loic Hausammann committed
257
258
259
  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

260
261
  const int count_j = cj->hydro.count;
  struct part *restrict parts_j = cj->hydro.parts;
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

  /* 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) {
303
        IACT_STARS(r2, dx, hi, pj->h, spi, pj, a, H);
Loic Hausammann's avatar
Loic Hausammann committed
304
305
306
307
      }
    } /* loop over the parts in cj. */
  }   /* loop over the parts in ci. */
}
Loic Hausammann's avatar
Loic Hausammann committed
308
309
310
311
312
313
314
315
316
317
318

/**
 * @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.
 */
319
void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci,
320
321
                          struct spart *restrict sparts, int *restrict ind,
                          int scount) {
Loic Hausammann's avatar
Loic Hausammann committed
322

323
324
325
326
#ifdef SWIFT_DEBUG_CHECKS
  if (ci->nodeID != engine_rank) error("Should be run on a different node");
#endif

Loic Hausammann's avatar
Loic Hausammann committed
327
328
329
330
331
332
333
  const struct engine *e = r->e;
  const struct cosmology *cosmo = e->cosmology;

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

334
335
  const int count_i = ci->hydro.count;
  struct part *restrict parts_j = ci->hydro.parts;
Loic Hausammann's avatar
Loic Hausammann committed
336
337
338
339
340
341
342

  /* 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]),
343
344
                           (float)(spi->x[1] - ci->loc[1]),
                           (float)(spi->x[2] - ci->loc[2])};
Loic Hausammann's avatar
Loic Hausammann committed
345
346
347
348
    const float hi = spi->h;
    const float hig2 = hi * hi * kernel_gamma2;

#ifdef SWIFT_DEBUG_CHECKS
349
350
    if (!spart_is_active(spi, e))
      error("Inactive particle in subset function!");
Loic Hausammann's avatar
Loic Hausammann committed
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
#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) {
375
        IACT_STARS(r2, dx, hi, hj, spi, pj, a, H);
Loic Hausammann's avatar
Loic Hausammann committed
376
377
378
379
380
      }
    } /* loop over the parts in cj. */
  }   /* loop over the parts in ci. */
}

381
/**
382
383
384
385
386
387
388
389
390
391
392
393
 * @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
394

395
  DOSELF1_SUBSET_STARS(r, ci, sparts, ind, scount);
Loic Hausammann's avatar
Loic Hausammann committed
396
397
}

398
/**
399
400
401
 * @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
402
403
404
405
406
407
408
409
 *
 * @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.
 */
410
411
412
413
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
414
415
416
417
418
419
420
421
422
423
424
425

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

426
  DOPAIR1_SUBSET_STARS(r, ci, sparts_i, ind, scount, cj, shift);
Loic Hausammann's avatar
Loic Hausammann committed
427
428
}

429
430
431
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
432
433
434
435
436

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

  /* Should we even bother? */
Loic Hausammann's avatar
Loic Hausammann committed
437
438
  if (!cell_is_active_stars(ci, e) &&
      (cj == NULL || !cell_is_active_stars(cj, e)))
Loic Hausammann's avatar
Loic Hausammann committed
439
440
441
442
443
444
445
    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) {
446
447
448
        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
449
450
451
452
453
454
455
456
457
458
459
          sub = ci->progeny[k];
          break;
        }
      }
    }
  }

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

    /* Recurse? */
460
    if (cell_can_recurse_in_self_stars_task(ci)) {
Loic Hausammann's avatar
Loic Hausammann committed
461
462

      /* Loop over all progeny. */
463
      DOSUB_SUBSET_STARS(r, sub, sparts, ind, scount, NULL, -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
464
465
      for (int j = 0; j < 8; j++)
        if (ci->progeny[j] != sub && ci->progeny[j] != NULL)
466
467
          DOSUB_SUBSET_STARS(r, sub, sparts, ind, scount, ci->progeny[j], -1,
                             0);
Loic Hausammann's avatar
Loic Hausammann committed
468
469
470
471
472

    }

    /* Otherwise, compute self-interaction. */
    else
473
      DOSELF1_SUBSET_BRANCH_STARS(r, ci, sparts, ind, scount);
Loic Hausammann's avatar
Loic Hausammann committed
474
475
476
477
478
479
  } /* self-interaction. */

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

    /* Recurse? */
loikki's avatar
loikki committed
480
481
    if (cell_can_recurse_in_pair_stars_task(ci, cj) &&
        cell_can_recurse_in_pair_stars_task(cj, ci)) {
Loic Hausammann's avatar
Loic Hausammann committed
482
483
484
485
486
487
488
489
490
491
492

      /* 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)
493
494
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
495
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
496
497
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
498
499
500
501
          break;

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

        case 2: /* (  1 ,  1 , -1 ) */
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
529
530
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
531
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
532
533
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
534
535
536
537
          break;

        case 3: /* (  1 ,  0 ,  1 ) */
          if (ci->progeny[5] == sub && cj->progeny[0] != NULL)
538
539
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
540
          if (ci->progeny[5] != NULL && cj->progeny[0] == sub)
541
542
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
543
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
544
545
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
546
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
547
548
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
549
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
550
551
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
552
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
553
554
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
555
          if (ci->progeny[7] == sub && cj->progeny[2] != NULL)
556
557
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
558
          if (ci->progeny[7] != NULL && cj->progeny[2] == sub)
559
560
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
561
562
563
564
          break;

        case 4: /* (  1 ,  0 ,  0 ) */
          if (ci->progeny[4] == sub && cj->progeny[0] != NULL)
565
566
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
567
          if (ci->progeny[4] != NULL && cj->progeny[0] == sub)
568
569
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
570
          if (ci->progeny[4] == sub && cj->progeny[1] != NULL)
571
572
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
573
          if (ci->progeny[4] != NULL && cj->progeny[1] == sub)
574
575
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
576
          if (ci->progeny[4] == sub && cj->progeny[2] != NULL)
577
578
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
579
          if (ci->progeny[4] != NULL && cj->progeny[2] == sub)
580
581
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
582
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
583
584
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
585
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
586
587
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
588
          if (ci->progeny[5] == sub && cj->progeny[0] != NULL)
589
590
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
591
          if (ci->progeny[5] != NULL && cj->progeny[0] == sub)
592
593
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
594
          if (ci->progeny[5] == sub && cj->progeny[1] != NULL)
595
596
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
597
          if (ci->progeny[5] != NULL && cj->progeny[1] == sub)
598
599
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
600
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
601
602
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
603
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
604
605
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
606
          if (ci->progeny[5] == sub && cj->progeny[3] != NULL)
607
608
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
609
          if (ci->progeny[5] != NULL && cj->progeny[3] == sub)
610
611
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
612
          if (ci->progeny[6] == sub && cj->progeny[0] != NULL)
613
614
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
615
          if (ci->progeny[6] != NULL && cj->progeny[0] == sub)
616
617
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
618
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
619
620
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
621
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
622
623
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
624
          if (ci->progeny[6] == sub && cj->progeny[2] != NULL)
625
626
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
627
          if (ci->progeny[6] != NULL && cj->progeny[2] == sub)
628
629
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
630
          if (ci->progeny[6] == sub && cj->progeny[3] != NULL)
631
632
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
633
          if (ci->progeny[6] != NULL && cj->progeny[3] == sub)
634
635
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
636
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
637
638
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
639
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
640
641
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
642
          if (ci->progeny[7] == sub && cj->progeny[1] != NULL)
643
644
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
645
          if (ci->progeny[7] != NULL && cj->progeny[1] == sub)
646
647
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
648
          if (ci->progeny[7] == sub && cj->progeny[2] != NULL)
649
650
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
651
          if (ci->progeny[7] != NULL && cj->progeny[2] == sub)
652
653
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
654
          if (ci->progeny[7] == sub && cj->progeny[3] != NULL)
655
656
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
657
          if (ci->progeny[7] != NULL && cj->progeny[3] == sub)
658
659
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
660
661
662
663
          break;

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

        case 6: /* (  1 , -1 ,  1 ) */
          if (ci->progeny[5] == sub && cj->progeny[2] != NULL)
691
692
            DOSUB_SUBSET_STARS(r, ci->progeny[5], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
693
          if (ci->progeny[5] != NULL && cj->progeny[2] == sub)
694
695
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
696
697
698
699
          break;

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

        case 8: /* (  1 , -1 , -1 ) */
          if (ci->progeny[4] == sub && cj->progeny[3] != NULL)
727
728
            DOSUB_SUBSET_STARS(r, ci->progeny[4], sparts, ind, scount,
                               cj->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
729
          if (ci->progeny[4] != NULL && cj->progeny[3] == sub)
730
731
            DOSUB_SUBSET_STARS(r, cj->progeny[3], sparts, ind, scount,
                               ci->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
732
733
734
735
          break;

        case 9: /* (  0 ,  1 ,  1 ) */
          if (ci->progeny[3] == sub && cj->progeny[0] != NULL)
736
737
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
738
          if (ci->progeny[3] != NULL && cj->progeny[0] == sub)
739
740
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
741
          if (ci->progeny[3] == sub && cj->progeny[4] != NULL)
742
743
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
744
          if (ci->progeny[3] != NULL && cj->progeny[4] == sub)
745
746
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
747
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
748
749
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
750
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
751
752
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
753
          if (ci->progeny[7] == sub && cj->progeny[4] != NULL)
754
755
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
756
          if (ci->progeny[7] != NULL && cj->progeny[4] == sub)
757
758
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
759
760
761
762
          break;

        case 10: /* (  0 ,  1 ,  0 ) */
          if (ci->progeny[2] == sub && cj->progeny[0] != NULL)
763
764
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
765
          if (ci->progeny[2] != NULL && cj->progeny[0] == sub)
766
767
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
768
          if (ci->progeny[2] == sub && cj->progeny[1] != NULL)
769
770
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
771
          if (ci->progeny[2] != NULL && cj->progeny[1] == sub)
772
773
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
774
          if (ci->progeny[2] == sub && cj->progeny[4] != NULL)
775
776
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
777
          if (ci->progeny[2] != NULL && cj->progeny[4] == sub)
778
779
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
780
          if (ci->progeny[2] == sub && cj->progeny[5] != NULL)
781
782
            DOSUB_SUBSET_STARS(r, ci->progeny[2], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
783
          if (ci->progeny[2] != NULL && cj->progeny[5] == sub)
784
785
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
786
          if (ci->progeny[3] == sub && cj->progeny[0] != NULL)
787
788
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
789
          if (ci->progeny[3] != NULL && cj->progeny[0] == sub)
790
791
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
792
          if (ci->progeny[3] == sub && cj->progeny[1] != NULL)
793
794
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
795
          if (ci->progeny[3] != NULL && cj->progeny[1] == sub)
796
797
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
798
          if (ci->progeny[3] == sub && cj->progeny[4] != NULL)
799
800
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
801
          if (ci->progeny[3] != NULL && cj->progeny[4] == sub)
802
803
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
804
          if (ci->progeny[3] == sub && cj->progeny[5] != NULL)
805
806
            DOSUB_SUBSET_STARS(r, ci->progeny[3], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
807
          if (ci->progeny[3] != NULL && cj->progeny[5] == sub)
808
809
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[3], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
810
          if (ci->progeny[6] == sub && cj->progeny[0] != NULL)
811
812
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
813
          if (ci->progeny[6] != NULL && cj->progeny[0] == sub)
814
815
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
816
          if (ci->progeny[6] == sub && cj->progeny[1] != NULL)
817
818
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
819
          if (ci->progeny[6] != NULL && cj->progeny[1] == sub)
820
821
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
822
          if (ci->progeny[6] == sub && cj->progeny[4] != NULL)
823
824
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
825
          if (ci->progeny[6] != NULL && cj->progeny[4] == sub)
826
827
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
828
          if (ci->progeny[6] == sub && cj->progeny[5] != NULL)
829
830
            DOSUB_SUBSET_STARS(r, ci->progeny[6], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
831
          if (ci->progeny[6] != NULL && cj->progeny[5] == sub)
832
833
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[6], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
834
          if (ci->progeny[7] == sub && cj->progeny[0] != NULL)
835
836
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
837
          if (ci->progeny[7] != NULL && cj->progeny[0] == sub)
838
839
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
840
          if (ci->progeny[7] == sub && cj->progeny[1] != NULL)
841
842
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
843
          if (ci->progeny[7] != NULL && cj->progeny[1] == sub)
844
845
            DOSUB_SUBSET_STARS(r, cj->progeny[1], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
846
          if (ci->progeny[7] == sub && cj->progeny[4] != NULL)
847
848
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[4], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
849
          if (ci->progeny[7] != NULL && cj->progeny[4] == sub)
850
851
            DOSUB_SUBSET_STARS(r, cj->progeny[4], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
852
          if (ci->progeny[7] == sub && cj->progeny[5] != NULL)
853
854
            DOSUB_SUBSET_STARS(r, ci->progeny[7], sparts, ind, scount,
                               cj->progeny[5], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
855
          if (ci->progeny[7] != NULL && cj->progeny[5] == sub)
856
857
            DOSUB_SUBSET_STARS(r, cj->progeny[5], sparts, ind, scount,
                               ci->progeny[7], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
858
859
860
861
          break;

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

        case 12: /* (  0 ,  0 ,  1 ) */
          if (ci->progeny[1] == sub && cj->progeny[0] != NULL)
889
890
            DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount,
                               cj->progeny[0], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
891
          if (ci->progeny[1] != NULL && cj->progeny[0] == sub)
892
893
            DOSUB_SUBSET_STARS(r, cj->progeny[0], sparts, ind, scount,
                               ci->progeny[1], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
894
          if (ci->progeny[1] == sub && cj->progeny[2] != NULL)
895
896
            DOSUB_SUBSET_STARS(r, ci->progeny[1], sparts, ind, scount,
                               cj->progeny[2], -1, 0);
Loic Hausammann's avatar
Loic Hausammann committed
897
          if (ci->progeny[1] != NULL && cj->progeny[2] == sub)
898
899
            DOSUB_SUBSET_STARS(r, cj->progeny[2], sparts, ind, scount,
                               ci->progeny[1], -1<