diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp index d3e92d9e7afb7b0d0cca8c097f50ec3351e7e5c1..83fcbc78b0eb4a2e0d268072991d57f7cff3fe72 100644 --- a/Common/GetOptions.cpp +++ b/Common/GetOptions.cpp @@ -1,4 +1,4 @@ -// $Id: GetOptions.cpp,v 1.33 2001-08-04 01:16:58 geuzaine Exp $ +// $Id: GetOptions.cpp,v 1.34 2001-08-04 03:35:32 geuzaine Exp $ #include <unistd.h> #include "Gmsh.h" @@ -55,6 +55,7 @@ void Print_Usage(char *name){ Msg(DIRECT, " -dl enable display lists"); Msg(DIRECT, " -noview hide all views on startup"); Msg(DIRECT, " -link int select link mode between views (default: 0)"); + Msg(DIRECT, " -smoothview smooth views"); Msg(DIRECT, " -convert file file convert an ascii view into a binary one"); Msg(DIRECT, "Display options:"); Msg(DIRECT, " -nodb disable double buffering"); @@ -381,11 +382,20 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { opt_general_default_plugins(0, GMSH_SET, 0); i++; } else if(!strcmp(argv[i]+1, "link")){ - CTX.post.link = 2 ; i++; + i++ ; + if(argv[i]!=NULL) + CTX.post.link = atoi(argv[i++]); + else{ + fprintf(stderr, ERROR_STR "Missing number\n"); + exit(1); + } } else if(!strcmp(argv[i]+1, "fill")){ opt_view_intervals_type(0, GMSH_SET, DRAW_POST_CONTINUOUS) ; i++; } + else if(!strcmp(argv[i]+1, "smoothview")){ + CTX.post.smooth=1; i++; + } else if(!strcmp(argv[i]+1, "nbiso")){ i++ ; if(argv[i]!=NULL) diff --git a/Common/Views.cpp b/Common/Views.cpp index fd75c1fa73f652fb4dfd15d9f3cd3803c9d870ac..484e4cda8719cf53c866639070568aaa1d033e1e 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.46 2001-08-03 21:27:20 geuzaine Exp $ +// $Id: Views.cpp,v 1.47 2001-08-04 03:35:32 geuzaine Exp $ #include <set> #include "Gmsh.h" @@ -725,12 +725,12 @@ void xyzv::update (int n, double *v){ throw n; } - //if(n==3)printf("val(%d,%f,%f,%f) = %f %f %f\n",nboccurences,x,y,z,v[0],v[1],v[2]); - double x1 = (double)(nboccurences)/ (double)(nboccurences + 1); double x2 = 1./(double)(nboccurences + 1); for(i=0;i<nbvals;i++)vals[i] = (x1 * vals[i] + x2 * v[i]); nboccurences++; + + //printf("val(%d,%f,%f,%f) = %f\n",nboccurences,x,y,z,vals[0]); } // trop simple... If faudrait coder une structure qui tient compte des @@ -759,6 +759,7 @@ public : }; void smooth_list (List_T *SS , + double *min, double *max, int NbTimeStep, int nbvert, int nb, @@ -766,6 +767,9 @@ void smooth_list (List_T *SS , double *x,*y,*z,*v; int i,j,k; double *vals = new double[NbTimeStep]; + *min = 1.e200; + *max = -1.e200; + for(i = 0 ; i < List_Nbr(SS) ; i+=nb){ x = (double*)List_Pointer_Fast(SS,i); y = (double*)List_Pointer_Fast(SS,i+nbvert); @@ -798,8 +802,13 @@ void smooth_list (List_T *SS , for(j=0;j<nbvert;j++){ xyzv xyz(x[j],y[j],z[j]); iter it = connectivities.find(xyz); - if(it != connectivities.end()) - for(k=0;k<NbTimeStep;k++)v[j+k*nbvert] = (*it).vals[k]; + if(it != connectivities.end()){ + for(k=0;k<NbTimeStep;k++){ + v[j+k*nbvert] = (*it).vals[k]; + if(v[j+k*nbvert] < *min) *min = v[j+k*nbvert] ; + if(v[j+k*nbvert] > *max) *max = v[j+k*nbvert] ; + } + } } } delete [] vals; @@ -813,14 +822,14 @@ void Post_View :: smooth (){ mycont conSS; Msg(INFO,"Smoothing SS vector in a view ..."); nb = List_Nbr(SS) / NbSS ; - smooth_list (SS , NbTimeStep, 4, nb, conSS); + smooth_list (SS , &Min, &Max, NbTimeStep, 4, nb, conSS); Msg(INFO,"...done"); } if(NbST){ mycont conST; Msg(INFO,"Smoothing ST vector in a view ..."); nb = List_Nbr(ST) / NbST ; - smooth_list (ST , NbTimeStep, 3, nb, conST); + smooth_list (ST , &Min, &Max, NbTimeStep, 3, nb, conST); Msg(INFO,"...done"); }