From f242fb6a8a2d7b2383a592df378ef750c3dfac41 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 6 Apr 2009 06:55:48 +0000
Subject: [PATCH] *** empty log message ***

---
 Plugin/Evaluate.cpp | 21 ++++++++++-----------
 Plugin/Plugin.cpp   |  2 +-
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/Plugin/Evaluate.cpp b/Plugin/Evaluate.cpp
index 3c82869891..442ecfd933 100644
--- a/Plugin/Evaluate.cpp
+++ b/Plugin/Evaluate.cpp
@@ -155,7 +155,12 @@ PView *GMSH_EvaluatePlugin::execute(PView *v)
     externalTimeStep = 0;
   }
 
-  v1->setChanged(true);
+#if defined(HAVE_MATH_EVAL)
+  void *f = evaluator_create((char*)expr);
+  if(!f){
+    Msg::Error("Invalid expression '%s'", expr);
+    return v;
+  }
 
   OctreePost *octree = 0;
   if((data1->getNumEntities() != data2->getNumEntities()) ||
@@ -163,13 +168,8 @@ PView *GMSH_EvaluatePlugin::execute(PView *v)
     Msg::Info("External view based on different grid: interpolating...");
     octree = new OctreePost(v2);
   }
-  
-#if defined(HAVE_MATH_EVAL)
-  void *f = evaluator_create((char*)expr);
-  if(!f){
-    Msg::Error("Invalid expression '%s'", expr);
-    return v;
-  }
+
+  v1->setChanged(true);
 
   for(int step = 0; step < data1->getNumTimeSteps(); step++){
     if(timeStep >= 0 && timeStep != step) continue;
@@ -219,7 +219,7 @@ PView *GMSH_EvaluatePlugin::execute(PView *v)
                v[comp], v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8],
                w[comp], w[0], w[1], w[2], w[3], w[4], w[5], w[6], w[7], w[8]};
             double res = evaluator_evaluate
-              (f, sizeof(names)/sizeof(names[0]), names, values);
+              (f, sizeof(names) / sizeof(names[0]), names, values);
             data1->setValue(step, ent, ele, nod, comp, res);
             data1->tagNode(step, ent, ele, nod, 1);
           }
@@ -228,12 +228,11 @@ PView *GMSH_EvaluatePlugin::execute(PView *v)
     }
   }
   evaluator_destroy(f);
+  if(octree) delete octree;
 #else
   Msg::Error("MathEval is not compiled in this version of Gmsh");
 #endif
 
-  if(octree) delete octree;
-
   data1->finalize();
 
   return v1;
diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp
index 37b63f40ab..f432ea83c7 100644
--- a/Plugin/Plugin.cpp
+++ b/Plugin/Plugin.cpp
@@ -29,7 +29,7 @@ PViewDataList *GMSH_PostPlugin::getDataList(PView *view)
   }
   else{
     // FIXME: do automatic data conversion here
-    Msg::Error("This plugin can only be run on list-based datasets");
+    Msg::Error("This plugin can only be run on list-based views (`.pos' files)");
     return 0;
   }
 }
-- 
GitLab