Skip to content
Snippets Groups Projects
Commit 7f21db23 authored by lhausamm's avatar lhausamm
Browse files

Fix Grackle structures

parent fe71bf97
No related branches found
No related tags found
1 merge request!2Update cooling with Grackle3
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
...@@ -152,10 +152,11 @@ class SwiftStruct(struct.Struct): ...@@ -152,10 +152,11 @@ class SwiftStruct(struct.Struct):
txt = tab + "%s:\n" % type(self) txt = tab + "%s:\n" % type(self)
for name in self.struct_name: for name in self.struct_name:
d = getattr(self, name) d = getattr(self, name)
txt += tab + "\t%s: " % name
if isinstance(d, SwiftStruct): if isinstance(d, SwiftStruct):
txt += d.__str__(tab+"\t") txt += d.__str__(tab+"\t")
else: else:
txt += tab + "\t%s: %s\n" % (name, d) txt += "%s\n" % d
return txt return txt
def __getattr__(self, name): def __getattr__(self, name):
...@@ -252,7 +253,7 @@ class ArrayStruct(SwiftStruct): ...@@ -252,7 +253,7 @@ class ArrayStruct(SwiftStruct):
def __str__(self, tab=""): def __str__(self, tab=""):
data = self.unpack(self.data) data = self.unpack(self.data)
data = self._clean(data) data = self._clean(data)
return tab + str(data) return tab + str(data) + "\n"
def getArray(self): def getArray(self):
...@@ -431,10 +432,7 @@ class GrackleUnits(SwiftStruct): ...@@ -431,10 +432,7 @@ class GrackleUnits(SwiftStruct):
super().__init__(self.struct_format, data, parent) super().__init__(self.struct_format, data, parent)
class GrackleChemistryData(SwiftStruct): class GrackleChemistryData(SwiftStruct):
""" _format = "iiiiiPidiidiiiiiiidddiiddiddiiddddddiiiiii"
WARNING, class quickly done, may contain error when accessing it directly
"""
_format = "iiiiipidiidiiiiiiidddiiddiddiiddddddiiiiiid"
_name = [ _name = [
'use_grackle', 'use_grackle',
'with_radiative_cooling', 'with_radiative_cooling',
...@@ -478,7 +476,6 @@ class GrackleChemistryData(SwiftStruct): ...@@ -478,7 +476,6 @@ class GrackleChemistryData(SwiftStruct):
'radiative_transfer_hydrogen_only', 'radiative_transfer_hydrogen_only',
'self_shielding_method', 'self_shielding_method',
'H2_self_shielding', 'H2_self_shielding',
"omp"
] ]
def __init__(self, data, parent=None): def __init__(self, data, parent=None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment