diff --git a/Common/Context.h b/Common/Context.h index 75bb5f9a208a9638d52c36b1d645db7719d8c315..d3497d8e080908d0d54b5cddff0867eaca301fab 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -119,6 +119,7 @@ public : double normals, tangents; double scaling_factor; int color_scheme ; + int auto_coherence; } geom; // mesh options diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 077b4a45a7e9cc0ede2ca9b4d3c3bb41a29a2873..dcbfdda0f922978f024845f6d89041fbc093cbaa 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -283,6 +283,8 @@ StringXNumber GeneralOptions_Number[] = { } ; StringXNumber GeometryOptions_Number[] = { + { F|O, "AutoCoherence" , opt_geometry_auto_coherence , 1. , + "Should all duplicate entities be automatically be removed? (Beware! Setting this option to 1 will slow down things a lot)" }, { F|O, "Normals" , opt_geometry_normals , 0. , "Size of the vectors normal to the surfaces" }, { F|O, "Tangents" , opt_geometry_tangents , 0. , diff --git a/Common/Options.cpp b/Common/Options.cpp index 8bc4d25733f7c0f1d1c91da180b60da65ba13882..5b21af7a7ace02ea2b3d3a0df23bf76231cf957d 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.48 2001-09-26 08:28:12 geuzaine Exp $ +// $Id: Options.cpp,v 1.49 2001-10-05 15:25:35 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -1053,6 +1053,15 @@ double opt_general_light52(OPT_ARGS_NUM){ +double opt_geometry_auto_coherence(OPT_ARGS_NUM){ + if(action & GMSH_SET) + CTX.geom.auto_coherence = (int)val; +#ifdef _FLTK + if(WID && (action & GMSH_GUI)) + WID->geo_butt[8]->value(CTX.geom.auto_coherence); +#endif + return CTX.geom.auto_coherence; +} double opt_geometry_normals(OPT_ARGS_NUM){ if(action & GMSH_SET) CTX.geom.normals = val; diff --git a/Common/Options.h b/Common/Options.h index c19f6008b934e782c12e3d50b3c9ff60f018078d..562e348c2d71f3d29d5fc84dbb1fb26a8da5966e 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -130,6 +130,7 @@ double opt_general_light5(OPT_ARGS_NUM); double opt_general_light50(OPT_ARGS_NUM); double opt_general_light51(OPT_ARGS_NUM); double opt_general_light52(OPT_ARGS_NUM); +double opt_geometry_auto_coherence(OPT_ARGS_NUM); double opt_geometry_normals(OPT_ARGS_NUM); double opt_geometry_tangents(OPT_ARGS_NUM); double opt_geometry_points(OPT_ARGS_NUM); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 8c596576a935c2be39e5a1a7c7fa9349e4489d1f..e30867cc527b2119b95a1e3a63b5fa1670e1f35f 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.83 2001-09-06 06:38:48 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.84 2001-10-05 15:25:35 geuzaine Exp $ #include <sys/types.h> #include <signal.h> @@ -383,6 +383,7 @@ void opt_geometry_ok_cb(CALLBACK_ARGS) { opt_geometry_lines_num(0, GMSH_SET, WID->geo_butt[5]->value()); opt_geometry_surfaces_num(0, GMSH_SET, WID->geo_butt[6]->value()); opt_geometry_volumes_num(0, GMSH_SET, WID->geo_butt[7]->value()); + opt_geometry_auto_coherence(0, GMSH_SET, WID->geo_butt[8]->value()); opt_geometry_normals(0, GMSH_SET, WID->geo_value[0]->value()); opt_geometry_tangents(0, GMSH_SET, WID->geo_value[1]->value()); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 0a6b32ada98c4f1714334a3b81558120ba3b4b0a..8e6e6cf7742e4b52a30c46ed2e0a6c8afb844d99 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.115 2001-09-06 07:18:13 geuzaine Exp $ +// $Id: GUI.cpp,v 1.116 2001-10-05 15:25:35 geuzaine Exp $ // To make the interface as visually consistent as possible, please: // - use the BH, BW, WB, IW values for button heights/widths, window borders, etc. @@ -1090,6 +1090,17 @@ void GUI::create_geometry_options_window(){ geo_window->label("Geometry options"); { Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH); + { + Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Algorithm"); + o->labelsize(CTX.fontsize); + o->hide(); + geo_butt[8] = new Fl_Check_Button(2*WB, 2*WB+1*BH, IW, BH, "Auto coherence (suppress duplicates)"); + geo_butt[8]->type(FL_TOGGLE_BUTTON); + geo_butt[8]->down_box(FL_DOWN_BOX); + geo_butt[8]->labelsize(CTX.fontsize); + geo_butt[8]->selection_color(FL_YELLOW); + o->end(); + } { Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Visibility"); o->labelsize(CTX.fontsize); diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp index 23636e9d973e8d36d7840e039f3898b114f3a13f..26328aef8d8d9319c3d016bb96643687f5272e56 100644 --- a/Geo/CAD.cpp +++ b/Geo/CAD.cpp @@ -1,4 +1,4 @@ -// $Id: CAD.cpp,v 1.31 2001-08-28 20:40:21 geuzaine Exp $ +// $Id: CAD.cpp,v 1.32 2001-10-05 15:25:35 geuzaine Exp $ #include "Gmsh.h" #include "Numeric.h" @@ -940,6 +940,7 @@ void Extrude_ProtudePoint(int ep, int ip, double A, double B, double C, CreateReversedCurve (THEM,c); *pc = c; *prc = FindCurve(-c->Num,THEM); + } Surface *Extrude_ProtudeCurve(int ep, int ic, @@ -1032,6 +1033,7 @@ Surface *Extrude_ProtudeCurve(int ep, int ic, End_Surface(s); Tree_Add(THEM->Surfaces,&s); + return s; } @@ -1121,7 +1123,7 @@ void Extrude_ProtudeSurface(int ep, int is, if(pv)Tree_Add(THEM->Volumes,&pv); - ReplaceAllDuplicates ( THEM ); + if(CTX.geom.auto_coherence) ReplaceAllDuplicates ( THEM ); List_Reset(ListOfTransformedPoints); } @@ -1482,7 +1484,7 @@ void TranslateShapes(double X,double Y,double Z, T[0] = X;T[1] = Y;T[2] = Z; SetTranslationMatrix(matrix,T); ApplicationOnShapes(matrix,ListShapes); - if(isFinal)ReplaceAllDuplicates ( THEM ); + if(CTX.geom.auto_coherence && isFinal) ReplaceAllDuplicates ( THEM ); } void DilatShapes(double X,double Y,double Z, double A, @@ -1491,7 +1493,7 @@ void DilatShapes(double X,double Y,double Z, double A, T[0] = X;T[1] = Y;T[2] = Z; SetDilatationMatrix(matrix,T,A); ApplicationOnShapes(matrix,ListShapes); - ReplaceAllDuplicates ( THEM ); + if(CTX.geom.auto_coherence) ReplaceAllDuplicates ( THEM ); } @@ -1506,7 +1508,7 @@ void RotateShapes (double Ax,double Ay,double Az, ApplicationOnShapes(matrix,ListShapes); TranslateShapes(Px,Py,Pz,ListShapes,0); List_Reset(ListOfTransformedPoints); - ReplaceAllDuplicates ( THEM ); + if(CTX.geom.auto_coherence) ReplaceAllDuplicates ( THEM ); } void SymmetryShapes (double A,double B,double C, @@ -1514,7 +1516,7 @@ void SymmetryShapes (double A,double B,double C, double matrix[4][4]; SetSymmetryMatrix(matrix,A,B,C,D); ApplicationOnShapes(matrix,ListShapes); - ReplaceAllDuplicates ( THEM ); + if(CTX.geom.auto_coherence) ReplaceAllDuplicates ( THEM ); }