Commits

Matthew Turk committed bc7361f

Replaced return FAIL with ENZO_FAIL

Comments (0)

Files changed (14)

src/enzo/Grid_ComputeAccelerationFieldExternal.C

 	      } else {
 		/* this is only reached if there are two types of point sources - 
 		   when you add a new one, this changes */
-		printf("should never get here! in Grid::ComputeAccelFieldExternal\n");
-		return FAIL;
+		ENZO_FAIL("should never get here! in Grid::ComputeAccelFieldExternal");
 	      }
 
 	      /* Apply force. */
     /* DO PARTICLES HERE! */
 
     if (NumberOfParticles > 0 && GridRank != 3) {
-      fprintf(stderr, "PointSourceGravity assumes 3D\n");
-      return FAIL;
+        ENZO_FAIL("PointSourceGravity assumes 3D");
     }
       
     if (PointSourceGravity == 1 || PointSourceGravity == 2)

src/enzo/Grid_ComputeCoolingTime.C

        &TemperatureUnits,&LengthUnits,
        &aUnits,&DensityUnits,&TimeUnits,&Gamma);
     if (result == FAIL )  {
-      fprintf(stderr,"Error in GadgetCoolingTime.  Exiting.\n");
-      return FAIL;
+      ENZO_FAIL("Error in GadgetCoolingTime.  Exiting.");
     }
   } else { // if not multispecies or Gadget cooling, must be generic cooling.
     FORTRAN_NAME(cool_time)(

src/enzo/Grid_ComputeTemperatureField.C

       result = this->GadgetComputeTemperature(Time,temperature);
 
     if(result == FAIL) {
-      fprintf(stderr, "Error in grid->ComputePressure: Gadget.\n");
-      return FAIL;
+      ENZO_FAIL("Error in grid->ComputePressure: Gadget.");
     }
     return SUCCESS;
   }
     result = this->ComputePressure(Time, temperature);
  
   if (result == FAIL) {
-    fprintf(stderr, "Error in grid->ComputePressure.\n");
-    ENZO_FAIL("");
+        ENZO_FAIL("Error in grid->ComputePressure.");
   }
  
   /* Compute the size of the fields. */
   /* Find Density, if possible. */
  
   if ((DensNum = FindField(Density, FieldType, NumberOfBaryonFields)) < 0) {
-    fprintf(stderr, "Cannot find density.\n");
-    ENZO_FAIL("");
+        ENZO_FAIL("Cannot find density.");
   }
  
  
  
   if (GetUnits(&DensityUnits, &LengthUnits, &TemperatureUnits,
 	       &TimeUnits, &VelocityUnits, Time) == FAIL) {
-    fprintf(stderr, "Error in GetUnits.\n");
-    ENZO_FAIL("");
+        ENZO_FAIL("Error in GetUnits.");
   }
 
   /* For Sedov Explosion compute temperature without floor */
  
     if (IdentifySpeciesFields(DeNum, HINum, HIINum, HeINum, HeIINum, HeIIINum,
 		      HMNum, H2INum, H2IINum, DINum, DIINum, HDINum) == FAIL) {
-      fprintf(stderr, "Error in grid->IdentifySpeciesFields.\n");
-      ENZO_FAIL("");
+            ENZO_FAIL("Error in grid->IdentifySpeciesFields.");
     }
  
     /* Compute temperature with mu calculated directly. */

src/enzo/Grid_GadgetCalculateCooling.C

 
 #include <stdio.h>
 #include <math.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"
 	
 	if(u_new < 0.0){
 	  printf("GadgetCalculateCooling:  incorrect internal energy calculated:  %e  Exiting.\n",u_new);
-	  return FAIL;
+	  ENZO_FAIL("");
 	}	
 	
 	/* store the new energy value - basically reverse the process above.

src/enzo/Grid_GadgetComputeTemperature.C

 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"
   /* Error Check */
 
   if (time < OldTime || time > Time) {
-    fprintf(stderr, "requested time is outside available range.\n");
-    return FAIL;
+    ENZO_FAIL("requested time is outside available range.");
   }
 
   /* Compute interpolation coefficients. */
   int DensNum, GENum, Vel1Num, Vel2Num, Vel3Num, TENum;
   if (this->IdentifyPhysicalQuantities(DensNum, GENum, Vel1Num, Vel2Num, 
 					 Vel3Num, TENum) == FAIL) {
-    fprintf(stderr, "Error in IdentifyPhysicalQuantities.\n");
-    return FAIL;
+    ENZO_FAIL("Error in IdentifyPhysicalQuantities.");
   }
 
   // get physical units
 
   if (GetUnits(&DensityUnits, &LengthUnits, &TemperatureUnits,
 	       &TimeUnits, &VelocityUnits, &MassUnits, Time) == FAIL) {
-    fprintf(stderr, "Error in GetUnits.\n");
-    return FAIL;
+    ENZO_FAIL("Error in GetUnits.");
   }
   
 

src/enzo/Grid_GadgetComputeTemperatureDEF.C

 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"
   /* Error Check */
 
   if (time < OldTime || time > Time) {
-    fprintf(stderr, "requested time is outside available range.\n");
-    return FAIL;
+    ENZO_FAIL("requested time is outside available range.");
   }
 
   /* Compute interpolation coefficients. */
   int DensNum, GENum, Vel1Num, Vel2Num, Vel3Num, TENum;
   if (this->IdentifyPhysicalQuantities(DensNum, GENum, Vel1Num, Vel2Num, 
 					 Vel3Num, TENum) == FAIL) {
-    fprintf(stderr, "Error in IdentifyPhysicalQuantities.\n");
-    return FAIL;
+    ENZO_FAIL("Error in IdentifyPhysicalQuantities.");
   }
 
   // get physical units
 
   if (GetUnits(&DensityUnits, &LengthUnits, &TemperatureUnits,
 	       &TimeUnits, &VelocityUnits, &MassUnits, Time) == FAIL) {
-    fprintf(stderr, "Error in GetUnits.\n");
-    return FAIL;
+    ENZO_FAIL("Error in GetUnits.");
   }
 
   /* Loop over the grid, compute the thermal energy, then the temperature,

src/enzo/Grid_GalaxySimulationInitializeGrid.C

 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"
 
   if (GetUnits(&DensityUnits, &LengthUnits, &TemperatureUnits,
 	       &TimeUnits, &VelocityUnits, &MassUnits, Time) == FAIL) {
-    fprintf(stderr, "Error in GetUnits.\n");
-    return FAIL;
+    ENZO_FAIL("Error in GetUnits.");
   }
 
   double MassUnitsDouble=1.0;

src/enzo/Grid_IdentifyGloverSpeciesFields.C

 ************************************************************************/
  
 #include <stdio.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"
     fprintf(stderr,"Error identifying species for GloverChemistryModel = %"ISYM".\n",
 	    GloverChemistryModel);
 
-    return FAIL;
+    ENZO_FAIL("");
   }
 
   return SUCCESS;

src/enzo/Grid_RadiatingShockInitializeGrid.C

  
 #include <stdio.h>
 #include <math.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"
 
   if (this->IdentifyPhysicalQuantities(DensNum, GENum, Vel1Num, Vel2Num,
 				       Vel3Num, TENum) == FAIL) {
-    fprintf(stderr, "Error in IdentifyPhysicalQuantities.\n");
-    return FAIL;
+        ENZO_FAIL("Error in IdentifyPhysicalQuantities.");
   }
 
   if (MultiSpecies)
     if (IdentifySpeciesFields(DeNum, HINum, HIINum, HeINum, HeIINum, HeIIINum,
                       HMNum, H2INum, H2IINum, DINum, DIINum, HDINum) == FAIL) {
-      fprintf(stderr, "Error in grid->IdentifySpeciesFields.\n");
-      return FAIL;
+            ENZO_FAIL("Error in grid->IdentifySpeciesFields.");
     }
 
   // If using Simon Glover's non-equilibrium cooling, set up fields.
 
     if (GetUnits(&DensityUnits, &LengthUnits, &TemperatureUnits,
 		 &TimeUnits, &VelocityUnits, &MassUnits, 0.0) == FAIL) {
-      fprintf(stderr, "Error in GetUnits.\n");
-      return FAIL;
+            ENZO_FAIL("Error in GetUnits.");
     }
  
     sedovradius = new double[numbins];

src/enzo/Grid_SetFlaggingField.C

   case 11:
       NumberOfFlaggedCells = this->FlagCellsToBeRefinedByResistiveLength();
       if (NumberOfFlaggedCells < 0) {
-	fprintf(stderr, "Error in grid->FlagCellsToBeRefinedByResistiveLength.\n");
-	return FAIL;
+		ENZO_FAIL("Error in grid->FlagCellsToBeRefinedByResistiveLength.");
       }
       break;
 
  
       NumberOfFlaggedCells = this->FlagCellsToBeRefinedByMustRefineRegion(level);
       if (NumberOfFlaggedCells < 0) {
-        fprintf(stderr, "Error in grid->FlagCellsToBeRefinedByMustRefineRegion.\n");
-        return FAIL;
+        ENZO_FAIL("Error in grid->FlagCellsToBeRefinedByMustRefineRegion.");
       }
       break;
  
  
       NumberOfFlaggedCells = this->FlagCellsToBeRefinedByMetallicity(level);
       if (NumberOfFlaggedCells < 0) {
-        fprintf(stderr, "Error in grid->FlagCellsToBeRefinedByMetallicity.\n");
-        return FAIL;
+        ENZO_FAIL("Error in grid->FlagCellsToBeRefinedByMetallicity.");
       }
       break;
  

src/enzo/Grid_SolveHydroEquations.C

 
 #include <stdio.h>
 #include "ErrorExceptions.h"
-#include "ErrorExceptions.h"
 #include "performance.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 				      OIINum,SiINum,SiIINum,SiIIINum,CHINum,CH2INum,
 				      CH3IINum,C2INum,COINum,HCOIINum,OHINum,H2OINum,
 				      O2INum) == FAIL) {
-	fprintf(stderr,"Error in IdentifyGloverSpeciesFields.\n");
-	return FAIL;
+	ENZO_FAIL("Error in IdentifyGloverSpeciesFields.");
       }
 
       colnum[NumberOfColours++] = HIINum;

src/enzo/InitializeGadgetEquilibriumCoolData.C

 #include <string.h>
 #include <stdio.h>
 #include <math.h>
+#include "ErrorExceptions.h"
 #include "macros_and_parameters.h"
 #include "typedefs.h"
 #include "global_data.h"
 
   FLOAT a = 1.0, dadt, redshift;
   
-  if (CosmologyComputeExpansionFactor(Time, &a, &dadt) 
-      == FAIL) {
-    fprintf(stderr, "Error in CosmologyComputeExpansionFactors.\n");
-    return FAIL;
+  if (CosmologyComputeExpansionFactor(Time, &a, &dadt) == FAIL) {
+    ENZO_FAIL("Error in CosmologyComputeExpansionFactors.");
   }
 
   redshift = 1.0 / a - 1.0;

src/enzo/RH_Grid_ComputeTemperatureField.C

     else
       result = this->GadgetComputeTemperature(Time,temperature);
 
-    if(result == FAIL) {
-      fprintf(stderr, "Error in grid->ComputePressure: Gadget.\n");
-      return FAIL;
+    if(result == FAIL) { ENZO_FAIL("Error in grid->ComputePressure: Gadget.");
     }
     return SUCCESS;
   }
     result = this->ComputePressure(Time, temperature);
  
   if (result == FAIL) {
-    fprintf(stderr, "Error in grid->ComputePressure.\n");
-    ENZO_FAIL("");
+        ENZO_FAIL("Error in grid->ComputePressure.");
   }
  
   /* Compute the size of the fields. */
   /* Find Density, if possible. */
  
   if ((DensNum = FindField(Density, FieldType, NumberOfBaryonFields)) < 0) {
-    fprintf(stderr, "Cannot find density.\n");
-    ENZO_FAIL("");
+        ENZO_FAIL("Cannot find density.");
   }
  
  
  
   if (GetUnits(&DensityUnits, &LengthUnits, &TemperatureUnits,
 	       &TimeUnits, &VelocityUnits, Time) == FAIL) {
-    fprintf(stderr, "Error in GetUnits.\n");
-    ENZO_FAIL("");
+        ENZO_FAIL("Error in GetUnits.");
   }
  
   if (MultiSpecies == FALSE)
  
     if (IdentifySpeciesFields(DeNum, HINum, HIINum, HeINum, HeIINum, HeIIINum,
 		      HMNum, H2INum, H2IINum, DINum, DIINum, HDINum) == FAIL) {
-      fprintf(stderr, "Error in grid->IdentifySpeciesFields.\n");
-      ENZO_FAIL("");
+            ENZO_FAIL("Error in grid->IdentifySpeciesFields.");
     }
  
     /* Compute temperature with mu calculated directly. */

src/enzo/ReadParameterFile.C

 
     // initialize Gadget equilibrium cooling
     if (InitializeGadgetEquilibriumCoolData(MetaData.Time) == FAIL) {
-      fprintf(stderr, "Error in InitializeGadgetEquilibriumCoolData.\n");
-      return FAIL;
+            ENZO_FAIL("Error in InitializeGadgetEquilibriumCoolData.");
     } 
   }
 
 
   if (MetalCooling == CLOUDY_METAL_COOLING) {
     if (InitializeCloudyCooling(MetaData.Time) == FAIL) {
-      fprintf(stderr, "Error in InitializeCloudyCooling.\n");
-      return FAIL;
+      ENZO_FAIL("Error in InitializeCloudyCooling.");
     }
   }