diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 119abcfeb..e672cb4e7 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -31,6 +31,7 @@ list (APPEND MAIN_SOURCE_FILES src/opm/common/OpmLog/StreamLog.cpp src/opm/common/OpmLog/TimerLog.cpp src/opm/common/utility/ActiveGridCells.cpp + src/opm/common/utility/FileSystem.cpp src/opm/common/utility/numeric/MonotCubicInterpolator.cpp src/opm/common/utility/parameters/Parameter.cpp src/opm/common/utility/parameters/ParameterGroup.cpp @@ -471,6 +472,7 @@ list( APPEND PUBLIC_HEADER_FILES opm/common/OpmLog/StreamLog.hpp opm/common/OpmLog/TimerLog.hpp opm/common/utility/ActiveGridCells.hpp + opm/common/utility/FileSystem.hpp opm/common/utility/numeric/cmp.hpp opm/common/utility/platform_dependent/disable_warnings.h opm/common/utility/platform_dependent/reenable_warnings.h diff --git a/GenerateKeywords.cmake b/GenerateKeywords.cmake index 78f061cad..1ef0a4280 100644 --- a/GenerateKeywords.cmake +++ b/GenerateKeywords.cmake @@ -32,7 +32,7 @@ if(NOT cjson_FOUND) endif() add_executable(genkw ${genkw_SOURCES}) -target_link_libraries(genkw Boost::filesystem Boost::system) +target_link_libraries(genkw ${opm-common_LIBRARIES}) # Generate keyword list include(src/opm/parser/eclipse/share/keywords/keyword_list.cmake) diff --git a/cmake/Modules/OpmCompilerChecks.cmake b/cmake/Modules/OpmCompilerChecks.cmake index fe2387b07..137da1758 100644 --- a/cmake/Modules/OpmCompilerChecks.cmake +++ b/cmake/Modules/OpmCompilerChecks.cmake @@ -91,3 +91,9 @@ CHECK_CXX_SOURCE_COMPILES(" }; " HAS_ATTRIBUTE_DEPRECATED_MSG ) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSRSION VERSION_LESS 8.0) + list(APPEND ${project}_LIBRARIES stdc++fs) + endif() +endif() diff --git a/examples/opmpack.cpp b/examples/opmpack.cpp index 28fb3ec3a..8444a06df 100644 --- a/examples/opmpack.cpp +++ b/examples/opmpack.cpp @@ -19,8 +19,8 @@ #include #include -#include +#include #include #include #include @@ -95,10 +95,10 @@ int main(int argc, char** argv) { pack_deck(argv[arg_offset], std::cout); else { std::ofstream os; - using path = boost::filesystem::path; + using path = Opm::filesystem::path; path input_arg(argv[arg_offset]); path output_arg(coutput_arg); - if (boost::filesystem::is_directory(output_arg)) { + if (Opm::filesystem::is_directory(output_arg)) { path output_path = output_arg / input_arg.filename(); os.open(output_path.string()); } else diff --git a/opm-common-prereqs.cmake b/opm-common-prereqs.cmake index 987e86436..1939eda81 100644 --- a/opm-common-prereqs.cmake +++ b/opm-common-prereqs.cmake @@ -9,20 +9,11 @@ set (opm-common_CONFIG_VAR set (opm-common_DEPS # compile with C99 support if available "C99" - ) +) + +list(APPEND opm-common_DEPS + # various runtime library enhancements + "Boost 1.44.0 COMPONENTS system unit_test_framework REQUIRED" +) -if(ENABLE_ECL_INPUT) - list(APPEND opm-common_DEPS - # various runtime library enhancements - "Boost 1.44.0 - COMPONENTS system filesystem unit_test_framework REQUIRED") -else() - list(APPEND opm-common_DEPS - # various runtime library enhancements - "Boost 1.44.0 - COMPONENTS system unit_test_framework REQUIRED") -endif() -# We need a defined target for libecl when linking. -# The definition of the target is done implicitly below when -# libecl is searched for. find_package_deps(opm-common) diff --git a/opm/common/utility/FileSystem.hpp b/opm/common/utility/FileSystem.hpp new file mode 100644 index 000000000..603553e71 --- /dev/null +++ b/opm/common/utility/FileSystem.hpp @@ -0,0 +1,46 @@ +/* + Copyright 2019 Equinor ASA + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ +#ifndef OPM_FILESYSTEM_HPP +#define OPM_FILESYSTEM_HPP + + +#if __cplusplus__ >= 201703L +#include +#else +#include +#endif + +#include + + +namespace Opm +{ +#if __cplusplus__ >= 201703L + namespace filesystem = std::filesystem; +#else + namespace filesystem = std::experimental::filesystem; +#endif + + // A poor man's filesystem::unique_path + std::string unique_path(const std::string& input); + +} // end namespace Opm + + +#endif // OPM_FILESYSTEM_HPP diff --git a/opm/io/eclipse/ESmry.hpp b/opm/io/eclipse/ESmry.hpp index 7dfa33a52..dee9d5743 100644 --- a/opm/io/eclipse/ESmry.hpp +++ b/opm/io/eclipse/ESmry.hpp @@ -21,7 +21,7 @@ #include #include -#include +#include namespace Opm { namespace EclIO { @@ -54,13 +54,13 @@ private: std::vector seqIndex; std::vector seqTime; - std::vector checkForMultipleResultFiles(const boost::filesystem::path& rootN, bool formatted) const; + std::vector checkForMultipleResultFiles(const Opm::filesystem::path& rootN, bool formatted) const; void getRstString(const std::vector& restartArray, - boost::filesystem::path& pathRst, - boost::filesystem::path& rootN) const; + Opm::filesystem::path& pathRst, + Opm::filesystem::path& rootN) const; - void updatePathAndRootName(boost::filesystem::path& dir, boost::filesystem::path& rootN) const; + void updatePathAndRootName(Opm::filesystem::path& dir, Opm::filesystem::path& rootN) const; std::string makeKeyString(const std::string& keyword, const std::string& wgname, int num) const; }; diff --git a/opm/json/JsonObject.hpp b/opm/json/JsonObject.hpp index e949859cf..3872a9ca2 100644 --- a/opm/json/JsonObject.hpp +++ b/opm/json/JsonObject.hpp @@ -22,7 +22,7 @@ #include -#include +#include struct cJSON; @@ -30,7 +30,7 @@ namespace Json { class JsonObject { public: - explicit JsonObject(const boost::filesystem::path& jsonFile ); + explicit JsonObject(const Opm::filesystem::path& jsonFile ); explicit JsonObject(const std::string& inline_json); explicit JsonObject(const char * inline_json); explicit JsonObject(cJSON * root); diff --git a/opm/parser/eclipse/Deck/Deck.hpp b/opm/parser/eclipse/Deck/Deck.hpp index c369d9020..4b3663686 100644 --- a/opm/parser/eclipse/Deck/Deck.hpp +++ b/opm/parser/eclipse/Deck/Deck.hpp @@ -26,8 +26,6 @@ #include #include -#include - #include #include diff --git a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp index c22bf4ff6..e1c09d7df 100644 --- a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp @@ -21,6 +21,7 @@ #ifndef OPM_TABLE_MANAGER_HPP #define OPM_TABLE_MANAGER_HPP +#include #include #include diff --git a/opm/parser/eclipse/Generator/KeywordLoader.hpp b/opm/parser/eclipse/Generator/KeywordLoader.hpp index 5028e4e06..7df16a430 100644 --- a/opm/parser/eclipse/Generator/KeywordLoader.hpp +++ b/opm/parser/eclipse/Generator/KeywordLoader.hpp @@ -25,7 +25,6 @@ #include #include -#include #include namespace Opm { diff --git a/opm/parser/eclipse/Parser/Parser.hpp b/opm/parser/eclipse/Parser/Parser.hpp index 02d3752ed..3391446e0 100644 --- a/opm/parser/eclipse/Parser/Parser.hpp +++ b/opm/parser/eclipse/Parser/Parser.hpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -86,9 +86,9 @@ namespace Opm { std::vector getAllDeckNames () const; void loadKeywords(const Json::JsonObject& jsonKeywords); - bool loadKeywordFromFile(const boost::filesystem::path& configFile); + bool loadKeywordFromFile(const Opm::filesystem::path& configFile); - void loadKeywordsFromDirectory(const boost::filesystem::path& directory , bool recursive = true); + void loadKeywordsFromDirectory(const Opm::filesystem::path& directory , bool recursive = true); void applyUnitsToDeck(Deck& deck) const; /*! diff --git a/python/setup.py b/python/setup.py index f1bd269e2..8da7c3c72 100644 --- a/python/setup.py +++ b/python/setup.py @@ -7,6 +7,7 @@ import setuptools import glob import os +import re import subprocess try: from importlib.machinery import EXTENSION_SUFFIXES @@ -23,6 +24,14 @@ try: cc = os.environ.get("CC", "c++") os.environ['CC'] = 'ccache {}'.format(cc) print("Using 'ccache {}' as compiler".format(cc)) + + # This is very hacky but so is the entire setup.py buildsystem. + output=subprocess.check_output([cc, "--version"]) + libs=['opmcommon', 'boost_system'] + output=str(output) + if output.find('Free Software Foundation'): + libs.append('stdc++fs') + except OSError as e: print('\nNOTE: please install ccache for faster compilation of python bindings.\n') @@ -54,7 +63,7 @@ ext_modules = [ 'cxx/well.cpp', 'cxx/export.cpp' ], - libraries=['opmcommon', 'boost_filesystem', 'boost_regex'], + libraries=libs, language='c++', undef_macros=["NDEBUG"], include_dirs=["pybind11/include"], diff --git a/src/opm/common/utility/FileSystem.cpp b/src/opm/common/utility/FileSystem.cpp new file mode 100644 index 000000000..d2c85cd50 --- /dev/null +++ b/src/opm/common/utility/FileSystem.cpp @@ -0,0 +1,50 @@ +/* + Copyright 2019 Equinor ASA + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#include + +#include +#include + +namespace Opm +{ + +std::string unique_path(const std::string& input) +{ + std::random_device rd; + std::mt19937 gen(rd()); + auto randchar = [&gen]() + { + const std::string set = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + std::uniform_int_distribution<> select(0, set.size()-1); + return set[select(gen)]; + }; + + std::string ret; + ret.reserve(input.size()); + std::transform(input.begin(), input.end(), std::back_inserter(ret), + [&randchar](const char c) + { + return (c == '%') ? randchar() : c; + }); + + return ret; +} + +} diff --git a/src/opm/io/eclipse/ESmry.cpp b/src/opm/io/eclipse/ESmry.cpp index 39ae62235..fb240232c 100644 --- a/src/opm/io/eclipse/ESmry.cpp +++ b/src/opm/io/eclipse/ESmry.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include /* @@ -60,8 +60,8 @@ namespace Opm { namespace EclIO { ESmry::ESmry(const std::string &filename, bool loadBaseRunData) { - boost::filesystem::path inputFileName(filename); - boost::filesystem::path rootName = inputFileName.parent_path() / inputFileName.stem(); + Opm::filesystem::path inputFileName(filename); + Opm::filesystem::path rootName = inputFileName.parent_path() / inputFileName.stem(); // if root name (without any extension) given as first argument in constructor, binary will then be assumed if (inputFileName.extension()==""){ @@ -77,15 +77,15 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) bool formatted = inputFileName.extension()==".SMSPEC" ? false : true; formattedVect.push_back(formatted); - boost::filesystem::path path = boost::filesystem::current_path();; + Opm::filesystem::path path = Opm::filesystem::current_path();; updatePathAndRootName(path, rootName); - boost::filesystem::path smspec_file = path / rootName; + Opm::filesystem::path smspec_file = path / rootName; smspec_file += inputFileName.extension(); - boost::filesystem::path rstRootN; - boost::filesystem::path pathRstFile = path; + Opm::filesystem::path rstRootN; + Opm::filesystem::path pathRstFile = path; std::set keywList; std::vector> smryArray; @@ -124,13 +124,13 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) while ((rstRootN.string() != "") && (loadBaseRunData)) { - boost::filesystem::path rstFile = pathRstFile / rstRootN; + Opm::filesystem::path rstFile = pathRstFile / rstRootN; rstFile += ".SMSPEC"; bool baseRunFmt = false; // if unformatted file not exists, check for formatted file - if (!boost::filesystem::exists(rstFile)){ + if (!Opm::filesystem::exists(rstFile)){ rstFile = pathRstFile / rstRootN; rstFile += ".FSMSPEC"; @@ -230,7 +230,7 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) toReportStepNumber = std::numeric_limits::max(); } - boost::filesystem::path smspecFile(std::get<0>(smryArray[n])); + Opm::filesystem::path smspecFile(std::get<0>(smryArray[n])); rootName = smspecFile.parent_path() / smspecFile.stem(); @@ -239,11 +239,11 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) // if both unified and non-unified files exists, will use most recent based on // time stamp - boost::filesystem::path unsmryFile = rootName; + Opm::filesystem::path unsmryFile = rootName; formattedVect[n] ? unsmryFile += ".FUNSMRY" : unsmryFile += ".UNSMRY"; - bool use_unified = boost::filesystem::exists(unsmryFile.string()); + bool use_unified = Opm::filesystem::exists(unsmryFile.string()); std::vector multFileList = checkForMultipleResultFiles(rootName, formattedVect[n]); @@ -252,8 +252,8 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) if ((!use_unified) && (multFileList.size()==0)){ throw std::runtime_error("neigther unified or non-unified result files found"); } else if ((use_unified) && (multFileList.size()>0)){ - auto time_multiple = boost::filesystem::last_write_time(multFileList.back()); - auto time_unified = boost::filesystem::last_write_time(unsmryFile); + auto time_multiple = Opm::filesystem::last_write_time(multFileList.back()); + auto time_unified = Opm::filesystem::last_write_time(unsmryFile); if (time_multiple > time_unified){ resultsFileList=multFileList; @@ -374,14 +374,14 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) } -std::vector ESmry::checkForMultipleResultFiles(const boost::filesystem::path& rootN, bool formatted) const { +std::vector ESmry::checkForMultipleResultFiles(const Opm::filesystem::path& rootN, bool formatted) const { std::vector fileList; std::string pathRootN = rootN.parent_path().string(); std::string fileFilter = formatted ? rootN.stem().string()+".A" : rootN.stem().string()+".S"; - for (boost::filesystem::directory_iterator itr(pathRootN); itr!=boost::filesystem::directory_iterator(); ++itr) + for (Opm::filesystem::directory_iterator itr(pathRootN); itr != Opm::filesystem::directory_iterator(); ++itr) { std::string file = itr->path().filename().string(); @@ -395,7 +395,7 @@ std::vector ESmry::checkForMultipleResultFiles(const boost::filesys return fileList; } -void ESmry::getRstString(const std::vector& restartArray, boost::filesystem::path& pathRst, boost::filesystem::path& rootN) const { +void ESmry::getRstString(const std::vector& restartArray, Opm::filesystem::path& pathRst, Opm::filesystem::path& rootN) const { std::string rootNameStr=""; @@ -403,12 +403,12 @@ void ESmry::getRstString(const std::vector& restartArray, boost::fi rootNameStr = rootNameStr + str; } - rootN = boost::filesystem::path(rootNameStr); + rootN = Opm::filesystem::path(rootNameStr); updatePathAndRootName(pathRst, rootN); } -void ESmry::updatePathAndRootName(boost::filesystem::path& dir, boost::filesystem::path& rootN) const { +void ESmry::updatePathAndRootName(Opm::filesystem::path& dir, Opm::filesystem::path& rootN) const { if (rootN.parent_path().is_absolute()){ dir = rootN.parent_path(); diff --git a/src/opm/io/eclipse/OutputStream.cpp b/src/opm/io/eclipse/OutputStream.cpp index 0cf8b8eb2..263fbcdc1 100644 --- a/src/opm/io/eclipse/OutputStream.cpp +++ b/src/opm/io/eclipse/OutputStream.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include namespace { namespace FileExtension @@ -396,7 +396,7 @@ openUnified(const std::string& fname, // to be an actual unified restart file. throw std::invalid_argument { "Purported existing unified restart file '" - + boost::filesystem::path{fname}.filename().string() + + Opm::filesystem::path{fname}.filename().string() + "' does not appear to be a unified restart file" }; } @@ -444,7 +444,7 @@ openExisting(const std::string& fname, // resize_file() followed by seekp() is the intended and expected // order of operations. - boost::filesystem::resize_file(fname, writePos); + Opm::filesystem::resize_file(fname, writePos); if (! this->stream_->ofileH.seekp(0, std::ios_base::end)) { throw std::invalid_argument { @@ -800,7 +800,7 @@ std::string Opm::EclIO::OutputStream::outputFileName(const ResultSet& rsetDescriptor, const std::string& ext) { - namespace fs = boost::filesystem; + namespace fs = Opm::filesystem; // Allow baseName = "CASE", "CASE.", "CASE.N", or "CASE.N.". auto fname = fs::path { diff --git a/src/opm/json/JsonObject.cpp b/src/opm/json/JsonObject.cpp index 67cd6e9bd..1774d9704 100644 --- a/src/opm/json/JsonObject.cpp +++ b/src/opm/json/JsonObject.cpp @@ -23,8 +23,7 @@ #include #include -#include -#include +#include #include #include @@ -49,7 +48,7 @@ namespace Json { - JsonObject::JsonObject(const boost::filesystem::path& jsonFile ) { + JsonObject::JsonObject(const Opm::filesystem::path& jsonFile ) { std::ifstream stream(jsonFile.string().c_str()); if (stream) { std::string content_from_file( (std::istreambuf_iterator(stream)), diff --git a/src/opm/output/eclipse/EclipseIO.cpp b/src/opm/output/eclipse/EclipseIO.cpp index b6ce89be0..24e388683 100644 --- a/src/opm/output/eclipse/EclipseIO.cpp +++ b/src/opm/output/eclipse/EclipseIO.cpp @@ -54,8 +54,7 @@ #include #include // move -#include -#include +#include namespace { @@ -66,9 +65,9 @@ inline std::string uppercase( std::string x ) { return x; } -void ensure_directory_exists( const boost::filesystem::path& odir ) +void ensure_directory_exists( const Opm::filesystem::path& odir ) { - namespace fs = boost::filesystem; + namespace fs = Opm::filesystem; if (fs::exists( odir ) && !fs::is_directory( odir )) throw std::runtime_error { @@ -76,11 +75,11 @@ void ensure_directory_exists( const boost::filesystem::path& odir ) + "' already exists but is not a directory" }; - boost::system::error_code ec{}; + std::error_code ec{}; if (! fs::exists( odir )) fs::create_directories( odir, ec ); - if (ec != boost::system::errc::success) { + if (ec) { std::ostringstream msg; msg << "Failed to create output directory '" @@ -145,7 +144,7 @@ void EclipseIO::Impl::writeEGRIDFile( const NNC& nnc ) { + (formatted ? std::string{"F"} : std::string{}) + "EGRID"; - const auto egridFile = (boost::filesystem::path{ this->outputDir } + const auto egridFile = (Opm::filesystem::path{ this->outputDir } / (this->baseName + ext)).generic_string(); this->grid.save( egridFile, formatted, nnc, this->es.getDeckUnitSystem()); diff --git a/src/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp b/src/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp index 55b4f4c84..43ee3d170 100644 --- a/src/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp +++ b/src/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -60,12 +60,12 @@ namespace Opm { inline std::string basename( const std::string& path ) { - return boost::filesystem::path( path ).stem().string(); + return Opm::filesystem::path( path ).stem().string(); } inline std::string outputdir( const std::string& path ) { - auto dir = boost::filesystem::path( path ).parent_path().string(); + auto dir = Opm::filesystem::path( path ).parent_path().string(); if( dir.empty() ) return default_dir; @@ -266,7 +266,7 @@ namespace Opm { } std::string IOConfig::fullBasePath( ) const { - namespace fs = boost::filesystem; + namespace fs = Opm::filesystem; fs::path dir( m_output_dir ); fs::path base( m_base_name ); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp index b1f36af59..8f4b47187 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp @@ -17,6 +17,7 @@ along with OPM. If not, see . */ +#include #include #include diff --git a/src/opm/parser/eclipse/Generator/KeywordGenerator.cpp b/src/opm/parser/eclipse/Generator/KeywordGenerator.cpp index 9b9812239..589c7edc3 100644 --- a/src/opm/parser/eclipse/Generator/KeywordGenerator.cpp +++ b/src/opm/parser/eclipse/Generator/KeywordGenerator.cpp @@ -23,8 +23,7 @@ #include #include -#include -#include +#include #include #include @@ -60,9 +59,9 @@ namespace Opm { } void KeywordGenerator::ensurePath( const std::string& file_name) { - boost::filesystem::path file(file_name); - if (!boost::filesystem::is_directory( file.parent_path())) - boost::filesystem::create_directories( file.parent_path()); + Opm::filesystem::path file(file_name); + if (!Opm::filesystem::is_directory( file.parent_path())) + Opm::filesystem::create_directories( file.parent_path()); } void KeywordGenerator::updateFile(const std::stringstream& newContent , const std::string& filename) { @@ -163,7 +162,7 @@ namespace Opm { stream << R"( #define BOOST_TEST_MODULE GeneratedKeywordTest -#include +#include #include #include #include @@ -175,7 +174,7 @@ auto unitSystem = Opm::UnitSystem::newMETRIC(); namespace Opm { void test_keyword(const ParserKeyword& inline_keyword, const std::string& json_file) { - boost::filesystem::path jsonPath( json_file ); + Opm::filesystem::path jsonPath( json_file ); Json::JsonObject jsonConfig( jsonPath ); ParserKeyword json_keyword(jsonConfig); BOOST_CHECK_EQUAL( json_keyword, inline_keyword); diff --git a/src/opm/parser/eclipse/Generator/KeywordLoader.cpp b/src/opm/parser/eclipse/Generator/KeywordLoader.cpp index 19ee07c2c..f1582c76c 100644 --- a/src/opm/parser/eclipse/Generator/KeywordLoader.cpp +++ b/src/opm/parser/eclipse/Generator/KeywordLoader.cpp @@ -21,8 +21,7 @@ #include #include -#include -#include +#include #include #include @@ -37,13 +36,13 @@ namespace Opm { if (verbose) std::cout << "Loading keyword from file: " << keyword_file << std::endl; - boost::filesystem::path path( keyword_file ); + Opm::filesystem::path path( keyword_file ); std::unique_ptr parserKeyword; try { Json::JsonObject jsonConfig = Json::JsonObject( path ); parserKeyword.reset( new ParserKeyword(jsonConfig) ); - boost::filesystem::path abs_path = boost::filesystem::absolute( path ); + auto abs_path = Opm::filesystem::absolute( path ); } catch (const std::exception& exc) { std::cerr << std::endl; std::cerr << "Failed to create parserkeyword from: " << path.string() << std::endl; diff --git a/src/opm/parser/eclipse/Parser/Parser.cpp b/src/opm/parser/eclipse/Parser/Parser.cpp index 81bfda63b..e4abb4b5c 100644 --- a/src/opm/parser/eclipse/Parser/Parser.cpp +++ b/src/opm/parser/eclipse/Parser/Parser.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -300,26 +300,26 @@ inline bool isTerminatedRecordString(const string_view& line) { } struct file { - file( boost::filesystem::path p, const std::string& in ) : + file( Opm::filesystem::path p, const std::string& in ) : input( in ), path( p ) {} string_view input; size_t lineNR = 0; - boost::filesystem::path path; + Opm::filesystem::path path; }; class InputStack : public std::stack< file, std::vector< file > > { public: - void push( std::string&& input, boost::filesystem::path p = "" ); + void push( std::string&& input, Opm::filesystem::path p = "" ); private: std::list< std::string > string_storage; using base = std::stack< file, std::vector< file > >; }; -void InputStack::push( std::string&& input, boost::filesystem::path p ) { +void InputStack::push( std::string&& input, Opm::filesystem::path p ) { this->string_storage.push_back( std::move( input ) ); this->emplace( p, this->string_storage.back() ); } @@ -327,17 +327,17 @@ void InputStack::push( std::string&& input, boost::filesystem::path p ) { class ParserState { public: ParserState( const std::vector>&, const ParseContext&, ErrorGuard& ); - ParserState( const std::vector>&, const ParseContext&, ErrorGuard&, boost::filesystem::path ); + ParserState( const std::vector>&, const ParseContext&, ErrorGuard&, Opm::filesystem::path ); void loadString( const std::string& ); - void loadFile( const boost::filesystem::path& ); - void openRootFile( const boost::filesystem::path& ); + void loadFile( const Opm::filesystem::path& ); + void openRootFile( const Opm::filesystem::path& ); void handleRandomText(const string_view& ) const; - boost::filesystem::path getIncludeFilePath( std::string ) const; + Opm::filesystem::path getIncludeFilePath( std::string ) const; void addPathAlias( const std::string& alias, const std::string& path ); - const boost::filesystem::path& current_path() const; + const Opm::filesystem::path& current_path() const; size_t line() const; bool done() const; @@ -350,7 +350,7 @@ class ParserState { InputStack input_stack; std::map< std::string, std::string > pathMap; - boost::filesystem::path rootPath; + Opm::filesystem::path rootPath; public: ParserKeywordSizeEnum lastSizeType = SLASH_TERMINATED; @@ -363,7 +363,7 @@ class ParserState { bool unknown_keyword = false; }; -const boost::filesystem::path& ParserState::current_path() const { +const Opm::filesystem::path& ParserState::current_path() const { return this->input_stack.top().path; } @@ -419,9 +419,9 @@ ParserState::ParserState(const std::vector>& ParserState::ParserState( const std::vector>& code_keywords_arg, const ParseContext& context, ErrorGuard& errors_arg, - boost::filesystem::path p ) : + Opm::filesystem::path p ) : code_keywords(code_keywords_arg), - rootPath( boost::filesystem::canonical( p ).parent_path() ), + rootPath( Opm::filesystem::canonical( p ).parent_path() ), python( PythonInstance() ), parseContext( context ), errors( errors_arg ) @@ -433,12 +433,12 @@ void ParserState::loadString(const std::string& input) { this->input_stack.push( str::clean( this->code_keywords, input + "\n" ) ); } -void ParserState::loadFile(const boost::filesystem::path& inputFile) { +void ParserState::loadFile(const Opm::filesystem::path& inputFile) { - boost::filesystem::path inputFileCanonical; + Opm::filesystem::path inputFileCanonical; try { - inputFileCanonical = boost::filesystem::canonical(inputFile); - } catch (const boost::filesystem::filesystem_error& fs_error) { + inputFileCanonical = Opm::filesystem::canonical(inputFile); + } catch (const Opm::filesystem::filesystem_error& fs_error) { std::string msg = "Could not open file: " + inputFile.string(); parseContext.handleError( ParseContext::PARSE_MISSING_INCLUDE , msg, errors); return; @@ -517,14 +517,14 @@ void ParserState::handleRandomText(const string_view& keywordString ) const { parseContext.handleError( errorKey , msg.str(), errors ); } -void ParserState::openRootFile( const boost::filesystem::path& inputFile) { +void ParserState::openRootFile( const Opm::filesystem::path& inputFile) { this->loadFile( inputFile ); this->deck.setDataFile( inputFile.string() ); - const boost::filesystem::path& inputFileCanonical = boost::filesystem::canonical(inputFile); + const Opm::filesystem::path& inputFileCanonical = Opm::filesystem::canonical(inputFile); rootPath = inputFileCanonical.parent_path(); } -boost::filesystem::path ParserState::getIncludeFilePath( std::string path ) const { +Opm::filesystem::path ParserState::getIncludeFilePath( std::string path ) const { static const std::string pathKeywordPrefix("$"); static const std::string validPathNameCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"); @@ -545,7 +545,7 @@ boost::filesystem::path ParserState::getIncludeFilePath( std::string path ) cons OpmLog::warning("Replaced one or more backslash with a slash in an INCLUDE path."); } - boost::filesystem::path includeFilePath(path); + Opm::filesystem::path includeFilePath(path); if (includeFilePath.is_relative()) return this->rootPath / includeFilePath; @@ -852,7 +852,7 @@ bool parseState( ParserState& parserState, const Parser& parser ) { if (rawKeyword->getKeywordName() == Opm::RawConsts::include) { auto& firstRecord = rawKeyword->getFirstRecord( ); std::string includeFileAsString = readValueToken(firstRecord.getItem(0)); - boost::filesystem::path includeFile = parserState.getIncludeFilePath( includeFileAsString ); + Opm::filesystem::path includeFile = parserState.getIncludeFilePath( includeFileAsString ); parserState.loadFile( includeFile ); continue; @@ -1127,7 +1127,7 @@ std::vector Parser::getAllDeckNames () const { throw std::invalid_argument("Input JSON object is not an array"); } - bool Parser::loadKeywordFromFile(const boost::filesystem::path& configFile) { + bool Parser::loadKeywordFromFile(const Opm::filesystem::path& configFile) { try { Json::JsonObject jsonKeyword(configFile); @@ -1140,13 +1140,13 @@ std::vector Parser::getAllDeckNames () const { } - void Parser::loadKeywordsFromDirectory(const boost::filesystem::path& directory, bool recursive) { - if (!boost::filesystem::exists(directory)) + void Parser::loadKeywordsFromDirectory(const Opm::filesystem::path& directory, bool recursive) { + if (!Opm::filesystem::exists(directory)) throw std::invalid_argument("Directory: " + directory.string() + " does not exist."); else { - boost::filesystem::directory_iterator end; - for (boost::filesystem::directory_iterator iter(directory); iter != end; iter++) { - if (boost::filesystem::is_directory(*iter)) { + Opm::filesystem::directory_iterator end; + for (Opm::filesystem::directory_iterator iter(directory); iter != end; iter++) { + if (Opm::filesystem::is_directory(*iter)) { if (recursive) loadKeywordsFromDirectory(*iter, recursive); } else { diff --git a/src/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp b/src/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp index 52873acad..3a30def0b 100644 --- a/src/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp +++ b/src/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp @@ -26,8 +26,6 @@ #include #include -#include - #include #include @@ -47,17 +45,6 @@ int main(int , char ** argv) { #if !defined(WIN32) setenv( "LC_ALL", "C", 1 ); #endif - auto loc = boost::filesystem::path::imbue( std::locale::classic() ); - boost::filesystem::path::imbue( loc ); - std::cout << "User preferred locale setting is invalid " - << "which breaks Boost <= 1.56 " - << "- forcing to 'C' as workaround for Boost <= 1.56. " - << "This workaround only applies to compile opm-parser, " - << "but your locale settings seem BROKEN, " - << "and opm-parser is likely NOT GOING TO WORK. " - << "If you're on linux you can try setting the LANG " - << "or LC_ALL environment variables to C or POSIX." - << std::endl; } const char * keyword_list_file = argv[1]; const char * source_file_path = argv[2]; diff --git a/tests/WorkArea.cpp b/tests/WorkArea.cpp index 9cf82327d..5d5ac56c1 100644 --- a/tests/WorkArea.cpp +++ b/tests/WorkArea.cpp @@ -22,29 +22,30 @@ #include -#include +#include namespace { + class WorkArea { public: explicit WorkArea(const std::string& subdir = "") - : root_(boost::filesystem::temp_directory_path() / - boost::filesystem::unique_path("wrk-%%%%")) + : root_(Opm::filesystem::temp_directory_path() / + Opm::unique_path("wrk-%%%%")) , area_(root_) - , orig_(boost::filesystem::current_path()) + , orig_(Opm::filesystem::current_path()) { if (! subdir.empty()) this->area_ /= subdir; - boost::filesystem::create_directories(this->area_); - boost::filesystem::current_path(this->area_); + Opm::filesystem::create_directories(this->area_); + Opm::filesystem::current_path(this->area_); } void copyIn(const std::string& filename) const { - boost::filesystem::copy_file(this->orig_ / filename, - this->area_ / filename); + Opm::filesystem::copy_file(this->orig_ / filename, + this->area_ / filename); } std::string currentWorkingDirectory() const @@ -54,18 +55,18 @@ namespace { void makeSubDir(const std::string& dirname) { - boost::filesystem::create_directories(this->area_ / dirname); + Opm::filesystem::create_directories(this->area_ / dirname); } ~WorkArea() { - boost::filesystem::current_path(this->orig_); - boost::filesystem::remove_all(this->root_); + Opm::filesystem::current_path(this->orig_); + Opm::filesystem::remove_all(this->root_); } private: - boost::filesystem::path root_; - boost::filesystem::path area_; - boost::filesystem::path orig_; + Opm::filesystem::path root_; + Opm::filesystem::path area_; + Opm::filesystem::path orig_; }; } // Anonymous diff --git a/tests/json/jsonTests.cpp b/tests/json/jsonTests.cpp index f4ceceab1..f9efe6bda 100644 --- a/tests/json/jsonTests.cpp +++ b/tests/json/jsonTests.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE(parseJSONObject_testType) { BOOST_AUTO_TEST_CASE(Parse_fileDoesNotExist_Throws) { - boost::filesystem::path jsonFile("file/does/not/exist"); + Opm::filesystem::path jsonFile("file/does/not/exist"); BOOST_CHECK_THROW( Json::JsonObject parser(jsonFile) , std::invalid_argument); } @@ -252,14 +252,14 @@ BOOST_AUTO_TEST_CASE(Parse_fileDoesNotExist_Throws) { BOOST_AUTO_TEST_CASE(Parse_fileExists_OK) { const auto arg = framework::master_test_suite().argv[1]; - boost::filesystem::path jsonFile(arg); + Opm::filesystem::path jsonFile(arg); BOOST_CHECK_NO_THROW( Json::JsonObject parser(jsonFile) ); } BOOST_AUTO_TEST_CASE(to_string_ok) { const auto arg = framework::master_test_suite().argv[1]; - boost::filesystem::path jsonFile(arg); + Opm::filesystem::path jsonFile(arg); Json::JsonObject parser(jsonFile); std::string json_string = "{\n" diff --git a/tests/msim/test_msim.cpp b/tests/msim/test_msim.cpp index 873dcba76..5e3054048 100644 --- a/tests/msim/test_msim.cpp +++ b/tests/msim/test_msim.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -59,10 +59,10 @@ void pressure(const EclipseState& es, const Schedule& /* sched */, data::Solutio std::fill(data.begin(), data.end(), units.to_si(UnitSystem::measure::pressure, seconds_elapsed)); } -bool is_file(const boost::filesystem::path& name) +bool is_file(const Opm::filesystem::path& name) { - return boost::filesystem::exists(name) - && boost::filesystem::is_regular_file(name); + return Opm::filesystem::exists(name) + && Opm::filesystem::is_regular_file(name); } } diff --git a/tests/parser/EclipseGridTests.cpp b/tests/parser/EclipseGridTests.cpp index 73e8a6f8a..c991b9e1a 100644 --- a/tests/parser/EclipseGridTests.cpp +++ b/tests/parser/EclipseGridTests.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #define BOOST_TEST_MODULE EclipseGridTests #include @@ -1800,14 +1800,14 @@ BOOST_AUTO_TEST_CASE(SAVE_FIELD_UNITS) { time_t timer; time(&timer); - std::string cwd = boost::filesystem::current_path().c_str(); + std::string cwd = Opm::filesystem::current_path().c_str(); std::string testDir = cwd + "/tmp_dir_" + std::to_string(timer); - if ( boost::filesystem::exists( testDir )) { - boost::filesystem::remove_all(testDir); + if ( Opm::filesystem::exists( testDir )) { + Opm::filesystem::remove_all(testDir); } - boost::filesystem::create_directory(testDir); + Opm::filesystem::create_directory(testDir); std::string fileName = testDir + "/" + "TMP.EGRID"; grid1.save(fileName, formatted, nnc, units); @@ -1912,7 +1912,7 @@ BOOST_AUTO_TEST_CASE(SAVE_FIELD_UNITS) { BOOST_CHECK( ref3_mapaxes[n] == test_mapaxes3[n]); } - boost::filesystem::remove_all(testDir); + Opm::filesystem::remove_all(testDir); } BOOST_AUTO_TEST_CASE(SAVE_METRIC_UNITS) { @@ -1993,14 +1993,14 @@ BOOST_AUTO_TEST_CASE(SAVE_METRIC_UNITS) { time_t timer; time(&timer); - std::string cwd = boost::filesystem::current_path().c_str(); + std::string cwd = Opm::filesystem::current_path().c_str(); std::string testDir = cwd + "/tmp_dir_" + std::to_string(timer); - if ( boost::filesystem::exists( testDir )) { - boost::filesystem::remove_all(testDir); + if ( Opm::filesystem::exists( testDir )) { + Opm::filesystem::remove_all(testDir); } - boost::filesystem::create_directory(testDir); + Opm::filesystem::create_directory(testDir); std::string fileName = testDir + "/" + "TMP.FEGRID"; grid1.save(fileName, formatted, nnc, units1); @@ -2105,7 +2105,7 @@ BOOST_AUTO_TEST_CASE(SAVE_METRIC_UNITS) { } - boost::filesystem::remove_all(testDir); + Opm::filesystem::remove_all(testDir); } BOOST_AUTO_TEST_CASE(CalcCellDims) { diff --git a/tests/parser/IOConfigTests.cpp b/tests/parser/IOConfigTests.cpp index be1c5a53a..46df7d90f 100644 --- a/tests/parser/IOConfigTests.cpp +++ b/tests/parser/IOConfigTests.cpp @@ -23,6 +23,7 @@ #include +#include #include #include #include @@ -263,7 +264,7 @@ BOOST_AUTO_TEST_CASE(OutputPaths) { BOOST_CHECK_EQUAL( output_dir2, config2.getOutputDir() ); BOOST_CHECK_EQUAL( "TESTSTRING", config2.getBaseName() ); - namespace fs = boost::filesystem; + namespace fs = Opm::filesystem; Deck deck3; deck3.setDataFile( "/path/to/testString.DATA" ); diff --git a/tests/parser/ParserIncludeTests.cpp b/tests/parser/ParserIncludeTests.cpp index ae571879e..c7a19ad53 100644 --- a/tests/parser/ParserIncludeTests.cpp +++ b/tests/parser/ParserIncludeTests.cpp @@ -19,9 +19,9 @@ #define BOOST_TEST_MODULE ParserTests -#include #include +#include #include #include #include @@ -33,7 +33,7 @@ inline std::string prefix() { BOOST_AUTO_TEST_CASE(ParserKeyword_includeInvalid) { - boost::filesystem::path inputFilePath(prefix() + "includeInvalid.data"); + Opm::filesystem::path inputFilePath(prefix() + "includeInvalid.data"); Opm::Parser parser; Opm::ParseContext parseContext; @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(ParserKeyword_includeInvalid) { BOOST_AUTO_TEST_CASE(DATA_FILE_IS_SYMLINK) { - boost::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink4/path/case.data"); + Opm::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink4/path/case.data"); Opm::Parser parser; std::cout << "Input file: " << inputFilePath.string() << std::endl; auto deck = parser.parseFile(inputFilePath.string()); @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(DATA_FILE_IS_SYMLINK) { BOOST_AUTO_TEST_CASE(Verify_find_includes_Data_file_is_a_symlink) { - boost::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink1/case_symlink.data"); + Opm::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink1/case_symlink.data"); Opm::Parser parser; auto deck = parser.parseFile(inputFilePath.string()); @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(Verify_find_includes_Data_file_is_a_symlink) { BOOST_AUTO_TEST_CASE(Verify_find_includes_Data_file_has_include_that_is_a_symlink) { - boost::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink2/caseWithIncludedSymlink.data"); + Opm::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink2/caseWithIncludedSymlink.data"); Opm::Parser parser; auto deck = parser.parseFile(inputFilePath.string()); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(Verify_find_includes_Data_file_has_include_that_is_a_symlin BOOST_AUTO_TEST_CASE(Verify_find_includes_Data_file_has_include_file_that_again_includes_a_symlink) { - boost::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink3/case.data"); + Opm::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink3/case.data"); Opm::Parser parser; auto deck = parser.parseFile(inputFilePath.string()); @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(Verify_find_includes_Data_file_has_include_file_that_again_ BOOST_AUTO_TEST_CASE(ParserKeyword_includeValid) { - boost::filesystem::path inputFilePath(prefix() + "includeValid.data"); + Opm::filesystem::path inputFilePath(prefix() + "includeValid.data"); Opm::Parser parser; auto deck = parser.parseFile(inputFilePath.string()); @@ -104,9 +104,9 @@ BOOST_AUTO_TEST_CASE(ParserKeyword_includeValid) { BOOST_AUTO_TEST_CASE(ParserKeyword_includeWrongCase) { - boost::filesystem::path inputFile1Path(prefix() + "includeWrongCase1.data"); - boost::filesystem::path inputFile2Path(prefix() + "includeWrongCase2.data"); - boost::filesystem::path inputFile3Path(prefix() + "includeWrongCase3.data"); + Opm::filesystem::path inputFile1Path(prefix() + "includeWrongCase1.data"); + Opm::filesystem::path inputFile2Path(prefix() + "includeWrongCase2.data"); + Opm::filesystem::path inputFile3Path(prefix() + "includeWrongCase3.data"); Opm::Parser parser; diff --git a/tests/parser/ParserTests.cpp b/tests/parser/ParserTests.cpp index d8330bad2..48313d57d 100644 --- a/tests/parser/ParserTests.cpp +++ b/tests/parser/ParserTests.cpp @@ -22,6 +22,7 @@ #include +#include #include #include #include @@ -187,28 +188,28 @@ BOOST_AUTO_TEST_CASE(loadKeywordsJSON_manyKeywords_returnstrue) { BOOST_AUTO_TEST_CASE(loadKeywordFromFile_fileDoesNotExist_returnsFalse) { Parser parser; - boost::filesystem::path configFile("File/does/not/exist"); + Opm::filesystem::path configFile("File/does/not/exist"); BOOST_CHECK_EQUAL( false , parser.loadKeywordFromFile( configFile )); } BOOST_AUTO_TEST_CASE(loadKeywordFromFile_invalidJson_returnsFalse) { Parser parser; - boost::filesystem::path configFile(prefix() + "json/example_invalid_json"); + Opm::filesystem::path configFile(prefix() + "json/example_invalid_json"); BOOST_CHECK_EQUAL( false , parser.loadKeywordFromFile( configFile )); } BOOST_AUTO_TEST_CASE(loadKeywordFromFile_invalidConfig_returnsFalse) { Parser parser; - boost::filesystem::path configFile(prefix() + "json/example_missing_name.json"); + Opm::filesystem::path configFile(prefix() + "json/example_missing_name.json"); BOOST_CHECK_EQUAL( false , parser.loadKeywordFromFile( configFile )); } BOOST_AUTO_TEST_CASE(loadKeywordFromFile_validKeyword_returnsTrueHasKeyword) { Parser parser( false ); - boost::filesystem::path configFile(prefix() + "json/BPR"); + Opm::filesystem::path configFile(prefix() + "json/BPR"); BOOST_CHECK_EQUAL( true , parser.loadKeywordFromFile( configFile )); BOOST_CHECK_EQUAL( 1U , parser.size() ); BOOST_CHECK_EQUAL( true , parser.isRecognizedKeyword("BPR") ); @@ -218,14 +219,14 @@ BOOST_AUTO_TEST_CASE(loadKeywordFromFile_validKeyword_returnsTrueHasKeyword) { BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_directoryDoesNotexist_throws) { Parser parser; - boost::filesystem::path configPath("path/does/not/exist"); + Opm::filesystem::path configPath("path/does/not/exist"); BOOST_CHECK_THROW(parser.loadKeywordsFromDirectory( configPath), std::invalid_argument); } BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_notRecursive_allNames) { Parser parser( false ); BOOST_CHECK_EQUAL(false , parser.isRecognizedKeyword("BPR")); - boost::filesystem::path configPath(prefix() + "config/directory1"); + Opm::filesystem::path configPath(prefix() + "config/directory1"); BOOST_CHECK_NO_THROW(parser.loadKeywordsFromDirectory( configPath, false)); BOOST_CHECK(parser.isRecognizedKeyword("WWCT")); BOOST_CHECK_EQUAL(true , parser.isRecognizedKeyword("BPR")); @@ -235,7 +236,7 @@ BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_notRecursive_allNames) { BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_notRecursive_strictNames) { Parser parser( false ); - boost::filesystem::path configPath(prefix() + "config/directory1"); + Opm::filesystem::path configPath(prefix() + "config/directory1"); BOOST_CHECK_NO_THROW(parser.loadKeywordsFromDirectory( configPath, false)); BOOST_CHECK(parser.isRecognizedKeyword("WWCT")); // the file name for the following keyword is "Bpr", but that @@ -248,7 +249,7 @@ BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_notRecursive_strictNames) { BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_Recursive_allNames) { Parser parser( false ); BOOST_CHECK_EQUAL(false , parser.isRecognizedKeyword("BPR")); - boost::filesystem::path configPath(prefix() + "config/directory1"); + Opm::filesystem::path configPath(prefix() + "config/directory1"); BOOST_CHECK_NO_THROW(parser.loadKeywordsFromDirectory( configPath, true)); BOOST_CHECK(parser.isRecognizedKeyword("WWCT")); BOOST_CHECK_EQUAL(true , parser.isRecognizedKeyword("BPR")); @@ -259,7 +260,7 @@ BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_Recursive_allNames) { BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_default) { Parser parser( false ); BOOST_CHECK_EQUAL(false , parser.isRecognizedKeyword("BPR")); - boost::filesystem::path configPath(prefix() + "config/directory1"); + Opm::filesystem::path configPath(prefix() + "config/directory1"); BOOST_CHECK_NO_THROW(parser.loadKeywordsFromDirectory( configPath )); BOOST_CHECK(parser.isRecognizedKeyword("WWCT")); // the file name for the following keyword is "Bpr", but that diff --git a/tests/parser/PvtxTableTests.cpp b/tests/parser/PvtxTableTests.cpp index ca6a3abaf..7f2732518 100644 --- a/tests/parser/PvtxTableTests.cpp +++ b/tests/parser/PvtxTableTests.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ inline std::string prefix() { BOOST_AUTO_TEST_CASE( PvtxNumTables1 ) { Parser parser; - boost::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA"); + Opm::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA"); auto deck = parser.parseFile(deckFile.string()); BOOST_CHECK_EQUAL( PvtxTable::numTables( deck.getKeyword()) , 1); @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE( PvtxNumTables1 ) { BOOST_AUTO_TEST_CASE( PvtxNumTables2 ) { Parser parser; - boost::filesystem::path deckFile(prefix() + "TABLES/PVTO2.DATA"); + Opm::filesystem::path deckFile(prefix() + "TABLES/PVTO2.DATA"); auto deck = parser.parseFile(deckFile.string()); BOOST_CHECK_EQUAL( PvtxTable::numTables( deck.getKeyword()) , 3); @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE( PvtxNumTables3 ) { BOOST_AUTO_TEST_CASE( PVTOSaturatedTable ) { Parser parser; - boost::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA"); + Opm::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA"); auto deck = parser.parseFile(deckFile.string()); Opm::TableManager tables(deck); const auto& pvtoTables = tables.getPvtoTables( ); @@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE( PVTOSaturatedTable ) { BOOST_AUTO_TEST_CASE( PVTGSaturatedTable ) { Parser parser; - boost::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA"); + Opm::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA"); auto deck = parser.parseFile(deckFile.string()); Opm::TableManager tables(deck); const auto& pvtgTables = tables.getPvtgTables( ); diff --git a/tests/parser/integration/BoxTest.cpp b/tests/parser/integration/BoxTest.cpp index 78e1ab678..72b968137 100644 --- a/tests/parser/integration/BoxTest.cpp +++ b/tests/parser/integration/BoxTest.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -38,7 +38,7 @@ inline std::string prefix() { inline Deck makeDeck(const std::string& fileName) { Parser parser; - boost::filesystem::path boxFile(fileName); + Opm::filesystem::path boxFile(fileName); return parser.parseFile(boxFile.string()); } diff --git a/tests/parser/integration/EclipseGridCreateFromDeck.cpp b/tests/parser/integration/EclipseGridCreateFromDeck.cpp index 13d58a8cd..29ddfe8bc 100644 --- a/tests/parser/integration/EclipseGridCreateFromDeck.cpp +++ b/tests/parser/integration/EclipseGridCreateFromDeck.cpp @@ -23,7 +23,8 @@ #include #include #include -#include + +#include #include #include @@ -40,7 +41,7 @@ inline std::string prefix() { BOOST_AUTO_TEST_CASE(CreateCPGrid) { Parser parser; - boost::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA"); + Opm::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA"); auto deck = parser.parseFile(scheduleFile.string()); EclipseState es(deck); const auto& grid = es.getInputGrid(); @@ -54,7 +55,7 @@ BOOST_AUTO_TEST_CASE(CreateCPGrid) { BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) { Parser parser; - boost::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA"); + Opm::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA"); auto deck = parser.parseFile(scheduleFile.string()); EclipseState es(deck); const auto& grid = es.getInputGrid(); @@ -68,7 +69,7 @@ BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) { BOOST_AUTO_TEST_CASE(ExportFromCPGridAllActive) { Parser parser; - boost::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA"); + Opm::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA"); auto deck = parser.parseFile(scheduleFile.string()); EclipseState es(deck); const auto& grid = es.getInputGrid(); @@ -84,7 +85,7 @@ BOOST_AUTO_TEST_CASE(ExportFromCPGridAllActive) { BOOST_AUTO_TEST_CASE(ExportFromCPGridACTNUM) { Parser parser; - boost::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA"); + Opm::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA"); auto deck = parser.parseFile(scheduleFile.string()); EclipseState es(deck); auto& grid = es.getInputGrid(); diff --git a/tests/parser/integration/IncludeTest.cpp b/tests/parser/integration/IncludeTest.cpp index 3d51ca0d4..51c23c19e 100644 --- a/tests/parser/integration/IncludeTest.cpp +++ b/tests/parser/integration/IncludeTest.cpp @@ -20,7 +20,7 @@ #define BOOST_TEST_MODULE ParserIntegrationTests #include #include -#include +#include #include #include @@ -32,7 +32,7 @@ #include using namespace Opm; -using namespace boost::filesystem; +using namespace Opm::filesystem; static void createDeckWithInclude(path& datafile, std::string addEndKeyword) diff --git a/tests/parser/integration/IntegrationTests.cpp b/tests/parser/integration/IntegrationTests.cpp index 52ead68d0..f9ca1d3d7 100644 --- a/tests/parser/integration/IntegrationTests.cpp +++ b/tests/parser/integration/IntegrationTests.cpp @@ -20,7 +20,7 @@ #define BOOST_TEST_MODULE ParserIntegrationTests #include #include -#include +#include #include #include @@ -72,7 +72,7 @@ Parser createWWCTParser() { } BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckReturned) { - boost::filesystem::path singleKeywordFile(pathprefix() + "wwct.data"); + Opm::filesystem::path singleKeywordFile(pathprefix() + "wwct.data"); auto parser = createWWCTParser(); BOOST_CHECK( parser.isRecognizedKeyword("WWCT")); BOOST_CHECK( parser.isRecognizedKeyword("SUMMARY")); @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(parse_streamWithWWCTKeyword_deckReturned) { } BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckHasWWCT) { - boost::filesystem::path singleKeywordFile(pathprefix() + "wwct.data"); + Opm::filesystem::path singleKeywordFile(pathprefix() + "wwct.data"); auto parser = createWWCTParser(); auto deck = parser.parseFile(singleKeywordFile.string()); BOOST_CHECK(deck.hasKeyword("SUMMARY")); @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckHasWWCT) { } BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_dataIsCorrect) { - boost::filesystem::path singleKeywordFile(pathprefix() + "wwct.data"); + Opm::filesystem::path singleKeywordFile(pathprefix() + "wwct.data"); auto parser = createWWCTParser(); auto deck = parser.parseFile(singleKeywordFile.string()); BOOST_CHECK_EQUAL("WELL-1", deck.getKeyword("WWCT" , 0).getRecord(0).getItem(0).get< std::string >(0)); @@ -157,14 +157,14 @@ static Parser createBPRParser() { } BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_deckReturned) { - boost::filesystem::path singleKeywordFile(pathprefix() + "bpr.data"); + Opm::filesystem::path singleKeywordFile(pathprefix() + "bpr.data"); auto parser = createBPRParser(); BOOST_CHECK_NO_THROW(parser.parseFile(singleKeywordFile.string())); } BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_DeckhasBRP) { - boost::filesystem::path singleKeywordFile(pathprefix() + "bpr.data"); + Opm::filesystem::path singleKeywordFile(pathprefix() + "bpr.data"); auto parser = createBPRParser(); auto deck = parser.parseFile(singleKeywordFile.string()); @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_DeckhasBRP) { } BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_dataiscorrect) { - boost::filesystem::path singleKeywordFile(pathprefix() + "bpr.data"); + Opm::filesystem::path singleKeywordFile(pathprefix() + "bpr.data"); auto parser = createBPRParser(); auto deck = parser.parseFile(singleKeywordFile.string()); diff --git a/tests/test_ERst.cpp b/tests/test_ERst.cpp index dc8dd0604..7feb7738f 100644 --- a/tests/test_ERst.cpp +++ b/tests/test_ERst.cpp @@ -32,12 +32,13 @@ #include #include #include +#include #include #include #include #include -#include +#include using namespace Opm::EclIO; @@ -312,21 +313,20 @@ BOOST_AUTO_TEST_CASE(TestERst_4) { // ==================================================================== - class RSet { public: explicit RSet(std::string base) - : odir_(boost::filesystem::temp_directory_path() / - boost::filesystem::unique_path("rset-%%%%")) + : odir_(Opm::filesystem::temp_directory_path() / + Opm::unique_path("rset-%%%%")) , base_(std::move(base)) { - boost::filesystem::create_directories(this->odir_); + Opm::filesystem::create_directories(this->odir_); } ~RSet() { - boost::filesystem::remove_all(this->odir_); + Opm::filesystem::remove_all(this->odir_); } operator ::Opm::EclIO::OutputStream::ResultSet() const @@ -335,7 +335,7 @@ public: } private: - boost::filesystem::path odir_; + Opm::filesystem::path odir_; std::string base_; }; diff --git a/tests/test_OutputStream.cpp b/tests/test_OutputStream.cpp index c41835079..507290f17 100644 --- a/tests/test_OutputStream.cpp +++ b/tests/test_OutputStream.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include namespace Opm { namespace EclIO { @@ -129,21 +129,20 @@ BOOST_AUTO_TEST_CASE(ResultSetDescriptor) BOOST_AUTO_TEST_SUITE_END() // FileName // ========================================================================== - class RSet { public: explicit RSet(std::string base) - : odir_(boost::filesystem::temp_directory_path() / - boost::filesystem::unique_path("rset-%%%%")) + : odir_(Opm::filesystem::temp_directory_path() / + Opm::unique_path("rset-%%%%")) , base_(std::move(base)) { - boost::filesystem::create_directories(this->odir_); + Opm::filesystem::create_directories(this->odir_); } ~RSet() { - boost::filesystem::remove_all(this->odir_); + Opm::filesystem::remove_all(this->odir_); } operator ::Opm::EclIO::OutputStream::ResultSet() const @@ -152,7 +151,7 @@ public: } private: - boost::filesystem::path odir_; + Opm::filesystem::path odir_; std::string base_; }; diff --git a/tests/test_RFT.cpp b/tests/test_RFT.cpp index 51594de55..1a5802a51 100644 --- a/tests/test_RFT.cpp +++ b/tests/test_RFT.cpp @@ -55,7 +55,7 @@ #include #include -#include +#include using namespace Opm; @@ -76,16 +76,16 @@ namespace { { public: explicit RSet(std::string base) - : odir_(boost::filesystem::temp_directory_path() / - boost::filesystem::unique_path("rset-%%%%")) + : odir_(Opm::filesystem::temp_directory_path() / + Opm::unique_path("rset-%%%%")) , base_(std::move(base)) { - boost::filesystem::create_directories(this->odir_); + Opm::filesystem::create_directories(this->odir_); } ~RSet() { - boost::filesystem::remove_all(this->odir_); + Opm::filesystem::remove_all(this->odir_); } std::string outputDir() const @@ -99,7 +99,7 @@ namespace { } private: - boost::filesystem::path odir_; + Opm::filesystem::path odir_; std::string base_; };