Skip to content
Snippets Groups Projects
Commit 5acb1870 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Fix floating point exceptions

parent d3715377
No related branches found
No related tags found
No related merge requests found
// $Id: Post.cpp,v 1.29 2001-11-05 08:37:43 geuzaine Exp $ // $Id: Post.cpp,v 1.30 2001-11-16 10:57:31 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -80,7 +80,9 @@ void Palette(Post_View *v, int nbi, int i){ /* i in [0,nbi-1] */ ...@@ -80,7 +80,9 @@ void Palette(Post_View *v, int nbi, int i){ /* i in [0,nbi-1] */
void Palette2(Post_View *v,double min, double max, double val){ /* val in [min,max] */ void Palette2(Post_View *v,double min, double max, double val){ /* val in [min,max] */
int index; int index;
index = (int)( (val-min)/(max-min)*(v->CT.size-1) + 0.5); index = (min==max) ?
v->CT.size/2 :
(int)( (val-min)/(max-min)*(v->CT.size-1) + 0.5);
glColor4ubv((GLubyte *) &v->CT.table[index]); glColor4ubv((GLubyte *) &v->CT.table[index]);
} }
......
// $Id: LevelsetPlugin.cpp,v 1.20 2001-09-05 11:24:06 geuzaine Exp $ // $Id: LevelsetPlugin.cpp,v 1.21 2001-11-16 10:57:33 geuzaine Exp $
#include "LevelsetPlugin.h" #include "LevelsetPlugin.h"
#include "List.h" #include "List.h"
...@@ -81,6 +81,7 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v) ...@@ -81,6 +81,7 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v)
myVals[2] = vv; myVals[2] = vv;
} }
if(nx == 3 || nx == 4){
double v1[3] = {Xp[2]-Xp[0],Yp[2]-Yp[0],Zp[2]-Zp[0]}; double v1[3] = {Xp[2]-Xp[0],Yp[2]-Yp[0],Zp[2]-Zp[0]};
double v2[3] = {Xp[1]-Xp[0],Yp[1]-Yp[0],Zp[1]-Zp[0]}; double v2[3] = {Xp[1]-Xp[0],Yp[1]-Yp[0],Zp[1]-Zp[0]};
double gr[3]; double gr[3];
...@@ -121,13 +122,12 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v) ...@@ -121,13 +122,12 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v)
} }
} }
if(nx == 3 || nx == 4){
for(k=0 ; k<3 ; k++) List_Add(View->ST, &Xp[k]); for(k=0 ; k<3 ; k++) List_Add(View->ST, &Xp[k]);
for(k=0 ; k<3 ; k++) List_Add(View->ST, &Yp[k]); for(k=0 ; k<3 ; k++) List_Add(View->ST, &Yp[k]);
for(k=0 ; k<3 ; k++) List_Add(View->ST, &Zp[k]); for(k=0 ; k<3 ; k++) List_Add(View->ST, &Zp[k]);
for(k=0 ; k<3 ; k++) List_Add(View->ST, &myVals[k]); for(k=0 ; k<3 ; k++) List_Add(View->ST, &myVals[k]);
View->NbST++; View->NbST++;
}
if(nx == 4){ if(nx == 4){
for(k=2 ; k<5 ; k++) List_Add(View->ST, &Xp[k % 4]); for(k=2 ; k<5 ; k++) List_Add(View->ST, &Xp[k % 4]);
for(k=2 ; k<5 ; k++) List_Add(View->ST, &Yp[k % 4]); for(k=2 ; k<5 ; k++) List_Add(View->ST, &Yp[k % 4]);
...@@ -136,6 +136,7 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v) ...@@ -136,6 +136,7 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v)
View->NbST++; View->NbST++;
} }
} }
}
char name[1024],filename[1024]; char name[1024],filename[1024];
sprintf(name,"cut-%s",v->Name); sprintf(name,"cut-%s",v->Name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment