Fixed bug in programm.
This commit is contained in:
@@ -43,7 +43,8 @@ string Population_Load_Saver::get_save_path() {
|
||||
|
||||
void Population_Load_Saver::write_overhead(ofstream *save_stream) {
|
||||
*save_stream<<"# File is automatically created. File contains Populations Density. To be loaded as start offset.\n";
|
||||
*save_stream<<calc_number()<<"\t # Number of Populations \n";
|
||||
int num_species = calc_number_pops();
|
||||
*save_stream<<num_species<<"\t # Number of Populations \n";
|
||||
|
||||
*save_stream<<timer->get_time_s()<<"\t # Offset Time in seconds \n";
|
||||
|
||||
@@ -88,18 +89,17 @@ void Population_Load_Saver::write_species(ofstream *save_stream, species this_sp
|
||||
*save_stream<<"end_of_species \n";
|
||||
}
|
||||
|
||||
int Population_Load_Saver::calc_number() {
|
||||
int num = 0;
|
||||
int Population_Load_Saver::calc_number_pops() {
|
||||
int num_species = 0;
|
||||
vector<species> all_species = get_all_species_vector();
|
||||
for (vector<species>::iterator itr = all_species.begin(); itr!= all_species.end(); itr++) {
|
||||
if (populations->find(*itr)->access_container() != nullptr) {
|
||||
num += 1 ;
|
||||
num_species += 1 ;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
return num_species;
|
||||
}
|
||||
|
||||
|
||||
void Population_Load_Saver::load() {
|
||||
// Maybe change whole system to h5, therefore allowing sloppy style
|
||||
string load_path = get_enviroment_variable("pop_load_path");
|
||||
@@ -115,7 +115,7 @@ void Population_Load_Saver::load() {
|
||||
}
|
||||
goto_nextline(&load_stream); //ignore first line
|
||||
int number_populations = get_num_populations_line(&load_stream);
|
||||
if (number_populations != calc_number()) {
|
||||
if (number_populations != calc_number_pops()) {
|
||||
stringstream ss;
|
||||
ss<<"Population_Load_Saver::load: Number Population missmatch.\n";
|
||||
throw MyException(ss.str());
|
||||
|
||||
Reference in New Issue
Block a user