Exemplo n.º 1
0
struct gmi_ent* gmi_add_analytic(struct gmi_model* m, int dim, int tag,
    gmi_analytic_fun f, int* periodic, double (*ranges)[2], void* user_data)
{
  struct gmi_analytic* m2;
  struct agm_ent e;
  periodic_t* pp;
  ranges_t* rp;
  int i;
  m2 = to_model(m);
  e = agm_from_gmi(gmi_null_find(m, dim, tag));
  *(f_of(m2, e)) = f;
  pp = periodic_of(m2, e);
  rp = ranges_of(m2, e);
  for (i = 0; i < dim; ++i) {
    (*pp)[i] = periodic[i];
    (*rp)[i][0] = ranges[i][0];
    (*rp)[i][1] = ranges[i][1];
  }
  for (; i < 2; ++i) {
    (*pp)[i] = 0;
    (*rp)[i][0] = 0;
    (*rp)[i][1] = 0;
  }
  *(data_of(m2, e)) = user_data;
  return gmi_from_agm(e);
}
Exemplo n.º 2
0
struct gmi_ent* gmi_base_identify(int dim, int idx)
{
  struct agm_ent e;
  e.type = agm_type_from_dim(dim);
  e.id = idx;
  return gmi_from_agm(e);
}
Exemplo n.º 3
0
struct gmi_ent* gmi_base_find(struct gmi_model* m, int dim, int tag)
{
  struct agm_ent ae = gmi_look_up(
      to_base(m)->lookup,
      agm_type_from_dim(dim), tag);
  return gmi_from_agm(ae);
}
Exemplo n.º 4
0
struct gmi_ent* gmi_base_next(struct gmi_model* m, struct gmi_iter* it)
{
  struct agm_ent* i;
  struct agm_ent e;
  i = (struct agm_ent*)it;
  e = *i;
  *i = agm_next_ent(to_base(m)->topo, e);
  return gmi_from_agm(e);
}
Exemplo n.º 5
0
static struct gmi_set* get_up(struct agm* topo, struct agm_ent e)
{
  int n;
  struct gmi_set* s;
  int i;
  struct agm_use u;
  n = agm_use_count_of(topo, e);
  s = gmi_make_set(n);
  i = 0;
  for (u = agm_first_use_of(topo, e);
       !agm_use_null(u);
       u = agm_next_use_of(topo, u)) {
    s->e[i] = gmi_from_agm(agm_bounds(topo, agm_user(topo, u)));
    ++i;
  }
  return s;
}
Exemplo n.º 6
0
static struct gmi_set* get_down(struct agm* topo, struct agm_ent e)
{
  int n;
  struct gmi_set* s;
  int i;
  struct agm_bdry b;
  struct agm_use u;
  n = agm_down_count(topo, e);
  s = gmi_make_set(n);
  i = 0;
  for (b = agm_first_bdry_of(topo, e);
       !agm_bdry_null(b);
       b = agm_next_bdry_of(topo, b)) {
    for (u = agm_first_use_by(topo, b);
         !agm_use_null(u);
         u = agm_next_use_by(topo, u)) {
      s->e[i] = gmi_from_agm(agm_used(topo, u));
      ++i;
    }
  }
  return s;
}