mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-13 09:22:05 -05:00
Merge pull request #3651 from akva2/remove_gcc7_compat
use std::filesystem directly
This commit is contained in:
9 files changed
+29
-24
No files matched your search
@@ -25,7 +25,6 @@
|
|||||||
#include <ebos/eclgenericvanguard.hh>
|
#include <ebos/eclgenericvanguard.hh>
|
||||||
|
|
||||||
#include <opm/common/ErrorMacros.hpp>
|
#include <opm/common/ErrorMacros.hpp>
|
||||||
#include <opm/common/utility/FileSystem.hpp>
|
|
||||||
#include <opm/common/utility/TimeService.hpp>
|
#include <opm/common/utility/TimeService.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Aquifer/NumericalAquifer/NumericalAquiferCell.hpp>
|
#include <opm/parser/eclipse/EclipseState/Aquifer/NumericalAquifer/NumericalAquiferCell.hpp>
|
||||||
@@ -49,6 +48,7 @@
|
|||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
#endif // HAVE_MPI
|
#endif // HAVE_MPI
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
@@ -144,18 +144,18 @@ void EclGenericVanguard::setExternalWTestState(std::unique_ptr<WellTestState> wt
|
|||||||
|
|
||||||
std::string EclGenericVanguard::canonicalDeckPath(const std::string& caseName)
|
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;
|
return false;
|
||||||
|
|
||||||
if (filesystem::is_regular_file(f))
|
if (std::filesystem::is_regular_file(f))
|
||||||
return true;
|
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))
|
if (fileExists(simcase))
|
||||||
return simcase.string();
|
return simcase.string();
|
||||||
|
|
||||||
@@ -213,9 +213,9 @@ void EclGenericVanguard::updateOutputDir_(std::string outputDir,
|
|||||||
outputDir = ioConfig.getOutputDir();
|
outputDir = ioConfig.getOutputDir();
|
||||||
|
|
||||||
// ensure that the output directory exists and that it is a directory
|
// ensure that the output directory exists and that it is a directory
|
||||||
if (!filesystem::is_directory(outputDir)) {
|
if (!std::filesystem::is_directory(outputDir)) {
|
||||||
try {
|
try {
|
||||||
filesystem::create_directories(outputDir);
|
std::filesystem::create_directories(outputDir);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
throw std::runtime_error("Creation of output directory '"+outputDir+"' failed\n");
|
throw std::runtime_error("Creation of output directory '"+outputDir+"' failed\n");
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
#include <dune/common/parallel/mpihelper.hh>
|
#include <dune/common/parallel/mpihelper.hh>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
namespace Properties {
|
namespace Properties {
|
||||||
namespace TTag {
|
namespace TTag {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <opm/common/utility/String.hpp>
|
#include <opm/common/utility/String.hpp>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
#if HAVE_DUNE_FEM
|
#if HAVE_DUNE_FEM
|
||||||
#include <dune/fem/misc/mpimanager.hh>
|
#include <dune/fem/misc/mpimanager.hh>
|
||||||
@@ -466,7 +467,7 @@ namespace Opm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace fs = ::Opm::filesystem;
|
namespace fs = ::std::filesystem;
|
||||||
const std::string& output_dir = eclState().getIOConfig().getOutputDir();
|
const std::string& output_dir = eclState().getIOConfig().getOutputDir();
|
||||||
fs::path output_path(output_dir);
|
fs::path output_path(output_dir);
|
||||||
fs::path deck_filename(EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName));
|
fs::path deck_filename(EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName));
|
||||||
@@ -578,7 +579,7 @@ namespace Opm
|
|||||||
report.reportFullyImplicit(ss);
|
report.reportFullyImplicit(ss);
|
||||||
OpmLog::info(ss.str());
|
OpmLog::info(ss.str());
|
||||||
const std::string dir = eclState().getIOConfig().getOutputDir();
|
const std::string dir = eclState().getIOConfig().getOutputDir();
|
||||||
namespace fs = ::Opm::filesystem;
|
namespace fs = ::std::filesystem;
|
||||||
fs::path output_dir(dir);
|
fs::path output_dir(dir);
|
||||||
{
|
{
|
||||||
std::string filename = eclState().getIOConfig().getBaseName() + ".INFOSTEP";
|
std::string filename = eclState().getIOConfig().getBaseName() + ".INFOSTEP";
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@@ -496,9 +497,9 @@ namespace Opm
|
|||||||
return true;
|
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)
|
auto exists = [](const fs::path& f)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#include <dune/istl/matrixmarket.hh>
|
#include <dune/istl/matrixmarket.hh>
|
||||||
#include <opm/simulators/linalg/MatrixMarketSpecializations.hpp>
|
#include <opm/simulators/linalg/MatrixMarketSpecializations.hpp>
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@@ -40,7 +42,7 @@ namespace Helper
|
|||||||
} else if (!dir.empty() && dir.back() != '/') {
|
} else if (!dir.empty() && dir.back() != '/') {
|
||||||
dir += "/";
|
dir += "/";
|
||||||
}
|
}
|
||||||
namespace fs = ::Opm::filesystem;
|
namespace fs = ::std::filesystem;
|
||||||
fs::path output_dir(dir);
|
fs::path output_dir(dir);
|
||||||
fs::path subdir("reports");
|
fs::path subdir("reports");
|
||||||
output_dir = output_dir / subdir;
|
output_dir = output_dir / subdir;
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
|
|
||||||
#include <opm/simulators/linalg/setupPropertyTree.hpp>
|
#include <opm/simulators/linalg/setupPropertyTree.hpp>
|
||||||
|
|
||||||
#include <opm/common/utility/FileSystem.hpp>
|
#include <filesystem>
|
||||||
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@@ -43,7 +42,7 @@ setupPropertyTree(FlowLinearSolverParameters p, // Note: copying the parameters
|
|||||||
// Get configuration from file.
|
// 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 (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 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.");
|
OPM_THROW(std::invalid_argument, "JSON file " << conf << " does not exist.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -21,20 +21,19 @@
|
|||||||
#ifndef OPM_PARALLELFILEMERGER_HEADER_INCLUDED
|
#ifndef OPM_PARALLELFILEMERGER_HEADER_INCLUDED
|
||||||
#define OPM_PARALLELFILEMERGER_HEADER_INCLUDED
|
#define OPM_PARALLELFILEMERGER_HEADER_INCLUDED
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <opm/common/utility/FileSystem.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace fs = ::Opm::filesystem;
|
namespace fs = ::std::filesystem;
|
||||||
|
|
||||||
/// \brief A functor that merges multiple files of a parallel run to one file.
|
/// \brief A functor that merges multiple files of a parallel run to one file.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include <opm/common/ErrorMacros.hpp>
|
#include <opm/common/ErrorMacros.hpp>
|
||||||
#include <opm/common/OpmLog/EclipsePRTLog.hpp>
|
#include <opm/common/OpmLog/EclipsePRTLog.hpp>
|
||||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||||
#include <opm/common/utility/FileSystem.hpp>
|
|
||||||
#include <opm/common/utility/OpmInputError.hpp>
|
#include <opm/common/utility/OpmInputError.hpp>
|
||||||
#include <opm/common/utility/String.hpp>
|
#include <opm/common/utility/String.hpp>
|
||||||
|
|
||||||
@@ -66,6 +65,7 @@
|
|||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <filesystem>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -93,7 +93,7 @@ namespace {
|
|||||||
|
|
||||||
void ensureOutputDirExists_(const std::string& cmdline_output_dir)
|
void ensureOutputDirExists_(const std::string& cmdline_output_dir)
|
||||||
{
|
{
|
||||||
namespace fs = Opm::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
if (! fs::is_directory(cmdline_output_dir)) {
|
if (! fs::is_directory(cmdline_output_dir)) {
|
||||||
try {
|
try {
|
||||||
@@ -350,7 +350,7 @@ Opm::setupLogging(const int mpi_rank_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create logFile
|
// create logFile
|
||||||
using Opm::filesystem::path;
|
using std::filesystem::path;
|
||||||
path fpath(deck_filename);
|
path fpath(deck_filename);
|
||||||
std::string baseName;
|
std::string baseName;
|
||||||
std::ostringstream debugFileStream;
|
std::ostringstream debugFileStream;
|
||||||
@@ -369,7 +369,7 @@ Opm::setupLogging(const int mpi_rank_,
|
|||||||
if (output_dir.empty()) {
|
if (output_dir.empty()) {
|
||||||
output_dir = fpath.has_parent_path()
|
output_dir = fpath.has_parent_path()
|
||||||
? absolute(fpath.parent_path()).generic_string()
|
? absolute(fpath.parent_path()).generic_string()
|
||||||
: Opm::filesystem::current_path().generic_string();
|
: std::filesystem::current_path().generic_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
logFileStream << output_dir << "/" << baseName;
|
logFileStream << output_dir << "/" << baseName;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#define BOOST_TEST_MODULE VFPTest
|
#define BOOST_TEST_MODULE VFPTest
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <filesystem>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -645,7 +646,7 @@ BOOST_AUTO_TEST_CASE(ParseInterpolateRealisticVFPPROD)
|
|||||||
auto units = Opm::UnitSystem::newMETRIC();
|
auto units = Opm::UnitSystem::newMETRIC();
|
||||||
|
|
||||||
Opm::Parser parser;
|
Opm::Parser parser;
|
||||||
Opm::filesystem::path file("VFPPROD2");
|
std::filesystem::path file("VFPPROD2");
|
||||||
|
|
||||||
auto deck = parser.parseFile(file.string());
|
auto deck = parser.parseFile(file.string());
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user