From e5d89a2b835e2f730f741e64e23dd859ac53aa27 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@uliege.be> Date: Sat, 18 Dec 2021 10:34:18 +0100 Subject: [PATCH] return view, if any --- Plugin/AnalyseMeshQuality.cpp | 9 +++++---- demos/api/mesh_quality.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Plugin/AnalyseMeshQuality.cpp b/Plugin/AnalyseMeshQuality.cpp index fb181966aa..9d9f9e52d2 100644 --- a/Plugin/AnalyseMeshQuality.cpp +++ b/Plugin/AnalyseMeshQuality.cpp @@ -177,6 +177,7 @@ PView *GMSH_AnalyseMeshQualityPlugin::execute(PView *v) #endif // Create PView + PView *view = nullptr; if(createView) { for(int dim = 1; dim <= 3; ++dim) { if((askedDim == 4 && dim > 1) || dim == askedDim) { @@ -197,7 +198,7 @@ PView *GMSH_AnalyseMeshQualityPlugin::execute(PView *v) if(dataPV.size()) { std::stringstream name; name << "minJ/maxJ " << dim << "D"; - new PView(name.str().c_str(), "ElementData", _m, dataPV); + view = new PView(name.str().c_str(), "ElementData", _m, dataPV); } } if(!_pviewIGE[dim - 1] && computeIGE) { @@ -211,7 +212,7 @@ PView *GMSH_AnalyseMeshQualityPlugin::execute(PView *v) if(dataPV.size()) { std::stringstream name; name << "IGE " << dim << "D"; - new PView(name.str().c_str(), "ElementData", _m, dataPV); + view = new PView(name.str().c_str(), "ElementData", _m, dataPV); } } if(!_pviewICN[dim - 1] && computeICN) { @@ -225,7 +226,7 @@ PView *GMSH_AnalyseMeshQualityPlugin::execute(PView *v) if(dataPV.size()) { std::stringstream name; name << "ICN " << dim << "D"; - new PView(name.str().c_str(), "ElementData", _m, dataPV); + view = new PView(name.str().c_str(), "ElementData", _m, dataPV); } } } @@ -242,7 +243,7 @@ PView *GMSH_AnalyseMeshQualityPlugin::execute(PView *v) #endif } - return nullptr; + return view; } void GMSH_AnalyseMeshQualityPlugin::_computeMinMaxJandValidity(int dim) diff --git a/demos/api/mesh_quality.py b/demos/api/mesh_quality.py index 2660c739c1..2289b89e2e 100644 --- a/demos/api/mesh_quality.py +++ b/demos/api/mesh_quality.py @@ -9,9 +9,9 @@ gmsh.model.mesh.generate(3) gmsh.plugin.setNumber("AnalyseMeshQuality", "ICNMeasure", 1.) gmsh.plugin.setNumber("AnalyseMeshQuality", "CreateView", 1.) -gmsh.plugin.run("AnalyseMeshQuality") +t = gmsh.plugin.run("AnalyseMeshQuality") -dataType, tags, data, time, numComp = gmsh.view.getModelData(0, 0) +dataType, tags, data, time, numComp = gmsh.view.getModelData(t, 0) print('ICN for element {0} = {1}'.format(tags[0], data[0])) -- GitLab