diff --git a/Common/Context.h b/Common/Context.h index 9cdf74659678469ba1aa9dfe1a590a6f8fd2a822..b42bfd5bc50044a79e8e34e1a6c6aaa1ef7ea7ca 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -170,15 +170,15 @@ public : int quality_type, label_type; double quality_inf, quality_sup, radius_inf, radius_sup; double scaling_factor, lc_factor, rand_factor; - int dual, interactive; + int dual, interactive, renumber_nodes_continuous; int light, light_two_side, light_lines; - int format, nbPartitions,nb_smoothing, algo2d, algo3d, order,algo_recombine; + int format, nbPartitions, nb_smoothing, algo2d, algo3d, order, algo_recombine; int point_insertion, speed_max, min_circ_points, constrained_bgmesh; int histogram, initial_only; double normals, tangents, explode; - int color_carousel ; + int color_carousel; int use_cut_plane, cut_plane_as_surface, cut_plane_only_volume; - double cut_planea,cut_planeb,cut_planec,cut_planed; + double cut_planea, cut_planeb, cut_planec, cut_planed; double evalCutPlane (double x, double y, double z){ double val = cut_planea * x + cut_planeb * y + cut_planec * z + cut_planed; return val; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 5f63875377a38dcef9839c040af3cdeec79551b9..5df329b9dcba203bec730f4fb4e3aba19220fe2d 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -969,6 +969,8 @@ StringXNumber MeshOptions_Number[] = { "Random factor used in 2D and 3D meshing algorithm (test other values when the algorithm fails)" }, { F|O, "RecombineAlgo" , opt_mesh_recombine_algo , 1 , "Recombine algorithm (1=mixed triangles-quadrangles, 2=all quadrangles)" }, + { F|O, "RenumberNodes" , opt_mesh_renumber_nodes_continuous , 1. , + "Renumber nodes to remove holes in the numbering sequence" }, { F, "SaveAll" , opt_mesh_save_all , 0. , "Ignore Physical definitions and save all elements" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index a534e0e0b759a83644e98a0cef4b9975666f78de..721e7663f9a48d5da44bf4ed958455f864694e99 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.278 2006-04-18 07:49:18 remacle Exp $ +// $Id: Options.cpp,v 1.279 2006-04-24 00:26:48 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -4503,6 +4503,7 @@ double opt_mesh_min_elem_size_fact(OPT_ARGS_NUM) #endif return CTX.mesh.min_elem_size_fact; } + double opt_mesh_target_elem_size_fact(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -4513,6 +4514,7 @@ double opt_mesh_target_elem_size_fact(OPT_ARGS_NUM) #endif return CTX.mesh.target_elem_size_fact; } + double opt_mesh_beta_smooth_metric(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -4523,6 +4525,7 @@ double opt_mesh_beta_smooth_metric(OPT_ARGS_NUM) #endif return CTX.mesh.beta_smooth_metric; } + double opt_mesh_msh_file_version(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -4530,6 +4533,13 @@ double opt_mesh_msh_file_version(OPT_ARGS_NUM) return CTX.mesh.msh_file_version; } +double opt_mesh_renumber_nodes_continuous(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.mesh.renumber_nodes_continuous = (int)val; + return CTX.mesh.renumber_nodes_continuous; +} + double opt_mesh_nb_smoothing(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -4584,8 +4594,6 @@ double opt_mesh_algo2d(OPT_ARGS_NUM) return CTX.mesh.algo2d; } - - double opt_mesh_recombine_algo(OPT_ARGS_NUM) { if(action & GMSH_SET){ @@ -4612,7 +4620,6 @@ double opt_mesh_recombine_algo(OPT_ARGS_NUM) return CTX.mesh.algo_recombine; } - double opt_mesh_algo3d(OPT_ARGS_NUM) { if(action & GMSH_SET){ diff --git a/Common/Options.h b/Common/Options.h index cdbe95d5cef66636d1f41f421ce0c1832cab2b70..af354f7df1bb0ecac58bdc0acdcd99955c15318f 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -441,6 +441,7 @@ double opt_mesh_light_lines(OPT_ARGS_NUM); double opt_mesh_light_two_side(OPT_ARGS_NUM); double opt_mesh_format(OPT_ARGS_NUM); double opt_mesh_msh_file_version(OPT_ARGS_NUM); +double opt_mesh_renumber_nodes_continuous(OPT_ARGS_NUM); double opt_mesh_nb_smoothing(OPT_ARGS_NUM); double opt_mesh_stl_distance_tol(OPT_ARGS_NUM); double opt_mesh_nb_elem_per_rc(OPT_ARGS_NUM); diff --git a/Fltk/GUI_Extras.cpp b/Fltk/GUI_Extras.cpp index 5c96ec5fb51b87518cd8da1165908d00112c9c24..378cbe734f4581a0e38e93a3ad5d61d16948b9b9 100644 --- a/Fltk/GUI_Extras.cpp +++ b/Fltk/GUI_Extras.cpp @@ -1,4 +1,4 @@ -// $Id: GUI_Extras.cpp,v 1.14 2006-01-06 00:34:23 geuzaine Exp $ +// $Id: GUI_Extras.cpp,v 1.15 2006-04-24 00:26:48 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -508,7 +508,7 @@ int msh_dialog(char *name) { struct _msh_dialog{ Fl_Window *window; - Fl_Check_Button *b; + Fl_Check_Button *b[2]; Fl_Choice *c; Fl_Button *ok, *cancel; }; @@ -522,17 +522,21 @@ int msh_dialog(char *name) if(!dialog){ dialog = new _msh_dialog; - int h = 3*10 + 25 + 2*25, y = 0; + int h = 3*10 + 25 + 3*25, y = 0; // not a "Dialog_Window" since it is modal dialog->window = new Fl_Double_Window(200, h, "MSH Options"); y = 10; dialog->window->box(GMSH_WINDOW_BOX); dialog->c = new Fl_Choice(10, y, 130, 25, "Format"); y+= 25; dialog->c->menu(versionmenu); dialog->c->align(FL_ALIGN_RIGHT); - dialog->b = new Fl_Check_Button(10, y, 180, 25, "Save all (ignore physicals)"); y += 25; - dialog->b->type(FL_TOGGLE_BUTTON); - dialog->b->down_box(GMSH_TOGGLE_BOX); - dialog->b->selection_color(GMSH_TOGGLE_COLOR); + dialog->b[0] = new Fl_Check_Button(10, y, 180, 25, "Save all (ignore physicals)"); y += 25; + dialog->b[0]->type(FL_TOGGLE_BUTTON); + dialog->b[0]->down_box(GMSH_TOGGLE_BOX); + dialog->b[0]->selection_color(GMSH_TOGGLE_COLOR); + dialog->b[1] = new Fl_Check_Button(10, y, 180, 25, "Renumber nodes"); y += 25; + dialog->b[1]->type(FL_TOGGLE_BUTTON); + dialog->b[1]->down_box(GMSH_TOGGLE_BOX); + dialog->b[1]->selection_color(GMSH_TOGGLE_COLOR); dialog->ok = new Fl_Return_Button(10, y+10, 85, 25, "OK"); dialog->cancel = new Fl_Button(105, y+10, 85, 25, "Cancel"); dialog->window->set_modal(); @@ -541,7 +545,8 @@ int msh_dialog(char *name) } dialog->c->value((CTX.mesh.msh_file_version==1.0) ? 0 : 1); - dialog->b->value(CTX.mesh.save_all); + dialog->b[0]->value(CTX.mesh.save_all); + dialog->b[1]->value(CTX.mesh.renumber_nodes_continuous); dialog->window->show(); while(dialog->window->shown()){ @@ -551,7 +556,8 @@ int msh_dialog(char *name) if (!o) break; if (o == dialog->ok) { opt_mesh_msh_file_version(0, GMSH_SET | GMSH_GUI, dialog->c->value() + 1); - opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value()); + opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value()); + opt_mesh_renumber_nodes_continuous(0, GMSH_SET | GMSH_GUI, dialog->b[1]->value()); CreateOutputFile(name, FORMAT_MSH); dialog->window->hide(); return 1; diff --git a/Mesh/Print_Mesh.cpp b/Mesh/Print_Mesh.cpp index 19fbf65539f7a2ef2486389f65bc5692ca12b3d1..4eba56e2efda46a0bd6059159feafe3790f0542b 100644 --- a/Mesh/Print_Mesh.cpp +++ b/Mesh/Print_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Print_Mesh.cpp,v 1.72 2006-03-24 21:37:14 geuzaine Exp $ +// $Id: Print_Mesh.cpp,v 1.73 2006-04-24 00:26:48 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -59,6 +59,9 @@ static void _msh_print_node(void *a, void *b) { Vertex *V = *(Vertex **) a; + if(CTX.mesh.renumber_nodes_continuous) + V->Num = ++MSH_NODE_NUM; + fprintf(MSHFILE, "%d %.16g %.16g %.16g\n", V->Num, V->Pos.X * CTX.mesh.scaling_factor, @@ -87,13 +90,13 @@ static void _msh_process_nodes(Mesh *M) } } - MSH_NODE_NUM = Tree_Nbr(M->Vertices); - if(CTX.mesh.msh_file_version == 2.0) fprintf(MSHFILE, "$Nodes\n"); else fprintf(MSHFILE, "$NOD\n"); - fprintf(MSHFILE, "%d\n", MSH_NODE_NUM); + fprintf(MSHFILE, "%d\n", Tree_Nbr(M->Vertices)); + + MSH_NODE_NUM = 0; Tree_Action(M->Vertices, _msh_print_node); if(CTX.mesh.msh_file_version == 2.0) fprintf(MSHFILE, "$EndNodes\n"); diff --git a/doc/texinfo/opt_mesh.texi b/doc/texinfo/opt_mesh.texi index 2c75d73fb8683bd64176d87e9e0a6c8c5e2da64b..f44b941b8235cacb5a77d517262489c000525389 100644 --- a/doc/texinfo/opt_mesh.texi +++ b/doc/texinfo/opt_mesh.texi @@ -304,6 +304,11 @@ Recombine algorithm (1=mixed triangles-quadrangles, 2=all quadrangles)@* Default value: @code{1}@* Saved in: @code{General.OptionsFileName} +@item Mesh.RenumberNodes +Renumber nodes to remove holes in the numbering sequence@* +Default value: @code{0}@* +Saved in: @code{General.OptionsFileName} + @item Mesh.SaveAll Ignore Physical definitions and save all elements@* Default value: @code{0}@* diff --git a/doc/texinfo/opt_plugin.texi b/doc/texinfo/opt_plugin.texi index e024f0de2f3d9e9ca5f70a3cb7a8d2b83342a86c..172800bdefb0b1921b2f0cea13b2b4dcc7fdfafb 100644 --- a/doc/texinfo/opt_plugin.texi +++ b/doc/texinfo/opt_plugin.texi @@ -755,7 +755,7 @@ step of the view `dView', scaled by `Factor'. If of surface normals multiplied by the `TimeStep' value in `iView'. (The smoothing of the surface normals is controlled by the `SmoothingAngle' -parameter.). If `iView' < 0, the plugin is run on +parameter.) If `iView' < 0, the plugin is run on the current view. Plugin(Warp) is executed in-place.