MVertex_ptr MVs_Merge_R3R4(MVertex_ptr v1, MVertex_ptr v2, int topoflag) { int idx, gdim, gid, nsets; MFace_ptr face; Mesh_ptr mesh; List_ptr vfaces2; MSet_ptr mset; mesh = MV_Mesh(v1); gid = MV_GEntID(v1); gdim = MV_GEntDim(v1); if (mesh != MF_Mesh(v2)) { MSTK_Report("MVs_Join","Vertices not from same mesh",MSTK_ERROR); return 0; } else if (topoflag) { /* Make sure model topology is not violated */ if (gid != MV_GEntID(v2) || gdim != MV_GEntDim(v2)) { MSTK_Report("MFs_Join","Faces not from same geometric entity",MSTK_ERROR); return 0; } } vfaces2 = MV_Faces(v2); if (vfaces2) { idx = 0; while ((face = List_Next_Entry(vfaces2,&idx))) MF_Replace_Vertex(face,v2,v1); List_Delete(vfaces2); } nsets = MESH_Num_MSets(mesh); if(nsets) { idx = 0; while ((mset = (MSet_ptr) MESH_Next_MSet(mesh,&idx))) { if (MSet_Contains(mset, v2)) { if(MSet_Contains(mset, v1)) MSet_Rem(mset, v2); else MSet_Replace(mset, v2, v1); } } } MV_Delete(v2,1); return v1; }
MVertex_ptr MVs_Merge_R1R2(MVertex_ptr v1, MVertex_ptr v2, int topoflag) { int i, idx, gdim, gid; MFace_ptr face; MRegion_ptr region; Mesh_ptr mesh; List_ptr vfaces2, vregions2; mesh = MV_Mesh(v1); gid = MV_GEntID(v1); gdim = MV_GEntDim(v1); if (mesh != MF_Mesh(v2)) { MSTK_Report("MVs_Join","Vertices not from same mesh",MSTK_ERROR); return 0; } else if (topoflag) { /* make sure geometric model topology is not violated */ if (gid != MV_GEntID(v2) || gdim != MV_GEntDim(v2)) { MSTK_Report("MFs_Join","Faces not from same geometric entity",MSTK_ERROR); return 0; } } vfaces2 = MV_Faces(v2); if (vfaces2) { idx = 0; while ((face = List_Next_Entry(vfaces2,&idx))) MF_Replace_Vertex(face,v2,v1); List_Delete(vfaces2); } vregions2 = MV_Regions(v2); if (vregions2) { idx = 0; while ((region = List_Next_Entry(vregions2,&idx))) MR_Replace_Vertex(region,v2,v1); List_Delete(vregions2); } MV_Delete(v2,0); return v1; }
void MF_Insert_Vertex_i_R2(MFace_ptr f, MVertex_ptr nuv, int i) { MFace_Adj_R2 *adj; adj = (MFace_Adj_R2 *) f->adj; if (adj->fvertices == NULL) adj->fvertices = List_New(4); #ifdef DEBUG if (MF_Mesh(f) != MV_Mesh(nuv)) MSTK_Report("MF_Replace_Vertex_R2", "Face and Vertex are not from the same mesh", MSTK_FATAL); #endif List_Inserti(adj->fvertices,nuv,i); }
void MF_Replace_Vertex_R2(MFace_ptr f, MVertex_ptr v, MVertex_ptr nuv) { MFace_Adj_R2 *adj; adj = (MFace_Adj_R2 *) f->adj; if (adj->fvertices == NULL) MSTK_Report("MF_Replace_Vertex_R2", "No initial set of vertices for face",MSTK_ERROR); #ifdef DEBUG if (MF_Mesh(f) != MV_Mesh(v)) MSTK_Report("MF_Replace_Vertex_R2", "Face and Vertex are not from the same mesh", MSTK_FATAL); #endif List_Replace(adj->fvertices,v,nuv); }
void MF_Set_Vertices_R2(MFace_ptr f, int n, MVertex_ptr *v) { MFace_Adj_R2 *adj; int i; adj = (MFace_Adj_R2 *) f->adj; if (adj->fvertices) List_Delete(adj->fvertices); adj->fvertices = List_New(n); for (i = 0; i < n; i++) { #ifdef DEBUG if (MF_Mesh(f) != MV_Mesh(v[i])) MSTK_Report("MF_Set_Vertices_R2", "Face and Vertex are not from the same mesh", MSTK_FATAL); #endif List_Add(adj->fvertices,v[i]); } }
MVertex_ptr MVs_Merge(MVertex_ptr v1, MVertex_ptr v2, int topoflag) { RepType rtype = MESH_RepType(MV_Mesh(v1)); return (*MVs_Merge_jmp[rtype])(v1,v2,topoflag); }