diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 39fec36ddf9ff2d8c83b54ca18de04ae84644144..fbdd0ea38fbf91cd175e957aadd3affbec605624 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -1365,6 +1365,24 @@ StringXNumber ViewOptions_Number[] = { "Incremental colormap rotation" }, { F|O, "ColormapSwap" , opt_view_colormap_swap , 0. , "Swap the min/max values in the colormap?" }, + { F|O, "ComponentMap0" , opt_view_component_map0 , 0, + "Forced component 0 (if View.ForceComponents > 0)" }, + { F|O, "ComponentMap1" , opt_view_component_map1 , 1, + "Forced component 1 (if View.ForceComponents > 0)" }, + { F|O, "ComponentMap2" , opt_view_component_map2 , 2, + "Forced component 2 (if View.ForceComponents > 0)" }, + { F|O, "ComponentMap3" , opt_view_component_map3 , 3, + "Forced component 3 (if View.ForceComponents > 0)" }, + { F|O, "ComponentMap4" , opt_view_component_map4 , 4, + "Forced component 4 (if View.ForceComponents > 0)" }, + { F|O, "ComponentMap5" , opt_view_component_map5 , 5, + "Forced component 5 (if View.ForceComponents > 0)" }, + { F|O, "ComponentMap6" , opt_view_component_map6 , 6, + "Forced component 6 (if View.ForceComponents > 0)" }, + { F|O, "ComponentMap7" , opt_view_component_map7 , 7, + "Forced component 7 (if View.ForceComponents > 0)" }, + { F|O, "ComponentMap8" , opt_view_component_map8 , 8, + "Forced component 8 (if View.ForceComponents > 0)" }, { F, "CustomMax" , opt_view_custom_max , 0. , "User-defined maximum value to be displayed" }, { F, "CustomMin" , opt_view_custom_min , 0. , @@ -1406,6 +1424,8 @@ StringXNumber ViewOptions_Number[] = { { F|O, "FakeTransparency" , opt_view_fake_transparency , 0. , "Use fake transparency (cheaper than the real thing, but incorrect)" }, + { F|O, "ForceNumComponents" , opt_view_force_num_components , 0. , + "Force number of components to display (see View.ComponentMapN for mapping)" }, { F|O, "GeneralizedRaiseFactor" , opt_view_gen_raise_factor , 1. , "Generalized raise amplification factor" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 6743d66f3627995123fdf74b0820b6855c2bb013..5864e778954509055dd3bb0674414ecb5d5d26cf 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -8150,6 +8150,44 @@ double opt_view_clip(OPT_ARGS_NUM) #endif } +double opt_view_force_num_components(OPT_ARGS_NUM) +{ +#if !defined(HAVE_NO_POST) + GET_VIEW(0.); + if(action & GMSH_SET) { + opt->forceNumComponents = (int)val; + if(view) view->setChanged(true); + } + return opt->forceNumComponents; +#else + return 0.; +#endif +} + +static double ovcm(OPT_ARGS_NUM, int nn) +{ +#if !defined(HAVE_NO_POST) + GET_VIEW(0.); + if(action & GMSH_SET) { + opt->componentMap[nn] = (int)val; + if(view) view->setChanged(true); + } + return opt->componentMap[nn]; +#else + return 0.; +#endif +} + +double opt_view_component_map0(OPT_ARGS_NUM){ return ovcm(num, action, val, 0); } +double opt_view_component_map1(OPT_ARGS_NUM){ return ovcm(num, action, val, 1); } +double opt_view_component_map2(OPT_ARGS_NUM){ return ovcm(num, action, val, 2); } +double opt_view_component_map3(OPT_ARGS_NUM){ return ovcm(num, action, val, 3); } +double opt_view_component_map4(OPT_ARGS_NUM){ return ovcm(num, action, val, 4); } +double opt_view_component_map5(OPT_ARGS_NUM){ return ovcm(num, action, val, 5); } +double opt_view_component_map6(OPT_ARGS_NUM){ return ovcm(num, action, val, 6); } +double opt_view_component_map7(OPT_ARGS_NUM){ return ovcm(num, action, val, 7); } +double opt_view_component_map8(OPT_ARGS_NUM){ return ovcm(num, action, val, 8); } + double opt_print_format(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index 1d2e060a1136da4ec5e4caabefc549ffc8cd39b6..0f5ccaeed7a9e3d4a09ff6d8b65346793b6b85cb 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -685,6 +685,16 @@ double opt_view_line_width(OPT_ARGS_NUM); double opt_view_point_type(OPT_ARGS_NUM); double opt_view_line_type(OPT_ARGS_NUM); double opt_view_clip(OPT_ARGS_NUM); +double opt_view_force_num_components(OPT_ARGS_NUM); +double opt_view_component_map0(OPT_ARGS_NUM); +double opt_view_component_map1(OPT_ARGS_NUM); +double opt_view_component_map2(OPT_ARGS_NUM); +double opt_view_component_map3(OPT_ARGS_NUM); +double opt_view_component_map4(OPT_ARGS_NUM); +double opt_view_component_map5(OPT_ARGS_NUM); +double opt_view_component_map6(OPT_ARGS_NUM); +double opt_view_component_map7(OPT_ARGS_NUM); +double opt_view_component_map8(OPT_ARGS_NUM); double opt_print_format(OPT_ARGS_NUM); double opt_print_eps_compress(OPT_ARGS_NUM); double opt_print_eps_ps3shading(OPT_ARGS_NUM); diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 967668323f523e8c2fe6da56c7b7fc9db0591fd6..1d65c20f5996e853e4f55ddedd95361c5c7792b2 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -2885,9 +2885,6 @@ optionWindow::optionWindow(int deltaFontSize) view.value[62]->callback(view_options_ok_cb); { - view.vector = new Fl_Group - (L + 2 * WB, 2 * WB + 6 * BH, width - 2 * WB, 4 * BH, 0); - static Fl_Menu_Item menu_vectype[] = { {"Line", 0, 0, 0}, {"Arrow", 0, 0, 0}, @@ -2932,8 +2929,6 @@ optionWindow::optionWindow(int deltaFontSize) view.choice[10]->align(FL_ALIGN_RIGHT); view.choice[10]->add("Self"); view.choice[10]->callback(view_options_ok_cb); - - view.vector->end(); } static Fl_Menu_Item menu_vecloc[] = { @@ -3260,11 +3255,6 @@ void optionWindow::updateViewGroup(int index) opt_view_timestep(index, GMSH_GUI, 0); opt_view_show_time(index, GMSH_GUI, 0); - if(data->getNumVectors() || data->getNumTensors() || data->isRemote()) - view.vector->activate(); - else - view.vector->deactivate(); - opt_view_point_size(index, GMSH_GUI, 0); opt_view_point_type(index, GMSH_GUI, 0); opt_view_line_width(index, GMSH_GUI, 0); diff --git a/Fltk/optionWindow.h b/Fltk/optionWindow.h index bce08dba9c3f30846c9855cfc833a202f1e1ca61..733b871e0f0b7bb19bc5ad42a804406d60fcbf4b 100644 --- a/Fltk/optionWindow.h +++ b/Fltk/optionWindow.h @@ -69,7 +69,7 @@ class optionWindow{ } post; struct{ int index; - Fl_Group *group, *range, *vector; + Fl_Group *group, *range; Fl_Check_Button *butt[100]; Fl_Value_Input *value[100]; Fl_Input *input[100]; diff --git a/Post/PViewOptions.h b/Post/PViewOptions.h index 9c5dc3edcaa8ab7f88b5d65f682791bf67497cec..4fb9cd88f8e2129e44e8507cc04a993019c7d9cc 100644 --- a/Post/PViewOptions.h +++ b/Post/PViewOptions.h @@ -88,6 +88,7 @@ class PViewOptions { int adaptVisualizationGrid, maxRecursionLevel; double targetError; int clip; // status of clip planes (bit array) + int forceNumComponents, componentMap[9]; struct{ unsigned int point, line, triangle, quadrangle; unsigned int tetrahedron, hexahedron, prism, pyramid; diff --git a/Post/PViewVertexArrays.cpp b/Post/PViewVertexArrays.cpp index ee695962eee41ed750f28081e15a10e1bcc01912..e5a4ceb0023d128737e9418c91eb3a96ebaab1f0 100644 --- a/Post/PViewVertexArrays.cpp +++ b/Post/PViewVertexArrays.cpp @@ -958,9 +958,21 @@ static void addElementsInArrays(PView *p, bool preprocessNormalsOnly) } for(int j = 0; j < numNodes; j++){ data->getNode(opt->timeStep, ent, i, j, xyz[j][0], xyz[j][1], xyz[j][2]); - for(int k = 0; k < numComp; k++) - data->getValue(opt->timeStep, ent, i, j, k, val[j][k]); + if(opt->forceNumComponents){ + for(int k = 0; k < opt->forceNumComponents; k++){ + int comp = opt->componentMap[k]; + if(comp >= 0 && comp < numComp) + data->getValue(opt->timeStep, ent, i, j, comp, val[j][k]); + else + val[j][k] = 0.; + } + } + else + for(int k = 0; k < numComp; k++) + data->getValue(opt->timeStep, ent, i, j, k, val[j][k]); } + if(opt->forceNumComponents) numComp = opt->forceNumComponents; + changeCoordinates(p, ent, i, numNodes, type, numComp, xyz, val); int dim = data->getDimension(opt->timeStep, ent, i); if(!isElementVisible(opt, dim, numNodes, xyz)) continue; diff --git a/doc/TODO.txt b/doc/TODO.txt index 58ce6aa2f8ef007f5b659a7d270cc2942674a284..5f0f7daf21afdd934d8fb21a787c5ca3eff6aea8 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -1,4 +1,4 @@ -$Id: TODO.txt,v 1.32 2009-08-22 09:16:47 geuzaine Exp $ +$Id: TODO.txt,v 1.33 2009-10-13 19:25:34 geuzaine Exp $ ******************************************************************** @@ -77,12 +77,6 @@ single associated scalar/vector or tensor value. ******************************************************************** -Read all the components from postpro datasets, even if > 9. Provide a -"interpretation" option allowing to select which components to draw -and to force their interpretation as scalar, vector or tensor - -******************************************************************** - Add a global "transparency slider" for the mesh; if value != 1, fill a global triangle vertex array in GModel instead of in each separate entity, and sort like in post-processing.