netgen/libsrc/meshing/debugging.hpp

52 lines
1.3 KiB
C++
Raw Normal View History

2024-03-22 19:44:24 +05:00
#include "meshing.hpp"
2024-03-22 19:44:24 +05:00
#define NETGEN_DEBUGGING_GUI
2024-03-22 19:44:24 +05:00
#ifdef NETGEN_DEBUGGING_GUI
#include "json.hpp"
using json = nlohmann::json;
#endif // NETGEN_DEBUGGING_GUI
2024-03-22 19:44:24 +05:00
namespace netgen {
unique_ptr<Mesh> GetOpenElements(const Mesh& m, int dom = 0);
2024-03-22 19:44:24 +05:00
unique_ptr<Mesh> FilterMesh(
const Mesh& m, FlatArray<PointIndex> points,
FlatArray<SurfaceElementIndex> sels = Array<SurfaceElementIndex>{},
FlatArray<ElementIndex> els = Array<ElementIndex>{});
2024-03-22 19:44:24 +05:00
#ifdef NETGEN_DEBUGGING_GUI
class DebuggingGUI {
public:
DebuggingGUI();
~DebuggingGUI();
2024-03-22 19:44:24 +05:00
void Start();
void Stop();
void DrawMesh(const string& name, const Mesh& m);
void DrawPoints(const string& name, const Mesh& m,
FlatArray<PointIndex> points);
void DrawLines(const string& name, const Mesh& m,
FlatArray<SegmentIndex> lines);
void DrawTrigs(const string& name, const Mesh& m,
FlatArray<SurfaceElementIndex> trigs);
void DrawTets(const string& name, const Mesh& m,
FlatArray<ElementIndex> tets);
void AddComponent(const Mesh& m);
private:
thread gui_thread;
void *app, *loop, *token;
std::set<void*> websockets;
json data;
void Send(const json& data) { Send(data.dump()); }
void Send(const string& message);
};
extern DebuggingGUI debug_gui;
#endif // NETGEN_DEBUGGING_GUI
} // namespace netgen