Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Atgeirr Flø Rasmussen 2012-08-17 10:58:12 +02:00
commit 48acb816ff
2 changed files with 39 additions and 12 deletions

View File

@ -46,6 +46,7 @@
#include <opm/core/simulator/SimulatorTwophase.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/filesystem/convenience.hpp>
#include <algorithm>
#include <iostream>
@ -155,17 +156,27 @@ main(int argc, char** argv)
// Linear solver.
LinearSolverFactory linsolver(param);
// Warn if any parameters are unused.
// if (param.anyUnused()) {
// std::cout << "-------------------- Unused parameters: --------------------\n";
// param.displayUsage();
// std::cout << "----------------------------------------------------------------" << std::endl;
// }
//Warn if any parameters are unused.
if (param.anyUnused()) {
std::cout << "-------------------- Unused parameters: --------------------\n";
param.displayUsage();
std::cout << "----------------------------------------------------------------" << std::endl;
}
// Write parameters used for later reference.
// if (output) {
// param.writeParam(output_dir + "/spu_2p.param");
// }
bool output = param.getDefault("output", true);
if (output) {
std::string output_dir =
param.getDefault("output_dir", std::string("output"));
boost::filesystem::path fpath(output_dir);
try {
create_directories(fpath);
}
catch (...) {
THROW("Creating directories failed: " << fpath);
}
param.writeParam(output_dir + "/spu_2p.param");
}
std::cout << "\n\n================ Starting main simulation loop ===============\n"

View File

@ -137,7 +137,15 @@ namespace Opm
{
// Write data in VTK format.
std::ostringstream vtkfilename;
vtkfilename << output_dir << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
vtkfilename << output_dir << "/vtk_files";
boost::filesystem::path fpath(vtkfilename.str().c_str());
try {
create_directories(fpath);
}
catch (...) {
THROW("Creating directories failed: " << fpath);
}
vtkfilename << "/" << std::setw(3) << std::setfill('0') << step << ".vtu";
std::ofstream vtkfile(vtkfilename.str().c_str());
if (!vtkfile) {
THROW("Failed to open " << vtkfilename.str());
@ -153,7 +161,15 @@ namespace Opm
// Write data (not grid) in Matlab format
for (Opm::DataMap::const_iterator it = dm.begin(); it != dm.end(); ++it) {
std::ostringstream fname;
fname << output_dir << "/" << it->first << "-" << std::setw(3) << std::setfill('0') << step << ".dat";
fname << output_dir << "/" << it->first;
boost::filesystem::path fpath(fname.str().c_str());
try {
create_directories(fpath);
}
catch (...) {
THROW("Creating directories failed: " << fpath);
}
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
std::ofstream file(fname.str().c_str());
if (!file) {
THROW("Failed to open " << fname.str());