Cosisim::~Cosisim() { delete ccdf_; delete marginal_; delete kconstraints_; remove_temporary_properties(); }
int Cosisim::execute( GsTL_project* ) { // Initialize the global random number generator Global_random_number_generator::instance()->seed( seed_ ); // Set up a progress notifier int total_steps = simul_grid_->size() * (nb_of_realizations_); int frequency = std::max( total_steps / 20, 1 ); SmartPtr<Progress_notifier> progress_notifier = utils::create_notifier( "Running CoSisim", total_steps, frequency ); simul_grid_->init_random_path(); // loop on all realizations for( int nreal = 0; nreal < nb_of_realizations_ ; nreal ++ ) { // update the progress notifier progress_notifier->message() << "working on realization " << nreal+1 << gstlIO::end; if( !progress_notifier->notify() ) return 1; // Create a new property to hold the realization and tell the simulation // grid to use it as the current property appli_message( "Creating new realization" ); Grid_continuous_property* prop = multireal_property_->new_realization(); prop->set_parameters(parameters_); simul_grid_->select_property( prop->name() ); typedef Geostat_grid::random_path_iterator RandomPathIterator; RandomPathIterator path_begin = simul_grid_->random_path_begin(); RandomPathIterator path_end = simul_grid_->random_path_end(); int status = 0; if( do_median_ik_ ) status = median_ik( path_begin, path_end, progress_notifier.raw_ptr() ); else status = full_ik( path_begin, path_end, progress_notifier.raw_ptr() ); reset_indicator_properties(); // check if the simulation was aborted if( status == 1 ) { clean( prop ); return 1; } } // end loop on realizations remove_temporary_properties(); return 0; }
void Cosisim::clean( GsTLGridProperty* prop ) { simul_grid_->remove_property( prop->name() ); remove_temporary_properties(); }