Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed May 8, 2024
1 parent ac130da commit a3f5db7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/lib/simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { CompoundsCollector } from './analysis/compounds';
export class Simulation implements SimulationInterface {
readonly config: SimulationConfig;
private atoms: AtomInterface[];
private readonly links: LinkManagerInterface;
private readonly drawer: DrawerInterface;
private readonly linkManager: LinkManagerInterface;
private readonly interactionManager: InteractionManagerInterface;
private readonly clusterManager: ClusterManagerInterface;
private readonly summaryManager: SummaryManagerInterface;
Expand All @@ -27,12 +27,12 @@ export class Simulation implements SimulationInterface {
this.config = config;
this.atoms = this.config.atomsFactory(this.config.worldConfig, this.config.typesConfig);
this.drawer = this.config.drawer;
this.linkManager = new LinkManager();
this.links = new LinkManager();
this.interactionManager = new InteractionManager(
this.config.viewMode,
this.config.worldConfig,
this.config.typesConfig,
this.linkManager,
this.links,
this.config.physicModel,
new RulesHelper(this.config.worldConfig, this.config.typesConfig),
);
Expand Down Expand Up @@ -86,15 +86,15 @@ export class Simulation implements SimulationInterface {
this.interactionManager.interactAtomsStep2(lhs, rhs);
});
}
for (const link of this.linkManager) {
for (const link of this.links) {
this.interactionManager.interactLink(link);
this.summaryManager.noticeLink(link, this.config.worldConfig);
}
}
this.interactionManager.handleTime();
}

this.drawer.draw(this.atoms, this.linkManager);
this.drawer.draw(this.atoms, this.links);

this.summaryManager.finishStep();
}
Expand All @@ -114,7 +114,7 @@ export class Simulation implements SimulationInterface {
clear() {
this.atoms.length = 0;
this.clusterManager.clear();
this.linkManager.clear();
this.links.clear();
this.drawer.clear();
}

Expand All @@ -128,7 +128,7 @@ export class Simulation implements SimulationInterface {

const result = {
atoms: this.atoms.map(atom => atom.exportState()),
links: [...this.linkManager].map(link => link.exportState()),
links: [...this.links].map(link => link.exportState()),
};

if (needToStart) {
Expand Down Expand Up @@ -164,7 +164,7 @@ export class Simulation implements SimulationInterface {
console.warn(link, atomsMap, atoms);
}

this.linkManager.create(atomsMap.get(link[0])!, atomsMap.get(link[1])!);
this.links.create(atomsMap.get(link[0])!, atomsMap.get(link[1])!);
}

if (needToStart) {
Expand All @@ -174,7 +174,7 @@ export class Simulation implements SimulationInterface {

exportCompounds(): Compound[] {
const collector = new CompoundsCollector()
collector.handleLinks(this.linkManager);
collector.handleLinks(this.links);
return collector.getCompounds();
}

Expand Down

0 comments on commit a3f5db7

Please sign in to comment.