diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index b81ab8756cdb8dde11b643c13a7a074a923e892b..abf227144c065855da2d68785dd56df521780473 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -879,7 +879,8 @@ StringXNumber ViewOptions_Number[] = { "Show time value (or time step) if NbTimeStep > 1?" }, { F|O, "SmoothNormals" , opt_view_smooth_normals , 0. , "Smooth the normals?" }, - + { F|O, "TensorType" , opt_view_tensor_type , 0. , + "Tensor Visualization Type" }, { F, "TimeStep" , opt_view_timestep , 0. , "Current time step displayed" }, { F|O, "TransparentScale" , opt_view_transparent_scale , 1. , diff --git a/Common/Options.cpp b/Common/Options.cpp index d235e5d347d6ce6ac64c113ff95e5b25e9f79d83..276bb27db61728b1633f88502bc8f63cd6235f89 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.73 2002-02-22 23:07:01 geuzaine Exp $ +// $Id: Options.cpp,v 1.74 2002-03-10 23:23:33 remacle Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -2631,6 +2631,21 @@ double opt_view_range_type(OPT_ARGS_NUM){ #endif return v->RangeType; } +double opt_view_tensor_type(OPT_ARGS_NUM){ + GET_VIEW(0.) ; + if(action & GMSH_SET){ + printf("type = %d\n",(int)val); + v->TensorType = (int)val; + v->Changed = 1; + } +#ifdef _FLTK + if(WID && (action & GMSH_GUI) && (num == WID->view_number)){ + WID->view_butt[70]->value(v->TensorType==DRAW_POST_VONMISES); + WID->view_butt[71]->value(v->TensorType==DRAW_POST_EIGENVECTORS); + } +#endif + return v->RangeType; +} double opt_view_arrow_type(OPT_ARGS_NUM){ GET_VIEW(0.) ; if(action & GMSH_SET){ diff --git a/Common/Options.h b/Common/Options.h index 0e11dd1c596477748de55f96252b843a72293dd6..1c5779519c365727a91b65e434ecc784ca786a30 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -406,6 +406,7 @@ double opt_view_draw_vectors(OPT_ARGS_NUM); double opt_view_draw_tensors(OPT_ARGS_NUM); double opt_view_transparent_scale(OPT_ARGS_NUM); double opt_view_scale_type(OPT_ARGS_NUM); +double opt_view_tensor_type(OPT_ARGS_NUM); double opt_view_range_type(OPT_ARGS_NUM); double opt_view_arrow_type(OPT_ARGS_NUM); double opt_view_arrow_location(OPT_ARGS_NUM); diff --git a/Common/Views.cpp b/Common/Views.cpp index b76dc13d806d48371789d760314f75a2825264a0..d0e1256f6b904a71f53deed3603f5355f6ae510b 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.64 2002-02-13 09:20:41 stainier Exp $ +// $Id: Views.cpp,v 1.65 2002-03-10 23:23:33 remacle Exp $ #include <set> #include "Gmsh.h" @@ -174,7 +174,34 @@ void Stat_VectorSimplex(Post_View *v, int nbnod, int N, void Stat_TensorSimplex(Post_View *v, int nbnod, int N, double *X, double *Y, double *Z, double *V){ - Msg(GERROR, "Tensor field views not implemented yet"); + double l0; + int i; + + if(v->Min == INFINITY || v->Max == -INFINITY){ + l0 = sqrt(DSQR(V[0])+DSQR(V[1])+DSQR(V[2])); + v->Min = l0; + v->Max = l0; + v->NbTimeStep = N/(3*nbnod) ; + } + else if(N/(3*nbnod) < v->NbTimeStep) + v->NbTimeStep = N/(3*nbnod) ; + + for(i=0 ; i<N ; i+=3){ + l0 = sqrt(DSQR(V[i])+DSQR(V[i+1])+DSQR(V[i+2])); + if(l0 < v->Min) v->Min = l0 ; + if(l0 > v->Max) v->Max = l0 ; + } + + for(i=0 ; i<nbnod ; i++){ + if(X[i] < v->BBox[0]) v->BBox[0] = X[i] ; + if(X[i] > v->BBox[1]) v->BBox[1] = X[i] ; + if(Y[i] < v->BBox[2]) v->BBox[2] = Y[i] ; + if(Y[i] > v->BBox[3]) v->BBox[3] = Y[i] ; + if(Z[i] < v->BBox[4]) v->BBox[4] = Z[i] ; + if(Z[i] > v->BBox[5]) v->BBox[5] = Z[i] ; + } + + v->TextOnly = 0; } diff --git a/Common/Views.h b/Common/Views.h index dc470d259a5058df09f316398062e4657567407e..029abb67e34404ee07a7532b159f4c2531dece9c 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -28,7 +28,7 @@ class Post_View{ List_T *T2D, *T2C, *T3D, *T3C; // 2D and 3D text strings // options - int Type, Position[2], AutoPosition, Size[2]; + int Type, Position[2], AutoPosition, Size[2],TensorType; char Format[256]; double CustomMin, CustomMax; double Offset[3], Raise[3], ArrowScale, Explode; @@ -85,6 +85,10 @@ class Post_View{ #define DRAW_POST_LOCATE_COG 1 #define DRAW_POST_LOCATE_VERTEX 2 +// Tensor Type +#define DRAW_POST_VONMISES 0 +#define DRAW_POST_EIGENVECTORS 1 + // RangeType #define DRAW_POST_DEFAULT 1 #define DRAW_POST_CUSTOM 2 diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 7503beb0297c69065d7c45e3ddeeb9c512d31a57..87b52c7489fc82e465125784274653c6b0514aa2 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.110 2002-02-22 16:44:09 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.111 2002-03-10 23:23:33 remacle Exp $ #include <sys/types.h> #include <signal.h> @@ -2057,6 +2057,13 @@ void view_options_ok_cb(CALLBACK_ARGS){ WID->view_butt[62]->value()?DRAW_POST_CONE: DRAW_POST_DISPLACEMENT); + + if(force || WID->view_butt[70]->changed() || + WID->view_butt[71]->changed()) + opt_view_tensor_type(i, GMSH_SET, + WID->view_butt[70]->value()?DRAW_POST_VONMISES: + DRAW_POST_EIGENVECTORS); + if(force || WID->view_butt[64]->changed() || WID->view_butt[65]->changed()) opt_view_arrow_location(i, GMSH_SET, diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index bc09c82a7a55460fbfdf6cf87ae58f2e595828be..b114802431755f973aacb6f0be754c5acaa89657 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.157 2002-03-05 19:40:47 geuzaine Exp $ +// $Id: GUI.cpp,v 1.158 2002-03-10 23:23:33 remacle Exp $ // To make the interface as visually consistent as possible, please: // - use the IW, BB, BH, BW and WB values @@ -2552,6 +2552,20 @@ void GUI::create_view_options_window(int num){ view_value[i]->callback(set_changed_cb, 0); } + { + Fl_Group *o = new Fl_Group(2*WB, 2*WB+4*BH, width-4*WB, 2*BH, 0); + view_butt[70] = new Fl_Check_Button(2*WB, 2*WB+4*BH, BW/2-WB, BH, "Von-Mises"); + view_butt[71] = new Fl_Check_Button(2*WB, 2*WB+5*BH, BW/2-WB, BH, "Eigenvectors"); + for(i=70 ; i<=71 ; i++){ + view_butt[i]->type(FL_RADIO_BUTTON); + view_butt[i]->down_box(RADIO_BOX); + view_butt[i]->labelsize(CTX.fontsize); + view_butt[i]->selection_color(RADIO_COLOR); + view_butt[i]->callback(set_changed_cb, 0); + } + o->end(); + } + o->end(); } // Colors @@ -2710,6 +2724,7 @@ void GUI::update_view_window(int num){ opt_view_arrow_type(num, GMSH_GUI, 0); opt_view_arrow_scale(num, GMSH_GUI, 0); opt_view_arrow_location(num, GMSH_GUI, 0); + opt_view_tensor_type(num, GMSH_GUI, 0); // colors view_colorbar_window->update(v->Name, v->Min, v->Max, &v->CT, &v->Changed); diff --git a/Fltk/GmshServer.cpp b/Fltk/GmshServer.cpp index b1905da5eff3468faa488863772457f8b9d36753..923cf3cae01398d780ca840fbcd62f43d525601e 100644 --- a/Fltk/GmshServer.cpp +++ b/Fltk/GmshServer.cpp @@ -1,4 +1,4 @@ -/* $Id: GmshServer.cpp,v 1.2 2002-01-03 13:49:42 geuzaine Exp $ */ +/* $Id: GmshServer.cpp,v 1.3 2002-03-10 23:23:33 remacle Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -47,7 +47,7 @@ static int Socket_UnlinkName(char *name){ int Gmsh_StartClient(char *command, char *sockname){ int s, sock; -#if defined(linux) || defined(_AIX) +#if defined(linux) || defined(_AIX) || defined (sun) socklen_t len ; #else int len; diff --git a/Graphics/PostSimplex.cpp b/Graphics/PostSimplex.cpp index b322db0c6c2a2c1cc4a219b2dc189c1db192a38b..ed7d3e0d714b51d0fd57a67012196dcd6dc05ddb 100644 --- a/Graphics/PostSimplex.cpp +++ b/Graphics/PostSimplex.cpp @@ -1,4 +1,4 @@ -// $Id: PostSimplex.cpp,v 1.32 2002-02-13 09:20:41 stainier Exp $ +// $Id: PostSimplex.cpp,v 1.33 2002-03-10 23:23:33 remacle Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -573,6 +573,7 @@ static int TensorError = 0 ; void Draw_TensorSimplex(int nbnod, Post_View *View, double ValMin, double ValMax, double Raise[3][5], double *X, double *Y, double *Z, double *V){ + if(!TensorError){ TensorError = 1; Msg(GERROR, "Tensor field visualization is not implemented"); @@ -597,7 +598,26 @@ void Draw_TensorLine(Post_View *View, void Draw_TensorTriangle(Post_View *View, double ValMin, double ValMax, double Raise[3][5], double *X, double *Y, double *Z, double *V){ - Draw_TensorSimplex(3, View, ValMin, ValMax, Raise, X, Y, Z, V); + + /// we want to compute "von mises" value i.e. max eigenvalue + /// this will simply call the scalar function + + if(View->TensorType == DRAW_POST_VONMISES) + { + double V_VonMises [3]; + + for(int i=0;i<3;i++) + { + double xx = V[0+9*i]; + double yy = V[4+9*i]; + double xy = V[1+9*i]; + V_VonMises[i] = sqrt (0.5 * ( + (xx-yy) * (xx-yy) + + (xx-xy) * (xx-xy) + + (xy-yy) * (xy-yy) ) ); + } + Draw_ScalarTriangle(View, 0,ValMin, ValMax, Raise, X,Y,Z,V_VonMises); + } } void Draw_TensorTetrahedron(Post_View *View, diff --git a/Makefile b/Makefile index 6dd7d136d378fba5facebcb6d147e5472693241c..a953018d697e2a6839933b674232d02e869a14e3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.190 2002-02-20 16:41:20 geuzaine Exp $ +# $Id: Makefile,v 1.191 2002-03-10 23:23:33 remacle Exp $ GMSH_MAJOR_VERSION = 1 GMSH_MINOR_VERSION = 34 @@ -136,7 +136,7 @@ tag: echo " 0.0001 * (double)GMSH_PATCH_VERSION)" >> Common/GmshVersion.h echo "#define GMSH_DATE \"`date`\"" >> Common/GmshVersion.h echo "#define GMSH_HOST \"`hostname`\"" >> Common/GmshVersion.h - echo "#define GMSH_PACKAGER \"`whoami`\"" >> Common/GmshVersion.h + echo "#define GMSH_PACKAGER \"`who -m`\"" >> Common/GmshVersion.h echo "#define GMSH_OS \"`uname -sr`\"" >> Common/GmshVersion.h initialtag: diff --git a/benchmarks/2d/wing.geo b/benchmarks/2d/wing.geo index 0546a05d4e7d25e4c01a9eb050f2882bbf054d86..e8db8d0c798ab0a316b54f2600f22f8241900625 100644 --- a/benchmarks/2d/wing.geo +++ b/benchmarks/2d/wing.geo @@ -1,4 +1,4 @@ -scale = 1 ; +scale = 2 ; lc1 = 5.e-3 *scale ; lc2 = 1.e-2 *scale ;