From dd91ee2a62b7d28e3c57367336d06ef8d6cfbb22 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 22 Jan 2009 09:19:47 +0000
Subject: [PATCH] fix crash for adaptive view with element data

---
 Post/PViewDataGModel.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp
index 5ac90c84c8..4207811925 100644
--- a/Post/PViewDataGModel.cpp
+++ b/Post/PViewDataGModel.cpp
@@ -340,16 +340,19 @@ int PViewDataGModel::getNumValues(int step, int ent, int ele)
   if(_type == ElementNodeData || _type == NodeData){
     return getNumNodes(step, ent, ele) * getNumComponents(step, ent, ele);
   }
+  else if(_type == ElementData){
+    return getNumComponents(step, ent, ele);
+  }
   else{
-    Msg::Error("getNumValues should not be used on this type of view");
-    return 0;
+    Msg::Error("getNumValue() should not be used on this type of view");
+    return getNumComponents(step, ent, ele);
   }
 }
 
 void PViewDataGModel::getValue(int step, int ent, int ele, int idx, double &val)
 {
   MElement *e = _getElement(step, ent, ele);
-  if(_type == ElementNodeData){
+  if(_type == ElementNodeData || _type == ElementData){
     val = _steps[step]->getData(e->getNum())[idx];
   }
   else if(_type == NodeData){
-- 
GitLab