Use a "const" DataMap object.

As a fall-out, we can no longer use std::map<K,V>::operator[], because
that function cannot be applied to "const" objects.  Replace by .find().
This commit is contained in:
Bård Skaflestad 2012-06-28 14:42:04 +02:00
parent 89e099b724
commit ebf4b63aa4

View File

@ -53,7 +53,7 @@ namespace Opm
void writeECLData(const UnstructuredGrid& grid,
DataMap& data,
const DataMap& data,
const SimulatorTimer& simtimer,
const std::string& output_dir,
const std::string& base_name) {
@ -79,15 +79,21 @@ namespace Opm
ecl_rst_file_start_solution( rst_file );
{
ecl_kw_type * pressure_kw = ecl_kw_wrapper( grid , "PRESSURE" , data["pressure"] , 0 , 1);
ecl_rst_file_add_kw( rst_file , pressure_kw );
ecl_kw_free( pressure_kw );
DataMap::const_iterator i = data.find("pressure");
if (i != data.end()) {
ecl_kw_type * pressure_kw = ecl_kw_wrapper( grid , "PRESSURE" , i->second , 0 , 1);
ecl_rst_file_add_kw( rst_file , pressure_kw );
ecl_kw_free( pressure_kw );
}
}
{
ecl_kw_type * swat_kw = ecl_kw_wrapper( grid , "SWAT" , data["saturation"] , 0 , 2);
ecl_rst_file_add_kw( rst_file , swat_kw );
ecl_kw_free( swat_kw );
DataMap::const_iterator i = data.find("saturation");
if (i != data.end()) {
ecl_kw_type * swat_kw = ecl_kw_wrapper( grid , "SWAT" , i->second , 0 , 2);
ecl_rst_file_add_kw( rst_file , swat_kw );
ecl_kw_free( swat_kw );
}
}
ecl_rst_file_end_solution( rst_file );