Guard against non-existing file

This commit is contained in:
Tor Harald Sandve 2016-09-21 09:38:51 +02:00
parent f1bdd67438
commit ff81d48551

View File

@ -87,6 +87,9 @@ namespace Opm
HardcodedTimeStepControl( const std::string& filename)
{
std::ifstream infile (filename);
if (!infile.is_open()) {
OPM_THROW(std::runtime_error,"Incorrect or no filename is provided to the hardcodedTimeStep. Use timestep.control.filename=your_file_name");
}
std::string::size_type sz;
std::string line;
while ( std::getline(infile, line)) {