[Yt-svn] commit/yt: MatthewTurk: Fixing a problem where boxlib can accept '0', '1', 't', 'f', and possibly other

Bitbucket commits-noreply at bitbucket.org
Thu May 12 12:58:02 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/3167f58d6e42/
changeset:   r4252:3167f58d6e42
branch:      yt
user:        MatthewTurk
date:        2011-05-12 21:57:54
summary:     Fixing a problem where boxlib can accept '0', '1', 't', 'f', and possibly other
variants for the parameter settings.  So far I have only seen this with Castro,
so that's where I have applied the fix.
affected #:  1 file (238 bytes)

--- a/yt/frontends/castro/definitions.py	Thu May 12 14:18:52 2011 -0400
+++ b/yt/frontends/castro/definitions.py	Thu May 12 12:57:54 2011 -0700
@@ -25,6 +25,16 @@
 """
 from yt.funcs import *
 
+def boxlib_bool_to_int(v):
+    if isinstance(v, types.StringTypes):
+        v = v.upper().strip()
+        if v[0] == 'T':
+            return 1
+        elif v[0] == 'F':
+            return 0
+    else:
+        return int(v)
+
 # TODO: get rid of enzo parameters we do not need
 parameterDict = {"CosmologyCurrentRedshift": float,
                  "CosmologyComovingBoxSize": float,
@@ -38,7 +48,7 @@
                  "HydroMethod": int,
                  "DualEnergyFormalism": int,
                  "InitialTime": float,
-                 "ComovingCoordinates": int,
+                 "ComovingCoordinates": boxlib_bool_to_int,
                  "DensityUnits": float,
                  "LengthUnits": float,
                  "LengthUnit": float,

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list