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]); }
static void rebuild_tags( struct mds_apf* m, struct mds_apf* m2, struct mds_tag* old_of, struct mds_tag* new_of) { struct mds_tag* t; struct mds_tag* nt; int d; mds_id e; mds_id ne; void* p; void* q; for (t = m->tags.first; t; t = t->next) { if (t == new_of) continue; nt = mds_create_tag(&(m2->tags), t->name,t->bytes,t->user_type); mds_swap_tag_structs(&m->tags, &t, &m2->tags, &nt); for (d = 0; d <= m2->mds.d; ++d) { for (ne = mds_begin(&(m2->mds),d); ne != MDS_NONE; ne = mds_next(&(m2->mds),ne)) { e = lookup(old_of,ne); if ( ! mds_has_tag(t,e)) continue; p = mds_get_tag(t,e); mds_give_tag(nt,&(m2->mds),ne); q = mds_get_tag(nt,ne); memcpy(q,p,t->bytes); } } } }
void mds_apf_destroy_entity(struct mds_apf* m, mds_id e) { struct mds_tag* t; for (t = m->tags.first; t; t = t->next) if (mds_has_tag(t,e)) mds_take_tag(t,e); mds_set_copies(&m->remotes, &m->mds, e, NULL); mds_set_copies(&m->ghosts, &m->mds, e, NULL); //seol mds_set_copies(&m->matches, &m->mds, e, NULL); mds_destroy_entity(&(m->mds),e); }
static int visit( struct mds* m, struct mds_tag* tag, mds_id* label, mds_id e) { mds_id* l; if (mds_has_tag(tag,e)) return 0; mds_give_tag(tag,m,e); l = mds_get_tag(tag,e); *l = *label; ++(*label); return 1; }