Skip to content
Snippets Groups Projects
Commit baf0b167 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Better sorting of line loops

parent 890ebc93
No related branches found
No related tags found
No related merge requests found
// $Id: DataBase.cpp,v 1.8 2001-03-23 08:55:14 geuzaine Exp $
// $Id: DataBase.cpp,v 1.9 2001-03-23 14:41:52 geuzaine Exp $
#include "Gmsh.h"
#include "Const.h"
......@@ -223,10 +223,10 @@ void Cdbz101(int izon, int typzon,int o1, int o2, int nbu, int nbv,
int support, List_T *ListCP, List_T *liste,
List_T *intlist){
int i,j,k,nb, *pj, *pl;
int i,j;
double f;
List_T *templist, *templist2;
Curve *c1, *c2;
List_T *templist;
Curve *c, **pc1, **pc2;
if(liste){
templist = List_Create(List_Nbr(liste),1,sizeof(int));
......@@ -251,32 +251,39 @@ void Cdbz101(int izon, int typzon,int o1, int o2, int nbu, int nbv,
}
else if(typzon == MSH_SEGM_LOOP){
nb = List_Nbr(templist);
templist2 = List_Create(List_Nbr(templist),1,sizeof(int));
pj = (int*)List_Pointer_Fast(templist,0);
List_Add(templist2, pj);
while(List_Nbr(templist2) != nb){
pj = (int*)List_Pointer_Fast(templist2,List_Nbr(templist2)-1);
c1 = FindCurve(*pj, THEM);
//printf("last = %d \n", *pj);
for(k=0; k<List_Nbr(templist) ; k++){
pl = (int*)List_Pointer_Fast(templist,k);
//printf("testing %d \n", *pl);
c2 = FindCurve(*pl, THEM);
if(c2->beg == c1->end){
List_Add(templist2, pl);
//printf("adding %d \n", *pl);
// We sort the lines in the line loops. Without this sort, it very
// difficult to write general scriptable surface generation in
// complex cases.
int NbCurves = List_Nbr(templist) ;
List_T *curves = List_Create(NbCurves,1,sizeof(Curve*));
for(i=0 ; i<NbCurves ; i++){
if((c = FindCurve(*(int*)List_Pointer(templist,i), THEM)))
List_Add(curves, &c);
else
Msg(GERROR, "Unknown Curve %d in Line Loop %d",
*(int*)List_Pointer(templist,i), izon);
}
List_Reset(templist);
pc1 = (Curve**)List_Pointer(curves, 0);
List_Add(templist, &(*pc1)->Num);
int j=0;
while(List_Nbr(templist) < NbCurves){
for(i=0 ; i<NbCurves ; i++){
pc2 = (Curve**)List_Pointer(curves, i);
if((*pc1)->end == (*pc2)->beg){
List_Add(templist, &(*pc2)->Num);
pc1 = pc2 ;
break;
}
}
if(j++ > NbCurves){
Msg(GERROR, "Wrong Line Loop %d", izon);
break;
}
}
Add_EdgeLoop(izon,templist2,THEM);
Add_EdgeLoop(izon,templist,THEM);
}
else if(typzon == MSH_VOLUME){
CreateVolumeFromOldCrappyDatabase (izon,templist,THEM);
......
# $Id: Makefile,v 1.84 2001-03-22 16:36:21 lefevre Exp $
# $Id: Makefile,v 1.85 2001-03-23 14:41:52 geuzaine Exp $
# ----------------------------------------------------------------------
# Makefile for Gmsh
# ----------------------------------------------------------------------
......@@ -427,7 +427,7 @@ fltk_link_mesa:
$(FLTK_LIB) -lm -ldl
fltk_link_opengl:
$(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB) $(OPENGL_LIB) \
$(FLTK_LIB) -lm -ldl
$(FLTK_LIB) -lm
fltk_link_sgi:
CC -O2 -mips3 -n32 -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB)\
$(FLTK_LIB) $(OPENGL_LIB) -lm -ldl
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment