def test1(self):
     print "Testing ParallelStellarEvolution initialization"
     instance = ParallelStellarEvolution(self.code_factory,
                                         number_of_workers=3,
                                         **default_options)
     instance.initialize_code()
     instance.cleanup_code()
     instance.stop()
 def test2(self):
     print "Testing ParallelStellarEvolution particles"
     instance = ParallelStellarEvolution(self.code_factory, number_of_workers=2, **default_options)
     instance.initialize_code()
     instance.commit_parameters()
     
     particles = Particles(5)
     particles.mass = range(1, 1+len(particles)) | units.MSun
     incode = instance.particles.add_particles(particles)
     instance.commit_particles()
     self.assertAlmostEqual(incode.mass, range(1, 1+len(particles)) | units.MSun)
     print "Note that the order of instance.particles is different from the",
     print "original particle order, since particles are distributed over 2 processes"
     self.assertAlmostEqual(instance.particles.mass, [1,3,5, 2,4] | units.MSun)
     
     instance.stop()
    def test2(self):
        print "Testing ParallelStellarEvolution particles"
        instance = ParallelStellarEvolution(self.code_factory,
                                            number_of_workers=2,
                                            **default_options)
        instance.initialize_code()
        instance.commit_parameters()

        particles = Particles(5)
        particles.mass = range(1, 1 + len(particles)) | units.MSun
        incode = instance.particles.add_particles(particles)
        instance.commit_particles()
        self.assertAlmostEqual(incode.mass,
                               range(1, 1 + len(particles)) | units.MSun)
        print "Note that the order of instance.particles is different from the",
        print "original particle order, since particles are distributed over 2 processes"
        self.assertAlmostEqual(instance.particles.mass,
                               [1, 3, 5, 2, 4] | units.MSun)

        instance.stop()
 def test1(self):
     print "Testing ParallelStellarEvolution initialization"
     instance = ParallelStellarEvolution(self.code_factory, number_of_workers=3, **default_options)
     instance.initialize_code()
     instance.cleanup_code()
     instance.stop()