diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index f3270e342236fdb49ff7a6973feccfd54f9cc930..61c3830bc1efcf9dd68793155bce8e10ba354f34 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -293,6 +293,13 @@ void Get_Options(int argc, char *argv[]) else Msg::Fatal("Missing file name"); } + else if(!strcmp(argv[i] + 1, "nw")) { + i++; + if(argv[i] != NULL) + CTX.num_windows = atoi(argv[i++]); + else + Msg::Fatal("Missing number"); + } else if(!strcmp(argv[i] + 1, "convert")) { i++; CTX.batch = 1; diff --git a/Common/Context.h b/Common/Context.h index b797d1f828fe466fc5139789c2b2ebede038fadd..78a19b27bb4d829eb07ba20cc91ea3200a44e194 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -40,7 +40,8 @@ class Context_T { int session_save, options_save; // save session/option file on exit int confirm_overwrite; // confirm overwrite when file->save as const char *display; // forced display host:0.0 under X11 - int terminal; // show we print to the terminal console? + int terminal; // show we print to the terminal console? + int num_windows; // number of graphical windows to create const char *editor; // text editor command (with included '%s') const char *web_browser; // web browser command (with included '%s') char home_dir[256]; // the home directory @@ -119,6 +120,8 @@ class Context_T { int printing; // dynamic: equal to 1 while gmsh is printing int hide_unselected; // hide all unselected entities int draw_all_models; + int use_transform; // transform display coordinates? (0=no, 1=scale, 2=...) + double transform[3][3], offset[3]; // transformation matrix for geo/mesh drawing // these are used as temp vars until the GUI is ready double tmp_r[3]; // current Euler angles (in degrees!) diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 2c6d8440957512d8bd6eff7215ae6ec30fdbb881..a15aef284afed00c97f0a3513951424d9751dff4 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -673,6 +673,12 @@ StringXNumber GeneralOptions_Number[] = { { F|O, "NoPopup" , opt_general_nopopup , 0. , "Disable interactive dialog windows in scripts (and use default values instead)" }, + { F, "OffsetX" , opt_general_offset0 , 0. , + "Model diplay offset along X-axis (in model coordinates)" }, + { F, "OffsetY" , opt_general_offset1 , 0. , + "Model diplay offset along Y-axis (in model coordinates)" }, + { F, "OffsetZ" , opt_general_offset2 , 0. , + "Model diplay offset along Z-axis (in model coordinates)" }, { F|S, "OptionsPositionX" , opt_general_option_position0 , 650. , "Horizontal position (in pixels) of the upper left corner of the option window" }, { F|S, "OptionsPositionY" , opt_general_option_position1 , 150. , @@ -767,6 +773,26 @@ StringXNumber GeneralOptions_Number[] = { "Third trackball quaternion component (used if General.Trackball=1)" }, { F, "TrackballQuaternion3" , opt_general_quaternion3 , 1.0 , "Fourth trackball quaternion component (used if General.Trackball=1)" }, + { F, "Transform" , opt_general_transform , 0. , + "Transform model display coordinates (0=no, 1=scale)" }, + { F, "TransformXX" , opt_general_transform00 , 1. , + "Element (1,1) of the 3x3 model display transformation matrix" }, + { F, "TransformXY" , opt_general_transform01 , 0. , + "Element (1,2) of the 3x3 model display transformation matrix" }, + { F, "TransformXZ" , opt_general_transform02 , 0. , + "Element (1,3) of the 3x3 model display transformation matrix" }, + { F, "TransformYX" , opt_general_transform10 , 0. , + "Element (2,1) of the 3x3 model display transformation matrix" }, + { F, "TransformYY" , opt_general_transform11 , 1. , + "Element (2,2) of the 3x3 model display transformation matrix" }, + { F, "TransformYZ" , opt_general_transform12 , 0. , + "Element (2,3) of the 3x3 model display transformation matrix" }, + { F, "TransformZX" , opt_general_transform20 , 0. , + "Element (3,1) of the 3x3 model display transformation matrix" }, + { F, "TransformZY" , opt_general_transform21 , 0. , + "Element (3,2) of the 3x3 model display transformation matrix" }, + { F, "TransformZZ" , opt_general_transform22 , 1. , + "Element (3,3) of the 3x3 model display transformation matrix" }, { F, "TranslationX" , opt_general_translation0 , 0.0 , "X-axis translation (in model units)" }, { F, "TranslationY" , opt_general_translation1 , 0.0 , @@ -1399,23 +1425,23 @@ StringXNumber ViewOptions_Number[] = { "Tensor Visualization Type" }, { F, "TimeStep" , opt_view_timestep , 0. , "Current time step displayed" }, - { F, "Transform11" , opt_view_transform00 , 1. , + { F, "TransformXX" , opt_view_transform00 , 1. , "Element (1,1) of the 3x3 coordinate transformation matrix" }, - { F, "Transform12" , opt_view_transform01 , 0. , + { F, "TransformXY" , opt_view_transform01 , 0. , "Element (1,2) of the 3x3 coordinate transformation matrix" }, - { F, "Transform13" , opt_view_transform02 , 0. , + { F, "TransformXZ" , opt_view_transform02 , 0. , "Element (1,3) of the 3x3 coordinate transformation matrix" }, - { F, "Transform21" , opt_view_transform10 , 0. , + { F, "TransformYX" , opt_view_transform10 , 0. , "Element (2,1) of the 3x3 coordinate transformation matrix" }, - { F, "Transform22" , opt_view_transform11 , 1. , + { F, "TransformYY" , opt_view_transform11 , 1. , "Element (2,2) of the 3x3 coordinate transformation matrix" }, - { F, "Transform23" , opt_view_transform12 , 0. , + { F, "TransformYZ" , opt_view_transform12 , 0. , "Element (2,3) of the 3x3 coordinate transformation matrix" }, - { F, "Transform31" , opt_view_transform20 , 0. , + { F, "TransformZX" , opt_view_transform20 , 0. , "Element (3,1) of the 3x3 coordinate transformation matrix" }, - { F, "Transform32" , opt_view_transform21 , 0. , + { F, "TransformZY" , opt_view_transform21 , 0. , "Element (3,2) of the 3x3 coordinate transformation matrix" }, - { F, "Transform33" , opt_view_transform22 , 1. , + { F, "TransformZZ" , opt_view_transform22 , 1. , "Element (3,3) of the 3x3 coordinate transformation matrix" }, { F, "Type" , opt_view_type , 1 , "Type of plot (1=3D, 2=2D space, 3=2D time)" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 538874c631b4c15c8cbd4702885360bd0bb3536a..7e55ecfb626eec4c0aae36b3d6431749e7c8f6dd 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -494,6 +494,7 @@ void Init_Options(int num) #endif CTX.forced_bbox = 0; CTX.hide_unselected = 0; + CTX.num_windows = 1; } void ReInit_Options(int num) @@ -3910,8 +3911,8 @@ double opt_general_light00(OPT_ARGS_NUM) if(GUI::available() && (action & GMSH_GUI)){ GUI::instance()->options->general.value[2]->value(CTX.light_position[0][0]); GUI::instance()->options->general.sphere->setValue(CTX.light_position[0][0], - CTX.light_position[0][1], - CTX.light_position[0][2]); + CTX.light_position[0][1], + CTX.light_position[0][2]); } #endif return CTX.light_position[0][0]; @@ -3925,8 +3926,8 @@ double opt_general_light01(OPT_ARGS_NUM) if(GUI::available() && (action & GMSH_GUI)){ GUI::instance()->options->general.value[3]->value(CTX.light_position[0][1]); GUI::instance()->options->general.sphere->setValue(CTX.light_position[0][0], - CTX.light_position[0][1], - CTX.light_position[0][2]); + CTX.light_position[0][1], + CTX.light_position[0][2]); } #endif return CTX.light_position[0][1]; @@ -3940,8 +3941,8 @@ double opt_general_light02(OPT_ARGS_NUM) if(GUI::available() && (action & GMSH_GUI)){ GUI::instance()->options->general.value[4]->value(CTX.light_position[0][2]); GUI::instance()->options->general.sphere->setValue(CTX.light_position[0][0], - CTX.light_position[0][1], - CTX.light_position[0][2]); + CTX.light_position[0][1], + CTX.light_position[0][2]); } #endif return CTX.light_position[0][2]; @@ -4133,6 +4134,127 @@ double opt_general_light53(OPT_ARGS_NUM) return CTX.light_position[5][3]; } +double opt_general_transform(OPT_ARGS_NUM) +{ + if(action & GMSH_SET){ + CTX.use_transform = (int)val; + if(CTX.use_transform < 0 || CTX.use_transform > 1) CTX.use_transform = 0; + } +#if defined(HAVE_FLTK) + if(GUI::available()){ + if(action & GMSH_GUI) + GUI::instance()->options->general.choice[6]->value(CTX.use_transform); + if(action & GMSH_SET){ + if(CTX.use_transform == 1){ + drawTransform *tr = new drawTransformScaled(CTX.transform, CTX.offset); + GUI::instance()->graph[0]->gl->getDrawContext()->setTransform(tr); + } + else{ + drawTransform *tr = GUI::instance()->graph[0]->gl->getDrawContext()->getTransform(); + GUI::instance()->graph[0]->gl->getDrawContext()->setTransform(0); + if(tr) delete tr; + } + } + GUI::instance()->options->activate("general_transform"); + } +#endif + return CTX.use_transform; +} + +static double _opt_general_transform(OPT_ARGS_NUM, int ii, int jj, int nn) +{ + if(action & GMSH_SET) + CTX.transform[ii][jj] = val; +#if defined(HAVE_FLTK) + if(GUI::available()){ + if(action & GMSH_GUI) + GUI::instance()->options->general.value[nn]->value(CTX.transform[ii][jj]); + if(action & GMSH_SET){ + drawTransform *tr = GUI::instance()->graph[0]->gl->getDrawContext()->getTransform(); + if(tr) tr->setMatrix(CTX.transform, CTX.offset); + } + } +#endif + return CTX.transform[ii][jj]; +} + +double opt_general_transform00(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 0, 0, 28); +} + +double opt_general_transform01(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 0, 1, 29); +} + +double opt_general_transform02(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 0, 2, 30); +} + +double opt_general_transform10(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 1, 0, 32); +} + +double opt_general_transform11(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 1, 1, 33); +} + +double opt_general_transform12(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 1, 2, 34); +} + +double opt_general_transform20(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 2, 0, 36); +} + +double opt_general_transform21(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 2, 1, 37); +} + +double opt_general_transform22(OPT_ARGS_NUM) +{ + return _opt_general_transform(num, action, val, 2, 2, 38); +} + +static double _opt_general_offset(OPT_ARGS_NUM, int ii, int nn) +{ + if(action & GMSH_SET) + CTX.offset[ii] = val; +#if defined(HAVE_FLTK) + if(GUI::available()){ + if(action & GMSH_GUI) + GUI::instance()->options->general.value[nn]->value(CTX.offset[ii]); + if(action & GMSH_SET){ + drawTransform *tr = GUI::instance()->graph[0]->gl->getDrawContext()->getTransform(); + if(tr) tr->setMatrix(CTX.transform, CTX.offset); + } + } +#endif + return CTX.offset[ii]; +} + +double opt_general_offset0(OPT_ARGS_NUM) +{ + return _opt_general_offset(num, action, val, 0, 31); +} + +double opt_general_offset1(OPT_ARGS_NUM) +{ + return _opt_general_offset(num, action, val, 1, 35); +} + +double opt_general_offset2(OPT_ARGS_NUM) +{ + return _opt_general_offset(num, action, val, 2, 39); +} + double opt_geometry_auto_coherence(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -6620,6 +6742,7 @@ double opt_view_adapt_visualization_grid(OPT_ARGS_NUM) #if defined(HAVE_FLTK) if(_gui_action_valid(action, num)) { GUI::instance()->options->view.butt[0]->value(opt->AdaptVisualizationGrid); + GUI::instance()->options->activate("view_adaptive"); } #endif return opt->AdaptVisualizationGrid; @@ -7919,7 +8042,7 @@ double opt_view_use_gen_raise(OPT_ARGS_NUM) #if defined(HAVE_FLTK) if(_gui_action_valid(action, num)){ GUI::instance()->options->view.butt[6]->value(opt->UseGenRaise); - GUI::instance()->options->activate("general_transform"); + GUI::instance()->options->activate("view_general_transform"); } #endif return opt->UseGenRaise; diff --git a/Common/Options.h b/Common/Options.h index 7d1a8dcadc84177ea03c3797f416398df6b51f64..54e972cafd69090ec02ba17857422dba2f6178f3 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -381,6 +381,19 @@ double opt_general_light50(OPT_ARGS_NUM); double opt_general_light51(OPT_ARGS_NUM); double opt_general_light52(OPT_ARGS_NUM); double opt_general_light53(OPT_ARGS_NUM); +double opt_general_transform(OPT_ARGS_NUM); +double opt_general_transform00(OPT_ARGS_NUM); +double opt_general_transform01(OPT_ARGS_NUM); +double opt_general_transform02(OPT_ARGS_NUM); +double opt_general_transform10(OPT_ARGS_NUM); +double opt_general_transform11(OPT_ARGS_NUM); +double opt_general_transform12(OPT_ARGS_NUM); +double opt_general_transform20(OPT_ARGS_NUM); +double opt_general_transform21(OPT_ARGS_NUM); +double opt_general_transform22(OPT_ARGS_NUM); +double opt_general_offset0(OPT_ARGS_NUM); +double opt_general_offset1(OPT_ARGS_NUM); +double opt_general_offset2(OPT_ARGS_NUM); double opt_geometry_auto_coherence(OPT_ARGS_NUM); double opt_geometry_highlight_orphans(OPT_ARGS_NUM); double opt_geometry_tolerance(OPT_ARGS_NUM); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index fb4a15eb486f07df36a08b0373c59dcf881aa34e..9712186c62b03df4c822735547b76d7c5641f40f 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -124,12 +124,15 @@ GUI::GUI(int argc, char **argv) // e.g. directly loop through time steps with the keyboard) graph[0]->gl->take_focus(); - // test: create another graphic window with a coordinate transform - //graph.push_back(new graphicWindow(_fontsize)); - //drawTransform *tr = new drawTransformScaled(2,0,0, 0,1,0, 0,0,1); - //graph.back()->gl->getDrawContext()->setTransform(tr); - //graph.back()->win->size(300, 300); - //graph.back()->win->show(); + // create additional graphic windows + for(int i = 1; i < CTX.num_windows; i++){ + graph.push_back(new graphicWindow(_fontsize)); + //double mat[3][3] = {10,0,0,0,1,0,0,0,1}; + //drawTransform *tr = new drawTransformScaled(mat); + //graph.back()->gl->getDrawContext()->setTransform(tr); + graph.back()->win->size(400, 400); + graph.back()->win->show(); + } options = new optionWindow(_fontsize); fields = new fieldWindow(_fontsize); diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 060aefa4dc75639ed2365770172ace52228e79c7..77dd3013d4b8cdca4cdbf7ad058ab7cac1453020 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -277,6 +277,18 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) opt_general_axes_zmax(0, GMSH_SET, o->general.value[25]->value()); opt_general_small_axes_position0(0, GMSH_SET, o->general.value[26]->value()); opt_general_small_axes_position1(0, GMSH_SET, o->general.value[27]->value()); + opt_general_offset0(0, GMSH_SET, o->general.value[31]->value()); + opt_general_offset1(0, GMSH_SET, o->general.value[35]->value()); + opt_general_offset2(0, GMSH_SET, o->general.value[39]->value()); + opt_general_transform00(0, GMSH_SET, o->general.value[28]->value()); + opt_general_transform01(0, GMSH_SET, o->general.value[29]->value()); + opt_general_transform02(0, GMSH_SET, o->general.value[30]->value()); + opt_general_transform10(0, GMSH_SET, o->general.value[32]->value()); + opt_general_transform11(0, GMSH_SET, o->general.value[33]->value()); + opt_general_transform12(0, GMSH_SET, o->general.value[34]->value()); + opt_general_transform20(0, GMSH_SET, o->general.value[36]->value()); + opt_general_transform21(0, GMSH_SET, o->general.value[37]->value()); + opt_general_transform22(0, GMSH_SET, o->general.value[38]->value()); opt_general_default_filename(0, GMSH_SET, o->general.input[0]->value()); opt_general_editor(0, GMSH_SET, o->general.input[1]->value()); @@ -293,6 +305,7 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) opt_general_orthographic(0, GMSH_SET, !o->general.choice[2]->value()); opt_general_axes(0, GMSH_SET, o->general.choice[4]->value()); opt_general_background_gradient(0, GMSH_SET, o->general.choice[5]->value()); + opt_general_transform(0, GMSH_SET, o->general.choice[6]->value()); if(CTX.fast_redraw) CTX.post.draw = CTX.mesh.draw = 0; @@ -1362,33 +1375,44 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize) { Fl_Group *o = new Fl_Group (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Output"); + + general.input[1] = new Fl_Input + (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Text editor command"); + general.input[1]->align(FL_ALIGN_RIGHT); + general.input[1]->callback(general_options_ok_cb); + + general.input[2] = new Fl_Input + (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Web browser command"); + general.input[2]->align(FL_ALIGN_RIGHT); + general.input[2]->callback(general_options_ok_cb); + general.butt[7] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Print messages on terminal"); + (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Print messages on terminal"); general.butt[7]->type(FL_TOGGLE_BUTTON); general.butt[7]->callback(general_options_ok_cb); general.butt[8] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Save session information on exit"); + (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Save session information on exit"); general.butt[8]->type(FL_TOGGLE_BUTTON); general.butt[8]->callback(general_options_ok_cb); general.butt[9] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW/2-WB, BH, "Save options on exit"); + (L + 2 * WB, 2 * WB + 5 * BH, BW/2-WB, BH, "Save options on exit"); general.butt[9]->type(FL_TOGGLE_BUTTON); general.butt[9]->callback(general_options_ok_cb); Fl_Button *b0 = new Fl_Button - (L + width / 2, 2 * WB + 3 * BH, (int)(1.75*BB), BH, "Restore default options"); + (L + width / 2, 2 * WB + 5 * BH, (int)(1.75*BB), BH, "Restore default options"); b0->callback(options_restore_defaults_cb); general.butt[14] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Ask confirmation before overwriting files"); general.butt[14]->type(FL_TOGGLE_BUTTON); general.butt[14]->callback(general_options_ok_cb); general.value[5] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Message verbosity"); + (L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Message verbosity"); general.value[5]->minimum(0); general.value[5]->maximum(10); general.value[5]->step(1); @@ -1396,7 +1420,7 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize) general.value[5]->callback(general_options_ok_cb); general.input[0] = new Fl_Input - (L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Default file name"); + (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Default file name"); general.input[0]->align(FL_ALIGN_RIGHT); general.input[0]->callback(general_options_ok_cb); @@ -1404,17 +1428,56 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize) } { Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Helpers"); + (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfo"); + o->hide(); + + static Fl_Menu_Item menu_transform[] = { + {"None", 0, 0, 0}, + {"Scaling", 0, 0, 0}, + {0} + }; + general.choice[6] = new Fl_Choice + (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Model coordinate transform"); + general.choice[6]->menu(menu_transform); + general.choice[6]->align(FL_ALIGN_RIGHT); + general.choice[6]->callback(general_options_ok_cb, (void*)"general_transform"); + + int ss = 2 * IW / 3 / 3 + 4; + general.value[28] = new Fl_Value_Input + (L + 2 * WB , 2 * WB + 2 * BH, ss, BH); + general.value[29] = new Fl_Value_Input + (L + 2 * WB + ss , 2 * WB + 2 * BH, ss, BH); + general.value[30] = new Fl_Value_Input + (L + 2 * WB + 2*ss, 2 * WB + 2 * BH, ss, BH, " X"); + general.value[31] = new Fl_Value_Input + (L + 2 * WB + IW , 2 * WB + 2 * BH, 7*IW/10, BH); - general.input[1] = new Fl_Input - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Text editor command"); - general.input[1]->align(FL_ALIGN_RIGHT); - general.input[1]->callback(general_options_ok_cb); + general.value[32] = new Fl_Value_Input + (L + 2 * WB , 2 * WB + 3 * BH, ss, BH); + general.value[33] = new Fl_Value_Input + (L + 2 * WB + ss , 2 * WB + 3 * BH, ss, BH); + general.value[34] = new Fl_Value_Input + (L + 2 * WB + 2*ss, 2 * WB + 3 * BH, ss, BH, " Y +"); + general.value[35] = new Fl_Value_Input + (L + 2 * WB + IW , 2 * WB + 3 * BH, 7*IW/10, BH); - general.input[2] = new Fl_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Web browser command"); - general.input[2]->align(FL_ALIGN_RIGHT); - general.input[2]->callback(general_options_ok_cb); + general.value[36] = new Fl_Value_Input + (L + 2 * WB , 2 * WB + 4 * BH, ss, BH); + general.value[37] = new Fl_Value_Input + (L + 2 * WB + ss , 2 * WB + 4 * BH, ss, BH); + general.value[38] = new Fl_Value_Input + (L + 2 * WB + 2*ss, 2 * WB + 4 * BH, ss, BH, " Z"); + general.value[39] = new Fl_Value_Input + (L + 2 * WB + IW , 2 * WB + 4 * BH, 7*IW/10, BH); + + for(int i = 28; i <= 39; i++){ + general.value[i]->minimum(-1.); + general.value[i]->maximum(1.); + general.value[i]->step(0.1); + general.value[i]->align(FL_ALIGN_RIGHT); + general.value[i]->when(FL_WHEN_RELEASE); + general.value[i]->callback(general_options_ok_cb); + } o->end(); } @@ -2450,7 +2513,7 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize) view.butt[0] = new Fl_Check_Button (L + 2 * WB, 2 * WB + 9 * BH, BW, BH, "Adapt visualization grid"); view.butt[0]->type(FL_TOGGLE_BUTTON); - view.butt[0]->callback(view_options_ok_cb, (void*)"adapt_vis"); + view.butt[0]->callback(view_options_ok_cb, (void*)"view_adaptive"); view.push[5] = new Fl_Button (L + 2 * WB, 2 * WB + 10 * BH, sw, BH, "-"); @@ -2712,14 +2775,14 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize) } { Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Offset"); + (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfo"); o->hide(); Fl_Box *b = new Fl_Box (FL_NO_BOX, L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Coordinate transformation:"); b->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); - int ss = 2*IW/3/3+4; + int ss = 2 * IW / 3 / 3 + 4; view.value[51] = new Fl_Value_Input (L + 2 * WB , 2 * WB + 2 * BH, ss, BH); view.value[52] = new Fl_Value_Input @@ -2778,7 +2841,7 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize) view.butt[6] = new Fl_Check_Button (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Use general transformation expressions"); view.butt[6]->type(FL_TOGGLE_BUTTON); - view.butt[6]->callback(view_options_ok_cb, (void*)"general_transform"); + view.butt[6]->callback(view_options_ok_cb, (void*)"view_general_transform"); view.choice[11] = new Fl_Choice (L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Data source"); @@ -3105,20 +3168,6 @@ void optionWindow::updateViewGroup(int index) opt_view_adapt_visualization_grid(index, GMSH_GUI, 0); opt_view_max_recursion_level(index, GMSH_GUI, 0); opt_view_target_error(index, GMSH_GUI, 0); - if(data->isAdaptive()){ - view.push[5]->activate(); - view.push[6]->activate(); - view.value[33]->activate(); - view.value[34]->activate(); - view.label[1]->activate(); - } - else{ - view.push[5]->deactivate(); - view.push[6]->deactivate(); - view.value[33]->deactivate(); - view.value[34]->deactivate(); - view.label[1]->deactivate(); - } if(data->getNumPoints() || data->getNumLines()){ ((Fl_Menu_Item*)view.choice[13]->menu())[1].activate(); @@ -3371,6 +3420,16 @@ void optionWindow::activate(const char *what) general.value[27]->deactivate(); } } + else if(!strcmp(what, "general_transform")){ + if(general.choice[6]->value() == 1){ + for(int i = 28; i <= 39; i++) + general.value[i]->activate(); + } + else{ + for(int i = 28; i <= 39; i++) + general.value[i]->deactivate(); + } + } else if(!strcmp(what, "custom_range")){ if(view.choice[7]->value() == 1){ view.value[31]->activate(); @@ -3387,7 +3446,7 @@ void optionWindow::activate(const char *what) view.butt[38]->deactivate(); } } - else if(!strcmp(what, "adapt_vis")){ + else if(!strcmp(what, "view_adaptive")){ if(view.butt[0]->value()){ view.push[5]->activate(); view.push[6]->activate(); @@ -3403,7 +3462,7 @@ void optionWindow::activate(const char *what) view.label[1]->deactivate(); } } - else if(!strcmp(what, "general_transform")){ + else if(!strcmp(what, "view_general_transform")){ if(view.butt[6]->value()){ view.choice[11]->activate(); view.value[2]->activate(); diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h index 2a19797c9d81e2b5a34ced3dc7d0b827d4c029fb..115d8100c7001a05622f9eb688e262acc4d6c019 100644 --- a/Graphics/drawContext.h +++ b/Graphics/drawContext.h @@ -16,20 +16,27 @@ class drawTransform { drawTransform(){} virtual ~drawTransform(){} virtual void transform(double &x, double &y, double &z){} + virtual void setMatrix(double mat[3][3], double tra[3]){} }; class drawTransformScaled : public drawTransform { private: double _mat[3][3]; + double _tra[3]; public: - drawTransformScaled(double a11, double a12, double a13, - double a21, double a22, double a23, - double a31, double a32, double a33) + drawTransformScaled(double mat[3][3], double tra[3]=0) : drawTransform() { - _mat[0][0] = a11; _mat[0][1] = a12; _mat[0][2] = a13; - _mat[1][0] = a21; _mat[1][1] = a22; _mat[1][2] = a23; - _mat[2][0] = a31; _mat[2][1] = a32; _mat[2][2] = a33; + setMatrix(mat, tra); + } + virtual void setMatrix(double mat[3][3], double tra[3]=0) + { + for(int i = 0; i < 3; i++){ + for(int j = 0; j < 3; j++) + _mat[i][j] = mat[i][j]; + if(tra) _tra[i] = tra[i]; + else _tra[i] = 0.; + } } virtual void transform(double &x, double &y, double &z) { @@ -40,6 +47,9 @@ class drawTransformScaled : public drawTransform { y += _mat[1][k] * xyz[k]; z += _mat[2][k] * xyz[k]; } + x += _tra[0]; + y += _tra[1]; + z += _tra[2]; } }; diff --git a/Mesh/Makefile b/Mesh/Makefile index 6f9533a7984f71ee7669c59f8552fe6e599a71a6..15a3dec75ef1ce760b0f7ccb5100a3e07192fa15 100644 --- a/Mesh/Makefile +++ b/Mesh/Makefile @@ -129,13 +129,13 @@ gmshSmoothHighOrder${OBJEXT}: gmshSmoothHighOrder.cpp HighOrder.h \ ../Numeric/GmshMatrix.h meshGFaceDelaunayInsertion.h \ gmshSmoothHighOrder.h ../Numeric/gmshAssembler.h \ ../Numeric/gmshLinearSystem.h ../Numeric/gmshLaplace.h \ - ../Numeric/gmshTermOfFormulation.h ../Numeric/gmshFunction.h \ - ../Common/Gmsh.h ../Common/GmshMessage.h ../Numeric/GmshMatrix.h \ - ../Numeric/gmshElasticity.h ../Numeric/gmshTermOfFormulation.h \ - ../Numeric/GmshMatrix.h ../Numeric/gmshLinearSystemGmm.h \ - ../Numeric/gmshLinearSystem.h ../Common/Context.h ../Geo/CGNSOptions.h \ - ../Mesh/PartitionOptions.h ../Numeric/Numeric.h \ - ../Numeric/NumericEmbedded.h + ../Numeric/gmshTermOfFormulation.h ../Numeric/GmshMatrix.h \ + ../Numeric/gmshFunction.h ../Common/Gmsh.h ../Common/GmshMessage.h \ + ../Numeric/GmshMatrix.h ../Numeric/gmshElasticity.h \ + ../Numeric/gmshTermOfFormulation.h ../Numeric/GmshMatrix.h \ + ../Numeric/gmshLinearSystemGmm.h ../Numeric/gmshLinearSystem.h \ + ../Common/Context.h ../Geo/CGNSOptions.h ../Mesh/PartitionOptions.h \ + ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h meshGEdge${OBJEXT}: meshGEdge.cpp ../Geo/GModel.h ../Geo/GVertex.h \ ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \ diff --git a/Numeric/Makefile b/Numeric/Makefile index 31bdf450f7dfd07ca1f155b452aaa288dec79d02..a1135dba541f9dc0ace51b8b1455322f31541f9d 100644 --- a/Numeric/Makefile +++ b/Numeric/Makefile @@ -72,9 +72,9 @@ gmshTermOfFormulation${OBJEXT}: gmshTermOfFormulation.cpp ../Common/Gmsh.h \ GmshMatrix.h gmshTermOfFormulation.h gmshFunction.h gmshLinearSystem.h \ gmshAssembler.h gmshLaplace${OBJEXT}: gmshLaplace.cpp gmshLaplace.h gmshTermOfFormulation.h \ - ../Numeric/GmshMatrix.h ../Common/GmshMessage.h gmshFunction.h \ - ../Common/Gmsh.h ../Common/GmshMessage.h ../Geo/GModel.h \ - ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ + GmshMatrix.h ../Common/GmshMessage.h gmshFunction.h ../Common/Gmsh.h \ + ../Common/GmshMessage.h ../Geo/GModel.h ../Geo/GVertex.h \ + ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \ ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \ ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \ @@ -84,10 +84,9 @@ gmshLaplace${OBJEXT}: gmshLaplace.cpp gmshLaplace.h gmshTermOfFormulation.h \ ../Geo/SBoundingBox3d.h ../Geo/MElement.h ../Common/GmshDefines.h \ ../Geo/MVertex.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/MEdge.h \ ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h \ - ../Geo/SVector3.h ../Numeric/FunctionSpace.h ../Numeric/GmshMatrix.h \ - GmshMatrix.h + ../Geo/SVector3.h ../Numeric/FunctionSpace.h ../Numeric/GmshMatrix.h gmshElasticity${OBJEXT}: gmshElasticity.cpp gmshElasticity.h \ - gmshTermOfFormulation.h ../Numeric/GmshMatrix.h ../Common/GmshMessage.h \ + gmshTermOfFormulation.h GmshMatrix.h ../Common/GmshMessage.h \ ../Common/Gmsh.h ../Common/GmshMessage.h ../Geo/GModel.h \ ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \ ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/GPoint.h \ @@ -99,8 +98,7 @@ gmshElasticity${OBJEXT}: gmshElasticity.cpp gmshElasticity.h \ ../Geo/SBoundingBox3d.h ../Geo/MElement.h ../Common/GmshDefines.h \ ../Geo/MVertex.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/MEdge.h \ ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h \ - ../Geo/SVector3.h ../Numeric/FunctionSpace.h ../Numeric/GmshMatrix.h \ - GmshMatrix.h + ../Geo/SVector3.h ../Numeric/FunctionSpace.h ../Numeric/GmshMatrix.h EigSolve${OBJEXT}: EigSolve.cpp FunctionSpace${OBJEXT}: FunctionSpace.cpp FunctionSpace.h GmshMatrix.h \ ../Common/GmshMessage.h ../Common/GmshDefines.h diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp index 692a8556d33a2958e1305ad2cb8bd8218ae3c6f7..f7546c15f7237a98eb858f3f521c3c5c17482a04 100644 --- a/Post/PViewDataGModel.cpp +++ b/Post/PViewDataGModel.cpp @@ -110,7 +110,7 @@ void PViewDataGModel::_addInterpolationMatricesForElement(MElement *e) _interpolation[edg].push_back(m); } else{ - Msg::Error("need to add interpol matrices for ele type %d", e->getTypeForMSH()); + Msg::Warning("need to add interpol matrices for ele type %d", e->getTypeForMSH()); } } diff --git a/doc/TODO.txt b/doc/TODO.txt index beb80c1ca4f95ce7e77b8fa358893c52c08bfdfe..96d008d2b494476d04e1dca53e04edce99d720b4 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -1,4 +1,8 @@ -$Id: TODO.txt,v 1.10 2008-11-14 17:55:18 geuzaine Exp $ +$Id: TODO.txt,v 1.11 2008-12-10 14:01:33 geuzaine Exp $ + +******************************************************************** + +move Geo/Gauss* into Numeric/ + cleanup ******************************************************************** diff --git a/doc/texinfo/opt_general.texi b/doc/texinfo/opt_general.texi index 3c299adf8afaf2a4d2246ec292f1253fb971815a..802747c368b80bf8e17de1a76921ff73834a0187 100644 --- a/doc/texinfo/opt_general.texi +++ b/doc/texinfo/opt_general.texi @@ -689,6 +689,21 @@ Disable interactive dialog windows in scripts (and use default values instead)@* Default value: @code{0}@* Saved in: @code{General.OptionsFileName} +@item General.OffsetX +Model diplay offset along X-axis (in model coordinates)@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.OffsetY +Model diplay offset along Y-axis (in model coordinates)@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.OffsetZ +Model diplay offset along Z-axis (in model coordinates)@* +Default value: @code{0}@* +Saved in: @code{-} + @item General.OptionsPositionX Horizontal position (in pixels) of the upper left corner of the option window@* Default value: @code{650}@* @@ -899,6 +914,56 @@ Fourth trackball quaternion component (used if General.Trackball=1)@* Default value: @code{1}@* Saved in: @code{-} +@item General.Transform +Transform model display coordinates (0=no, 1=scale)@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.TransformXX +Element (1,1) of the 3x3 model display transformation matrix@* +Default value: @code{1}@* +Saved in: @code{-} + +@item General.TransformXY +Element (1,2) of the 3x3 model display transformation matrix@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.TransformXZ +Element (1,3) of the 3x3 model display transformation matrix@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.TransformYX +Element (2,1) of the 3x3 model display transformation matrix@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.TransformYY +Element (2,2) of the 3x3 model display transformation matrix@* +Default value: @code{1}@* +Saved in: @code{-} + +@item General.TransformYZ +Element (2,3) of the 3x3 model display transformation matrix@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.TransformZX +Element (3,1) of the 3x3 model display transformation matrix@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.TransformZY +Element (3,2) of the 3x3 model display transformation matrix@* +Default value: @code{0}@* +Saved in: @code{-} + +@item General.TransformZZ +Element (3,3) of the 3x3 model display transformation matrix@* +Default value: @code{1}@* +Saved in: @code{-} + @item General.TranslationX X-axis translation (in model units)@* Default value: @code{0}@* diff --git a/doc/texinfo/opt_view.texi b/doc/texinfo/opt_view.texi index 10156c6ccffc8c83ea62f0d0be76d9d7adec3273..87c9b40ee4261de71128e3eeac457b247c70a042 100644 --- a/doc/texinfo/opt_view.texi +++ b/doc/texinfo/opt_view.texi @@ -594,47 +594,47 @@ Current time step displayed@* Default value: @code{0}@* Saved in: @code{-} -@item View.Transform11 +@item View.TransformXX Element (1,1) of the 3x3 coordinate transformation matrix@* Default value: @code{1}@* Saved in: @code{-} -@item View.Transform12 +@item View.TransformXY Element (1,2) of the 3x3 coordinate transformation matrix@* Default value: @code{0}@* Saved in: @code{-} -@item View.Transform13 +@item View.TransformXZ Element (1,3) of the 3x3 coordinate transformation matrix@* Default value: @code{0}@* Saved in: @code{-} -@item View.Transform21 +@item View.TransformYX Element (2,1) of the 3x3 coordinate transformation matrix@* Default value: @code{0}@* Saved in: @code{-} -@item View.Transform22 +@item View.TransformYY Element (2,2) of the 3x3 coordinate transformation matrix@* Default value: @code{1}@* Saved in: @code{-} -@item View.Transform23 +@item View.TransformYZ Element (2,3) of the 3x3 coordinate transformation matrix@* Default value: @code{0}@* Saved in: @code{-} -@item View.Transform31 +@item View.TransformZX Element (3,1) of the 3x3 coordinate transformation matrix@* Default value: @code{0}@* Saved in: @code{-} -@item View.Transform32 +@item View.TransformZY Element (3,2) of the 3x3 coordinate transformation matrix@* Default value: @code{0}@* Saved in: @code{-} -@item View.Transform33 +@item View.TransformZZ Element (3,3) of the 3x3 coordinate transformation matrix@* Default value: @code{1}@* Saved in: @code{-}