File: visual_interface.hpp

package info (click to toggle)
netgen 6.2.2601%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,076 kB
  • sloc: cpp: 166,627; tcl: 6,310; python: 2,868; sh: 528; makefile: 90
file content (71 lines) | stat: -rw-r--r-- 2,744 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef VISUAL_INTERFACE_HPP_INCLUDED
#define VISUAL_INTERFACE_HPP_INCLUDED

#include <mystdlib.h>
#include <meshing.hpp>
#include <myadt.hpp>

struct Ng_SolutionData;

// 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);

// Tcl wrapper functions
struct Tcl_Interp;
typedef int (Tcl_CmdProc) (void * clientData, Tcl_Interp *interp,
        int argc, const char *argv[]);
typedef void (Tcl_FreeProc) (char *blockPtr);

namespace netgen {
  /*
  inline constexpr int NG_TCL_VOLATILE = 1;
  inline constexpr int NG_TCL_STATIC   = 0;
  inline constexpr int NG_TCL_DYNAMIC  = 3;
  */

#define NG_TCL_VOLATILE		((Tcl_FreeProc *) 1)
#define NG_TCL_STATIC		((Tcl_FreeProc *) 0)
#define NG_TCL_DYNAMIC		((Tcl_FreeProc *) 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, Tcl_FreeProc *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_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);
    }

    inline void Ng_Tcl_SetResult(Tcl_Interp *interp, char *result, Tcl_FreeProc *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