move ngtcl.hpp interface to meshing/visual_interface.hpp

This commit is contained in:
Matthias Hochsteger 2022-05-06 12:02:28 +02:00
parent 22e57a1159
commit 165947295e
6 changed files with 42 additions and 57 deletions

View File

@ -12,6 +12,7 @@
/**************************************************************************/ /**************************************************************************/
#include "mydefs.hpp" #include "mydefs.hpp"
#include <meshing/visual_interface.hpp>
/* /*
Application program interface to Netgen Application program interface to Netgen
@ -451,15 +452,6 @@ extern "C" {
return value is number of nodes return value is number of nodes
*/ */
DLL_HEADER int Ng_GetElementClosureNodes (int dim, int elementnr, int nodeset, int * nodes); DLL_HEADER int Ng_GetElementClosureNodes (int dim, int elementnr, int nodeset, int * nodes);
struct Ng_Tcl_Interp;
typedef int (Ng_Tcl_CmdProc) (Ng_Tcl_Interp *interp, int argc, const char *argv[]);
DLL_HEADER void Ng_Tcl_CreateCommand (Ng_Tcl_Interp * interp,
const char * cmdName, Ng_Tcl_CmdProc * proc);
void Ng_Tcl_SetResult (Ng_Tcl_Interp * interp, const char * result);
} }

View File

@ -13,6 +13,9 @@ void Ng_Redraw (bool blocking) { if(Ptr_Ng_Redraw) Ptr_Ng_Redraw(blocking); }
namespace netgen namespace netgen
{ {
void (*Ptr_Ng_Tcl_SetResult)(Tcl_Interp *interp, char *result, const int freeProc) = nullptr;
void (*Ptr_Ng_Tcl_CreateCommand)(Tcl_Interp *interp,
const char *cmdName, Tcl_CmdProc *proc) = nullptr;
void (*Ptr_Render)(bool) = nullptr; void (*Ptr_Render)(bool) = nullptr;
void (*Ptr_UpdateVisSurfaceMeshData)(int, void (*Ptr_UpdateVisSurfaceMeshData)(int,
shared_ptr<NgArray<Point<3>>>, shared_ptr<NgArray<Point<3>>>,
@ -20,3 +23,4 @@ namespace netgen
shared_ptr<NgArray<Point<2>>> shared_ptr<NgArray<Point<2>>>
) = nullptr; ) = nullptr;
} // namespace netgen } // namespace netgen

View File

@ -3,6 +3,7 @@
#include <mystdlib.h> #include <mystdlib.h>
#include <meshing.hpp> #include <meshing.hpp>
#include <myadt.hpp>
class Ng_SolutionData; class Ng_SolutionData;
@ -13,7 +14,25 @@ DLL_HEADER extern void (*Ptr_Ng_InitSolutionData) (Ng_SolutionData * soldata);
DLL_HEADER extern void (*Ptr_Ng_SetSolutionData) (Ng_SolutionData * soldata); DLL_HEADER extern void (*Ptr_Ng_SetSolutionData) (Ng_SolutionData * soldata);
DLL_HEADER extern void (*Ptr_Ng_Redraw) (bool blocking); DLL_HEADER extern void (*Ptr_Ng_Redraw) (bool blocking);
// Tcl wrapper functions
class Tcl_Interp;
typedef int (Tcl_CmdProc) (void * clientData, Tcl_Interp *interp,
int argc, const char *argv[]);
namespace netgen { namespace netgen {
inline constexpr int NG_TCL_VOLATILE = 1;
inline constexpr int NG_TCL_STATIC = 0;
inline constexpr int NG_TCL_DYNAMIC = 3;
inline constexpr int NG_TCL_OK = 0;
inline constexpr int NG_TCL_ERROR = 1;
inline constexpr int NG_TCL_RETURN = 2;
inline constexpr int NG_TCL_BREAK = 3;
inline constexpr int NG_TCL_CONTINUE = 4;
DLL_HEADER extern void (*Ptr_Ng_Tcl_SetResult)(Tcl_Interp *interp, char *result, const int freeProc);
DLL_HEADER extern void (*Ptr_Ng_Tcl_CreateCommand)(Tcl_Interp *interp,
const char *cmdName, Tcl_CmdProc *proc);
DLL_HEADER extern void (*Ptr_Render)(bool); DLL_HEADER extern void (*Ptr_Render)(bool);
DLL_HEADER extern void (*Ptr_UpdateVisSurfaceMeshData)(int, DLL_HEADER extern void (*Ptr_UpdateVisSurfaceMeshData)(int,
shared_ptr<NgArray<Point<3>>>, shared_ptr<NgArray<Point<3>>>,
@ -29,6 +48,17 @@ namespace netgen {
) { ) {
if(Ptr_UpdateVisSurfaceMeshData) Ptr_UpdateVisSurfaceMeshData(oldnl, locpointsptr, loclinesptr, plainpointsptr); if(Ptr_UpdateVisSurfaceMeshData) Ptr_UpdateVisSurfaceMeshData(oldnl, locpointsptr, loclinesptr, plainpointsptr);
} }
inline void Ng_Tcl_SetResult(Tcl_Interp *interp, char *result, const int freeProc)
{
if(Ptr_Ng_Tcl_SetResult)
Ptr_Ng_Tcl_SetResult(interp, result, freeProc);
}
inline void Ng_Tcl_CreateCommand(Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc)
{
if(Ptr_Ng_Tcl_CreateCommand)
Ptr_Ng_Tcl_CreateCommand(interp, cmdName, proc);
}
} }
#endif // VISUAL_INTERFACE_HPP_INCLUDED #endif // VISUAL_INTERFACE_HPP_INCLUDED

View File

@ -15,7 +15,7 @@ target_sources(nglib PRIVATE onetcl.cpp)
if(USE_GUI) if(USE_GUI)
target_sources(nggui PRIVATE target_sources(nggui PRIVATE
gui.cpp ngpkg.cpp demoview.cpp parallelfunc.cpp ngtcl.cpp gui.cpp ngpkg.cpp demoview.cpp parallelfunc.cpp
) )
if(NOT BUILD_FOR_CONDA) if(NOT BUILD_FOR_CONDA)
@ -71,9 +71,5 @@ if(USE_GUI)
endif() endif()
add_subdirectory(Togl2.1) add_subdirectory(Togl2.1)
install(FILES
ngtcl.hpp
DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel
)
endif(USE_GUI) endif(USE_GUI)

View File

@ -1,16 +1,9 @@
#include "ngtcl.hpp" #include "../libsrc/meshing/visual_interface.hpp"
#include <inctcl.hpp> #include <inctcl.hpp>
namespace netgen static bool dummy_init_pointers = [](){
{ Ptr_Ng_Tcl_SetResult = Tcl_SetResult;
void Ng_Tcl_SetResult(Tcl_Interp *interp, char *result, const int freeProc) Ptr_Ng_Tcl_CreateCommand = Tcl_CreateCommand;
{ return true;
Tcl_SetResult(interp, result, (Tcl_FreeProc*)freeProc); }();
}
void Ng_Tcl_CreateCommand(Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc)
{
Tcl_CreateCommand(interp, cmdName, proc, nullptr, nullptr);
}
}

View File

@ -1,30 +0,0 @@
#ifndef FILE_NG_TCL_HPP
#define FILE_NG_TCL_HPP
#include <myadt.hpp>
class Tcl_Interp;
class Tcl_cmdProc;
namespace netgen
{
typedef int (Tcl_CmdProc) (void * clientData, Tcl_Interp *interp,
int argc, const char *argv[]);
inline constexpr int NG_TCL_VOLATILE = 1;
inline constexpr int NG_TCL_STATIC = 0;
inline constexpr int NG_TCL_DYNAMIC = 3;
inline constexpr int NG_TCL_OK = 0;
inline constexpr int NG_TCL_ERROR = 1;
inline constexpr int NG_TCL_RETURN = 2;
inline constexpr int NG_TCL_BREAK = 3;
inline constexpr int NG_TCL_CONTINUE = 4;
DLL_HEADER void Ng_Tcl_SetResult(Tcl_Interp *interp, char *result, const int freeProc);
DLL_HEADER void Ng_Tcl_CreateCommand(Tcl_Interp *interp,
const char *cmdName, Tcl_CmdProc *proc);
}
#endif // FILE_NG_TCL_HPP