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

API to get message handler + never intiialize twice

parent 7ab9ecd6
No related branches found
No related tags found
No related merge requests found
...@@ -472,7 +472,7 @@ endif(ENABLE_BUILD_ANDROID) ...@@ -472,7 +472,7 @@ endif(ENABLE_BUILD_ANDROID)
if(HAVE_FLTK OR HAVE_QT OR ENABLE_GRAPHICS) if(HAVE_FLTK OR HAVE_QT OR ENABLE_GRAPHICS)
if(NOT HAVE_MESH OR NOT HAVE_POST OR NOT HAVE_PLUGINS OR NOT HAVE_ONELAB) if(NOT HAVE_MESH OR NOT HAVE_POST OR NOT HAVE_PLUGINS OR NOT HAVE_ONELAB)
message(SEND_ERROR "Cannot compile GUI without Mesh, Post, Plugin or OneLab") message(SEND_ERROR "Cannot compile GUI without Mesh, Post, Plugin and OneLab")
endif(NOT HAVE_MESH OR NOT HAVE_POST OR NOT HAVE_PLUGINS OR NOT HAVE_ONELAB) endif(NOT HAVE_MESH OR NOT HAVE_POST OR NOT HAVE_PLUGINS OR NOT HAVE_ONELAB)
if(FLTK_JPEG) if(FLTK_JPEG)
...@@ -1281,6 +1281,9 @@ if(ENABLE_BUILD_LIB) ...@@ -1281,6 +1281,9 @@ if(ENABLE_BUILD_LIB)
endif(ENABLE_BUILD_LIB) endif(ENABLE_BUILD_LIB)
if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC) if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
install(TARGETS shared DESTINATION ${GMSH_LIB} OPTIONAL) install(TARGETS shared DESTINATION ${GMSH_LIB} OPTIONAL)
if(WIN32 OR CYGWIN)
endif(WIN32 OR CYGWIN)
endif(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC) endif(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
install(FILES ${ONELAB_PY} DESTINATION ${GMSH_BIN}) install(FILES ${ONELAB_PY} DESTINATION ${GMSH_BIN})
......
...@@ -45,6 +45,10 @@ ...@@ -45,6 +45,10 @@
int GmshInitialize(int argc, char **argv) int GmshInitialize(int argc, char **argv)
{ {
static bool isInitialized = false;
if(isInitialized) return 1;
isInitialized = true;
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
RedirectIOToConsole(); RedirectIOToConsole();
#endif #endif
...@@ -83,6 +87,11 @@ int GmshSetMessageHandler(GmshMessage *callback) ...@@ -83,6 +87,11 @@ int GmshSetMessageHandler(GmshMessage *callback)
return 1; return 1;
} }
GmshMessage *GmshGetMessageHandler()
{
return Msg::GetCallback();
}
int GmshSetBoundingBox(double xmin, double xmax, int GmshSetBoundingBox(double xmin, double xmax,
double ymin, double ymax, double ymin, double ymax,
double zmin, double zmax) double zmin, double zmax)
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
int GmshInitialize(int argc=0, char **argv=0); int GmshInitialize(int argc=0, char **argv=0);
int GmshSetMessageHandler(GmshMessage *callback); int GmshSetMessageHandler(GmshMessage *callback);
GmshMessage *GmshGetMessageHandler();
int GmshSetBoundingBox(double xmin, double xmax, int GmshSetBoundingBox(double xmin, double xmax,
double ymin, double ymax, double ymin, double ymax,
double zmin, double zmax); double zmin, double zmax);
......
...@@ -56,6 +56,7 @@ class Msg { ...@@ -56,6 +56,7 @@ class Msg {
static void SetCommRank(int val){ _commRank = val; } static void SetCommRank(int val){ _commRank = val; }
static void SetCommSize(int val){ _commSize = val; } static void SetCommSize(int val){ _commSize = val; }
static void SetCallback(GmshMessage *callback){ _callback = callback; } static void SetCallback(GmshMessage *callback){ _callback = callback; }
static GmshMessage *GetCallback(){ return _callback; }
static void Barrier(); static void Barrier();
static int GetNumThreads(); static int GetNumThreads();
static int GetMaxThreads(); static int GetMaxThreads();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment