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
Branches
Tags
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 "Gmsh.h"
#include "Const.h" #include "Const.h"
...@@ -223,10 +223,10 @@ void Cdbz101(int izon, int typzon,int o1, int o2, int nbu, int nbv, ...@@ -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, int support, List_T *ListCP, List_T *liste,
List_T *intlist){ List_T *intlist){
int i,j,k,nb, *pj, *pl; int i,j;
double f; double f;
List_T *templist, *templist2; List_T *templist;
Curve *c1, *c2; Curve *c, **pc1, **pc2;
if(liste){ if(liste){
templist = List_Create(List_Nbr(liste),1,sizeof(int)); 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, ...@@ -251,32 +251,39 @@ void Cdbz101(int izon, int typzon,int o1, int o2, int nbu, int nbv,
} }
else if(typzon == MSH_SEGM_LOOP){ else if(typzon == MSH_SEGM_LOOP){
nb = List_Nbr(templist); // We sort the lines in the line loops. Without this sort, it very
templist2 = List_Create(List_Nbr(templist),1,sizeof(int)); // difficult to write general scriptable surface generation in
// complex cases.
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++){ int NbCurves = List_Nbr(templist) ;
pl = (int*)List_Pointer_Fast(templist,k); List_T *curves = List_Create(NbCurves,1,sizeof(Curve*));
//printf("testing %d \n", *pl); for(i=0 ; i<NbCurves ; i++){
if((c = FindCurve(*(int*)List_Pointer(templist,i), THEM)))
c2 = FindCurve(*pl, THEM); List_Add(curves, &c);
if(c2->beg == c1->end){ else
List_Add(templist2, pl); Msg(GERROR, "Unknown Curve %d in Line Loop %d",
//printf("adding %d \n", *pl); *(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; 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){ else if(typzon == MSH_VOLUME){
CreateVolumeFromOldCrappyDatabase (izon,templist,THEM); 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 # Makefile for Gmsh
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -427,7 +427,7 @@ fltk_link_mesa: ...@@ -427,7 +427,7 @@ fltk_link_mesa:
$(FLTK_LIB) -lm -ldl $(FLTK_LIB) -lm -ldl
fltk_link_opengl: fltk_link_opengl:
$(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB) $(OPENGL_LIB) \ $(CC) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB) $(OPENGL_LIB) \
$(FLTK_LIB) -lm -ldl $(FLTK_LIB) -lm
fltk_link_sgi: fltk_link_sgi:
CC -O2 -mips3 -n32 -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB)\ CC -O2 -mips3 -n32 -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB)\
$(FLTK_LIB) $(OPENGL_LIB) -lm -ldl $(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