[Commits] [svn:einsteintoolkit] EOS_Omni/trunk/src/nuc_eos_cxx/ (Rev. 100)

rhaas at tapir.caltech.edu rhaas at tapir.caltech.edu
Wed Mar 12 22:01:52 CDT 2014


User: rhaas
Date: 2014/03/12 10:01 PM

Modified:
 /trunk/src/nuc_eos_cxx/
  nuc_eos_dpdrhoe_dpderho.cc, nuc_eos_full.cc, nuc_eos_press.cc, nuc_eos_press_cs2.cc, nuc_eos_short.cc

Log:
 EOS_Omni: always set anyerr when an error is detected
 
 consistently abort the EOS call when checkbounds fails
 
 From: Roland Haas <rhaas at tapir.caltech.edu>

File Changes:

Directory: /trunk/src/nuc_eos_cxx/
==================================

File [modified]: nuc_eos_dpdrhoe_dpderho.cc
Delta lines: +2 -2
===================================================================
--- trunk/src/nuc_eos_cxx/nuc_eos_dpdrhoe_dpderho.cc	2014-03-13 03:01:48 UTC (rev 99)
+++ trunk/src/nuc_eos_cxx/nuc_eos_dpdrhoe_dpderho.cc	2014-03-13 03:01:52 UTC (rev 100)
@@ -57,11 +57,11 @@
       nuc_eos_findtemp(lr,lt,ye[i],lxeps,*prec,
 		       (double *restrict)(&ltout),&keyerr[i]);
     } else {
+      // will be overwritten further down, only marks error
       keyerr[i] = 667;
-      *anyerr = 1;
     } // epstot > 0.0
 
-    if(keyerr[i] != 0) {
+    if(keyerr[i]) {
       // now try negative temperature treatment
       double eps0, eps1;
       int idx[8];

File [modified]: nuc_eos_full.cc
Delta lines: +8 -3
===================================================================
--- trunk/src/nuc_eos_cxx/nuc_eos_full.cc	2014-03-13 03:01:48 UTC (rev 99)
+++ trunk/src/nuc_eos_cxx/nuc_eos_full.cc	2014-03-13 03:01:52 UTC (rev 100)
@@ -41,10 +41,14 @@
     keyerr[i] = checkbounds(rho[i], temp[i], ye[i]);
     if(keyerr[i] != 0) {
       *anyerr = 1;
-      return;
     }
   }
 
+  // Abort if there is any error in checkbounds.
+  // This should never happen and the program should abort with
+  // a fatal error anyway. No point in doing any further EOS calculations.
+  if(*anyerr) return;
+
   for(int i=0;i<n;i++) {
   
     int idx[8];
@@ -218,11 +222,12 @@
 		       (double *restrict)(&ltout),&keyerr[i]);
     } else {
       keyerr[i] = 667;
-      *anyerr=1;
     } // epstot > 0.0
 
 
-    if(!keyerr[i]) {
+    if(keyerr[i]) {
+      *anyerr=1;
+    } else {
       temp[i] = exp(ltout);
       int idx[8];
       double delx,dely,delz;

File [modified]: nuc_eos_press.cc
Delta lines: +6 -1
===================================================================
--- trunk/src/nuc_eos_cxx/nuc_eos_press.cc	2014-03-13 03:01:48 UTC (rev 99)
+++ trunk/src/nuc_eos_cxx/nuc_eos_press.cc	2014-03-13 03:01:52 UTC (rev 100)
@@ -27,10 +27,14 @@
     keyerr[i] = checkbounds(rho[i], temp[i], ye[i]);
     if(keyerr[i] != 0) {
       *anyerr = 1;
-      return;
     }
   }
 
+  // Abort if there is any error in checkbounds.
+  // This should never happen and the program should abort with
+  // a fatal error anyway. No point in doing any further EOS calculations.
+  if(*anyerr) return;
+
   for(int i=0;i<n;i++) {
     int idx[8];
     double delx,dely,delz;
@@ -111,6 +115,7 @@
       nuc_eos_findtemp(lr,lt,ye[i],lxeps,*prec,
 		       (double *restrict)(&ltout),&keyerr[i]);
     } else {
+      // will be overwritten further down, only marks error
       keyerr[i] = 667;
     } // epstot > 0.0
 

File [modified]: nuc_eos_press_cs2.cc
Delta lines: +7 -3
===================================================================
--- trunk/src/nuc_eos_cxx/nuc_eos_press_cs2.cc	2014-03-13 03:01:48 UTC (rev 99)
+++ trunk/src/nuc_eos_cxx/nuc_eos_press_cs2.cc	2014-03-13 03:01:52 UTC (rev 100)
@@ -28,10 +28,14 @@
     keyerr[i] = checkbounds(rho[i], temp[i], ye[i]);
     if(keyerr[i] != 0) {
       *anyerr = 1;
-      return;
     }
   }
   
+  // Abort if there is any error in checkbounds.
+  // This should never happen and the program should abort with
+  // a fatal error anyway. No point in doing any further EOS calculations.
+  if(*anyerr) return;
+
   for(int i=0;i<n;i++) {
     int idx[8];
     double delx,dely,delz;
@@ -116,11 +120,11 @@
       nuc_eos_findtemp(lr,lt,ye[i],lxeps,*prec,
 		       (double *restrict)(&ltout),&keyerr[i]);
     } else {
+      // will be overwritten further down, only marks error
       keyerr[i] = 667;
-      *anyerr = 1;
     } // epstot > 0.0
 
-    if(keyerr[i] != 0) {
+    if(keyerr[i]) {
       // now try negative temperature treatment
       double eps0, eps1;
       int idx[8];

File [modified]: nuc_eos_short.cc
Delta lines: +12 -4
===================================================================
--- trunk/src/nuc_eos_cxx/nuc_eos_short.cc	2014-03-13 03:01:48 UTC (rev 99)
+++ trunk/src/nuc_eos_cxx/nuc_eos_short.cc	2014-03-13 03:01:52 UTC (rev 100)
@@ -33,10 +33,14 @@
     keyerr[i] = checkbounds(rho[i], temp[i], ye[i]);
     if(keyerr[i] != 0) {
       *anyerr = 1;
-      return;
     }
   }
 
+  // Abort if there is any error in checkbounds.
+  // This should never happen and the program should abort with
+  // a fatal error anyway. No point in doing any further EOS calculations.
+  if(*anyerr) return;
+
   for(int i=0;i<n;i++) {
   
     int idx[8];
@@ -154,12 +158,14 @@
       nuc_eos_findtemp(lr,lt,ye[i],lxeps,*prec,
 		       (double *restrict)(&ltout),&keyerr[i]);
     } else {
+      // will be overwritten further down, only marks error
       keyerr[i] = 667;
-      *anyerr=1;
     } // epstot > 0.0
 
 
-    if(!keyerr[i]) {
+    if(keyerr[i]) {
+      *anyerr = 1;
+    } else {
       temp[i] = exp(ltout);
       int idx[8];
       double delx,dely,delz;
@@ -258,7 +264,9 @@
       nuc_eos_findtemp_entropy(lr,lt,ye[i],ent[i],*prec,
 			       (double *restrict)(&ltout),&keyerr[i]);
 
-      if(!keyerr[i]) {
+      if(keyerr[i]) {
+        *anyerr = 1;
+      } else {
 	temp[i] = exp(ltout);
 	int idx[8];
 	double delx,dely,delz;



More information about the Commits mailing list