diff --git a/ebos/eclgenericvanguard.cc b/ebos/eclgenericvanguard.cc index 33bcbb3bb..149a551c2 100644 --- a/ebos/eclgenericvanguard.cc +++ b/ebos/eclgenericvanguard.cc @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #endif // HAVE_MPI +#include #include namespace Opm { @@ -144,18 +144,18 @@ void EclGenericVanguard::setExternalWTestState(std::unique_ptr wt std::string EclGenericVanguard::canonicalDeckPath(const std::string& caseName) { - const auto fileExists = [](const filesystem::path& f) -> bool + const auto fileExists = [](const std::filesystem::path& f) -> bool { - if (!filesystem::exists(f)) + if (!std::filesystem::exists(f)) return false; - if (filesystem::is_regular_file(f)) + if (std::filesystem::is_regular_file(f)) return true; - return filesystem::is_symlink(f) && filesystem::is_regular_file(filesystem::read_symlink(f)); + return std::filesystem::is_symlink(f) && std::filesystem::is_regular_file(std::filesystem::read_symlink(f)); }; - auto simcase = filesystem::path(caseName); + auto simcase = std::filesystem::path(caseName); if (fileExists(simcase)) return simcase.string(); @@ -213,9 +213,9 @@ void EclGenericVanguard::updateOutputDir_(std::string outputDir, outputDir = ioConfig.getOutputDir(); // ensure that the output directory exists and that it is a directory - if (!filesystem::is_directory(outputDir)) { + if (!std::filesystem::is_directory(outputDir)) { try { - filesystem::create_directories(outputDir); + std::filesystem::create_directories(outputDir); } catch (...) { throw std::runtime_error("Creation of output directory '"+outputDir+"' failed\n"); diff --git a/flow/flow_ebos_solvent.cpp b/flow/flow_ebos_solvent.cpp index 0312c1841..cb40c9297 100644 --- a/flow/flow_ebos_solvent.cpp +++ b/flow/flow_ebos_solvent.cpp @@ -29,6 +29,8 @@ #include #endif +#include + namespace Opm { namespace Properties { namespace TTag { diff --git a/opm/simulators/flow/FlowMainEbos.hpp b/opm/simulators/flow/FlowMainEbos.hpp index 2430ee2ee..b3cc7ea43 100644 --- a/opm/simulators/flow/FlowMainEbos.hpp +++ b/opm/simulators/flow/FlowMainEbos.hpp @@ -37,6 +37,7 @@ #include #include +#include #if HAVE_DUNE_FEM #include @@ -466,7 +467,7 @@ namespace Opm return; } - namespace fs = ::Opm::filesystem; + namespace fs = ::std::filesystem; const std::string& output_dir = eclState().getIOConfig().getOutputDir(); fs::path output_path(output_dir); fs::path deck_filename(EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName)); @@ -578,7 +579,7 @@ namespace Opm report.reportFullyImplicit(ss); OpmLog::info(ss.str()); const std::string dir = eclState().getIOConfig().getOutputDir(); - namespace fs = ::Opm::filesystem; + namespace fs = ::std::filesystem; fs::path output_dir(dir); { std::string filename = eclState().getIOConfig().getBaseName() + ".INFOSTEP"; diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index a4b889b75..af3430b63 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -69,6 +69,7 @@ #include #include +#include #include #include #include @@ -496,9 +497,9 @@ namespace Opm return true; } - filesystem::path simulationCaseName_(const std::string& casename) + std::filesystem::path simulationCaseName_(const std::string& casename) { - namespace fs = ::Opm::filesystem; + namespace fs = ::std::filesystem; auto exists = [](const fs::path& f) { diff --git a/opm/simulators/linalg/WriteSystemMatrixHelper.hpp b/opm/simulators/linalg/WriteSystemMatrixHelper.hpp index 35041dea4..496c3790b 100644 --- a/opm/simulators/linalg/WriteSystemMatrixHelper.hpp +++ b/opm/simulators/linalg/WriteSystemMatrixHelper.hpp @@ -23,6 +23,8 @@ #include #include +#include + namespace Opm { @@ -40,7 +42,7 @@ namespace Helper } else if (!dir.empty() && dir.back() != '/') { dir += "/"; } - namespace fs = ::Opm::filesystem; + namespace fs = ::std::filesystem; fs::path output_dir(dir); fs::path subdir("reports"); output_dir = output_dir / subdir; diff --git a/opm/simulators/linalg/setupPropertyTree.cpp b/opm/simulators/linalg/setupPropertyTree.cpp index b48df879f..5b4b8e7da 100644 --- a/opm/simulators/linalg/setupPropertyTree.cpp +++ b/opm/simulators/linalg/setupPropertyTree.cpp @@ -21,8 +21,7 @@ #include -#include - +#include #include namespace Opm @@ -43,7 +42,7 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters // Get configuration from file. if (conf.size() > 5 && conf.substr(conf.size() - 5, 5) == ".json") { // the ends_with() method is not available until C++20 #if BOOST_VERSION / 100 % 1000 > 48 - if ( !filesystem::exists(conf) ) { + if ( !std::filesystem::exists(conf) ) { OPM_THROW(std::invalid_argument, "JSON file " << conf << " does not exist."); } try { diff --git a/opm/simulators/utils/ParallelFileMerger.hpp b/opm/simulators/utils/ParallelFileMerger.hpp index 4b6602ad8..5d8f91b84 100644 --- a/opm/simulators/utils/ParallelFileMerger.hpp +++ b/opm/simulators/utils/ParallelFileMerger.hpp @@ -21,20 +21,19 @@ #ifndef OPM_PARALLELFILEMERGER_HEADER_INCLUDED #define OPM_PARALLELFILEMERGER_HEADER_INCLUDED +#include #include #include #include #include -#include - namespace Opm { namespace detail { -namespace fs = ::Opm::filesystem; +namespace fs = ::std::filesystem; /// \brief A functor that merges multiple files of a parallel run to one file. /// diff --git a/opm/simulators/utils/readDeck.cpp b/opm/simulators/utils/readDeck.cpp index 8cbe24ae7..d19139359 100644 --- a/opm/simulators/utils/readDeck.cpp +++ b/opm/simulators/utils/readDeck.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -66,6 +65,7 @@ #include #include +#include #include #include #include @@ -93,7 +93,7 @@ namespace { void ensureOutputDirExists_(const std::string& cmdline_output_dir) { - namespace fs = Opm::filesystem; + namespace fs = std::filesystem; if (! fs::is_directory(cmdline_output_dir)) { try { @@ -350,7 +350,7 @@ Opm::setupLogging(const int mpi_rank_, } // create logFile - using Opm::filesystem::path; + using std::filesystem::path; path fpath(deck_filename); std::string baseName; std::ostringstream debugFileStream; @@ -369,7 +369,7 @@ Opm::setupLogging(const int mpi_rank_, if (output_dir.empty()) { output_dir = fpath.has_parent_path() ? absolute(fpath.parent_path()).generic_string() - : Opm::filesystem::current_path().generic_string(); + : std::filesystem::current_path().generic_string(); } logFileStream << output_dir << "/" << baseName; diff --git a/tests/test_vfpproperties.cpp b/tests/test_vfpproperties.cpp index d1927b177..a2bb8cd53 100644 --- a/tests/test_vfpproperties.cpp +++ b/tests/test_vfpproperties.cpp @@ -23,6 +23,7 @@ #define BOOST_TEST_MODULE VFPTest #include +#include #include #include #include @@ -645,7 +646,7 @@ BOOST_AUTO_TEST_CASE(ParseInterpolateRealisticVFPPROD) auto units = Opm::UnitSystem::newMETRIC(); Opm::Parser parser; - Opm::filesystem::path file("VFPPROD2"); + std::filesystem::path file("VFPPROD2"); auto deck = parser.parseFile(file.string());