예제 #1
0
 def _parse_enzo3_parameter_file(self, f):
     self.parameters = p = libconfig(f)
     sim = p["SimulationControl"]
     internal = p["Internal"]
     phys = p["Physics"]
     self.refine_by = sim["AMR"]["RefineBy"]
     self.periodicity = tuple(
         a == 3 for a in sim["Domain"]["LeftFaceBoundaryCondition"])
     self.dimensionality = sim["Domain"]["TopGridRank"]
     self.domain_dimensions = np.array(sim["Domain"]["TopGridDimensions"],
                                       dtype="int64")
     self.domain_left_edge = np.array(sim["Domain"]["DomainLeftEdge"],
                                      dtype="float64")
     self.domain_right_edge = np.array(sim["Domain"]["DomainRightEdge"],
                                       dtype="float64")
     self.gamma = phys["Hydro"]["Gamma"]
     self.unique_identifier = internal["Provenance"][
         "CurrentTimeIdentifier"]
     self.current_time = internal["InitialTime"]
     self.cosmological_simulation = phys["Cosmology"]["ComovingCoordinates"]
     if self.cosmological_simulation == 1:
         cosmo = phys["Cosmology"]
         self.current_redshift = internal["CosmologyCurrentRedshift"]
         self.omega_lambda = cosmo["OmegaLambdaNow"]
         self.omega_matter = cosmo["OmegaMatterNow"]
         self.hubble_constant = cosmo["HubbleConstantNow"]
     else:
         self.current_redshift = self.omega_lambda = self.omega_matter = \
             self.hubble_constant = self.cosmological_simulation = 0.0
     self.particle_types = ["DarkMatter"] + \
         phys["ActiveParticles"]["ActiveParticlesEnabled"]
     self.particle_types = tuple(self.particle_types)
     self.particle_types_raw = self.particle_types
     if self.dimensionality == 1:
         self._setup_1d()
     elif self.dimensionality == 2:
         self._setup_2d()
 def _parse_enzo3_parameter_file(self, f):
     self.parameters = p = libconfig(f)
     sim = p["SimulationControl"]
     internal = p["Internal"]
     phys = p["Physics"]
     self.refine_by = sim["AMR"]["RefineBy"]
     self.periodicity = tuple(a == 3 for a in
                         sim["Domain"]["LeftFaceBoundaryCondition"])
     self.dimensionality = sim["Domain"]["TopGridRank"]
     self.domain_dimensions = np.array(sim["Domain"]["TopGridDimensions"],
                                       dtype="int64")
     self.domain_left_edge = np.array(sim["Domain"]["DomainLeftEdge"],
                                      dtype="float64")
     self.domain_right_edge = np.array(sim["Domain"]["DomainRightEdge"],
                                       dtype="float64")
     self.gamma = phys["Hydro"]["Gamma"]
     self.unique_identifier = internal["Provenance"]["CurrentTimeIdentifier"]
     self.current_time = internal["InitialTime"]
     self.cosmological_simulation = phys["Cosmology"]["ComovingCoordinates"]
     if self.cosmological_simulation == 1:
         cosmo = phys["Cosmology"]
         self.current_redshift = internal["CosmologyCurrentRedshift"]
         self.omega_lambda = cosmo["OmegaLambdaNow"]
         self.omega_matter = cosmo["OmegaMatterNow"]
         self.hubble_constant = cosmo["HubbleConstantNow"]
     else:
         self.current_redshift = self.omega_lambda = self.omega_matter = \
             self.hubble_constant = self.cosmological_simulation = 0.0
     self.particle_types = ["DarkMatter"] + \
         phys["ActiveParticles"]["ActiveParticlesEnabled"]
     self.particle_types = tuple(self.particle_types)
     self.particle_types_raw = self.particle_types
     if self.dimensionality == 1:
         self._setup_1d()
     elif self.dimensionality == 2:
         self._setup_2d()