diff --git a/Common/Options.cpp b/Common/Options.cpp index 61b072cf0280042d257176522fffb4dd23c4fe3a..cc107d063b9cba0f94d9325528f1ff71de428c85 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -4792,7 +4792,7 @@ double opt_geometry_snap0(OPT_ARGS_NUM) CTX::instance()->geom.snap[0] = val; #if defined(HAVE_FLTK) if(FlGui::available() && (action & GMSH_GUI)) - FlGui::instance()->geoContext->value[0]->value + FlGui::instance()->elementaryContext->value[0]->value (CTX::instance()->geom.snap[0]); #endif return CTX::instance()->geom.snap[0]; @@ -4804,7 +4804,7 @@ double opt_geometry_snap1(OPT_ARGS_NUM) CTX::instance()->geom.snap[1] = val; #if defined(HAVE_FLTK) if(FlGui::available() && (action & GMSH_GUI)) - FlGui::instance()->geoContext->value[1]->value + FlGui::instance()->elementaryContext->value[1]->value (CTX::instance()->geom.snap[1]); #endif return CTX::instance()->geom.snap[1]; @@ -4816,7 +4816,7 @@ double opt_geometry_snap2(OPT_ARGS_NUM) CTX::instance()->geom.snap[2] = val; #if defined(HAVE_FLTK) if(FlGui::available() && (action & GMSH_GUI)) - FlGui::instance()->geoContext->value[2]->value + FlGui::instance()->elementaryContext->value[2]->value (CTX::instance()->geom.snap[2]); #endif return CTX::instance()->geom.snap[2]; diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index 921ed9f2ddc47f5b1f989433d512afaa33b6fe3e..711d1bce402b42209c4988bfe442429204b20e88 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -456,7 +456,8 @@ FlGui::FlGui(int argc, char **argv) highordertools = new highOrderToolsWindow(CTX::instance()->deltaFontSize); clipping = new clippingWindow(CTX::instance()->deltaFontSize); manip = new manipWindow(CTX::instance()->deltaFontSize); - geoContext = new geometryContextWindow(CTX::instance()->deltaFontSize); + elementaryContext = new elementaryContextWindow(CTX::instance()->deltaFontSize); + physicalContext = new physicalContextWindow(CTX::instance()->deltaFontSize); meshContext = new meshContextWindow(CTX::instance()->deltaFontSize); help = new helpWindow(); @@ -1119,8 +1120,8 @@ void FlGui::storeCurrentWindowsInfo() CTX::instance()->clipPosition[1] = clipping->win->y(); CTX::instance()->manipPosition[0] = manip->win->x(); CTX::instance()->manipPosition[1] = manip->win->y(); - CTX::instance()->ctxPosition[0] = geoContext->win->x(); - CTX::instance()->ctxPosition[1] = meshContext->win->y(); + CTX::instance()->ctxPosition[0] = elementaryContext->win->x(); + CTX::instance()->ctxPosition[1] = elementaryContext->win->y(); #if defined(HAVE_3M) storeWindowPosition3M(); #endif @@ -1224,8 +1225,10 @@ void window_cb(Fl_Widget *w, void *data) FlGui::instance()->plugins->win->show(); if(FlGui::instance()->fields->win->shown()) FlGui::instance()->fields->win->show(); - if(FlGui::instance()->geoContext->win->shown()) - FlGui::instance()->geoContext->win->show(); + if(FlGui::instance()->elementaryContext->win->shown()) + FlGui::instance()->elementaryContext->win->show(); + if(FlGui::instance()->physicalContext->win->shown()) + FlGui::instance()->physicalContext->win->show(); if(FlGui::instance()->meshContext->win->shown()) FlGui::instance()->meshContext->win->show(); if(FlGui::instance()->visibility->win->shown()) diff --git a/Fltk/FlGui.h b/Fltk/FlGui.h index d47689577ed0a8e60478a2dcd0b4735803f5897b..b1c1c043395d4860ece30c4e9f21645a56de17f4 100644 --- a/Fltk/FlGui.h +++ b/Fltk/FlGui.h @@ -30,7 +30,8 @@ class visibilityWindow; class highOrderToolsWindow; class clippingWindow; class manipWindow; -class geometryContextWindow; +class elementaryContextWindow; +class physicalContextWindow; class meshContextWindow; class helpWindow; class onelabGroup; @@ -68,7 +69,8 @@ class FlGui{ highOrderToolsWindow *highordertools; clippingWindow *clipping; manipWindow *manip; - geometryContextWindow *geoContext; + elementaryContextWindow *elementaryContext; + physicalContextWindow *physicalContext; meshContextWindow *meshContext; helpWindow *help; onelabGroup *onelab; diff --git a/Fltk/contextWindow.cpp b/Fltk/contextWindow.cpp index c5326893e963515747aa51b5b9efb025b96ee4cc..c218486be945b94b2da4db90b39f0f94cd38c729 100644 --- a/Fltk/contextWindow.cpp +++ b/Fltk/contextWindow.cpp @@ -10,41 +10,42 @@ #include "contextWindow.h" #include "paletteWindow.h" #include "GModel.h" +#include "Geo.h" #include "GeoStringInterface.h" #include "OpenFile.h" #include "Context.h" -static void con_geometry_define_parameter_cb(Fl_Widget *w, void *data) +static void elementary_define_parameter_cb(Fl_Widget *w, void *data) { - add_param(FlGui::instance()->geoContext->input[0]->value(), - FlGui::instance()->geoContext->input[1]->value(), - FlGui::instance()->geoContext->input[24]->value(), - FlGui::instance()->geoContext->input[25]->value(), + add_param(FlGui::instance()->elementaryContext->input[0]->value(), + FlGui::instance()->elementaryContext->input[1]->value(), + FlGui::instance()->elementaryContext->input[24]->value(), + FlGui::instance()->elementaryContext->input[25]->value(), GModel::current()->getFileName()); FlGui::instance()->resetVisibility(); } -static void con_geometry_define_point_cb(Fl_Widget *w, void *data) +static void elementary_define_point_cb(Fl_Widget *w, void *data) { add_point(GModel::current()->getFileName(), - FlGui::instance()->geoContext->input[2]->value(), - FlGui::instance()->geoContext->input[3]->value(), - FlGui::instance()->geoContext->input[4]->value(), - FlGui::instance()->geoContext->input[5]->value()); + FlGui::instance()->elementaryContext->input[2]->value(), + FlGui::instance()->elementaryContext->input[3]->value(), + FlGui::instance()->elementaryContext->input[4]->value(), + FlGui::instance()->elementaryContext->input[5]->value()); FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); SetBoundingBox(); drawContext::global()->draw(); } -static void con_geometry_snap_cb(Fl_Widget *w, void *data) +static void elementary_snap_cb(Fl_Widget *w, void *data) { - CTX::instance()->geom.snap[0] = FlGui::instance()->geoContext->value[0]->value(); - CTX::instance()->geom.snap[1] = FlGui::instance()->geoContext->value[1]->value(); - CTX::instance()->geom.snap[2] = FlGui::instance()->geoContext->value[2]->value(); + CTX::instance()->geom.snap[0] = FlGui::instance()->elementaryContext->value[0]->value(); + CTX::instance()->geom.snap[1] = FlGui::instance()->elementaryContext->value[1]->value(); + CTX::instance()->geom.snap[2] = FlGui::instance()->elementaryContext->value[2]->value(); } -geometryContextWindow::geometryContextWindow(int deltaFontSize) +elementaryContextWindow::elementaryContextWindow(int deltaFontSize) { FL_NORMAL_SIZE -= deltaFontSize; @@ -52,7 +53,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) int height = 4 * WB + 8 * BH; win = new paletteWindow(width, height, CTX::instance()->nonModalWindows ? true : false, - "Contextual Geometry Definitions"); + "Elementary Entity Context"); win->box(GMSH_WINDOW_BOX); { Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 2 * WB); @@ -73,7 +74,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) { Fl_Return_Button *o = new Fl_Return_Button (width - BB - 2 * WB, 2 * WB + 7 * BH, BB, BH, "Add"); - o->callback(con_geometry_define_parameter_cb); + o->callback(elementary_define_parameter_cb); } group[0]->end(); } @@ -87,7 +88,8 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) input[3]->value("0"); input[4] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Z coordinate"); input[4]->value("0"); - input[5] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Prescribed mesh element size at point"); + input[5] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, + "Prescribed mesh element size at point"); input[5]->value("1.0"); for(int i = 2; i < 6; i++) { input[i]->align(FL_ALIGN_RIGHT); @@ -98,12 +100,12 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) "Snapping grid spacing"); for(int i = 0; i < 3; i++) { value[i]->align(FL_ALIGN_RIGHT); - value[i]->callback(con_geometry_snap_cb); + value[i]->callback(elementary_snap_cb); } { Fl_Return_Button *o = new Fl_Return_Button (width - BB - 2 * WB, 2 * WB + 7 * BH, BB, BH, "Add"); - o->callback(con_geometry_define_point_cb); + o->callback(elementary_define_point_cb); } group[1]->end(); } @@ -199,7 +201,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) FL_NORMAL_SIZE += deltaFontSize; } -void geometryContextWindow::show(int pane) +void elementaryContextWindow::show(int pane) { for(int i = 0; i < 6; i++) group[i]->hide(); @@ -207,6 +209,85 @@ void geometryContextWindow::show(int pane) win->show(); } +static void physical_name_cb(Fl_Widget *w, void *data) +{ + std::string name = FlGui::instance()->physicalContext->input[0]->value(); + for(GModel::piter it = GModel::current()->firstPhysicalName(); + it != GModel::current()->lastPhysicalName(); it++){ + if(it->second == name){ + FlGui::instance()->physicalContext->input[0]->textcolor(FL_RED); + FlGui::instance()->physicalContext->input[0]->redraw(); + return; + } + } + FlGui::instance()->physicalContext->input[0]->textcolor(FL_FOREGROUND_COLOR); + FlGui::instance()->physicalContext->input[0]->redraw(); +} + +static void physical_number_cb(Fl_Widget *w, void *data) +{ + if(FlGui::instance()->physicalContext->butt[0]->value()){ + FlGui::instance()->physicalContext->value[0]->value(NEWPHYSICAL()); + FlGui::instance()->physicalContext->value[0]->deactivate(); + } + else{ + FlGui::instance()->physicalContext->value[0]->activate(); + int val = FlGui::instance()->physicalContext->value[0]->value(); + for(GModel::piter it = GModel::current()->firstPhysicalName(); + it != GModel::current()->lastPhysicalName(); it++){ + if(it->first.second == val){ + FlGui::instance()->physicalContext->value[0]->textcolor(FL_RED); + FlGui::instance()->physicalContext->value[0]->redraw(); + return; + } + } + } + FlGui::instance()->physicalContext->value[0]->textcolor(FL_FOREGROUND_COLOR); + FlGui::instance()->physicalContext->value[0]->redraw(); +} + +physicalContextWindow::physicalContextWindow(int deltaFontSize) +{ + FL_NORMAL_SIZE -= deltaFontSize; + + int width = 28 * FL_NORMAL_SIZE; + int height = 2 * WB + 3 * BH; + + win = new paletteWindow(width, height, CTX::instance()->nonModalWindows ? true : false, + "Physical Group Context"); + win->box(GMSH_WINDOW_BOX); + { + input[0] = new Fl_Input(WB, WB, (2 * width) / 3, BH, "Name"); + input[0]->value(""); + input[0]->align(FL_ALIGN_RIGHT); + input[0]->callback(physical_name_cb); + input[0]->when(FL_WHEN_CHANGED); + + butt[0] = new Fl_Check_Button(WB, WB + BH, width - 2 * WB, BH, "Automatic numbering"); + butt[0]->value(1); + butt[0]->callback(physical_number_cb); + + value[0] = new Fl_Value_Input(WB, WB + 2 * BH, (2 * width) / 3, BH, "Numeric tag"); + value[0]->value(0); + value[0]->deactivate(); + value[0]->align(FL_ALIGN_RIGHT); + value[0]->callback(physical_number_cb); + value[0]->when(FL_WHEN_CHANGED); + } + + win->position(CTX::instance()->ctxPosition[0], CTX::instance()->ctxPosition[1]); + win->end(); + + FL_NORMAL_SIZE += deltaFontSize; +} + +void physicalContextWindow::show() +{ + physical_name_cb(0, 0); + physical_number_cb(0, 0); + if(!win->shown()) win->show(); +} + meshContextWindow::meshContextWindow(int deltaFontSize) { FL_NORMAL_SIZE -= deltaFontSize; @@ -222,14 +303,14 @@ meshContextWindow::meshContextWindow(int deltaFontSize) int height = 4 * WB + 4 * BH; win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows, "Contextual Mesh Definitions"); + (width, height, CTX::instance()->nonModalWindows, "Mesh Context"); win->box(GMSH_WINDOW_BOX); { Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 2 * WB); // 0: Element size at points { group[0] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Element size at points"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Element size"); input[0] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Value"); input[0]->value("0.1"); input[0]->align(FL_ALIGN_RIGHT); diff --git a/Fltk/contextWindow.h b/Fltk/contextWindow.h index b2406db058068a021ef4f14af7dc5b1434820db1..3d8c3ae8bb14d65093f1e5dfb3f0e7e923be7a4c 100644 --- a/Fltk/contextWindow.h +++ b/Fltk/contextWindow.h @@ -9,20 +9,32 @@ #include <FL/Fl_Window.H> #include <FL/Fl_Input.H> #include <FL/Fl_Value_Input.H> +#include <FL/Fl_Check_Button.H> #include <FL/Fl_Choice.H> #include <FL/Fl_Group.H> -class geometryContextWindow{ +class elementaryContextWindow{ public: Fl_Window *win; Fl_Input *input[30]; Fl_Value_Input *value[10]; Fl_Group *group[10]; public: - geometryContextWindow(int deltaFontSize=0); + elementaryContextWindow(int deltaFontSize=0); void show(int pane); }; +class physicalContextWindow{ + public: + Fl_Window *win; + Fl_Input *input[10]; + Fl_Check_Button *butt[10]; + Fl_Value_Input *value[10]; + public: + physicalContextWindow(int deltaFontSize=0); + void show(); +}; + class meshContextWindow{ public: Fl_Window *win; diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 1072ff4c2f9c668fdf0fbd63515b9bfa3ecdd873..ce98964ec91ae21bcbab21b86627175fc6046920 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -600,7 +600,7 @@ static void add_new_point() opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); drawContext::global()->draw(); - FlGui::instance()->geoContext->show(1); + FlGui::instance()->elementaryContext->show(1); while(1) { for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) @@ -612,10 +612,10 @@ static void add_new_point() char ib = FlGui::instance()->selectEntity(ENT_NONE); if(ib == 'e'){ add_point(GModel::current()->getFileName(), - FlGui::instance()->geoContext->input[2]->value(), - FlGui::instance()->geoContext->input[3]->value(), - FlGui::instance()->geoContext->input[4]->value(), - FlGui::instance()->geoContext->input[5]->value()); + FlGui::instance()->elementaryContext->input[2]->value(), + FlGui::instance()->elementaryContext->input[3]->value(), + FlGui::instance()->elementaryContext->input[4]->value(), + FlGui::instance()->elementaryContext->input[5]->value()); FlGui::instance()->resetVisibility(); drawContext::global()->draw(); } @@ -1033,7 +1033,7 @@ static void geometry_elementary_add_new_cb(Fl_Widget *w, void *data) std::string str((const char*)data); if(str == "Parameter") - FlGui::instance()->geoContext->show(0); + FlGui::instance()->elementaryContext->show(0); else if(str == "Point") add_new_point(); else if(str == "Line") @@ -1262,55 +1262,59 @@ static void action_point_line_surface_volume(int action, int mode, const char *w switch (action) { case 0: translate(mode, List1, GModel::current()->getFileName(), what, - FlGui::instance()->geoContext->input[6]->value(), - FlGui::instance()->geoContext->input[7]->value(), - FlGui::instance()->geoContext->input[8]->value()); + FlGui::instance()->elementaryContext->input[6]->value(), + FlGui::instance()->elementaryContext->input[7]->value(), + FlGui::instance()->elementaryContext->input[8]->value()); break; case 1: rotate(mode, List1, GModel::current()->getFileName(), what, - FlGui::instance()->geoContext->input[12]->value(), - FlGui::instance()->geoContext->input[13]->value(), - FlGui::instance()->geoContext->input[14]->value(), - FlGui::instance()->geoContext->input[9]->value(), - FlGui::instance()->geoContext->input[10]->value(), - FlGui::instance()->geoContext->input[11]->value(), - FlGui::instance()->geoContext->input[15]->value()); + FlGui::instance()->elementaryContext->input[12]->value(), + FlGui::instance()->elementaryContext->input[13]->value(), + FlGui::instance()->elementaryContext->input[14]->value(), + FlGui::instance()->elementaryContext->input[9]->value(), + FlGui::instance()->elementaryContext->input[10]->value(), + FlGui::instance()->elementaryContext->input[11]->value(), + FlGui::instance()->elementaryContext->input[15]->value()); break; case 2: dilate(mode, List1, GModel::current()->getFileName(), what, - FlGui::instance()->geoContext->input[16]->value(), - FlGui::instance()->geoContext->input[17]->value(), - FlGui::instance()->geoContext->input[18]->value(), - FlGui::instance()->geoContext->input[19]->value()); + FlGui::instance()->elementaryContext->input[16]->value(), + FlGui::instance()->elementaryContext->input[17]->value(), + FlGui::instance()->elementaryContext->input[18]->value(), + FlGui::instance()->elementaryContext->input[19]->value()); break; case 3: symmetry(mode, List1, GModel::current()->getFileName(), what, - FlGui::instance()->geoContext->input[20]->value(), - FlGui::instance()->geoContext->input[21]->value(), - FlGui::instance()->geoContext->input[22]->value(), - FlGui::instance()->geoContext->input[23]->value()); + FlGui::instance()->elementaryContext->input[20]->value(), + FlGui::instance()->elementaryContext->input[21]->value(), + FlGui::instance()->elementaryContext->input[22]->value(), + FlGui::instance()->elementaryContext->input[23]->value()); break; case 4: extrude(List1, GModel::current()->getFileName(), what, - FlGui::instance()->geoContext->input[6]->value(), - FlGui::instance()->geoContext->input[7]->value(), - FlGui::instance()->geoContext->input[8]->value()); + FlGui::instance()->elementaryContext->input[6]->value(), + FlGui::instance()->elementaryContext->input[7]->value(), + FlGui::instance()->elementaryContext->input[8]->value()); break; case 5: protude(List1, GModel::current()->getFileName(), what, - FlGui::instance()->geoContext->input[12]->value(), - FlGui::instance()->geoContext->input[13]->value(), - FlGui::instance()->geoContext->input[14]->value(), - FlGui::instance()->geoContext->input[9]->value(), - FlGui::instance()->geoContext->input[10]->value(), - FlGui::instance()->geoContext->input[11]->value(), - FlGui::instance()->geoContext->input[15]->value()); + FlGui::instance()->elementaryContext->input[12]->value(), + FlGui::instance()->elementaryContext->input[13]->value(), + FlGui::instance()->elementaryContext->input[14]->value(), + FlGui::instance()->elementaryContext->input[9]->value(), + FlGui::instance()->elementaryContext->input[10]->value(), + FlGui::instance()->elementaryContext->input[11]->value(), + FlGui::instance()->elementaryContext->input[15]->value()); break; case 6: delet(List1, GModel::current()->getFileName(), what); break; case 7: - add_physical(what, List1, GModel::current()->getFileName()); + add_physical(what, List1, GModel::current()->getFileName(), + FlGui::instance()->physicalContext->input[0]->value(), + FlGui::instance()->physicalContext->butt[0]->value() ? 0 : + FlGui::instance()->physicalContext->value[0]->value()); + FlGui::instance()->physicalContext->show(); break; case 8: add_charlength(List1, GModel::current()->getFileName(), @@ -1347,70 +1351,70 @@ static void action_point_line_surface_volume(int action, int mode, const char *w static void geometry_elementary_add_translate_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(2); + FlGui::instance()->elementaryContext->show(2); action_point_line_surface_volume(0, 1, (const char*)data); } static void geometry_elementary_add_rotate_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(3); + FlGui::instance()->elementaryContext->show(3); action_point_line_surface_volume(1, 1, (const char*)data); } static void geometry_elementary_add_scale_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(4); + FlGui::instance()->elementaryContext->show(4); action_point_line_surface_volume(2, 1, (const char*)data); } static void geometry_elementary_add_symmetry_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(5); + FlGui::instance()->elementaryContext->show(5); action_point_line_surface_volume(3, 1, (const char*)data); } static void geometry_elementary_translate_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(2); + FlGui::instance()->elementaryContext->show(2); action_point_line_surface_volume(0, 0, (const char*)data); } static void geometry_elementary_rotate_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(3); + FlGui::instance()->elementaryContext->show(3); action_point_line_surface_volume(1, 0, (const char*)data); } static void geometry_elementary_scale_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(4); + FlGui::instance()->elementaryContext->show(4); action_point_line_surface_volume(2, 0, (const char*)data); } static void geometry_elementary_symmetry_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(5); + FlGui::instance()->elementaryContext->show(5); action_point_line_surface_volume(3, 0, (const char*)data); } static void geometry_elementary_extrude_translate_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(2); + FlGui::instance()->elementaryContext->show(2); action_point_line_surface_volume(4, 0, (const char*)data); } static void geometry_elementary_extrude_rotate_cb(Fl_Widget *w, void *data) { if(!data) return; - FlGui::instance()->geoContext->show(3); + FlGui::instance()->elementaryContext->show(3); action_point_line_surface_volume(5, 0, (const char*)data); } @@ -1439,7 +1443,7 @@ static void geometry_physical_add_cb(Fl_Widget *w, void *data) FlGui::instance()->callForSolverPlugin(0); else if(str == "Line") FlGui::instance()->callForSolverPlugin(1); - + FlGui::instance()->physicalContext->show(); action_point_line_surface_volume(7, 0, str.c_str()); } diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index f4b22ed4ee1f9c092e3285ff6519b37f30d78ac5..9bb13c10cd0334a7c4e33e253cf42724804260c8 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -636,11 +636,11 @@ int openglWindow::handle(int event) } char str[32]; sprintf(str, "%g", _point[0]); - FlGui::instance()->geoContext->input[2]->value(str); + FlGui::instance()->elementaryContext->input[2]->value(str); sprintf(str, "%g", _point[1]); - FlGui::instance()->geoContext->input[3]->value(str); + FlGui::instance()->elementaryContext->input[3]->value(str); sprintf(str, "%g", _point[2]); - FlGui::instance()->geoContext->input[4]->value(str); + FlGui::instance()->elementaryContext->input[4]->value(str); redraw(); } else{ // hover mode diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index b191dd4ca1dc1869d79922b02d3ef85e05f1038c..5ab0ef15b35cb4fc0c4d9bc4bedd38d8785b6e6f 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -3511,8 +3511,7 @@ optionWindow::optionWindow(int deltaFontSize) { Fl_Group *o = new Fl_Group (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Map"); - o->label("@-1gmsh_colormap"); - + //o->label("@-1gmsh_colormap"); o->hide(); view.colorbar = new colorbarWindow diff --git a/Fltk/visibilityWindow.cpp b/Fltk/visibilityWindow.cpp index 23ed0e807ca2badc63813ed136c3eb7dc7a84f89..3b1903fca344c1b5d5dc42d4d24892c07297cac8 100644 --- a/Fltk/visibilityWindow.cpp +++ b/Fltk/visibilityWindow.cpp @@ -431,12 +431,12 @@ static void visibility_sort_cb(Fl_Widget *w, void *data) if(FlGui::instance()->visibility->browser->selected(i + 1)){ static char tmpstr[256]; sprintf(tmpstr, "%d", VisibilityList::instance()->getTag(i)); - FlGui::instance()->geoContext->input[1]->value(tmpstr); + FlGui::instance()->elementaryContext->input[1]->value(tmpstr); break; } } - FlGui::instance()->geoContext->input[0]->value("NewName"); - FlGui::instance()->geoContext->show(0); + FlGui::instance()->elementaryContext->input[0]->value("NewName"); + FlGui::instance()->elementaryContext->show(0); } else { // set new sorting mode VisibilityList::instance()->setSortMode(val); diff --git a/Geo/GeoStringInterface.cpp b/Geo/GeoStringInterface.cpp index ad9529c41c09f02b5c1134621ca67826a7af959d..bf1c6de4e9588e1989771344f54ccc3593d9a6f0 100644 --- a/Geo/GeoStringInterface.cpp +++ b/Geo/GeoStringInterface.cpp @@ -27,7 +27,7 @@ #include "OnelabDatabase.h" #endif -void add_infile(std::string text, std::string fileName, bool forceDestroy) +void add_infile(const std::string &text, const std::string &fileName, bool forceDestroy) { std::vector<std::string> split = SplitFileName(fileName); std::string noExt = split[0] + split[1], ext = split[2]; @@ -147,7 +147,7 @@ void add_infile(std::string text, std::string fileName, bool forceDestroy) #endif } -void coherence(std::string fileName) +void coherence(const std::string &fileName) { add_infile("Coherence;", fileName, true); } @@ -164,29 +164,30 @@ static std::string list2string(List_T *list) return sstream.str(); } -void delet(List_T *list, std::string fileName, std::string what) +void delet(List_T *list, const std::string &fileName, const std::string &what) { std::ostringstream sstream; sstream << "Delete {\n " << what << "{" << list2string(list) << "};\n}"; add_infile(sstream.str(), fileName, true); } -void add_charlength(List_T *list, std::string fileName, std::string lc) +void add_charlength(List_T *list, const std::string &fileName, const std::string &lc) { std::ostringstream sstream; sstream << "Characteristic Length {" << list2string(list) << "} = " << lc << ";"; add_infile(sstream.str(), fileName); } -void add_recosurf(List_T *list, std::string fileName) +void add_recosurf(List_T *list, const std::string &fileName) { std::ostringstream sstream; sstream << "Recombine Surface {" << list2string(list) << "};"; add_infile(sstream.str(), fileName); } -void add_trsfline(std::vector<int> &l, std::string fileName, std::string type, - std::string typearg, std::string pts) +void add_trsfline(std::vector<int> &l, const std::string &fileName, + const std::string &type, const std::string &typearg, + const std::string &pts) { std::ostringstream sstream; sstream << "Transfinite Line {"; @@ -200,7 +201,8 @@ void add_trsfline(std::vector<int> &l, std::string fileName, std::string type, add_infile(sstream.str(), fileName); } -void add_trsfsurf(std::vector<int> &l, std::string fileName, std::string dir) +void add_trsfsurf(std::vector<int> &l, const std::string &fileName, + const std::string &dir) { std::ostringstream sstream; sstream << "Transfinite Surface {" << l[0] << "}"; @@ -218,7 +220,7 @@ void add_trsfsurf(std::vector<int> &l, std::string fileName, std::string dir) add_infile(sstream.str(), fileName); } -void add_trsfvol(std::vector<int> &l, std::string fileName) +void add_trsfvol(std::vector<int> &l, const std::string &fileName) { std::ostringstream sstream; sstream << "Transfinite Volume{" << l[0] << "} = {"; @@ -230,7 +232,8 @@ void add_trsfvol(std::vector<int> &l, std::string fileName) add_infile(sstream.str(), fileName); } -void add_embedded(std::string what, std::vector<int> &l, std::string fileName) +void add_embedded(const std::string &what, std::vector<int> &l, + const std::string &fileName) { std::ostringstream sstream; sstream << "Point{"; @@ -242,8 +245,9 @@ void add_embedded(std::string what, std::vector<int> &l, std::string fileName) add_infile(sstream.str(), fileName, true); } -void add_param(std::string par, std::string value, std::string label, - std::string path, std::string fileName) +void add_param(const std::string &par, const std::string &value, + const std::string &label, const std::string &path, + const std::string &fileName) { std::ostringstream sstream; sstream << par << " = DefineNumber[ " << value; @@ -260,8 +264,8 @@ void add_param(std::string par, std::string value, std::string label, add_infile(sstream.str(), fileName); } -void add_point(std::string fileName, std::string x, std::string y, - std::string z, std::string lc) +void add_point(const std::string &fileName, const std::string &x, const std::string &y, + const std::string &z, const std::string &lc) { std::ostringstream sstream; sstream << "Point(" << NEWPOINT() << ") = {" << x << ", " << y << ", " @@ -271,8 +275,8 @@ void add_point(std::string fileName, std::string x, std::string y, add_infile(sstream.str(), fileName); } -void add_field_option(int field_id, std::string option_name, - std::string option_value, std::string fileName) +void add_field_option(int field_id, const std::string &option_name, + const std::string &option_value, const std::string &fileName) { std::ostringstream sstream; sstream << "Field[" << field_id << "]." << option_name << " = " @@ -280,28 +284,29 @@ void add_field_option(int field_id, std::string option_name, add_infile(sstream.str(), fileName); } -void add_field(int field_id, std::string type_name, std::string fileName) +void add_field(int field_id, const std::string &type_name, const std::string &fileName) { std::ostringstream sstream; sstream << "Field[" << field_id << "] = " << type_name << ";"; add_infile(sstream.str(), fileName); } -void delete_field(int field_id, std::string fileName) +void delete_field(int field_id, const std::string &fileName) { std::ostringstream sstream; sstream << "Delete Field [" << field_id << "];"; add_infile(sstream.str(), fileName); } -void set_background_field(int field_id, std::string fileName) +void set_background_field(int field_id, const std::string &fileName) { std::ostringstream sstream; sstream << "Background Field = " << field_id << ";"; add_infile(sstream.str(), fileName); } -void add_multline(std::string type, std::vector<int> &p, std::string fileName) +void add_multline(const std::string &type, std::vector<int> &p, + const std::string &fileName) { std::ostringstream sstream; sstream << type << "(" << NEWLINE() << ") = {"; @@ -313,7 +318,7 @@ void add_multline(std::string type, std::vector<int> &p, std::string fileName) add_infile(sstream.str(), fileName); } -void add_circ(int p1, int p2, int p3, std::string fileName) +void add_circ(int p1, int p2, int p3, const std::string &fileName) { std::ostringstream sstream; sstream << "Circle(" << NEWLINE() << ") = {" << p1 << ", " << p2 << ", " @@ -321,7 +326,7 @@ void add_circ(int p1, int p2, int p3, std::string fileName) add_infile(sstream.str(), fileName); } -void add_ell(int p1, int p2, int p3, int p4, std::string fileName) +void add_ell(int p1, int p2, int p3, int p4, const std::string &fileName) { std::ostringstream sstream; sstream << "Ellipse(" << NEWLINE() << ") = {" << p1 << ", " << p2 << ", " @@ -329,7 +334,7 @@ void add_ell(int p1, int p2, int p3, int p4, std::string fileName) add_infile(sstream.str(), fileName); } -void add_lineloop(List_T *list, std::string fileName, int *numloop) +void add_lineloop(List_T *list, const std::string &fileName, int *numloop) { if(recognize_loop(list, numloop)) return; *numloop = NEWLINELOOP(); @@ -338,14 +343,14 @@ void add_lineloop(List_T *list, std::string fileName, int *numloop) add_infile(sstream.str(), fileName); } -void add_surf(std::string type, List_T *list, std::string fileName) +void add_surf(const std::string &type, List_T *list, const std::string &fileName) { std::ostringstream sstream; sstream << type << "(" << NEWSURFACE() << ") = {" << list2string(list) << "};"; add_infile(sstream.str(), fileName); } -void add_surfloop(List_T *list, std::string fileName, int *numloop) +void add_surfloop(List_T *list, const std::string &fileName, int *numloop) { if(recognize_surfloop(list, numloop)) return; *numloop = NEWSURFACELOOP(); @@ -354,31 +359,40 @@ void add_surfloop(List_T *list, std::string fileName, int *numloop) add_infile(sstream.str(), fileName); } -void add_vol(List_T *list, std::string fileName) +void add_vol(List_T *list, const std::string &fileName) { std::ostringstream sstream; sstream << "Volume(" << NEWVOLUME() << ") = {" << list2string(list) << "};"; add_infile(sstream.str(), fileName); } -void add_physical(std::string type, List_T *list, std::string fileName) +void add_physical(const std::string &type, List_T *list, const std::string &fileName, + const std::string &name, int forceTag) { std::ostringstream sstream; - sstream << "Physical " << type << "(" << NEWPHYSICAL() << ") = {" - << list2string(list) << "};"; + sstream << "Physical " << type << "("; + if(name.size()){ + sstream << "\"" << name << "\""; + if(forceTag) + sstream << ", " << forceTag; + } + else{ + sstream << (forceTag ? forceTag : NEWPHYSICAL()); + } + sstream << ") = {" << list2string(list) << "};"; add_infile(sstream.str(), fileName); } -void add_compound(std::string type, List_T *list, std::string fileName) +void add_compound(const std::string &type, List_T *list, const std::string &fileName) { std::ostringstream sstream; if(SplitFileName(fileName)[2] != ".geo") sstream << "CreateTopology;\n"; if (type == "Surface"){ - sstream << "Compound " << type << "(" << NEWSURFACE()+1000 << ") = {" + sstream << "Compound " << type << "(" << NEWSURFACE() << ") = {" << list2string(list) << "};"; } else if (type == "Line"){ - sstream << "Compound " << type << "(" << NEWLINE()+1000 << ") = {" + sstream << "Compound " << type << "(" << NEWLINE() << ") = {" << list2string(list) << "};"; } else{ @@ -388,8 +402,9 @@ void add_compound(std::string type, List_T *list, std::string fileName) add_infile(sstream.str(), fileName); } -void translate(int add, List_T *list, std::string fileName, std::string what, - std::string tx, std::string ty, std::string tz) +void translate(int add, List_T *list, const std::string &fileName, + const std::string &what, const std::string &tx, + const std::string &ty, const std::string &tz) { std::ostringstream sstream; sstream << "Translate {" << tx << ", " << ty << ", " << tz << "} {\n "; @@ -400,9 +415,10 @@ void translate(int add, List_T *list, std::string fileName, std::string what, add_infile(sstream.str(), fileName); } -void rotate(int add, List_T *list, std::string fileName, std::string what, - std::string ax, std::string ay, std::string az, - std::string px, std::string py, std::string pz, std::string angle) +void rotate(int add, List_T *list, const std::string &fileName, + const std::string &what, const std::string &ax, const std::string &ay, + const std::string &az, const std::string &px, const std::string &py, + const std::string &pz, const std::string &angle) { std::ostringstream sstream; sstream << "Rotate {{" << ax << ", " << ay << ", " << az << "}, {" @@ -414,8 +430,9 @@ void rotate(int add, List_T *list, std::string fileName, std::string what, add_infile(sstream.str(), fileName); } -void dilate(int add, List_T *list, std::string fileName, std::string what, - std::string dx, std::string dy, std::string dz, std::string df) +void dilate(int add, List_T *list, const std::string &fileName, + const std::string &what, const std::string &dx, const std::string &dy, + const std::string &dz, const std::string &df) { std::ostringstream sstream; sstream << "Dilate {{" << dx << ", " << dy << ", " << dz << "}, " << df << "} {\n "; @@ -426,8 +443,9 @@ void dilate(int add, List_T *list, std::string fileName, std::string what, add_infile(sstream.str(), fileName); } -void symmetry(int add, List_T *list, std::string fileName, std::string what, - std::string sa, std::string sb, std::string sc, std::string sd) +void symmetry(int add, List_T *list, const std::string &fileName, + const std::string &what, const std::string &sa, const std::string &sb, + const std::string &sc, const std::string &sd) { std::ostringstream sstream; sstream << "Symmetry {" << sa << ", " << sb << ", " << sc << ", " << sd << "} {\n "; @@ -438,8 +456,8 @@ void symmetry(int add, List_T *list, std::string fileName, std::string what, add_infile(sstream.str(), fileName); } -void extrude(List_T *list, std::string fileName, std::string what, - std::string tx, std::string ty, std::string tz) +void extrude(List_T *list, const std::string &fileName, const std::string &what, + const std::string &tx, const std::string &ty, const std::string &tz) { std::ostringstream sstream; sstream << "Extrude {" << tx << ", " << ty << ", " << tz << "} {\n " << what @@ -447,9 +465,10 @@ void extrude(List_T *list, std::string fileName, std::string what, add_infile(sstream.str(), fileName); } -void protude(List_T *list, std::string fileName, std::string what, - std::string ax, std::string ay, std::string az, - std::string px, std::string py, std::string pz, std::string angle) +void protude(List_T *list, const std::string &fileName, const std::string &what, + const std::string &ax, const std::string &ay, const std::string &az, + const std::string &px, const std::string &py, const std::string &pz, + const std::string &angle) { std::ostringstream sstream; sstream << "Extrude {{" << ax << ", " << ay << ", " << az << "}, {" @@ -458,7 +477,7 @@ void protude(List_T *list, std::string fileName, std::string what, add_infile(sstream.str(), fileName); } -void split_edge(int edge_id, List_T *vertices,std::string fileName) +void split_edge(int edge_id, List_T *vertices, const std::string &fileName) { std::ostringstream sstream; sstream << "Split Line(" << edge_id << ") {" << list2string(vertices) << "};"; diff --git a/Geo/GeoStringInterface.h b/Geo/GeoStringInterface.h index 41256dcfe5191436f87f690df90aa17304e1a0c9..2e4fbb43473a3ab373c497e841afd82c421b483a 100644 --- a/Geo/GeoStringInterface.h +++ b/Geo/GeoStringInterface.h @@ -10,48 +10,63 @@ #include <vector> #include "ListUtils.h" -void coherence(std::string fileName); -void delet(List_T *list, std::string fileName, std::string what); -void add_infile(std::string text, std::string fileName, bool deleted_something=false); -void add_charlength(List_T *list, std::string fileName, std::string lc); -void add_recosurf(List_T *list, std::string fileName); -void add_trsfline(std::vector<int> &l, std::string fileName, std::string type, - std::string typearg, std::string pts); -void add_trsfsurf(std::vector<int> &l, std::string fileName, std::string dir); -void add_trsfvol(std::vector<int> &l, std::string fileName); -void add_embedded(std::string what, std::vector<int> &l, std::string fileName); -void add_param(std::string par, std::string value, std::string label, - std::string path, std::string fileName); -void add_point(std::string fileName, std::string x, std::string y, std::string z, - std::string lc); -void add_multline(std::string type, std::vector<int> &p, std::string fileName); -void add_circ(int p1, int p2, int p3, std::string fileName); -void add_ell(int p1, int p2, int p3, int p4, std::string fileName); -void add_field_option(int field_id, std::string option_name, std::string option_value, - std::string fileName); -void add_field(int field_id, std::string type_name, std::string fileName); -void delete_field(int field_id, std::string fileName); -void set_background_field(int field_id,std::string fileName); -void add_lineloop(List_T *list, std::string fileName, int *numloop); -void add_surf(std::string type, List_T *list, std::string fileName); -void add_surfloop(List_T *list, std::string fileName, int *numvol); -void add_vol(List_T *list, std::string fileName); -void add_physical(std::string type, List_T *list, std::string fileName); -void add_compound(std::string type, List_T *list, std::string fileName); -void translate(int add, List_T *list, std::string fileName, std::string what, - std::string tx, std::string ty, std::string tz); -void rotate(int add, List_T *list, std::string fileName, std::string what, - std::string ax, std::string ay, std::string az, - std::string px, std::string py, std::string pz, std::string angle); -void dilate(int add, List_T *list, std::string fileName, std::string what, - std::string dx, std::string dy, std::string dz, std::string df); -void symmetry(int add, List_T *list, std::string fileName, std::string what, - std::string sa, std::string sb, std::string sc, std::string sd); -void extrude(List_T *list, std::string fileName, std::string what, std::string tx, - std::string ty, std::string tz); -void protude(List_T *list, std::string fileName, std::string what, - std::string ax, std::string ay, std::string az, - std::string px, std::string py, std::string pz, std::string angle); -void split_edge(int edge_id, List_T *vertices, std::string fileName); +void coherence(const std::string &fileName); +void delet(List_T *list, const std::string &fileName, const std::string &what); +void add_infile(const std::string &text, const std::string &fileName, + bool deleted_something=false); +void add_charlength(List_T *list, const std::string &fileName, const std::string &lc); +void add_recosurf(List_T *list, const std::string &fileName); +void add_trsfline(std::vector<int> &l, const std::string &fileName, + const std::string &type, const std::string &typearg, + const std::string &pts); +void add_trsfsurf(std::vector<int> &l, const std::string &fileName, + const std::string &dir); +void add_trsfvol(std::vector<int> &l, const std::string &fileName); +void add_embedded(const std::string &what, std::vector<int> &l, + const std::string &fileName); +void add_param(const std::string &par, const std::string &value, + const std::string &label, const std::string &path, + const std::string &fileName); +void add_point(const std::string &fileName, const std::string &x, + const std::string &y, const std::string &z, const std::string &lc); +void add_multline(const std::string &type, std::vector<int> &p, + const std::string &fileName); +void add_circ(int p1, int p2, int p3, const std::string &fileName); +void add_ell(int p1, int p2, int p3, int p4, const std::string &fileName); +void add_field_option(int field_id, const std::string &option_name, + const std::string &option_value, const std::string &fileName); +void add_field(int field_id, const std::string &type_name, + const std::string &fileName); +void delete_field(int field_id, const std::string &fileName); +void set_background_field(int field_id,const std::string &fileName); +void add_lineloop(List_T *list, const std::string &fileName, int *numloop); +void add_surf(const std::string &type, List_T *list, const std::string &fileName); +void add_surfloop(List_T *list, const std::string &fileName, int *numvol); +void add_vol(List_T *list, const std::string &fileName); +void add_physical(const std::string &type, List_T *list, const std::string &fileName, + const std::string &name, int forceTag); +void add_compound(const std::string &type, List_T *list, const std::string &fileName); +void translate(int add, List_T *list, const std::string &fileName, + const std::string &what, const std::string &tx, const std::string &ty, + const std::string &tz); +void rotate(int add, List_T *list, const std::string &fileName, + const std::string &what, const std::string &ax, const std::string &ay, + const std::string &az, const std::string &px, const std::string &py, + const std::string &pz, + const std::string &angle); +void dilate(int add, List_T *list, const std::string &fileName, + const std::string &what, const std::string &dx, const std::string &dy, + const std::string &dz, const std::string &df); +void symmetry(int add, List_T *list, const std::string &fileName, + const std::string &what, const std::string &sa, const std::string &sb, + const std::string &sc, const std::string &sd); +void extrude(List_T *list, const std::string &fileName, const std::string &what, + const std::string &tx, + const std::string &ty, const std::string &tz); +void protude(List_T *list, const std::string &fileName, const std::string &what, + const std::string &ax, const std::string &ay, const std::string &az, + const std::string &px, const std::string &py, const std::string &pz, + const std::string &angle); +void split_edge(int edge_id, List_T *vertices, const std::string &fileName); #endif diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 83c73067e0952a92d10bb75f2ee2f394e9055f2c..27b6826e8bfe677623fcd93e395db23378aa8758 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -5996,7 +5996,7 @@ yyreduce: yymsg(0, "Physical point %d already exists", num); } else if(!p && op > 0){ - yymsg(0, "Physical point %d does not exists", num); + yymsg(0, "Physical point %d does not exist", num); } else if(op == 0){ List_T *temp = ListOfDouble2ListOfInt((yyvsp[-1].l)); @@ -6311,7 +6311,7 @@ yyreduce: yymsg(0, "Physical line %d already exists", num); } else if(!p && op > 0){ - yymsg(0, "Physical line %d does not exists", num); + yymsg(0, "Physical line %d does not exist", num); } else if(op == 0){ List_T *temp = ListOfDouble2ListOfInt((yyvsp[-1].l)); @@ -6582,7 +6582,7 @@ yyreduce: yymsg(0, "Physical surface %d already exists", num); } else if(!p && op > 0){ - yymsg(0, "Physical surface %d does not exists", num); + yymsg(0, "Physical surface %d does not exist", num); } else if(op == 0){ List_T *temp = ListOfDouble2ListOfInt((yyvsp[-1].l)); @@ -6681,7 +6681,7 @@ yyreduce: yymsg(0, "Physical volume %d already exists", num); } else if(!p && op > 0){ - yymsg(0, "Physical volume %d does not exists", num); + yymsg(0, "Physical volume %d does not exist", num); } else if(op == 0){ List_T *temp = ListOfDouble2ListOfInt((yyvsp[-1].l)); diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index aba5085548e4e9c8503d265f586a868025e872ed..325d03e657c140c5a5dabea8d69b7a71b7987431 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1450,7 +1450,7 @@ Shape : yymsg(0, "Physical point %d already exists", num); } else if(!p && op > 0){ - yymsg(0, "Physical point %d does not exists", num); + yymsg(0, "Physical point %d does not exist", num); } else if(op == 0){ List_T *temp = ListOfDouble2ListOfInt($7); @@ -1721,7 +1721,7 @@ Shape : yymsg(0, "Physical line %d already exists", num); } else if(!p && op > 0){ - yymsg(0, "Physical line %d does not exists", num); + yymsg(0, "Physical line %d does not exist", num); } else if(op == 0){ List_T *temp = ListOfDouble2ListOfInt($7); @@ -1952,7 +1952,7 @@ Shape : yymsg(0, "Physical surface %d already exists", num); } else if(!p && op > 0){ - yymsg(0, "Physical surface %d does not exists", num); + yymsg(0, "Physical surface %d does not exist", num); } else if(op == 0){ List_T *temp = ListOfDouble2ListOfInt($7); @@ -2039,7 +2039,7 @@ Shape : yymsg(0, "Physical volume %d already exists", num); } else if(!p && op > 0){ - yymsg(0, "Physical volume %d does not exists", num); + yymsg(0, "Physical volume %d does not exist", num); } else if(op == 0){ List_T *temp = ListOfDouble2ListOfInt($7);