<commit_before>#include "mesh_bbox.h"
#include "classif.h"

unsigned const bbox_verts[DIMS] = {
  1,
  2,
  4,
  8
};

unsigned const bbox_simplices[DIMS] = {
  1,
  1,
  2,
  6
};

static unsigned const e10[2] = {0,1};
static unsigned const* const e1[1] = {e10};
static unsigned const e20[3] = {0,1,3};
static unsigned const e21[3] = {0,3,2};
static unsigned const* const e2[2] = {e20,e21};
static unsigned const e30[4] = {0,3,1,7};
static unsigned const e31[4] = {5,0,1,7};
static unsigned const e32[4] = {5,4,0,7};
static unsigned const e33[4] = {4,6,0,7};
static unsigned const e34[4] = {0,2,3,7};
static unsigned const e35[4] = {0,6,2,7};
static unsigned const* const e3[6] = {e30,e31,e32,e33,e34,e35};
static unsigned const* const* const etables[DIMS] = {0,e1,e2,e3};

static point bbox_point(bbox b, unsigned i)
{
  double* min;
  double* max;
  double* out;
  point p;
  dim d;
  min = point_arr(&b.min);
  max = point_arr(&b.max);
  out = point_arr(&p);
  for (d = DIM0; d < DIMS; ++d) {
    if (i & bbox_verts[d])
      out[d] = max[d];
    else
      out[d] = min[d];
  }
  return p;
}

static void gen_bbox_verts(mesh* m, bbox b, dim d, ment v[])
{
  unsigned i;
  for (i = 0; i < bbox_verts[d]; ++i) {
    v[i] = ment_new(m, VERTEX, 0);
    mesh_set_point(m, v[i], bbox_point(b, i));
  }
}

static void gen_bbox_elems(mesh* m, dim d, ment v[], ment e[])<commit_msg>fixed excessive iteration in bbox_point<commit_after>#include "mesh_bbox.h"
#include "classif.h"

unsigned const bbox_verts[DIMS] = {
  1,
  2,
  4,
  8
};

unsigned const bbox_simplices[DIMS] = {
  1,
  1,
  2,
  6
};

static unsigned const e10[2] = {0,1};
static unsigned const* const e1[1] = {e10};
static unsigned const e20[3] = {0,1,3};
static unsigned const e21[3] = {0,3,2};
static unsigned const* const e2[2] = {e20,e21};
static unsigned const e30[4] = {0,3,1,7};
static unsigned const e31[4] = {5,0,1,7};
static unsigned const e32[4] = {5,4,0,7};
static unsigned const e33[4] = {4,6,0,7};
static unsigned const e34[4] = {0,2,3,7};
static unsigned const e35[4] = {0,6,2,7};
static unsigned const* const e3[6] = {e30,e31,e32,e33,e34,e35};
static unsigned const* const* const etables[DIMS] = {0,e1,e2,e3};

static point bbox_point(bbox b, unsigned i)
{
  double* min;
  double* max;
  double* out;
  point p;
  dim d;
  min = point_arr(&b.min);
  max = point_arr(&b.max);
  out = point_arr(&p);
  for (d = DIM0; d < DIM; ++d) {
    if (i & bbox_verts[d])
      out[d] = max[d];
    else
      out[d] = min[d];
  }
  return p;
}

static void gen_bbox_verts(mesh* m, bbox b, dim d, ment v[])
{
  unsigned i;
  for (i = 0; i < bbox_verts[d]; ++i) {
    v[i] = ment_new(m, VERTEX, 0);
    mesh_set_point(m, v[i], bbox_point(b, i));
  }
}

static void gen_bbox_elems(mesh* m, dim d, ment v[], ment e[])
{'fraction_non_alphanumeric': 0.18194893923049263, 'fraction_numerical': 0.07047824523552679, 'mean_word_length': 3.9065255731922397, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1587294', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1254, 'n_words': 327}