From c7d65522a5c99b9921f27d3ab2427311e668d5cb Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 14 Sep 2009 08:40:13 +0000
Subject: [PATCH] allow direct creation of ElementNodeData views

---
 Post/PView.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/Post/PView.cpp b/Post/PView.cpp
index 3c23f24029..247517a32e 100644
--- a/Post/PView.cpp
+++ b/Post/PView.cpp
@@ -98,8 +98,18 @@ PView::PView(std::string name, std::string type,
              double time)
 {
   _init();
-  PViewDataGModel *d = new PViewDataGModel
-    ((type == "NodeData") ? PViewDataGModel::NodeData : PViewDataGModel::ElementData);
+  PViewDataGModel::DataType t;
+  if(type == "NodeData")
+    t = PViewDataGModel::NodeData;
+  else if(type == "ElementData")
+    t = PViewDataGModel::ElementData;
+  else if(type == "ElementNodeData")
+    t = PViewDataGModel::ElementNodeData;
+  else{
+    Msg::Error("Unknown type of view to create '%s'", type.c_str());
+    return;
+  }
+  PViewDataGModel *d = new PViewDataGModel(t);
   d->addData(model, data, 0, time, 1);
   d->setName(name);
   d->setFileName(name + ".msh");
-- 
GitLab