Beispiel #1
0
 def __init__(
     self,
     ds,
     positions,
     xfield="velocity_x",
     yfield="velocity_x",
     zfield="velocity_x",
     volume=None,
     dx=None,
     length=None,
     direction=1,
     get_magnitude=False,
 ):
     ParallelAnalysisInterface.__init__(self)
     self.ds = ds
     self.start_positions = sanitize_length(positions, ds)
     self.N = self.start_positions.shape[0]
     # I need a data object to resolve the field names to field tuples
     # via _determine_fields()
     ad = self.ds.all_data()
     self.xfield = ad._determine_fields(xfield)[0]
     self.yfield = ad._determine_fields(yfield)[0]
     self.zfield = ad._determine_fields(zfield)[0]
     self.get_magnitude = get_magnitude
     self.direction = np.sign(direction)
     if volume is None:
         volume = AMRKDTree(self.ds)
         volume.set_fields([self.xfield, self.yfield, self.zfield],
                           [False, False, False], False)
         volume.join_parallel_trees()
     self.volume = volume
     if dx is None:
         dx = self.ds.index.get_smallest_dx()
     self.dx = sanitize_length(dx, ds)
     if length is None:
         length = np.max(self.ds.domain_right_edge -
                         self.ds.domain_left_edge)
     self.length = sanitize_length(length, ds)
     self.steps = int(self.length / self.dx) + 1
     # Fix up the dx.
     self.dx = 1.0 * self.length / self.steps
     self.streamlines = np.zeros((self.N, self.steps, 3), dtype="float64")
     self.magnitudes = None
     if self.get_magnitude:
         self.magnitudes = np.zeros((self.N, self.steps), dtype="float64")
Beispiel #2
0
 def __init__(self,
              ds,
              positions,
              xfield='velocity_x',
              yfield='velocity_x',
              zfield='velocity_x',
              volume=None,
              dx=None,
              length=None,
              direction=1,
              get_magnitude=False):
     ParallelAnalysisInterface.__init__(self)
     self.ds = ds
     self.start_positions = np.array(positions)
     self.N = self.start_positions.shape[0]
     self.xfield = xfield
     self.yfield = yfield
     self.zfield = zfield
     self.get_magnitude = get_magnitude
     self.direction = np.sign(direction)
     if volume is None:
         volume = AMRKDTree(self.ds)
         volume.set_fields([self.xfield, self.yfield, self.zfield],
                           [False, False, False], False)
         volume.join_parallel_trees()
     self.volume = volume
     if dx is None:
         dx = self.ds.index.get_smallest_dx()
     self.dx = dx
     if length is None:
         length = np.max(self.ds.domain_right_edge -
                         self.ds.domain_left_edge)
     self.length = length
     self.steps = int(length / dx) + 1
     # Fix up the dx.
     self.dx = 1.0 * self.length / self.steps
     self.streamlines = np.zeros((self.N, self.steps, 3), dtype='float64')
     self.magnitudes = None
     if self.get_magnitude:
         self.magnitudes = np.zeros((self.N, self.steps), dtype='float64')
 def __init__(self, ds, positions, xfield='velocity_x', yfield='velocity_x',
              zfield='velocity_x', volume=None,
              dx=None, length=None, direction=1,
              get_magnitude=False):
     ParallelAnalysisInterface.__init__(self)
     self.ds = ds
     self.start_positions = sanitize_length(positions, ds)
     self.N = self.start_positions.shape[0]
     # I need a data object to resolve the field names to field tuples
     # via _determine_fields()
     ad = self.ds.all_data()
     self.xfield = ad._determine_fields(xfield)[0]
     self.yfield = ad._determine_fields(yfield)[0]
     self.zfield = ad._determine_fields(zfield)[0]
     self.get_magnitude=get_magnitude
     self.direction = np.sign(direction)
     if volume is None:
         volume = AMRKDTree(self.ds)
         volume.set_fields([self.xfield,self.yfield,self.zfield],
                           [False,False,False],
                           False)
         volume.join_parallel_trees()
     self.volume = volume
     if dx is None:
         dx = self.ds.index.get_smallest_dx()
     self.dx = sanitize_length(dx, ds)
     if length is None:
         length = np.max(self.ds.domain_right_edge-self.ds.domain_left_edge)
     self.length = sanitize_length(length, ds)
     self.steps = int(length/dx)+1
     # Fix up the dx.
     self.dx = 1.0*self.length/self.steps
     self.streamlines = np.zeros((self.N,self.steps,3), dtype='float64')
     self.magnitudes = None
     if self.get_magnitude:
         self.magnitudes = np.zeros((self.N,self.steps), dtype='float64')