Ejemplo n.º 1
0
    def init_orbital_parameter_sorted_sets(self):
        """ Initialize particle sets which sort the particles by their bounds at each timestep """
        # Update current mask
        self.mask = self.tmp_mask

        for i,b in enumerate(self.bodies.history):
            two_stars = b[0:2]
            planetesimals = b[2:]

            if (self.mask[i] and (not isinstance(self.unbound[i], iterable)) ):
                 print "Iteration ", i
                 # iterable is defined in the header
                 # only sort if mask says to sort and array does not exist yet
                 unbound, central, passing, both = ps.orbital_parameter_sorted_sets(planetesimals, two_stars)
                 (self.unbound)[i] = unbound
                 (self.central)[i] = central
                 (self.passing)[i] = passing
                 (self.both)[i] = both

        print " **** Saving Sorted Particle Sets **** "
        self.save()

        # Also, partition 'both'
        self.partition_both()
        self.save()
Ejemplo n.º 2
0
    def split_sort(self, start, end):
        for i,b in enumerate(self.bodies.history):
            if (start <= i <= end):
               two_stars = b[0:2]
               planetesimals = b[2:]

               if (self.mask[i] and (not isinstance(self.unbound[i], iterable)) ):
                    print "Iteration ", i
                    # iterable is defined in the header
                    # only sort if mask says to sort and array does not exist yet
                    unbound, central, passing, both = ps.orbital_parameter_sorted_sets(planetesimals, two_stars)
                    (self.unbound)[i] = unbound
                    (self.central)[i] = central
                    (self.passing)[i] = passing
                    (self.both)[i] = both
Ejemplo n.º 3
0
    def split_sort(self, start, end):
        for i, b in enumerate(self.bodies.history):
            if (start <= i <= end):
                two_stars = b[0:2]
                planetesimals = b[2:]

                if (self.mask[i]
                        and (not isinstance(self.unbound[i], iterable))):
                    print "Iteration ", i
                    # iterable is defined in the header
                    # only sort if mask says to sort and array does not exist yet
                    unbound, central, passing, both = ps.orbital_parameter_sorted_sets(
                        planetesimals, two_stars)
                    (self.unbound)[i] = unbound
                    (self.central)[i] = central
                    (self.passing)[i] = passing
                    (self.both)[i] = both