diff --git a/Box/Main.cpp b/Box/Main.cpp index 73fddf9ddfaeb994e19761a8f1301bf828e37aa0..bdcc4789e3ab4ae421c883236f41636832adf671 100644 --- a/Box/Main.cpp +++ b/Box/Main.cpp @@ -1,6 +1,7 @@ -// $Id: Main.cpp,v 1.5 2001-05-25 11:03:38 geuzaine Exp $ +// $Id: Main.cpp,v 1.6 2001-08-08 15:36:09 remacle Exp $ #include <signal.h> +#include "ParUtil.h" #include <signal.h> #if !defined(WIN32) || defined(__CYGWIN__) @@ -66,6 +67,8 @@ void Info (int level, char *arg0){ int main(int argc, char *argv[]){ int i, nbf; + ParUtil::Instance()->init(argc,argv); + if(argc < 2) Info(0,argv[0]); Init_Options(0); @@ -90,7 +93,7 @@ int main(int argc, char *argv[]){ OpenProblem(CTX.filename); if(yyerrorstate) - exit(1); + ParUtil::Instance()->Abort(); else{ for(i=1;i<nbf;i++) MergeProblem(TheFileNameTab[i]); if(TheBgmFileName){ @@ -108,7 +111,7 @@ int main(int argc, char *argv[]){ Print_Geo(THEM, CTX.output_filename); if(CTX.mesh.histogram) Print_Histogram(THEM->Histogram[0]); - exit(1); + ParUtil::Instance()->Exit(); } } diff --git a/Box/Makefile b/Box/Makefile index 242ee9bccd8d3c4d08480ea936ef5e27fd27226f..56ce1e3eb57a4623a7e1eee3565b41a9b6809c3d 100644 --- a/Box/Makefile +++ b/Box/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.7 2001-02-17 22:08:53 geuzaine Exp $ +# $Id: Makefile,v 1.8 2001-08-08 15:36:09 remacle Exp $ # # Makefile for "libBox.a" # @@ -11,7 +11,7 @@ RM = rm RANLIB = ranlib LIB = ../lib/libBox.a INCLUDE = -I../Common -I../DataStr -I../Geo\ - -I../Graphics -I../Mesh -I../Parser -I../Motif -I../Fltk + -I../Graphics -I../Mesh -I../Parser -I../Motif -I../Fltk -I../Parallel C_FLAGS = -g OS_FLAGS = diff --git a/Parallel/ParUtil.cc b/Parallel/ParUtil.cc index 03492eead8aa6740c1980d29918e53bf6bcc1ba3..ab24d15e2f10426eae4e3b2f3ad2cfae29d89469 100644 --- a/Parallel/ParUtil.cc +++ b/Parallel/ParUtil.cc @@ -79,6 +79,15 @@ void ParUtil::Abort() #endif } +void ParUtil::Exit() +{ +#ifdef PARALLEL + MPI_Finalize(); +#else + exit(1); +#endif +} + void ParUtil::Barrier(int line, const char *fn) { #ifdef PARALLEL diff --git a/Parallel/ParUtil.h b/Parallel/ParUtil.h index 218072b555a19dd9d3e68a936588d481873d0fad..dee5c4a12cef1f385327f38cafa1208d900ae4fe 100644 --- a/Parallel/ParUtil.h +++ b/Parallel/ParUtil.h @@ -18,6 +18,8 @@ public: /// adds a barrier void Barrier(int, const char*); /// compute wall time + void Exit(); + /// compute wall time double wTime () const; /// gets the processor name void processorName(char *name) const;