2022-04-27 16:42:04 +05:00
|
|
|
#ifndef VISUAL_INTERFACE_HPP_INCLUDED
|
|
|
|
#define VISUAL_INTERFACE_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include <mystdlib.h>
|
|
|
|
#include <meshing.hpp>
|
2022-05-06 15:02:28 +05:00
|
|
|
#include <myadt.hpp>
|
2022-04-27 16:42:04 +05:00
|
|
|
|
2023-08-05 15:01:01 +05:00
|
|
|
struct Ng_SolutionData;
|
2022-04-27 16:42:04 +05:00
|
|
|
|
|
|
|
// Function pointers for visualization purposed, all set to nullptr by default and initialized correctly when the GUI library is loaded
|
|
|
|
|
|
|
|
DLL_HEADER extern void (*Ptr_Ng_ClearSolutionData) ();
|
|
|
|
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_Redraw) (bool blocking);
|
|
|
|
|
2022-05-06 15:02:28 +05:00
|
|
|
// Tcl wrapper functions
|
2023-08-05 15:01:01 +05:00
|
|
|
struct Tcl_Interp;
|
2022-05-06 15:02:28 +05:00
|
|
|
typedef int (Tcl_CmdProc) (void * clientData, Tcl_Interp *interp,
|
|
|
|
int argc, const char *argv[]);
|
2022-05-07 22:40:16 +05:00
|
|
|
typedef void (Tcl_FreeProc) (char *blockPtr);
|
|
|
|
|
2022-04-27 16:42:04 +05:00
|
|
|
namespace netgen {
|
2022-05-07 22:45:38 +05:00
|
|
|
/*
|
2022-05-07 22:54:43 +05:00
|
|
|
inline constexpr int NG_TCL_VOLATILE = 1;
|
|
|
|
inline constexpr int NG_TCL_STATIC = 0;
|
|
|
|
inline constexpr int NG_TCL_DYNAMIC = 3;
|
2022-05-07 22:45:38 +05:00
|
|
|
*/
|
2022-05-07 22:54:43 +05:00
|
|
|
|
|
|
|
#define NG_TCL_VOLATILE ((Tcl_FreeProc *) 1)
|
|
|
|
#define NG_TCL_STATIC ((Tcl_FreeProc *) 0)
|
|
|
|
#define NG_TCL_DYNAMIC ((Tcl_FreeProc *) 3)
|
|
|
|
|
2022-05-06 15:02:28 +05:00
|
|
|
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;
|
2022-05-07 22:40:16 +05:00
|
|
|
DLL_HEADER extern void (*Ptr_Ng_Tcl_SetResult)(Tcl_Interp *interp, char *result, Tcl_FreeProc *freeProc);
|
2022-05-06 15:02:28 +05:00
|
|
|
DLL_HEADER extern void (*Ptr_Ng_Tcl_CreateCommand)(Tcl_Interp *interp,
|
|
|
|
const char *cmdName, Tcl_CmdProc *proc);
|
|
|
|
|
2022-04-27 16:42:04 +05:00
|
|
|
DLL_HEADER extern void (*Ptr_Render)(bool);
|
|
|
|
DLL_HEADER extern void (*Ptr_UpdateVisSurfaceMeshData)(int,
|
|
|
|
shared_ptr<NgArray<Point<3>>>,
|
|
|
|
shared_ptr<NgArray<INDEX_2>>,
|
|
|
|
shared_ptr<NgArray<Point<2>>>
|
|
|
|
);
|
|
|
|
|
|
|
|
inline void Render(bool blocking = false) { if(Ptr_Render) Ptr_Render(blocking); }
|
|
|
|
inline void UpdateVisSurfaceMeshData(int oldnl,
|
|
|
|
shared_ptr<NgArray<Point<3>>> locpointsptr = nullptr,
|
|
|
|
shared_ptr<NgArray<INDEX_2>> loclinesptr = nullptr,
|
|
|
|
shared_ptr<NgArray<Point<2>>> plainpointsptr = nullptr
|
|
|
|
) {
|
|
|
|
if(Ptr_UpdateVisSurfaceMeshData) Ptr_UpdateVisSurfaceMeshData(oldnl, locpointsptr, loclinesptr, plainpointsptr);
|
|
|
|
}
|
2022-05-06 15:02:28 +05:00
|
|
|
|
2022-05-07 22:40:16 +05:00
|
|
|
inline void Ng_Tcl_SetResult(Tcl_Interp *interp, char *result, Tcl_FreeProc *freeProc)
|
2022-05-06 15:02:28 +05:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2022-04-27 16:42:04 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // VISUAL_INTERFACE_HPP_INCLUDED
|