void Visitation_object::load_PSF_from_archive()
{

    my_Forward_partial_sum_function.clear_data();    
    
    
    // open the archive
    std::ifstream in_fs( temporary_PSF_serialization_name.c_str(),   std::ios::binary | std::ios::in );  //  std::ios_base::binary    
                            if ( !in_fs.good()  )
                            {
                                std::stringstream error_strm;
                                print_line_of_markers("ERROR! ", &error_strm);
                                print_line_of_markers("(", &error_strm);
                                error_strm << "\n\nrank " << my_MPI_rank << "  thread " << omp_get_thread_num() << "\n";
                                
                                error_strm << "\n\nERROR!   not good ifstream   in  \"load_PSF_from_archive\",\n\t\t temporary_PSF_serialization_name =    "  
                                <<  temporary_PSF_serialization_name  << "\n\n";
                                
                                print_line_of_markers(")", &error_strm);
                                std::fprintf(stderr, "\n\n%s\n\n", error_strm.str().c_str() );    
                            }
    
    
    boost::archive::binary_iarchive in_archive( in_fs );

    // restore  from the archive
    
    in_archive >> my_Forward_partial_sum_function;
    
//     //recall that we ignored the Event pointer when saving.  so it must be reset now.
//     my_Forward_partial_sum_function.eliminating_Event_UID = event_for_elimination->UID;
    
    
    
    in_fs.close();

}  //  load_PSF_from_archive
Example #2
0
void World::loadState(std::string filename)
{
    std::cout << "Loading simulation state from " << filename << std::endl;
    std::ifstream file(filename);
    boost::archive::text_iarchive in_archive(file);
    
    g_world = this; // see serialization.hpp for info on this line
    
    in_archive >> *this;
    in_archive >> foods_;
    in_archive >> obstacles_;
    in_archive >> creatures_;
    in_archive >> anthills_;
    in_archive >> pheromone_maps_;

    entity_map_ = boost::make_shared<Entity2DMap>(width_, height_);
    
    for(const auto& entity : foods_) trackEntity(entity);
    for(const auto& entity : obstacles_) trackEntity(entity);
    for(const auto& entity : creatures_) trackEntity(entity);
    for(const auto& entity : anthills_) trackEntity(entity);
    
    std::cout << "Finished loading" << std::endl;
}