From e77c8677e177b3e408b9ca9063559a63bf4bf345 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (home)" <j.wuttke@fz-juelich.de>
Date: Tue, 13 Jan 2015 19:45:24 +0100
Subject: [PATCH] ctd

---
 pub/lib/node.cpp | 22 ++++++++++------------
 pub/lib/node.hpp |  3 ---
 pub/lib/obj.hpp  |  2 +-
 3 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/pub/lib/node.cpp b/pub/lib/node.cpp
index f717e160..04a8ab06 100644
--- a/pub/lib/node.cpp
+++ b/pub/lib/node.cpp
@@ -313,9 +313,10 @@ const RObj CNodeGeni::tree_val( const CContext& ctx ) const
                 has_error = true;
         }
         // Now evaluate the function.
-        PObjDble pret( new CObjDble() );
-        geni->eval( &(pret->val), (ctx.want_error && has_error) ? &(pret->err) : NULL, n, pav );
-        return pret;
+        double val, err;
+        geni->eval( &val, (ctx.want_error && has_error) ? &err : NULL, n, pav );
+        return PObjDble( new CObjDble( val, err ) );
+
     } catch( string& ex ) {
         throw ex+" in NodeGeni "+tree_info()+" {context="+ctx.context_info()+"}";
     }
@@ -415,11 +416,9 @@ const RObj CNodeCvin::tree_val( const CContext& ctx ) const
             throw S("This is not a curve file => cannot integrate");
         int j = ref->get_j( ctx, f->nJ() );
         // now evaluate the function
-        PObjDble pret( new CObjDble() );
-        cvin->eval( &(PCAST<CObjDble>(pret)->val),
-                    (ctx.want_error && has_error) ? &(PCAST<CObjDble>(pret)->err) : NULL,
-                    fc, k, j, a );
-        return pret;
+        double val, err;
+        cvin->eval( &val, (ctx.want_error && has_error) ? &err : NULL, fc, k, j, a );
+        return PObjDble( new CObjDble( val, err ) );
     } catch( string& ex ) {
         throw ex+" in NodeCvin "+tree_info()+" {context="+ctx.context_info()+"}";
     }
@@ -832,10 +831,9 @@ const RObj CNodeCev::tree_val( const CContext& ctx ) const
                                pav->v, k, j );
             return pret;
         } else if ( RObjDble par = PCAST<const CObjDble>(farg) ) {
-            PObjDble pret( new CObjDble() );
-            fc->curve_val_sca( &(pret->val), ctx.want_error? &(pret->err) : NULL,
-                               par->val, k, j );
-            return pret;
+            double val, err;
+            fc->curve_val_sca( &val, ctx.want_error? &err : NULL, par->val, k, j );
+            return PObjDble( new CObjDble( val, err ) );
         } else
             throw S("unexpected argument type");
     } catch( string& ex ) {
diff --git a/pub/lib/node.hpp b/pub/lib/node.hpp
index a1ca1241..e350b14e 100644
--- a/pub/lib/node.hpp
+++ b/pub/lib/node.hpp
@@ -35,7 +35,6 @@ class CNodeFun: public CNode {
 class CNodeFun1: public CNodeFun {
  public:
     CNodeFun1( const class CFunc *_fu, PNode a0 );
-//    const RObj tree_val( const CContext& ctx ) const;
     void set_coord( CCoord& ret, int k ) const;
     string tree_info() const;
 };
@@ -45,7 +44,6 @@ class CNodeFun1: public CNodeFun {
 class CNodeFun2: public CNodeFun {
  public:
     CNodeFun2( const class CFunc *_fu, PNode a0, PNode a1 );
-//    const RObj tree_val( const CContext& ctx ) const;
     void set_coord( CCoord& ret, int k ) const;
     string tree_info() const;
 };
@@ -55,7 +53,6 @@ class CNodeFun2: public CNodeFun {
 class CNodeFun3: public CNodeFun {
  public:
     CNodeFun3( const class CFunc *_fu, PNode a0, PNode a1, PNode a2 );
-//    const RObj tree_val( const CContext& ctx ) const;
     void set_coord( CCoord& ret, int k ) const;
     string tree_info() const;
 };
diff --git a/pub/lib/obj.hpp b/pub/lib/obj.hpp
index 8200cc7a..87cd4276 100644
--- a/pub/lib/obj.hpp
+++ b/pub/lib/obj.hpp
@@ -59,7 +59,7 @@ class CObjDble : public CObjNumber {
  public:
     double val;         //!< Scalar value.
     double err;         //!< Error of scalar value.
-    CObjDble( double _val=NAN, double _err=0 ) : CObjNumber(), val(_val), err(_err) {};
+    CObjDble( double _val, double _err=0 ) : CObjNumber(), val(_val), err(_err) {};
     bool has_err() const { return err>=0; };
     char base_type() const { return has_err() ? 'e' : 'd'; };
     string result_info() const;
-- 
GitLab