From 6f2525933ffcf6f49a21bb7a0a01e61ceffc7149 Mon Sep 17 00:00:00 2001
From: Amaury Johnen <amaury.johnen@uclouvain.be>
Date: Mon, 14 Aug 2017 17:01:39 +0200
Subject: [PATCH] qualtiy IGE

---
 Mesh/qualityMeasuresJacobian.cpp |  1 +
 Plugin/AnalyseCurvedMesh.cpp     | 25 +++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/Mesh/qualityMeasuresJacobian.cpp b/Mesh/qualityMeasuresJacobian.cpp
index b882e54b5c..2742a07978 100644
--- a/Mesh/qualityMeasuresJacobian.cpp
+++ b/Mesh/qualityMeasuresJacobian.cpp
@@ -465,6 +465,7 @@ void sampleIGEMeasure(MElement *el, int deg, fullVector<double> &ige)
 
   fullMatrix<double> coeffMatLag(gradBasis->getNumSamplingPoints(), 9);
   gradBasis->getAllGradientsFromNodes(nodesXYZ, coeffMatLag);
+  if (el->getDim() == 2) coeffMatLag.resize(coeffMatLag.size1(), 6, false);
 
   fullMatrix<double> v;
   computeCoeffLengthVectors_(coeffMatLag, v, type);
diff --git a/Plugin/AnalyseCurvedMesh.cpp b/Plugin/AnalyseCurvedMesh.cpp
index 28523f8db4..f60bb542a4 100644
--- a/Plugin/AnalyseCurvedMesh.cpp
+++ b/Plugin/AnalyseCurvedMesh.cpp
@@ -618,6 +618,8 @@ void GMSH_AnalyseCurvedMeshPlugin::_addElementInEntity(MElement *element,
 void GMSH_AnalyseCurvedMeshPlugin::_createPViewElementToScan()
 {
   if (!_hoElement) return;
+  const nodalBasis *fs = BasisFactory::getNodalBasis(_hoElement->getTypeForMSH());
+  const polynomialBasis *pfs = dynamic_cast<const polynomialBasis*>(fs);
 
   // Jacobian determinant
   std::map<int, std::vector<double>> dataPView;
@@ -626,13 +628,32 @@ void GMSH_AnalyseCurvedMeshPlugin::_createPViewElementToScan()
   name << "Jacobian elem " << _numElementToScan;
   PView *view = new PView(name.str().c_str(), "ElementNodeData",
                           _m, dataPView, 0, 1);
-  const nodalBasis *fs = BasisFactory::getNodalBasis(_hoElement->getTypeForMSH());
-  const polynomialBasis *pfs = dynamic_cast<const polynomialBasis*>(fs);
   PViewData *viewData = view->getData();
   viewData->deleteInterpolationMatrices(_hoElement->getType());
   viewData->setInterpolationMatrices(_hoElement->getType(),
                                      pfs->coefficients, pfs->monomials,
                                      pfs->coefficients, pfs->monomials);
+//  PView *view;
+//  PViewData *viewData;
+
+  // Quality measures
+  fullVector<double> ige;
+  jacobianBasedQuality::sampleIGEMeasure(_elementToScan, _viewOrder, ige);
+
+  //std::map<int, std::vector<double>> dataPView2;
+  dataPView[_hoElement->getNum()].clear();
+  for (int j = 0; j < ige.size(); ++j) {
+    dataPView[_hoElement->getNum()].push_back(ige(j));
+  }
+  name.str(std::string());
+  name << "IGE elem " << _numElementToScan;
+//  BUG, essayer en créant de nouveau dataPView
+  view = new PView(name.str().c_str(), "ElementNodeData", _m, dataPView, 0, 1);
+  viewData = view->getData();
+  viewData->deleteInterpolationMatrices(_hoElement->getType());
+  viewData->setInterpolationMatrices(_hoElement->getType(),
+                                     pfs->coefficients, pfs->monomials,
+                                     pfs->coefficients, pfs->monomials);
 }
 
 #endif
-- 
GitLab