@@ -11,6 +11,7 @@ use crate::tables::{validate_edge_table, TableCollection};
1111use crate :: tsdef:: * ;
1212use crate :: EdgeBuffer ;
1313use crate :: ForrusttsError ;
14+ use crate :: SamplesInfo ;
1415use crate :: Segment ;
1516use crate :: SimplificationBuffers ;
1617use crate :: SimplificationFlags ;
@@ -65,7 +66,6 @@ type VecBirth = Vec<Birth>;
6566struct PopulationState {
6667 pub parents : VecParent ,
6768 pub births : VecBirth ,
68- pub alive_at_last_simplification : Vec < IdType > ,
6969 pub edge_buffer : EdgeBuffer ,
7070 pub tables : TableCollection ,
7171}
@@ -75,7 +75,6 @@ impl PopulationState {
7575 PopulationState {
7676 parents : vec ! [ ] ,
7777 births : vec ! [ ] ,
78- alive_at_last_simplification : vec ! [ ] ,
7978 edge_buffer : EdgeBuffer :: new ( ) ,
8079 tables : TableCollection :: new ( genome_length) . unwrap ( ) ,
8180 }
@@ -291,17 +290,17 @@ fn recombination_breakpoints(
291290 }
292291}
293292
294- fn fill_samples ( parents : & [ Parent ] , samples : & mut Vec < IdType > ) {
295- samples. clear ( ) ;
293+ fn fill_samples ( parents : & [ Parent ] , samples : & mut SamplesInfo ) {
294+ samples. samples . clear ( ) ;
296295 for p in parents {
297- samples. push ( p. node0 ) ;
298- samples. push ( p. node1 ) ;
296+ samples. samples . push ( p. node0 ) ;
297+ samples. samples . push ( p. node1 ) ;
299298 }
300299}
301300
302301fn sort_and_simplify (
303302 flags : SimulationFlags ,
304- samples : & [ IdType ] ,
303+ samples : & SamplesInfo ,
305304 state : & mut SimplificationBuffers ,
306305 pop : & mut PopulationState ,
307306 output : & mut SimplificationOutput ,
@@ -341,7 +340,6 @@ fn sort_and_simplify(
341340 } else {
342341 simplify_from_edge_buffer (
343342 samples,
344- & pop. alive_at_last_simplification ,
345343 SimplificationFlags :: empty ( ) ,
346344 state,
347345 & mut pop. edge_buffer ,
@@ -354,7 +352,7 @@ fn sort_and_simplify(
354352
355353fn simplify_and_remap_nodes (
356354 flags : SimulationFlags ,
357- samples : & mut Vec < IdType > ,
355+ samples : & mut SamplesInfo ,
358356 state : & mut SimplificationBuffers ,
359357 pop : & mut PopulationState ,
360358 output : & mut SimplificationOutput ,
@@ -368,10 +366,10 @@ fn simplify_and_remap_nodes(
368366 }
369367
370368 if flags. contains ( SimulationFlags :: BUFFER_EDGES ) {
371- pop . alive_at_last_simplification . clear ( ) ;
369+ samples . edge_buffer_founder_nodes . clear ( ) ;
372370 for p in & pop. parents {
373- pop . alive_at_last_simplification . push ( p. node0 ) ;
374- pop . alive_at_last_simplification . push ( p. node1 ) ;
371+ samples . edge_buffer_founder_nodes . push ( p. node0 ) ;
372+ samples . edge_buffer_founder_nodes . push ( p. node1 ) ;
375373 }
376374 }
377375}
@@ -523,7 +521,7 @@ pub fn neutral_wf(
523521 rng. set ( params. seed ) ;
524522
525523 let mut pop = PopulationState :: new ( pop_params. genome_length ) ;
526- let mut samples: Vec < IdType > = vec ! [ ] ;
524+ let mut samples: SamplesInfo = Default :: default ( ) ;
527525 let mut breakpoints = vec ! [ ] ;
528526
529527 // Record nodes for the first generation
@@ -535,7 +533,7 @@ pub fn neutral_wf(
535533 }
536534
537535 for i in 0 ..pop. tables . num_nodes ( ) {
538- pop . alive_at_last_simplification . push ( i as IdType ) ;
536+ samples . edge_buffer_founder_nodes . push ( i as IdType ) ;
539537 }
540538
541539 let mut simplified = false ;
0 commit comments