diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 6d89268bda5d04093374d8b02e6e45a245d20dfd..8d50d01b8e0b2e9567bddb58818ab57a931b9729 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.213 2004-04-08 22:14:28 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.214 2004-04-18 21:47:29 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -2430,6 +2430,22 @@ void mesh_3d_cb(CALLBACK_ARGS) Msg(STATUS3N, "Ready"); } +void mesh_degree_cb(CALLBACK_ARGS) +{ + switch ((long int)data) { + case 2: + Degre2(THEM->status); + break; + case 1: + default: + Degre1(); + break; + } + + Draw(); + Msg(STATUS3N, "Ready"); +} + void mesh_define_length_cb(CALLBACK_ARGS) { Vertex *v; diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h index bfb951208255b3f258bbfdee0e54066a61e785d1..6156b966a006b196e3473cb9b1d610124fccb332 100644 --- a/Fltk/Callbacks.h +++ b/Fltk/Callbacks.h @@ -252,6 +252,7 @@ void mesh_define_cb(CALLBACK_ARGS) ; void mesh_1d_cb(CALLBACK_ARGS) ; void mesh_2d_cb(CALLBACK_ARGS) ; void mesh_3d_cb(CALLBACK_ARGS) ; +void mesh_degree_cb(CALLBACK_ARGS) ; void mesh_define_length_cb (CALLBACK_ARGS) ; void mesh_define_recombine_cb (CALLBACK_ARGS) ; void mesh_define_transfinite_cb (CALLBACK_ARGS) ; diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 768c1d13ebc24a3297f33b14c58d62eb53727055..16c147a205dc83b71ea43859ccccce36ac9d1335 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.282 2004-04-18 14:53:17 geuzaine Exp $ +// $Id: GUI.cpp,v 1.283 2004-04-18 21:47:29 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -332,9 +332,9 @@ Context_Item menu_mesh[] = { { "1D", (Fl_Callback *)mesh_1d_cb } , { "2D", (Fl_Callback *)mesh_2d_cb } , { "3D", (Fl_Callback *)mesh_3d_cb } , + { "First order", (Fl_Callback *)mesh_degree_cb, (void*)1 } , + { "Second order", (Fl_Callback *)mesh_degree_cb, (void*)2 } , { "Save", (Fl_Callback *)mesh_save_cb } , - // this one is confusing for beginners -> "Save (No Physical)" ?? - //{ "Save All", (Fl_Callback *)mesh_save_all_cb } , { NULL } }; Context_Item menu_mesh_define[] = { @@ -2463,7 +2463,7 @@ void GUI::create_statistics_window() } int width = 26 * fontsize; - int height = 5 * WB + 17 * BH; + int height = 5 * WB + 18 * BH; stat_window = new Fl_Window(width, height, "Statistics"); stat_window->box(WINDOW_BOX); @@ -2483,26 +2483,27 @@ void GUI::create_statistics_window() stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 1 * BH, IW, BH, "Nodes on Lines"); stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 2 * BH, IW, BH, "Nodes on surfaces"); stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 3 * BH, IW, BH, "Nodes in volumes"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Triangles"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Quadrangles"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 6 * BH, IW, BH, "Tetrahedra"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 7 * BH, IW, BH, "Hexahedra"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 8 * BH, IW, BH, "Prisms"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 9 * BH, IW, BH, "Pyramids"); - - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 10 * BH, IW, BH, "Time for 1D mesh"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 11 * BH, IW, BH, "Time for 2D mesh"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 12 * BH, IW, BH, "Time for 3D mesh"); - - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 13 * BH, IW, BH, "Gamma factor"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 14 * BH, IW, BH, "Eta factor"); - stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 15 * BH, IW, BH, "Rho factor"); - - Fl_Button *b0 = new Fl_Button(width - BB - 2 * WB, 2 * WB + 13 * BH, BB, BH, "Graph"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Second order nodes"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Triangles"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 6 * BH, IW, BH, "Quadrangles"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 7 * BH, IW, BH, "Tetrahedra"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 8 * BH, IW, BH, "Hexahedra"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 9 * BH, IW, BH, "Prisms"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 10 * BH, IW, BH, "Pyramids"); + + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 11 * BH, IW, BH, "Time for 1D mesh"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 12 * BH, IW, BH, "Time for 2D mesh"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 13 * BH, IW, BH, "Time for 3D mesh"); + + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 14 * BH, IW, BH, "Gamma factor"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 15 * BH, IW, BH, "Eta factor"); + stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 16 * BH, IW, BH, "Rho factor"); + + Fl_Button *b0 = new Fl_Button(width - BB - 2 * WB, 2 * WB + 14 * BH, BB, BH, "Graph"); b0->callback(statistics_histogram_cb, (void *)0); - Fl_Button *b1 = new Fl_Button(width - BB - 2 * WB, 2 * WB + 14 * BH, BB, BH, "Graph"); + Fl_Button *b1 = new Fl_Button(width - BB - 2 * WB, 2 * WB + 15 * BH, BB, BH, "Graph"); b1->callback(statistics_histogram_cb, (void *)1); - Fl_Button *b2 = new Fl_Button(width - BB - 2 * WB, 2 * WB + 15 * BH, BB, BH, "Graph"); + Fl_Button *b2 = new Fl_Button(width - BB - 2 * WB, 2 * WB + 16 * BH, BB, BH, "Graph"); b2->callback(statistics_histogram_cb, (void *)2); o->end(); @@ -2577,6 +2578,9 @@ void GUI::set_statistics() sprintf(label[num], "%g", s[6]); stat_value[num]->value(label[num]); num++; + sprintf(label[num], "%g", s[16]); + stat_value[num]->value(label[num]); + num++; sprintf(label[num], "%g", s[7] - s[8]); stat_value[num]->value(label[num]); num++; diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 7d4444ab6804978a2469f208d0143f3226562d05..b84c3c8194744a3048c8a797d534fa12120def26 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -1,4 +1,4 @@ -// $Id: Generator.cpp,v 1.50 2004-04-18 03:36:07 geuzaine Exp $ +// $Id: Generator.cpp,v 1.51 2004-04-18 21:47:29 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -89,6 +89,7 @@ void Maillage_Dimension_0(Mesh * M) void Maillage_Dimension_1(Mesh * M) { double t1, t2; + t1 = Cpu(); Tree_Action(M->Curves, Maillage_Curve); t2 = Cpu(); @@ -184,7 +185,6 @@ void Init_Mesh(Mesh * M) M->MaxSimplexNum = 0; ExitExtrude(); - Degre1(); Tree_Action(M->Vertices, Free_Vertex); Tree_Delete(M->Vertices); @@ -266,6 +266,8 @@ void mai3d(Mesh * M, int Asked) CTX.threads_lock = 1; + Degre1(); + // 1D mesh if((Asked > oldstatus && Asked > 0 && oldstatus < 1) || @@ -315,13 +317,8 @@ void mai3d(Mesh * M, int Asked) // Second order elements - if(M->status && CTX.mesh.order == 2){ - Msg(STATUS2, "Mesh second order..."); - t1 = Cpu(); + if(M->status && CTX.mesh.order == 2) Degre2(M->status); - t2 = Cpu(); - Msg(STATUS2, "Mesh second order complete (%g s)", t2 - t1); - } CTX.threads_lock = 0; CTX.mesh.changed = 1; diff --git a/Mesh/SecondOrder.cpp b/Mesh/SecondOrder.cpp index c224b50ffb549801fa5b2535eaf6b38d40614e85..846387595986c560edbe7e4ce02ba6f8519291b7 100644 --- a/Mesh/SecondOrder.cpp +++ b/Mesh/SecondOrder.cpp @@ -1,4 +1,4 @@ -// $Id: SecondOrder.cpp,v 1.20 2004-04-18 17:45:39 geuzaine Exp $ +// $Id: SecondOrder.cpp,v 1.21 2004-04-18 21:47:29 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -128,6 +128,7 @@ static int edges_tetra[6][2] = { {3, 2}, {3, 1} }; + static int edges_quad[4][2] = { {0, 1}, {1, 2}, @@ -268,6 +269,8 @@ void Degre1() Tree_Suppress(THEM->Vertices, v); Free_Vertex(v, NULL); } + + THEM->Statistics[16] = 0; } void Degre2_Curve(void *a, void *b) @@ -310,11 +313,22 @@ void Degre2_Volume(void *a, void *b) void Degre2(int dim) { + Msg(STATUS2, "Mesh second order..."); + double t1 = Cpu(); + Degre1(); + int nb1 = Tree_Nbr(THEM->Vertices); + if(dim >= 1) Tree_Action(THEM->Curves, Degre2_Curve); if(dim >= 2) Tree_Action(THEM->Surfaces, Degre2_Surface); if(dim >= 3) Tree_Action(THEM->Volumes, Degre2_Volume); + + int nb2 = Tree_Nbr(THEM->Vertices); + THEM->Statistics[16] = nb2 - nb1; + + double t2 = Cpu(); + Msg(STATUS2, "Mesh second order complete (%g s)", t2 - t1); }