mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-15 10:28:34 +05:00
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
#include "meshing.hpp"
|
|
|
|
// #define NETGEN_DEBUGGING_GUI
|
|
|
|
#ifdef NETGEN_DEBUGGING_GUI
|
|
#include "json.hpp"
|
|
using json = nlohmann::json;
|
|
#endif // NETGEN_DEBUGGING_GUI
|
|
|
|
namespace netgen {
|
|
unique_ptr<Mesh> GetOpenElements(const Mesh& m, int dom = 0);
|
|
|
|
unique_ptr<Mesh> FilterMesh(
|
|
const Mesh& m, FlatArray<PointIndex> points,
|
|
FlatArray<SurfaceElementIndex> sels = Array<SurfaceElementIndex>{},
|
|
FlatArray<ElementIndex> els = Array<ElementIndex>{});
|
|
|
|
#ifdef NETGEN_DEBUGGING_GUI
|
|
class DebuggingGUI {
|
|
public:
|
|
DebuggingGUI();
|
|
~DebuggingGUI();
|
|
|
|
void Start();
|
|
void Stop();
|
|
|
|
void DrawMesh(const Mesh& m);
|
|
void DrawPoints(FlatArray<Point<3>> position, string name = "points",
|
|
string color = "black");
|
|
void DrawLines(FlatArray<Point<3>> position, string name = "lines",
|
|
string color = "black");
|
|
void DrawTrigs(FlatArray<Point<3>> position, string name = "trigs",
|
|
string color = "black");
|
|
|
|
void DrawObject(FlatArray<Point<3>> position, string type, string name,
|
|
string color);
|
|
void ResetObjects() { data["objects"] = json::array_t(); }
|
|
|
|
private:
|
|
thread gui_thread;
|
|
void *app, *loop, *token;
|
|
std::set<void*> websockets;
|
|
json data;
|
|
shared_ptr<Mesh> mesh;
|
|
|
|
void Send(const json& data) { Send(data.dump()); }
|
|
void Send(const string& message);
|
|
};
|
|
|
|
extern DebuggingGUI debug_gui;
|
|
#endif // NETGEN_DEBUGGING_GUI
|
|
|
|
} // namespace netgen
|