def copy_results(self, instance):
     if self.name_of_the_code in self.sph_hydro_codes:
         n_samples = self.number_of_grid_points * 3
         result = Particles(n_samples)
         result.position = [(x, 0.5, 0.5) | length for x in numpy.linspace(0.0, 1.0, n_samples)]
         x, y, z = result.x, result.y, result.z
         if self.name_of_the_code == "fi":
             x -= (0.5 | length)
             y -= (0.5 | length)
             z -= (0.5 | length)
         no_speed = [0.0]*n_samples | speed
         result.rho, result.rhovx, result.rhovy, result.rhovz, result.energy = [
             self.convert_generic_units.to_generic(quantity) for quantity in 
             instance.get_hydro_state_at_point(x, y, z, no_speed, no_speed, no_speed)]
     else:
         result = []
         for x in instance.itergrids():
             result.append(x.copy())
     return result
Exemplo n.º 2
0
 def copy_results(self, instance):
     if self.name_of_the_code in self.sph_hydro_codes:
         n_samples = self.number_of_grid_points * 3
         result = Particles(n_samples)
         result.position = [
             (x, 0.5, 0.5) | length for x in numpy.linspace(0.0, 1.0, n_samples)
             ]
         x, y, z = result.x, result.y, result.z
         if self.name_of_the_code == "fi":
             x -= (0.5 | length)
             y -= (0.5 | length)
             z -= (0.5 | length)
         no_speed = [0.0]*n_samples | speed
         result.rho, result.rhovx, result.rhovy, result.rhovz, result.energy = [
             self.convert_generic_units.to_generic(quantity) for quantity in
             instance.get_hydro_state_at_point(x, y, z, no_speed, no_speed, no_speed)]
     else:
         result = []
         for x in instance.itergrids():
             result.append(x.copy())
     return result