Example #1
0
static void rebuild_ents(
    struct mds_apf* m,
    struct mds_apf* m2,
    struct mds_tag* old_of,
    struct mds_tag* new_of)
{
  int t;
  mds_id i;
  mds_id e;
  mds_id ne;
  void* model;
  int j;
  struct mds_set old_down;
  struct mds_set new_down;
  for (t = 1; t < MDS_TYPES; ++t) {
    for (i = 0; i < m->mds.n[t]; ++i) {
      ne = mds_identify(t,i);
      e = lookup(old_of,ne);
      model = mds_apf_model(m,e);
      mds_get_adjacent(&(m->mds),e,mds_dim[mds_type(e)]-1,&old_down);
      for (j = 0; j < old_down.n; ++j)
        new_down.e[j] = lookup(new_of,old_down.e[j]);
      ne = mds_apf_create_entity(m2,t,model,new_down.e);
      assert(ne == mds_identify(t,i));
    }
    assert(m->mds.n[t] == m2->mds.n[t]);
  }
}
Example #2
0
static void rebuild_verts(
    struct mds_apf* m,
    struct mds_apf* m2,
    struct mds_tag* old_of)
{
  mds_id i;
  mds_id e;
  mds_id ne;
  void* model;
  int j;
  double* p;
  double* q;
  for (i = 0; i < m->mds.n[MDS_VERTEX]; ++i) {
    ne = mds_identify(MDS_VERTEX,i);
    assert(mds_has_tag(old_of,ne));
    e = lookup(old_of,ne);
    model = mds_apf_model(m,e);
    ne = mds_apf_create_entity(m2,MDS_VERTEX,model,0);
    assert(ne == mds_identify(MDS_VERTEX,i));
    p = mds_apf_point(m,e);
    q = mds_apf_point(m2,ne);
    for (j = 0; j < 3; ++j)
      q[j] = p[j];
    p = mds_apf_param(m,e);
    q = mds_apf_param(m2,ne);
    for (j = 0; j < 2; ++j)
      q[j] = p[j];
  }
  assert(m2->mds.n[MDS_VERTEX] == m->mds.n[MDS_VERTEX]);
}
Example #3
0
void mds_set_type_links(struct mds_net* net, struct mds* m,
    int t, struct mds_links* ln)
{
  unsigned i;
  unsigned j;
  unsigned* in;
  struct mds_copy c;
  PCU_Comm_Begin();
  for (i = 0; i < ln->np; ++i) {
    PCU_ALWAYS_ASSERT(ln->l);
    for (j = 0; j < ln->n[i]; ++j)
      PCU_COMM_PACK(ln->p[i], ln->l[i][j]);
  }
  PCU_Comm_Send();
  while (PCU_Comm_Listen()) {
    c.p = PCU_Comm_Sender();
    PCU_ALWAYS_ASSERT(c.p != PCU_Comm_Self());
    i = find_peer(ln, c.p);
    in = PCU_Comm_Extract(ln->n[i] * sizeof(unsigned));
    for (j = 0; j < ln->n[i]; ++j) {
      c.e = mds_identify(t, in[j]);
      mds_add_copy(net, m, mds_identify(t, ln->l[i][j]), c);
    }
  }
}
Example #4
0
void mds_set_local_matches(struct mds_net* net, struct mds* m,
                         int t, struct mds_links* ln)
{
  int self, other;
  unsigned i;
  mds_id a, b;
  struct mds_copy c;
  c.p = PCU_Comm_Self();
  self = find_peer(ln, PCU_Comm_Self());
  if (self == -1)
    return;
  other = find_peer(ln, PCU_Comm_Peers());
  assert(ln->n[self] = ln->n[other]);
  for (i = 0; i < ln->n[self]; ++i) {
    a = mds_identify(t, ln->l[self][i]);
    b = mds_identify(t, ln->l[other][i]);
    c.e = b;
    mds_add_copy(net, m, a, c);
    c.e = a;
    mds_add_copy(net, m, b, c);
  }
}
Example #5
0
static void for_type_net(struct mds_net* net, struct mds* m,
    int t, void (*f)(mds_id i, struct mds_copy c, void* u), void* u)
{
  mds_id i;
  int j;
  struct mds_copies* cs;
  for (i = 0; i < m->end[t]; ++i) {
    cs = mds_get_copies(net, mds_identify(t, i));
    if (!cs)
      continue;
    for (j = 0; j < cs->n; ++j)
      f(i, cs->c[j], u);
  }
}
Example #6
0
static mds_id lookup(struct mds_tag* tag, mds_id old)
{
  mds_id* ip;
  ip = mds_get_tag(tag,old);
  return mds_identify(mds_type(old),*ip);
}