Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Mar 21, 2023
1 parent 38f0911 commit 1fce28c
Showing 1 changed file with 0 additions and 108 deletions.
108 changes: 0 additions & 108 deletions lib/evolve_discrete_demes/evolvets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,6 @@ evolve_with_tree_sequences(
}
}

// TODO: here, we need to simply set the model
// to the value of pop.generation, which means
// that pop.generation is a parental generation
// (which has always been true for fwdpy11).
//if (pop.generation == 0)
// {
// // If we have an already-initialized model state,
// // then we reset it back to an unevolved one.
// demography.reset_model_state();
// }

for (auto &region : mmodel.regions)
{
if (!region->valid(0.0, pop.tables->genome_length()))
Expand All @@ -294,12 +283,6 @@ evolve_with_tree_sequences(
"current time of population is past the end of the model");
}

// TODO: this goes away
//auto current_demographic_state = demography.get_model_state();

// TODO: this is replaced by calling update_state
// on the ForwardGraph
//current_demographic_state.initialize(pop);
demography.initialize_model(pop.generation);

if (demography.number_of_demes() <= 0)
Expand All @@ -315,7 +298,6 @@ evolve_with_tree_sequences(
throw std::invalid_argument(
"list of genetic values is longer than maxdemes");
}
// TODO: this changes to graph.number_of_demes()
if (static_cast<std::size_t>(demography.number_of_demes()) > 1
&& gvalue_pointers.genetic_values.size() > 1
&& gvalue_pointers.genetic_values.size()
Expand Down Expand Up @@ -372,7 +354,6 @@ evolve_with_tree_sequences(
std::vector<fwdpy11::DiploidGenotype> offspring;
std::vector<double> new_diploid_gvalues;

// NOTE: this API is likely to break.
calculate_diploid_fitness(rng, pop, genetics.gvalue, deme_to_gvalue_map,
offspring_metadata, new_diploid_gvalues,
options.record_gvalue_matrix);
Expand All @@ -387,50 +368,6 @@ evolve_with_tree_sequences(
fitness_bookmark.update(demography.parental_deme_sizes(), pop.diploid_metadata);
fitness_lookup.update(fitness_bookmark);

// NOTE: this goes away and is replaced by ancestry
// proportions per offspring deme.
// ddemog::migration_lookup miglookup{current_demographic_state.maxdemes,
// current_demographic_state.M.empty()};

// TODO: this entire if/else may not be necessary?
// if (pop.generation == 0)
// {
// // NOTE: the next 3 function calls all change
// current_demographic_state.early(rng, pop.generation, pop.diploid_metadata);
// current_demographic_state.late(rng, pop.generation, miglookup,
// pop.diploid_metadata);
// fitness_lookup.update(current_demographic_state.fitness_bookmark);
// ddemog::validate_parental_state(
// pop.generation, fitness_lookup,
// current_demographic_state.current_deme_parameters,
// current_demographic_state.M);
// }
// else
// {
// build_migration_lookup(
// pop.generation, current_demographic_state.M,
// current_demographic_state.current_deme_parameters.current_deme_sizes,
// current_demographic_state.current_deme_parameters.next_deme_sizes,
// miglookup);
// fitness_lookup.update(current_demographic_state.fitness_bookmark);
// ddemog::validate_parental_state(
// pop.generation, fitness_lookup,
// current_demographic_state.current_deme_parameters,
// current_demographic_state.M);
// }

// TODO: check that we can have all deme sizes be zero with a demes model?
// The specification says that a deme size has an exclusive minimum of zerol.
// So, no -- this cannot happen.
// Demes go extinct after their last epoch (forwards in time) has run out
// and the simulation is otherwise continuing.
//if (current_demographic_state.will_go_globally_extinct() == true)
// {
// std::ostringstream o;
// o << "extinction at time " << pop.generation;
// throw ddemog::GlobalExtinction(o.str());
// }

// TODO: Do we have sufficient test coverage through here?
if (!pop.mutations.empty())
{
Expand Down Expand Up @@ -534,9 +471,6 @@ evolve_with_tree_sequences(
// for a bit more context.
pop.diploids.swap(offspring);

// NOTE: this is a no-op
// current_demographic_state.early(rng, pop.generation, offspring_metadata);

// NOTE: the two swaps of the metadata ensure
// that the update loop below passes the correct
// metadata on, and that we then have the
Expand Down Expand Up @@ -652,52 +586,13 @@ evolve_with_tree_sequences(
}
}

// NOTE: this is where the model state is getting updated
// We will replace this with updating the state of the
// ForwardGraph.
//current_demographic_state.late(rng, pop.generation, miglookup,
// pop.diploid_metadata);
// FIXME: this is where our exception is happening
// in the test suite?
demography.iterate_state();

// NOTE: API change needed
// Easy mode: have one of these types locally
fitness_bookmark.update(demography.parental_deme_sizes(),
pop.diploid_metadata);
fitness_lookup.update(fitness_bookmark);
// NOTE: new function needed:
// If a pop has nonzero ancestry from a deme, but that
// parental deme has no individuals, throw an exception.
ddemog::validate_parental_state(pop.generation, fitness_lookup, demography);

// NOTE: this may be irrelevant -- see comment above about
// whether or not this is even possible.
// See above -- this block will likely just go away entirely.
// if (current_demographic_state.will_go_globally_extinct() == true)
// {
// simplification(
// options.preserve_selected_fixations,
// options.suppress_edge_table_indexing,
// options.reset_treeseqs_to_alive_nodes_after_simplification,
// post_simplification_recorder, *simplifier_state,
// simplification_output, *new_edge_buffer,
// alive_at_last_simplification, pop);
// simplifier_state.reset(nullptr);
// new_edge_buffer.reset(nullptr);
// final_population_cleanup(
// options.suppress_edge_table_indexing,
// options.preserve_selected_fixations,
// options.remove_extinct_mutations_at_finish,
// simulating_neutral_variants,
// options.reset_treeseqs_to_alive_nodes_after_simplification,
// last_preserved_generation, last_preserved_generation_counts,
// pop);
// std::ostringstream o;
// o << "extinction at time " << pop.generation;
// throw ddemog::GlobalExtinction(o.str());
// }

// TODO: deal with the result of the recorder populating sr
if (!sr.samples.empty())
{
Expand Down Expand Up @@ -766,7 +661,4 @@ evolve_with_tree_sequences(
<< __LINE__;
throw std::runtime_error(o.str());
}

// This is irrelevant -- yay!
// demography.set_model_state(std::move(current_demographic_state));
}

0 comments on commit 1fce28c

Please sign in to comment.