From 29509ca354eee4969e4807acbffd063d2217acdb Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 25 May 2001 11:03:38 +0000 Subject: [PATCH] black box compilation fixes --- Box/Main.cpp | 55 +++++++++++++++++++++++++++++++++++-------- Common/GetOptions.cpp | 4 +++- Common/Options.cpp | 16 ++++++------- 3 files changed, 56 insertions(+), 19 deletions(-) diff --git a/Box/Main.cpp b/Box/Main.cpp index 4f9bacbb32..73fddf9ddf 100644 --- a/Box/Main.cpp +++ b/Box/Main.cpp @@ -1,7 +1,12 @@ -// $Id: Main.cpp,v 1.4 2001-05-22 08:30:26 geuzaine Exp $ +// $Id: Main.cpp,v 1.5 2001-05-25 11:03:38 geuzaine Exp $ #include <signal.h> +#include <signal.h> +#if !defined(WIN32) || defined(__CYGWIN__) +#include <sys/resource.h> +#endif + #include "Gmsh.h" #include "GmshVersion.h" #include "Const.h" @@ -67,30 +72,44 @@ int main(int argc, char *argv[]){ Get_Options(argc, argv, &nbf); - signal(SIGINT, Signal); + M.Vertices = NULL ; + M.VertexEdges = NULL ; + M.Simplexes = NULL ; + M.Points = NULL ; + M.Curves = NULL ; + M.SurfaceLoops = NULL ; + M.EdgeLoops = NULL ; + M.Surfaces = NULL ; + M.Volumes = NULL ; + M.PhysicalGroups = NULL ; + M.Metric = NULL ; + + signal(SIGINT, Signal); signal(SIGSEGV, Signal); - signal(SIGFPE, Signal); + signal(SIGFPE, Signal); OpenProblem(CTX.filename); if(yyerrorstate) exit(1); else{ - if(nbf>1){ - for(i=1;i<nbf;i++) MergeProblem(TheFileNameTab[i]); - } + for(i=1;i<nbf;i++) MergeProblem(TheFileNameTab[i]); if(TheBgmFileName){ MergeProblem(TheBgmFileName); if(List_Nbr(Post_ViewList)) BGMWithView((Post_View*)List_Pointer(Post_ViewList, List_Nbr(Post_ViewList)-1)); else - fprintf(stderr, ERROR_STR "Invalid BGM (no view)\n"); exit(1); + fprintf(stderr, ERROR_STR "Invalid background mesh (no view)\n"); exit(1); } if(CTX.batch > 0){ mai3d(THEM, CTX.batch); Print_Mesh(THEM,CTX.output_filename,CTX.mesh.format); } + else + Print_Geo(THEM, CTX.output_filename); + if(CTX.mesh.histogram) + Print_Histogram(THEM->Histogram[0]); exit(1); - } + } } @@ -125,7 +144,7 @@ void Msg(int level, char *fmt, ...){ switch(level){ case DIRECT : - vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); + vfprintf(stdout, fmt, args); fprintf(stdout, "\n"); break; case FATAL : @@ -194,8 +213,24 @@ void Msg(int level, char *fmt, ...){ /* C p u */ /* ------------------------------------------------------------------------ */ +void GetResources(long *s, long *us, long *mem){ +#if !defined(WIN32) || defined(__CYGWIN__) + static struct rusage r; + + getrusage(RUSAGE_SELF,&r); + *s = (long)r.ru_utime.tv_sec ; + *us = (long)r.ru_utime.tv_usec ; + *mem = (long)r.ru_maxrss ; +#else + *s = *us = *mem = 0; +#endif + +} + double Cpu(void){ - return 0.; + long s, us, mem; + GetResources(&s, &us, &mem); + return (double)s + (double)us/1.e6 ; } /* ------------------------------------------------------------------------ */ diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp index b2afeb891f..41f5346968 100644 --- a/Common/GetOptions.cpp +++ b/Common/GetOptions.cpp @@ -1,4 +1,4 @@ -// $Id: GetOptions.cpp,v 1.23 2001-05-23 07:29:42 geuzaine Exp $ +// $Id: GetOptions.cpp,v 1.24 2001-05-25 11:03:38 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -67,8 +67,10 @@ void Print_Usage(char *name){ Msg(DIRECT, " -perspective set projection mode to perspective"); #endif Msg(DIRECT, "Other options:"); +#ifndef _BLACKBOX Msg(DIRECT, " -a, -g, -m, -s, -p start in automatic, geometry, mesh, solver or"); Msg(DIRECT, " post-processing mode (default: automatic)"); +#endif Msg(DIRECT, " -v int set verbosity level (default: 2)"); #ifdef _XMOTIF Msg(DIRECT, " -nothreads disable threads"); diff --git a/Common/Options.cpp b/Common/Options.cpp index d4000f561a..129be7bbae 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.24 2001-05-24 10:11:28 geuzaine Exp $ +// $Id: Options.cpp,v 1.25 2001-05-25 11:03:38 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -7,11 +7,11 @@ #include "Draw.h" #include "Context.h" #include "Options.h" -#include "Solvers.h" extern Context_T CTX ; #ifdef _FLTK +#include "Solvers.h" #include "GUI.h" extern GUI *WID ; #endif @@ -491,12 +491,12 @@ char * opt_general_editor(OPT_ARGS_STR){ } char * opt_solver_getdp_command(OPT_ARGS_STR){ - if(action & GMSH_SET) strcpy(GetDP_Info.command, val); #ifdef _FLTK + if(action & GMSH_SET) strcpy(GetDP_Info.command, val); if(WID && (action & GMSH_GUI)) WID->getdp_input[2]->value(GetDP_Info.command); -#endif return GetDP_Info.command; +#endif } char * opt_view_name(OPT_ARGS_STR){ @@ -1477,22 +1477,22 @@ double opt_mesh_color_carousel(OPT_ARGS_NUM){ double opt_solver_getdp_popupmessages(OPT_ARGS_NUM){ +#ifdef _FLTK if(action & GMSH_SET) GetDP_Info.popupmessages = (int)val; -#ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->getdp_butt[0]->value(GetDP_Info.popupmessages); -#endif return GetDP_Info.popupmessages; +#endif } double opt_solver_getdp_mergeviews(OPT_ARGS_NUM){ +#ifdef _FLTK if(action & GMSH_SET) GetDP_Info.mergeviews = (int)val; -#ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->getdp_butt[1]->value(GetDP_Info.mergeviews); -#endif return GetDP_Info.mergeviews; +#endif } -- GitLab