netgen/libsrc/meshing/debugging.hpp

54 lines
1.4 KiB
C++
Raw Normal View History

2024-03-22 19:44:24 +05:00
#include "meshing.hpp"
2024-03-25 00:39:50 +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();
2024-03-25 00:39:50 +05:00
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(); }
2024-03-22 19:44:24 +05:00
private:
thread gui_thread;
void *app, *loop, *token;
std::set<void*> websockets;
json data;
2024-03-25 00:39:50 +05:00
shared_ptr<Mesh> mesh;
2024-03-22 19:44:24 +05:00
void Send(const json& data) { Send(data.dump()); }
void Send(const string& message);
};
extern DebuggingGUI debug_gui;
#endif // NETGEN_DEBUGGING_GUI
} // namespace netgen