From cf6db03e55603c27f9e99cbd45e789c1d0820bf2 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@uliege.be>
Date: Sun, 8 May 2022 14:02:15 +0200
Subject: [PATCH] interactive debug

---
 src/plugin/Crack.cpp | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/plugin/Crack.cpp b/src/plugin/Crack.cpp
index f78eb233b0..694ebfb027 100644
--- a/src/plugin/Crack.cpp
+++ b/src/plugin/Crack.cpp
@@ -22,7 +22,7 @@ StringXNumber CrackOptions_Number[] = {
   {GMSH_FULLRC, "NormalY", nullptr, 0.},
   {GMSH_FULLRC, "NormalZ", nullptr, 1.},
   {GMSH_FULLRC, "NewPhysicalGroup", nullptr, 0},
-  {GMSH_FULLRC, "Debug", nullptr, 0}
+  {GMSH_FULLRC, "DebugView", nullptr, 0}
 };
 
 extern "C" {
@@ -249,16 +249,10 @@ PView *GMSH_CrackPlugin::execute(PView *view)
   }
 
   if(debug) {
-    Msg::Info("Writing 'debug.pos' file with elements detected on one side "
-              "of the crack");
-    FILE *fp = fopen("debug.pos", "w");
-    if(fp){
-      fprintf(fp, "View \"Elements on one side\" {\n");
-      for(auto it = oneside.begin(); it != oneside.end(); it++)
-        (*it)->writePOS(fp, false, true, false, false, false, false);
-      fprintf(fp, "};\n");
-      fclose(fp);
-    }
+    std::map<int, std::vector<double> > d;
+    for(auto e : oneside) d[e->getNum()] = {(double)e->getNum()};
+    view = new PView("Elements on one side of crack", "ElementData",
+                     GModel::current(), d);
   }
 
   // create new crack entity
-- 
GitLab