From eec1e5b5f0bc47949c733631e5e6ebf37ab823e8 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 21 Dec 2000 12:30:39 +0000 Subject: [PATCH] added geom.scaling_factor --- Box/Box.cpp | 11 ++++++++++- Common/Context.h | 3 ++- Common/Options.h | 3 ++- Geo/DataBase.cpp | 16 ++++++++++++---- Unix/Main.cpp | 11 ++++++++++- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/Box/Box.cpp b/Box/Box.cpp index 3f8a453645..60cb94a5a0 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 a6065ff486..f02a6e4e1f 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 a63800439a..8217925f05 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 b272bac83e..7093f0321d 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 c3265532af..4430a8f052 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 { -- GitLab