Skip to content
Snippets Groups Projects
Commit 70811f8d authored by Bastien Gorissen's avatar Bastien Gorissen
Browse files

Add the possibility to set the mesh order from the GUI (from 1 to 5)

May need a slight change to better handle options for meshes of order >2
parent 6ea86d5f
No related branches found
No related tags found
No related merge requests found
...@@ -1710,13 +1710,22 @@ static void mesh_inspect_cb(Fl_Widget *w, void *data) ...@@ -1710,13 +1710,22 @@ static void mesh_inspect_cb(Fl_Widget *w, void *data)
Msg::StatusBar(3, false, ""); Msg::StatusBar(3, false, "");
} }
static void mesh_change_order_cb(Fl_Widget *w, void *data)
{
FlGui::instance()->menu->setContext(menu_mesh_degree, 0);
}
static void mesh_degree_cb(Fl_Widget *w, void *data) static void mesh_degree_cb(Fl_Widget *w, void *data)
{ {
if((long)data == 2) if((long)data == 2)
SetOrderN(GModel::current(), 2, CTX::instance()->mesh.secondOrderLinear, SetOrderN(GModel::current(), 2, CTX::instance()->mesh.secondOrderLinear,
CTX::instance()->mesh.secondOrderIncomplete); CTX::instance()->mesh.secondOrderIncomplete);
else else if ((long)data == 1)
SetOrder1(GModel::current()); SetOrder1(GModel::current());
else // For now, use the same options as for second order meshes
SetOrderN(GModel::current(), (long)data, CTX::instance()->mesh.secondOrderLinear,
CTX::instance()->mesh.secondOrderIncomplete);
CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME); CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
drawContext::global()->draw(); drawContext::global()->draw();
Msg::StatusBar(2, false, " "); Msg::StatusBar(2, false, " ");
...@@ -2461,8 +2470,7 @@ contextItem menu_mesh[] = { ...@@ -2461,8 +2470,7 @@ contextItem menu_mesh[] = {
{"1D", (Fl_Callback *)mesh_1d_cb} , {"1D", (Fl_Callback *)mesh_1d_cb} ,
{"2D", (Fl_Callback *)mesh_2d_cb} , {"2D", (Fl_Callback *)mesh_2d_cb} ,
{"3D", (Fl_Callback *)mesh_3d_cb} , {"3D", (Fl_Callback *)mesh_3d_cb} ,
{"First order", (Fl_Callback *)mesh_degree_cb, (void*)1 } , {"Set order", (Fl_Callback *)mesh_change_order_cb} ,
{"Second order", (Fl_Callback *)mesh_degree_cb, (void*)2 } ,
{"Refine by splitting", (Fl_Callback *)mesh_refine_cb} , {"Refine by splitting", (Fl_Callback *)mesh_refine_cb} ,
{"Optimize", (Fl_Callback *)mesh_optimize_cb} , {"Optimize", (Fl_Callback *)mesh_optimize_cb} ,
#if defined(HAVE_NETGEN) #if defined(HAVE_NETGEN)
...@@ -2502,6 +2510,15 @@ contextItem menu_mesh[] = { ...@@ -2502,6 +2510,15 @@ contextItem menu_mesh[] = {
{"Volumes", (Fl_Callback *)mesh_delete_parts_cb, (void*)"volumes"} , {"Volumes", (Fl_Callback *)mesh_delete_parts_cb, (void*)"volumes"} ,
{""} {""}
}; };
contextItem menu_mesh_degree[] = {
{"1Mesh> Set order"} ,
{"1", (Fl_Callback *)mesh_degree_cb, (void*)1},
{"2", (Fl_Callback *)mesh_degree_cb, (void*)2},
{"3", (Fl_Callback *)mesh_degree_cb, (void*)3},
{"4", (Fl_Callback *)mesh_degree_cb, (void*)4},
{"5", (Fl_Callback *)mesh_degree_cb, (void*)5},
{""}
};
contextItem menu_solver[] = { contextItem menu_solver[] = {
{"2Solver"} , {"2Solver"} ,
......
...@@ -49,7 +49,8 @@ extern contextItem menu_mesh[]; ...@@ -49,7 +49,8 @@ extern contextItem menu_mesh[];
extern contextItem menu_mesh_edit[]; extern contextItem menu_mesh_edit[];
extern contextItem menu_mesh_delete[]; extern contextItem menu_mesh_delete[];
extern contextItem menu_mesh_define[]; extern contextItem menu_mesh_define[];
extern contextItem menu_mesh_define_transfinite[]; extern contextItem menu_mesh_define_transfinite[];
extern contextItem menu_mesh_degree[];
extern contextItem menu_solver[]; extern contextItem menu_solver[];
extern contextItem menu_post[]; extern contextItem menu_post[];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment