Skip to content
Snippets Groups Projects
Commit 55114433 authored by jakut77's avatar jakut77
Browse files

removed some files

parent d7de11b1
Branches
No related tags found
1 merge request!4Draft: Jt/bht
No preview for this file type
No preview for this file type
......@@ -9,7 +9,7 @@ class GalaxyCollisionSimulation:
def __init__(self, num_particles):
# Initialize the simulation with a given number of particles
self.num_particles = num_particles
self.particles = self.initialize_particles(random=True) # Generate particles
self.particles = self.initialize_particles(initial='random') # Generate particles
self.barnes_hut = MainApp() # Initialize Barnes-Hut algorithm instance
self.barnes_hut.BuildTree(self.particles) # Build the Barnes-Hut tree with particles
self.barnes_hut.rootNode.ComputeMassDistribution() #Compute the center of mass of the tree nodes
......@@ -29,9 +29,9 @@ class GalaxyCollisionSimulation:
0: (self.barnes_hut.rootNode.center_of_mass[0], self.barnes_hut.rootNode.center_of_mass[1])
}
def initialize_particles(self, random=True):
def initialize_particles(self, initial='random'):
if not random:
if initial == 'two':
particles = [Particle(80, 50, 1000), Particle(20, 50, 1000)]
#Particle(0.5, 0, 10000),
#Particle(-0.5, 0, 10000)]
......@@ -39,6 +39,8 @@ class GalaxyCollisionSimulation:
particles[1].vx, particles[1].vy = 0, -3
#particles=particles[:2]
return particles
elif initial == 'random':
# Generate random particles within a specified range
particles = []
for _ in range(self.num_particles):
......
from galaxysimulation import GalaxyCollisionSimulation
sim = GalaxyCollisionSimulation(num_particles=4)
sim.simulate(num_steps=10000, time_step=0.001)
sim = GalaxyCollisionSimulation(num_particles=6)
sim.simulate(num_steps=7000, time_step=0.001)
sim.display_snapshots(200, fix_axes=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment