diff --git a/Box/Box.cpp b/Box/Box.cpp index 3f8a4536453f29ad3701c7e149847b7e46c52c2e..60cb94a5a047be133bb04ce3ce98f391aa3e6440 100644 --- a/Box/Box.cpp +++ b/Box/Box.cpp @@ -1,4 +1,4 @@ -/* $Id: Box.cpp,v 1.16 2000-12-21 08:02:05 geuzaine Exp $ */ +/* $Id: Box.cpp,v 1.17 2000-12-21 12:30:34 geuzaine Exp $ */ #include <signal.h> @@ -42,6 +42,7 @@ char gmsh_help[] = " -format msh|unv|gref set output mesh format (default: msh)\n" " -algo iso|aniso select mesh algorithm (default: iso)\n" " -scale float set global scaling factor (default: 1.0)\n" + " -meshscale float set mesh scaling factor (default: 1.0)\n" " -clscale float set characteristic length scaling factor (default: 1.0)\n" " -bgm file load backround mesh from file\n" "Other options:\n" @@ -227,6 +228,14 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { } } else if(!strcmp(argv[i]+1, "scale")){ + i++; + if(argv[i] != NULL) CTX.geom.scaling_factor = atof(argv[i++]); + else{ + fprintf(stderr, ERROR_STR "Missing Number\n"); + exit(1); + } + } + else if(!strcmp(argv[i]+1, "meshscale")){ i++; if(argv[i] != NULL) CTX.mesh.scaling_factor = atof(argv[i++]); else{ diff --git a/Common/Context.h b/Common/Context.h index a6065ff4863198fe99601b333b9a4873ed840ca2..f02a6e4e1f3e60a420e69727a237724ead490b66 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -1,4 +1,4 @@ -/* $Id: Context.h,v 1.22 2000-12-21 10:41:01 geuzaine Exp $ */ +/* $Id: Context.h,v 1.23 2000-12-21 12:30:36 geuzaine Exp $ */ #ifndef _CONTEXT_H_ #define _CONTEXT_H_ @@ -114,6 +114,7 @@ class Context_T { int highlight; int level; double normals, tangents; + double scaling_factor; } geom; /* mesh options */ diff --git a/Common/Options.h b/Common/Options.h index a63800439a71eab4d0ae8ab93df5684175ebb228..8217925f05b75d61b1d7b2d7c337eae8918cb8cf 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -1,4 +1,4 @@ -/* $Id: Options.h,v 1.11 2000-12-21 10:41:02 geuzaine Exp $ */ +/* $Id: Options.h,v 1.12 2000-12-21 12:30:36 geuzaine Exp $ */ #ifndef _OPTIONS_H_ #define _OPTIONS_H_ @@ -146,6 +146,7 @@ StringXNumber GeometryOptions_Number[] = { { "HiddenLines" , GMSH_INT, (void*)&CTX.geom.hidden , 0. }, { "Shading" , GMSH_INT, (void*)&CTX.geom.shade , 0. }, { "Highlight" , GMSH_INT, (void*)&CTX.geom.highlight , 1. }, + { "ScalingFactor" , GMSH_DOUBLE, (void*)&CTX.geom.scaling_factor , 1.0 }, { NULL , GMSH_DOUBLE, NULL , 0. } } ; diff --git a/Geo/DataBase.cpp b/Geo/DataBase.cpp index b272bac83e55b221b6ac52f3d43c5d4edbcebd88..7093f0321df5f5f982e22682e7ae9890cfa58a51 100644 --- a/Geo/DataBase.cpp +++ b/Geo/DataBase.cpp @@ -1,4 +1,4 @@ -/* $Id: DataBase.cpp,v 1.5 2000-12-13 20:21:03 geuzaine Exp $ */ +/* $Id: DataBase.cpp,v 1.6 2000-12-21 12:30:37 geuzaine Exp $ */ #include "Gmsh.h" #include "Const.h" @@ -7,16 +7,24 @@ #include "CAD.h" #include "Create.h" #include "Verif.h" +#include "Context.h" -extern int CurrentNodeNumber; -extern Mesh *THEM; + +extern Context_T CTX ; +extern int CurrentNodeNumber; +extern Mesh *THEM; /* POINTS */ void Cdbpts101(int ip, double x, double y, double z, double l, double w){ Vertex *v; CurrentNodeNumber = IMAX(CurrentNodeNumber, ip); - v = Create_Vertex(ip,x,y,z,l,0.0); + v = Create_Vertex(ip, + CTX.geom.scaling_factor*x, + CTX.geom.scaling_factor*y, + CTX.geom.scaling_factor*z, + CTX.geom.scaling_factor*l, + 0.0); v->w = w; Tree_Insert(THEM->Points,&v); } diff --git a/Unix/Main.cpp b/Unix/Main.cpp index c3265532af657d6e21f4a0f741ed84af58e14786..4430a8f052698b657e924c224a6bf027b9bb7f0b 100644 --- a/Unix/Main.cpp +++ b/Unix/Main.cpp @@ -1,4 +1,4 @@ -/* $Id: Main.cpp,v 1.32 2000-12-21 08:02:06 geuzaine Exp $ */ +/* $Id: Main.cpp,v 1.33 2000-12-21 12:30:39 geuzaine Exp $ */ #include <signal.h> @@ -51,6 +51,7 @@ char gmsh_help[] = " -smooth int set mesh smoothing (default: 0)\n" " -degree int set mesh degree (default: 1)\n" " -scale float set global scaling factor (default: 1.0)\n" + " -meshscale float set mesh scaling factor (default: 1.0)\n" " -clscale float set characteristic length scaling factor (default: 1.0)\n" " -rand float set random perturbation factor (default: 1.e-5)\n" " -bgm file load backround mesh from file\n" @@ -248,6 +249,14 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { CTX.mesh.interactive = 1; i++; } else if(!strcmp(argv[i]+1, "scale")){ + i++; + if(argv[i]!=NULL) CTX.geom.scaling_factor = atof(argv[i++]); + else { + fprintf(stderr, ERROR_STR "Missing Number\n"); + exit(1); + } + } + else if(!strcmp(argv[i]+1, "meshscale")){ i++; if(argv[i]!=NULL) CTX.mesh.scaling_factor = atof(argv[i++]); else {