From ba5b3a07dd41a933b3566eebd322ec6b0fd727a6 Mon Sep 17 00:00:00 2001 From: Bryn Lloyd Date: Wed, 29 May 2019 16:35:39 +0200 Subject: [PATCH] expose Ng_SetTerminate for nglib --- nglib/nglib.cpp | 14 +++++++++++++- nglib/nglib.h | 10 ++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp index 4e189c86..b692ce46 100644 --- a/nglib/nglib.cpp +++ b/nglib/nglib.cpp @@ -44,7 +44,6 @@ namespace netgen } #endif - /* namespace netgen { @@ -101,6 +100,19 @@ namespace nglib } + DLL_HEADER void Ng_GetStatus(char ** str, double & percent) + { + ::netgen::MyStr s; + ::netgen::GetStatus(s, percent); + *str = new char[s.Length() + 1]; + strcpy(*str, s.c_str()); + } + + + DLL_HEADER void Ng_SetTerminate(bool abort) + { + ::netgen::multithread.terminate = abort ? 1 : 0; + } // Clean-up functions before ending usage of nglib diff --git a/nglib/nglib.h b/nglib/nglib.h index eb8c312d..913b66a5 100644 --- a/nglib/nglib.h +++ b/nglib/nglib.h @@ -250,6 +250,16 @@ DLL_HEADER void Ng_Init (bool cout_to_null = false, bool cerr_to_null = false, b DLL_HEADER void Ng_Exit (); +/*! \brief Get current status, e.g. info string and percent +*/ +DLL_HEADER void Ng_GetStatus(char ** str, double & percent); + + +/*! \brief Set abort flag +*/ +DLL_HEADER void Ng_SetTerminate(bool abort); + + /*! \brief Create a new (and empty) Netgen Mesh Structure This function creates a new Netgen Mesh, initialises