Merge pull request #2802 from akva2/remove_gcc7_compat
changed: drop gcc7 compatibility
This commit is contained in:
commit
af8fc94188
@ -345,7 +345,6 @@ list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_calculateCellVol.cpp
|
||||
tests/test_cmp.cpp
|
||||
tests/test_cubic.cpp
|
||||
tests/test_FileSystem.cpp
|
||||
tests/test_messagelimiter.cpp
|
||||
tests/test_nonuniformtablelinear.cpp
|
||||
tests/test_OpmInputError_format.cpp
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
@ -31,7 +32,6 @@
|
||||
|
||||
#include <opm/io/eclipse/ESmry.hpp>
|
||||
#include <opm/io/eclipse/EclUtil.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
|
||||
static void printHelp() {
|
||||
@ -93,9 +93,9 @@ int main(int argc, char **argv) {
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int f = argOffset; f < argc; f ++){
|
||||
Opm::filesystem::path inputFileName = argv[f];
|
||||
std::filesystem::path inputFileName = argv[f];
|
||||
|
||||
Opm::filesystem::path esmryFileName = inputFileName.parent_path() / inputFileName.stem();
|
||||
std::filesystem::path esmryFileName = inputFileName.parent_path() / inputFileName.stem();
|
||||
esmryFileName = esmryFileName += ".ESMRY";
|
||||
|
||||
if (Opm::EclIO::fileExists(esmryFileName) && (force))
|
||||
|
@ -17,11 +17,11 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/I.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/P.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/G.hpp>
|
||||
@ -31,7 +31,7 @@
|
||||
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
Opm::Deck pack_deck( const char * deck_file, std::ostream& os) {
|
||||
Opm::ParseContext parseContext(Opm::InputError::WARN);
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
@ -25,7 +26,6 @@
|
||||
#include <unordered_set>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/I.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/P.hpp>
|
||||
@ -39,7 +39,7 @@
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/FileDeck.hpp>
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
const std::unordered_set<std::string> remove_from_solution = {"EQUIL", "PRESSURE", "SWAT", "SGAS"};
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <chrono>
|
||||
@ -34,7 +35,6 @@
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <opm/common/OpmLog/StreamLog.hpp>
|
||||
#include <opm/common/OpmLog/LogUtil.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
|
||||
inline void createDot(const Opm::Schedule& schedule, const std::string& casename)
|
||||
@ -124,7 +124,7 @@ int main(int argc, char** argv)
|
||||
for (int iarg = 1; iarg < argc; iarg++) {
|
||||
const std::string filename = argv[iarg];
|
||||
const auto sched = loadSchedule(filename);
|
||||
const auto casename = Opm::filesystem::path(filename).stem();
|
||||
const auto casename = std::filesystem::path(filename).stem();
|
||||
createDot(sched, casename);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
|
@ -19,31 +19,15 @@
|
||||
#ifndef OPM_FILESYSTEM_HPP
|
||||
#define OPM_FILESYSTEM_HPP
|
||||
|
||||
#if __cplusplus < 201703L || \
|
||||
(defined(__GNUC__) && __GNUC__ < 8 && !defined(__clang__))
|
||||
#include <experimental/filesystem>
|
||||
#else
|
||||
#include <filesystem>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
#if __cplusplus < 201703L || \
|
||||
(defined(__GNUC__) && __GNUC__ < 8 && !defined(__clang__))
|
||||
namespace filesystem = std::experimental::filesystem;
|
||||
filesystem::path proximate(const filesystem::path& p,
|
||||
const filesystem::path& base = filesystem::current_path());
|
||||
#else
|
||||
namespace filesystem = std::filesystem;
|
||||
using filesystem::proximate;
|
||||
#endif
|
||||
|
||||
// A poor man's filesystem::unique_path
|
||||
std::string unique_path(const std::string& input);
|
||||
|
||||
} // end namespace Opm
|
||||
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define OPM_IO_EGRID_HPP
|
||||
|
||||
#include <opm/io/eclipse/EclFile.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
@ -71,7 +71,7 @@ public:
|
||||
const std::string& get_mapunits() const { return m_mapunits; }
|
||||
|
||||
private:
|
||||
Opm::filesystem::path inputFileName, initFileName;
|
||||
std::filesystem::path inputFileName, initFileName;
|
||||
std::string m_grid_name;
|
||||
bool m_radial;
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define OPM_IO_ESMRY_HPP
|
||||
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@ -27,7 +28,6 @@
|
||||
#include <map>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
#include <opm/io/eclipse/SummaryNode.hpp>
|
||||
|
||||
@ -75,13 +75,12 @@ public:
|
||||
const std::string& get_unit(const SummaryNode& node) const;
|
||||
|
||||
void write_rsm(std::ostream&) const;
|
||||
void write_rsm_file(std::optional<filesystem::path> = std::nullopt) const;
|
||||
void write_rsm_file(std::optional<std::filesystem::path> = std::nullopt) const;
|
||||
|
||||
bool all_steps_available();
|
||||
|
||||
private:
|
||||
|
||||
filesystem::path inputFileName;
|
||||
std::filesystem::path inputFileName;
|
||||
RstEntry restart_info;
|
||||
|
||||
int nI, nJ, nK, nSpecFiles;
|
||||
@ -111,13 +110,13 @@ private:
|
||||
|
||||
time_point startdat;
|
||||
|
||||
std::vector<std::string> checkForMultipleResultFiles(const filesystem::path& rootN, bool formatted) const;
|
||||
std::vector<std::string> checkForMultipleResultFiles(const std::filesystem::path& rootN, bool formatted) const;
|
||||
|
||||
void getRstString(const std::vector<std::string>& restartArray,
|
||||
filesystem::path& pathRst,
|
||||
filesystem::path& rootN) const;
|
||||
std::filesystem::path& pathRst,
|
||||
std::filesystem::path& rootN) const;
|
||||
|
||||
void updatePathAndRootName(filesystem::path& dir, filesystem::path& rootN) const;
|
||||
void updatePathAndRootName(std::filesystem::path& dir, std::filesystem::path& rootN) const;
|
||||
|
||||
|
||||
std::string makeKeyString(const std::string& keyword, const std::string& wgname, int num,
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define OPM_IO_ExtESmry_HPP
|
||||
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@ -27,7 +28,6 @@
|
||||
#include <map>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
|
||||
namespace Opm { namespace EclIO {
|
||||
@ -68,10 +68,9 @@ public:
|
||||
|
||||
bool all_steps_available();
|
||||
|
||||
|
||||
private:
|
||||
filesystem::path m_inputFileName;
|
||||
std::vector<filesystem::path> m_lodsmry_files;
|
||||
std::filesystem::path m_inputFileName;
|
||||
std::vector<std::filesystem::path> m_lodsmry_files;
|
||||
|
||||
bool m_loadBaseRun;
|
||||
std::vector<std::map<std::string, int>> m_keyword_index;
|
||||
@ -95,9 +94,9 @@ private:
|
||||
|
||||
time_point m_startdat;
|
||||
|
||||
uint64_t open_esmry(Opm::filesystem::path& inputFileName, LodsmryHeadType& lodsmry_head);
|
||||
uint64_t open_esmry(std::filesystem::path& inputFileName, LodsmryHeadType& lodsmry_head);
|
||||
|
||||
void updatePathAndRootName(Opm::filesystem::path& dir, Opm::filesystem::path& rootN);
|
||||
void updatePathAndRootName(std::filesystem::path& dir, std::filesystem::path& rootN);
|
||||
};
|
||||
|
||||
}} // namespace Opm::EclIO
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef JSON_OBJECT_HPP
|
||||
#define JSON_OBJECT_HPP
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
@ -32,7 +33,7 @@ namespace Json {
|
||||
public:
|
||||
JsonObject();
|
||||
|
||||
explicit JsonObject(const Opm::filesystem::path& jsonFile );
|
||||
explicit JsonObject(const std::filesystem::path& jsonFile );
|
||||
explicit JsonObject(const std::string& inline_json);
|
||||
explicit JsonObject(const char * inline_json);
|
||||
explicit JsonObject(cJSON * root);
|
||||
|
@ -23,15 +23,15 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/FileDeck.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace Opm {
|
||||
class Deck;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef OPM_PARSER_HPP
|
||||
#define OPM_PARSER_HPP
|
||||
|
||||
#include <filesystem>
|
||||
#include <iosfwd>
|
||||
#include <list>
|
||||
#include <map>
|
||||
@ -30,8 +31,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
|
||||
|
||||
@ -102,9 +101,9 @@ namespace Opm {
|
||||
std::vector<std::string> getAllDeckNames () const;
|
||||
|
||||
void loadKeywords(const Json::JsonObject& jsonKeywords);
|
||||
bool loadKeywordFromFile(const filesystem::path& configFile);
|
||||
bool loadKeywordFromFile(const std::filesystem::path& configFile);
|
||||
|
||||
void loadKeywordsFromDirectory(const filesystem::path& directory , bool recursive = true);
|
||||
void loadKeywordsFromDirectory(const std::filesystem::path& directory , bool recursive = true);
|
||||
void applyUnitsToDeck(Deck& deck) const;
|
||||
|
||||
/*!
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <pybind11/stl.h>
|
||||
#include <pybind11/numpy.h>
|
||||
#include <pybind11/chrono.h>
|
||||
#include <filesystem>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <opm/io/eclipse/EclFile.hpp>
|
||||
@ -13,7 +14,6 @@
|
||||
#include <opm/io/eclipse/ERft.hpp>
|
||||
#include <opm/io/eclipse/EclOutput.hpp>
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/common/utility/numeric/calculateCellVol.hpp>
|
||||
|
||||
@ -34,7 +34,7 @@ public:
|
||||
|
||||
ESmryBind(const std::string& filename, bool loadBaseRunData)
|
||||
{
|
||||
filesystem::path m_inputFileName(filename);
|
||||
std::filesystem::path m_inputFileName(filename);
|
||||
|
||||
if (m_inputFileName.extension() == ".SMSPEC"){
|
||||
m_esmry = std::make_unique<Opm::EclIO::ESmry>(m_inputFileName, loadBaseRunData);
|
||||
|
@ -47,134 +47,4 @@ std::string unique_path(const std::string& input)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if __cplusplus < 201703L || \
|
||||
(defined(__GNUC__) && __GNUC__ < 8 && !defined(__clang__))
|
||||
|
||||
// The following code has been extracted from libstdc++,
|
||||
// and slightly modified for use here.
|
||||
// License is replicated here for attribution.
|
||||
|
||||
// Copyright (C) 2014-2021 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library 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.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace {
|
||||
|
||||
bool is_dot(Opm::filesystem::path::value_type c) { return c == '.'; }
|
||||
|
||||
bool is_dot(const Opm::filesystem::path& path)
|
||||
{
|
||||
const auto& filename = path.native();
|
||||
return filename.size() == 1 && is_dot(filename[0]);
|
||||
}
|
||||
|
||||
bool is_dotdot(const Opm::filesystem::path& path)
|
||||
{
|
||||
const auto& filename = path.native();
|
||||
return filename.size() == 2 && is_dot(filename[0]) && is_dot(filename[1]);
|
||||
}
|
||||
|
||||
Opm::filesystem::path lexically_relative(const Opm::filesystem::path& p,
|
||||
const Opm::filesystem::path& base)
|
||||
{
|
||||
Opm::filesystem::path ret;
|
||||
if (p.root_name() != base.root_name())
|
||||
return ret;
|
||||
|
||||
if (p.is_absolute() != base.is_absolute())
|
||||
return ret;
|
||||
if (!p.has_root_directory() && base.has_root_directory())
|
||||
return ret;
|
||||
auto [a, b] = std::mismatch(p.begin(), p.end(), base.begin(), base.end());
|
||||
if (a == p.end() && b == base.end())
|
||||
ret = ".";
|
||||
else
|
||||
{
|
||||
int n = 0;
|
||||
for (; b != base.end(); ++b)
|
||||
{
|
||||
const Opm::filesystem::path& p2 = *b;
|
||||
if (is_dotdot(p2))
|
||||
--n;
|
||||
else if (!p2.empty() && !is_dot(p2))
|
||||
++n;
|
||||
}
|
||||
if (n == 0 && (a == p.end() || a->empty()))
|
||||
ret = ".";
|
||||
else if (n >= 0)
|
||||
{
|
||||
const Opm::filesystem::path dotdot("..");
|
||||
while (n--)
|
||||
ret /= dotdot;
|
||||
for (; a != p.end(); ++a)
|
||||
ret /= *a;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Opm::filesystem::path
|
||||
lexically_proximate(const Opm::filesystem::path& p, const Opm::filesystem::path& base)
|
||||
{
|
||||
Opm::filesystem::path rel = lexically_relative(p, base);
|
||||
return rel.empty() ? p : rel;
|
||||
}
|
||||
|
||||
Opm::filesystem::path
|
||||
weakly_canonical(const Opm::filesystem::path& p)
|
||||
{
|
||||
Opm::filesystem::path result;
|
||||
if (exists(status(p)))
|
||||
return canonical(p);
|
||||
|
||||
Opm::filesystem::path tmp;
|
||||
auto iter = p.begin(), end = p.end();
|
||||
// find leading elements of p that exist:
|
||||
while (iter != end)
|
||||
{
|
||||
tmp = result / *iter;
|
||||
if (exists(status(tmp)))
|
||||
swap(result, tmp);
|
||||
else
|
||||
break;
|
||||
++iter;
|
||||
}
|
||||
// canonicalize:
|
||||
if (!result.empty())
|
||||
result = canonical(result);
|
||||
// append the non-existing elements:
|
||||
while (iter != end)
|
||||
result /= *iter++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
filesystem::path proximate(const filesystem::path& p, const filesystem::path& base)
|
||||
{
|
||||
return lexically_proximate(weakly_canonical(p), weakly_canonical(base));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <numeric>
|
||||
@ -202,7 +203,7 @@ void EGrid::load_nnc_data()
|
||||
nnc1_array = getImpl(nnc1_array_index, Opm::EclIO::INTE, inte_array, "inte");
|
||||
nnc2_array = getImpl(nnc2_array_index, Opm::EclIO::INTE, inte_array, "inte");
|
||||
|
||||
if ((Opm::filesystem::exists(initFileName)) && (nnc1_array.size() > 0)){
|
||||
if ((std::filesystem::exists(initFileName)) && (nnc1_array.size() > 0)){
|
||||
Opm::EclIO::EInit init(initFileName);
|
||||
|
||||
auto init_dims = init.grid_dimension(m_grid_name);
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <opm/io/eclipse/ESmry.hpp>
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
#include <opm/io/eclipse/EclFile.hpp>
|
||||
#include <opm/io/eclipse/EclUtil.hpp>
|
||||
@ -99,7 +98,7 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) :
|
||||
{
|
||||
fromSingleRun = !loadBaseRunData;
|
||||
|
||||
Opm::filesystem::path rootName = inputFileName.parent_path() / inputFileName.stem();
|
||||
std::filesystem::path rootName = inputFileName.parent_path() / inputFileName.stem();
|
||||
|
||||
// if only root name (without any extension) given as first argument in constructor
|
||||
// binary will then be assumed
|
||||
@ -113,15 +112,15 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) :
|
||||
const bool formatted = inputFileName.extension()==".SMSPEC" ? false : true;
|
||||
formattedFiles.push_back(formatted);
|
||||
|
||||
Opm::filesystem::path path = Opm::filesystem::current_path();
|
||||
std::filesystem::path path = std::filesystem::current_path();
|
||||
|
||||
updatePathAndRootName(path, rootName);
|
||||
|
||||
Opm::filesystem::path smspec_file = path / rootName;
|
||||
std::filesystem::path smspec_file = path / rootName;
|
||||
smspec_file += inputFileName.extension();
|
||||
|
||||
Opm::filesystem::path rstRootN;
|
||||
Opm::filesystem::path pathRstFile = path;
|
||||
std::filesystem::path rstRootN;
|
||||
std::filesystem::path pathRstFile = path;
|
||||
|
||||
std::set<std::string> keywList;
|
||||
std::vector<std::pair<std::string,int>> smryArray;
|
||||
@ -235,16 +234,16 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) :
|
||||
|
||||
if ((rstRootN.string() != "") && (loadBaseRunData)) {
|
||||
|
||||
if (! Opm::filesystem::exists(pathRstFile))
|
||||
if (! std::filesystem::exists(pathRstFile))
|
||||
OPM_THROW(std::runtime_error, "path to restart file not found, '" + pathRstFile.string() + "'");
|
||||
|
||||
auto abs_rst_file = Opm::filesystem::canonical(pathRstFile) / rstRootN;
|
||||
Opm::filesystem::path rel_path;
|
||||
auto abs_rst_file = std::filesystem::canonical(pathRstFile) / rstRootN;
|
||||
std::filesystem::path rel_path;
|
||||
|
||||
if (inputFileName.parent_path().string().empty())
|
||||
rel_path = Opm::proximate(abs_rst_file);
|
||||
rel_path = std::filesystem::proximate(abs_rst_file);
|
||||
else
|
||||
rel_path = Opm::proximate(abs_rst_file, inputFileName.parent_path());
|
||||
rel_path = std::filesystem::proximate(abs_rst_file, inputFileName.parent_path());
|
||||
|
||||
if (abs_rst_file.string().size() < rel_path.string().size())
|
||||
restart_info = std::make_tuple(abs_rst_file.string(), dimens[5]);
|
||||
@ -262,13 +261,13 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) :
|
||||
|
||||
while ((rstRootN.string() != "") && (loadBaseRunData)){
|
||||
|
||||
Opm::filesystem::path rstFile = pathRstFile / rstRootN;
|
||||
std::filesystem::path rstFile = pathRstFile / rstRootN;
|
||||
rstFile += ".SMSPEC";
|
||||
|
||||
bool baseRunFmt = false;
|
||||
|
||||
// if unformatted file not exists, check for formatted file
|
||||
if (!Opm::filesystem::exists(rstFile)){
|
||||
if (!std::filesystem::exists(rstFile)){
|
||||
rstFile = pathRstFile / rstRootN;
|
||||
rstFile += ".FSMSPEC";
|
||||
baseRunFmt = true;
|
||||
@ -475,7 +474,7 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) :
|
||||
toReportStepNumber = std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
Opm::filesystem::path smspecFile(std::get<0>(smryArray[specInd]));
|
||||
std::filesystem::path smspecFile(std::get<0>(smryArray[specInd]));
|
||||
rootName = smspecFile.parent_path() / smspecFile.stem();
|
||||
|
||||
// check if multiple or unified result files should be used
|
||||
@ -483,10 +482,10 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) :
|
||||
// if both unified and non-unified files exists, will use most recent based on
|
||||
// time stamp
|
||||
|
||||
Opm::filesystem::path unsmryFile = rootName;
|
||||
std::filesystem::path unsmryFile = rootName;
|
||||
|
||||
unsmryFile += formattedFiles[specInd] ? ".FUNSMRY" : ".UNSMRY";
|
||||
const bool use_unified = Opm::filesystem::exists(unsmryFile.string());
|
||||
const bool use_unified = std::filesystem::exists(unsmryFile.string());
|
||||
|
||||
const std::vector<std::string> multFileList = checkForMultipleResultFiles(rootName, formattedFiles[specInd]);
|
||||
|
||||
@ -495,8 +494,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 = Opm::filesystem::last_write_time(multFileList.back());
|
||||
auto time_unified = Opm::filesystem::last_write_time(unsmryFile);
|
||||
auto time_multiple = std::filesystem::last_write_time(multFileList.back());
|
||||
auto time_unified = std::filesystem::last_write_time(unsmryFile);
|
||||
|
||||
if (time_multiple > time_unified) {
|
||||
resultsFileList=multFileList;
|
||||
@ -1007,9 +1006,9 @@ bool ESmry::make_esmry_file()
|
||||
if (mini_steps.size() == 0)
|
||||
this->read_ministeps_from_disk();
|
||||
|
||||
Opm::filesystem::path path = inputFileName.parent_path();
|
||||
Opm::filesystem::path rootName = inputFileName.stem();
|
||||
Opm::filesystem::path smryDataFile;
|
||||
std::filesystem::path path = inputFileName.parent_path();
|
||||
std::filesystem::path rootName = inputFileName.stem();
|
||||
std::filesystem::path smryDataFile;
|
||||
|
||||
smryDataFile = path / rootName += ".ESMRY";
|
||||
|
||||
@ -1067,14 +1066,14 @@ bool ESmry::make_esmry_file()
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> ESmry::checkForMultipleResultFiles(const Opm::filesystem::path& rootN, bool formatted) const {
|
||||
std::vector<std::string> ESmry::checkForMultipleResultFiles(const std::filesystem::path& rootN, bool formatted) const {
|
||||
|
||||
std::vector<std::string> fileList;
|
||||
const std::string pathRootN = rootN.parent_path().string();
|
||||
|
||||
const std::string fileFilter = formatted ? rootN.stem().string()+".A" : rootN.stem().string()+".S";
|
||||
|
||||
for (Opm::filesystem::directory_iterator itr(pathRootN); itr != Opm::filesystem::directory_iterator(); ++itr)
|
||||
for (std::filesystem::directory_iterator itr(pathRootN); itr != std::filesystem::directory_iterator(); ++itr)
|
||||
{
|
||||
const std::string file = itr->path().filename().string();
|
||||
|
||||
@ -1091,7 +1090,7 @@ std::vector<std::string> ESmry::checkForMultipleResultFiles(const Opm::filesyste
|
||||
return fileList;
|
||||
}
|
||||
|
||||
void ESmry::getRstString(const std::vector<std::string>& restartArray, Opm::filesystem::path& pathRst, Opm::filesystem::path& rootN) const {
|
||||
void ESmry::getRstString(const std::vector<std::string>& restartArray, std::filesystem::path& pathRst, std::filesystem::path& rootN) const {
|
||||
|
||||
std::string rootNameStr="";
|
||||
|
||||
@ -1099,12 +1098,12 @@ void ESmry::getRstString(const std::vector<std::string>& restartArray, Opm::file
|
||||
rootNameStr = rootNameStr + str;
|
||||
}
|
||||
|
||||
rootN = Opm::filesystem::path(rootNameStr);
|
||||
rootN = std::filesystem::path(rootNameStr);
|
||||
|
||||
updatePathAndRootName(pathRst, rootN);
|
||||
}
|
||||
|
||||
void ESmry::updatePathAndRootName(Opm::filesystem::path& dir, Opm::filesystem::path& rootN) const {
|
||||
void ESmry::updatePathAndRootName(std::filesystem::path& dir, std::filesystem::path& rootN) const {
|
||||
|
||||
if (rootN.parent_path().is_absolute()){
|
||||
dir = rootN.parent_path();
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
@ -238,8 +239,8 @@ void ESmry::write_rsm(std::ostream& os) const {
|
||||
}
|
||||
}
|
||||
|
||||
void ESmry::write_rsm_file(std::optional<Opm::filesystem::path> filename) const {
|
||||
Opm::filesystem::path summary_file_name { filename.value_or(inputFileName) } ;
|
||||
void ESmry::write_rsm_file(std::optional<std::filesystem::path> filename) const {
|
||||
std::filesystem::path summary_file_name { filename.value_or(inputFileName) } ;
|
||||
summary_file_name.replace_extension("RSM");
|
||||
|
||||
std::ofstream rsm_file { summary_file_name } ;
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <opm/io/eclipse/ExtESmry.hpp>
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
#include <opm/io/eclipse/EclFile.hpp>
|
||||
#include <opm/io/eclipse/EclUtil.hpp>
|
||||
@ -28,6 +27,7 @@
|
||||
#include <numeric>
|
||||
#include <chrono>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <set>
|
||||
@ -101,10 +101,10 @@ ExtESmry::ExtESmry(const std::string &filename, bool loadBaseRunData) :
|
||||
|
||||
m_lodsmry_files.push_back(m_inputFileName);
|
||||
|
||||
Opm::filesystem::path rootName = m_inputFileName.parent_path() / m_inputFileName.stem();
|
||||
Opm::filesystem::path path = Opm::filesystem::current_path();
|
||||
std::filesystem::path rootName = m_inputFileName.parent_path() / m_inputFileName.stem();
|
||||
std::filesystem::path path = std::filesystem::current_path();
|
||||
|
||||
Opm::filesystem::path rstRootN;
|
||||
std::filesystem::path rstRootN;
|
||||
|
||||
updatePathAndRootName(path, rootName);
|
||||
|
||||
@ -153,11 +153,11 @@ ExtESmry::ExtESmry(const std::string &filename, bool loadBaseRunData) :
|
||||
while (!restart.empty()){
|
||||
sim_ind++;
|
||||
|
||||
rstRootN = Opm::filesystem::path(restart);
|
||||
rstRootN = std::filesystem::path(restart);
|
||||
|
||||
updatePathAndRootName(path, rstRootN);
|
||||
|
||||
Opm::filesystem::path rstLodSmryFile = path / rstRootN;
|
||||
std::filesystem::path rstLodSmryFile = path / rstRootN;
|
||||
rstLodSmryFile += ".ESMRY";
|
||||
|
||||
m_lodsmry_files.push_back(rstLodSmryFile);
|
||||
@ -255,7 +255,7 @@ bool ExtESmry::all_steps_available()
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t ExtESmry::open_esmry(Opm::filesystem::path& inputFileName, LodsmryHeadType& lodsmry_head)
|
||||
uint64_t ExtESmry::open_esmry(std::filesystem::path& inputFileName, LodsmryHeadType& lodsmry_head)
|
||||
{
|
||||
std::fstream fileH;
|
||||
|
||||
@ -343,7 +343,7 @@ uint64_t ExtESmry::open_esmry(Opm::filesystem::path& inputFileName, LodsmryHeadT
|
||||
}
|
||||
|
||||
|
||||
void ExtESmry::updatePathAndRootName(Opm::filesystem::path& dir, Opm::filesystem::path& rootN) {
|
||||
void ExtESmry::updatePathAndRootName(std::filesystem::path& dir, std::filesystem::path& rootN) {
|
||||
|
||||
if (rootN.parent_path().is_absolute()){
|
||||
dir = rootN.parent_path();
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
@ -38,8 +39,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
namespace {
|
||||
namespace FileExtension
|
||||
{
|
||||
@ -396,7 +395,7 @@ openUnified(const std::string& fname,
|
||||
// to be an actual unified restart file.
|
||||
throw std::invalid_argument {
|
||||
"Purported existing unified restart file '"
|
||||
+ Opm::filesystem::path{fname}.filename().string()
|
||||
+ std::filesystem::path{fname}.filename().string()
|
||||
+ "' does not appear to be a unified restart file"
|
||||
};
|
||||
}
|
||||
@ -444,7 +443,7 @@ openExisting(const std::string& fname,
|
||||
// resize_file() followed by seekp() is the intended and expected
|
||||
// order of operations.
|
||||
|
||||
Opm::filesystem::resize_file(fname, writePos);
|
||||
std::filesystem::resize_file(fname, writePos);
|
||||
|
||||
if (! this->stream_->ofileH.seekp(0, std::ios_base::end)) {
|
||||
throw std::invalid_argument {
|
||||
@ -800,7 +799,7 @@ std::string
|
||||
Opm::EclIO::OutputStream::outputFileName(const ResultSet& rsetDescriptor,
|
||||
const std::string& ext)
|
||||
{
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
// Allow baseName = "CASE", "CASE.", "CASE.N", or "CASE.N.".
|
||||
auto fname = fs::path {
|
||||
|
@ -120,7 +120,7 @@ namespace Json {
|
||||
|
||||
|
||||
|
||||
JsonObject::JsonObject(const Opm::filesystem::path& jsonFile ) {
|
||||
JsonObject::JsonObject(const std::filesystem::path& jsonFile ) {
|
||||
std::ifstream stream(jsonFile.string().c_str());
|
||||
if (stream) {
|
||||
std::string content_from_file( (std::istreambuf_iterator<char>(stream)),
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cctype>
|
||||
#include <filesystem>
|
||||
#include <limits>
|
||||
#include <memory> // unique_ptr
|
||||
#include <optional>
|
||||
@ -62,8 +63,6 @@
|
||||
#include <unordered_map>
|
||||
#include <utility> // move
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
@ -74,9 +73,9 @@ inline std::string uppercase( std::string x ) {
|
||||
return x;
|
||||
}
|
||||
|
||||
void ensure_directory_exists( const Opm::filesystem::path& odir )
|
||||
void ensure_directory_exists( const std::filesystem::path& odir )
|
||||
{
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
if (fs::exists( odir ) && !fs::is_directory( odir ))
|
||||
throw std::runtime_error {
|
||||
@ -183,7 +182,7 @@ void EclipseIO::Impl::writeEGRIDFile( const std::vector<NNCdata>& nnc ) {
|
||||
+ (formatted ? std::string{"F"} : std::string{})
|
||||
+ "EGRID";
|
||||
|
||||
const auto egridFile = (Opm::filesystem::path{ this->outputDir }
|
||||
const auto egridFile = (std::filesystem::path{ this->outputDir }
|
||||
/ (this->baseName + ext)).generic_string();
|
||||
|
||||
this->grid.save( egridFile, formatted, nnc, this->es.getDeckUnitSystem());
|
||||
@ -298,8 +297,8 @@ void EclipseIO::writeTimeStep(const Action::State& action_state,
|
||||
const bool final_step { report_step == static_cast<int>(schedule.size()) - 1 };
|
||||
|
||||
if (final_step && !isSubstep && this->impl->summaryConfig.createRunSummary()) {
|
||||
Opm::filesystem::path outputDir { this->impl->outputDir } ;
|
||||
Opm::filesystem::path outputFile { outputDir / this->impl->baseName } ;
|
||||
std::filesystem::path outputDir { this->impl->outputDir } ;
|
||||
std::filesystem::path outputFile { outputDir / this->impl->baseName } ;
|
||||
EclIO::ESmry(outputFile).write_rsm_file();
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,6 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||
|
||||
@ -72,6 +70,7 @@
|
||||
#include <cctype>
|
||||
#include <ctime>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
@ -3387,8 +3386,8 @@ SummaryImplementation(const EclipseState& es,
|
||||
|
||||
std::string esmryFileName = EclIO::OutputStream::outputFileName(this->rset_, "ESMRY");
|
||||
|
||||
if (Opm::filesystem::exists(esmryFileName))
|
||||
Opm::filesystem::remove(esmryFileName);
|
||||
if (std::filesystem::exists(esmryFileName))
|
||||
std::filesystem::remove(esmryFileName);
|
||||
|
||||
if ((writeEsmry) and (es.cfg().io().getFMTOUT()==false))
|
||||
this->esmry_ = std::make_unique<Opm::EclIO::ExtSmryOutput>(this->valueKeys_, this->valueUnits_, es, sched.posixStartTime());
|
||||
|
@ -17,16 +17,16 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckOutput.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckSection.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace Opm {
|
||||
|
||||
|
@ -16,9 +16,11 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckTree.hpp>
|
||||
namespace fs = Opm::filesystem;
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace Opm {
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/S.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/T.hpp>
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@ -302,7 +302,7 @@ std::string FileDeck::dump_block(const FileDeck::Block& block, const std::string
|
||||
output_file = fs::path(output_dir) / data_file.value();
|
||||
else {
|
||||
// Should ideally use fs::relative()
|
||||
auto rel_path = proximate(block.fname, this->input_directory);
|
||||
auto rel_path = fs::proximate(block.fname, this->input_directory);
|
||||
output_file = output_dir / rel_path;
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ void FileDeck::include_block(const std::string& input_file, const std::string& o
|
||||
auto stream = context.get_stream(parent);
|
||||
if (stream.has_value()) {
|
||||
// Should ideally use fs::relative()
|
||||
std::string include_file = proximate(output_file, output_dir);
|
||||
std::string include_file = fs::proximate(output_file, output_dir);
|
||||
INCLUDE(*stream.value(), include_file);
|
||||
break;
|
||||
}
|
||||
@ -372,7 +372,7 @@ void FileDeck::dump_shared(std::ostream& stream, const std::string& output_dir)
|
||||
block.dump( out );
|
||||
} else {
|
||||
// Should ideally use fs::relative()
|
||||
std::string include_file = proximate(block.fname, output_dir);
|
||||
std::string include_file = fs::proximate(block.fname, output_dir);
|
||||
if (include_file.find(block.fname) == std::string::npos)
|
||||
INCLUDE(stream, include_file);
|
||||
else
|
||||
|
@ -17,6 +17,7 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <filesystem>
|
||||
#include <set>
|
||||
|
||||
#include <fmt/format.h>
|
||||
@ -25,7 +26,6 @@
|
||||
#include <opm/common/OpmLog/InfoLogger.hpp>
|
||||
#include <opm/common/OpmLog/LogUtil.hpp>
|
||||
#include <opm/common/utility/OpmInputError.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/io/eclipse/rst/aquifer.hpp>
|
||||
#include <opm/io/eclipse/ERst.hpp>
|
||||
@ -159,7 +159,7 @@ AquiferConfig load_aquifers(const Deck& deck, const TableManager& tables, NNC& i
|
||||
const auto& io_config = this->getIOConfig();
|
||||
const int report_step = init_config.getRestartStep();
|
||||
const auto& restart_file = io_config.getRestartFileName( init_config.getRestartRootName(), report_step, false);
|
||||
if (!filesystem::exists(restart_file))
|
||||
if (!std::filesystem::exists(restart_file))
|
||||
throw std::logic_error(fmt::format("The restart file: {} does not exist", restart_file));
|
||||
|
||||
if (io_config.getUNIFIN()) {
|
||||
|
@ -17,13 +17,12 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <filesystem>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
@ -58,12 +57,12 @@ namespace Opm {
|
||||
|
||||
|
||||
inline std::string basename( const std::string& path ) {
|
||||
return Opm::filesystem::path( path ).stem().string();
|
||||
return std::filesystem::path( path ).stem().string();
|
||||
}
|
||||
|
||||
|
||||
inline std::string outputdir( const std::string& path ) {
|
||||
auto dir = Opm::filesystem::path( path ).parent_path().string();
|
||||
auto dir = std::filesystem::path( path ).parent_path().string();
|
||||
|
||||
if( dir.empty() ) return default_dir;
|
||||
|
||||
@ -262,7 +261,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
std::string IOConfig::fullBasePath( ) const {
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
fs::path dir( m_output_dir );
|
||||
fs::path base( m_base_name );
|
||||
|
@ -18,14 +18,13 @@
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <cctype>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/json/JsonObject.hpp>
|
||||
#include <opm/parser/eclipse/Generator/KeywordGenerator.hpp>
|
||||
#include <opm/parser/eclipse/Generator/KeywordLoader.hpp>
|
||||
@ -61,9 +60,9 @@ namespace Opm {
|
||||
}
|
||||
|
||||
void KeywordGenerator::ensurePath( const std::string& file_name) {
|
||||
Opm::filesystem::path file(file_name);
|
||||
if (!Opm::filesystem::is_directory( file.parent_path()))
|
||||
Opm::filesystem::create_directories( file.parent_path());
|
||||
std::filesystem::path file(file_name);
|
||||
if (!std::filesystem::is_directory( file.parent_path()))
|
||||
std::filesystem::create_directories( file.parent_path());
|
||||
}
|
||||
|
||||
void KeywordGenerator::updateFile(const std::stringstream& newContent , const std::string& filename) {
|
||||
@ -274,7 +273,7 @@ void python::common::export_ParserKeywords(py::module& module) {
|
||||
stream << R"(
|
||||
|
||||
#define BOOST_TEST_MODULE GeneratedKeywordTest
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <filesystem>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <memory>
|
||||
#include <opm/json/JsonObject.hpp>
|
||||
@ -286,7 +285,7 @@ auto unitSystem = Opm::UnitSystem::newMETRIC();
|
||||
|
||||
namespace Opm {
|
||||
void test_keyword(const ParserKeyword& inline_keyword, const std::string& json_file) {
|
||||
Opm::filesystem::path jsonPath( json_file );
|
||||
std::filesystem::path jsonPath( json_file );
|
||||
Json::JsonObject jsonConfig( jsonPath );
|
||||
ParserKeyword json_keyword(jsonConfig);
|
||||
BOOST_CHECK_EQUAL( json_keyword, inline_keyword);
|
||||
|
@ -19,10 +19,9 @@
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/json/JsonObject.hpp>
|
||||
#include <opm/parser/eclipse/Generator/KeywordLoader.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
|
||||
@ -36,13 +35,13 @@ namespace Opm {
|
||||
if (verbose)
|
||||
std::cout << "Loading keyword from file: " << keyword_file << std::endl;
|
||||
|
||||
Opm::filesystem::path path( keyword_file );
|
||||
std::filesystem::path path( keyword_file );
|
||||
std::unique_ptr<ParserKeyword> parserKeyword;
|
||||
|
||||
try {
|
||||
Json::JsonObject jsonConfig = Json::JsonObject( path );
|
||||
parserKeyword.reset( new ParserKeyword(jsonConfig) );
|
||||
auto abs_path = Opm::filesystem::absolute( path );
|
||||
auto abs_path = std::filesystem::absolute( path );
|
||||
} catch (const std::exception& exc) {
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Failed to create parserkeyword from: " << path.string() << std::endl;
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <cctype>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
@ -31,8 +32,6 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <opm/common/OpmLog/LogUtil.hpp>
|
||||
#include <opm/common/utility/OpmInputError.hpp>
|
||||
@ -336,26 +335,26 @@ inline bool isTerminatedRecordString(const std::string_view& line) {
|
||||
}
|
||||
|
||||
struct file {
|
||||
file( Opm::filesystem::path p, const std::string& in ) :
|
||||
file( std::filesystem::path p, const std::string& in ) :
|
||||
input( in ), path( p )
|
||||
{}
|
||||
|
||||
std::string_view input;
|
||||
size_t lineNR = 0;
|
||||
Opm::filesystem::path path;
|
||||
std::filesystem::path path;
|
||||
};
|
||||
|
||||
|
||||
class InputStack : public std::stack< file, std::vector< file > > {
|
||||
public:
|
||||
void push( std::string&& input, Opm::filesystem::path p = "<memory string>" );
|
||||
void push( std::string&& input, std::filesystem::path p = "<memory string>" );
|
||||
|
||||
private:
|
||||
std::list< std::string > string_storage;
|
||||
using base = std::stack< file, std::vector< file > >;
|
||||
};
|
||||
|
||||
void InputStack::push( std::string&& input, Opm::filesystem::path p ) {
|
||||
void InputStack::push( std::string&& input, std::filesystem::path p ) {
|
||||
this->string_storage.push_back( std::move( input ) );
|
||||
this->emplace( p, this->string_storage.back() );
|
||||
}
|
||||
@ -368,17 +367,17 @@ class ParserState {
|
||||
|
||||
ParserState( const std::vector<std::pair<std::string,std::string>>&,
|
||||
const ParseContext&, ErrorGuard&,
|
||||
Opm::filesystem::path, const std::set<Opm::Ecl::SectionType>& ignore = {});
|
||||
std::filesystem::path, const std::set<Opm::Ecl::SectionType>& ignore = {});
|
||||
|
||||
void loadString( const std::string& );
|
||||
void loadFile( const Opm::filesystem::path& );
|
||||
void openRootFile( const Opm::filesystem::path& );
|
||||
void loadFile( const std::filesystem::path& );
|
||||
void openRootFile( const std::filesystem::path& );
|
||||
|
||||
void handleRandomText(const std::string_view& ) const;
|
||||
std::optional<Opm::filesystem::path> getIncludeFilePath( std::string ) const;
|
||||
std::optional<std::filesystem::path> getIncludeFilePath( std::string ) const;
|
||||
void addPathAlias( const std::string& alias, const std::string& path );
|
||||
|
||||
const Opm::filesystem::path& current_path() const;
|
||||
const std::filesystem::path& current_path() const;
|
||||
size_t line() const;
|
||||
|
||||
bool done() const;
|
||||
@ -401,14 +400,14 @@ class ParserState {
|
||||
std::string lastKeyWord;
|
||||
|
||||
Deck deck;
|
||||
Opm::filesystem::path rootPath;
|
||||
std::filesystem::path rootPath;
|
||||
std::unique_ptr<Python> python;
|
||||
const ParseContext& parseContext;
|
||||
ErrorGuard& errors;
|
||||
bool unknown_keyword = false;
|
||||
};
|
||||
|
||||
const Opm::filesystem::path& ParserState::current_path() const {
|
||||
const std::filesystem::path& ParserState::current_path() const {
|
||||
return this->input_stack.top().path;
|
||||
}
|
||||
|
||||
@ -466,11 +465,11 @@ ParserState::ParserState(const std::vector<std::pair<std::string, std::string>>&
|
||||
ParserState::ParserState( const std::vector<std::pair<std::string, std::string>>& code_keywords_arg,
|
||||
const ParseContext& context,
|
||||
ErrorGuard& errors_arg,
|
||||
Opm::filesystem::path p,
|
||||
std::filesystem::path p,
|
||||
const std::set<Opm::Ecl::SectionType>& ignore ) :
|
||||
code_keywords(code_keywords_arg),
|
||||
ignore_sections(ignore),
|
||||
rootPath( Opm::filesystem::canonical( p ).parent_path() ),
|
||||
rootPath( std::filesystem::canonical( p ).parent_path() ),
|
||||
python( std::make_unique<Python>() ),
|
||||
parseContext( context ),
|
||||
errors( errors_arg )
|
||||
@ -515,7 +514,7 @@ void ParserState::loadString(const std::string& input) {
|
||||
this->input_stack.push( str::clean( this->code_keywords, input + "\n" ) );
|
||||
}
|
||||
|
||||
void ParserState::loadFile(const Opm::filesystem::path& inputFile) {
|
||||
void ParserState::loadFile(const std::filesystem::path& inputFile) {
|
||||
|
||||
const auto closer = []( std::FILE* f ) { std::fclose( f ); };
|
||||
std::unique_ptr< std::FILE, decltype( closer ) > ufp(
|
||||
@ -580,15 +579,15 @@ void ParserState::handleRandomText(const std::string_view& keywordString ) const
|
||||
}
|
||||
|
||||
|
||||
void ParserState::openRootFile( const Opm::filesystem::path& inputFile) {
|
||||
void ParserState::openRootFile( const std::filesystem::path& inputFile) {
|
||||
|
||||
this->loadFile( inputFile );
|
||||
this->deck.setDataFile( inputFile.string() );
|
||||
const Opm::filesystem::path& inputFileCanonical = Opm::filesystem::canonical(inputFile);
|
||||
const std::filesystem::path& inputFileCanonical = std::filesystem::canonical(inputFile);
|
||||
this->rootPath = inputFileCanonical.parent_path();
|
||||
}
|
||||
|
||||
std::optional<Opm::filesystem::path> ParserState::getIncludeFilePath( std::string path ) const {
|
||||
std::optional<std::filesystem::path> ParserState::getIncludeFilePath( std::string path ) const {
|
||||
static const std::string pathKeywordPrefix("$");
|
||||
static const std::string validPathNameCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");
|
||||
|
||||
@ -609,14 +608,14 @@ std::optional<Opm::filesystem::path> ParserState::getIncludeFilePath( std::strin
|
||||
OpmLog::warning("Replaced one or more backslash with a slash in an INCLUDE path.");
|
||||
}
|
||||
|
||||
Opm::filesystem::path includeFilePath(path);
|
||||
std::filesystem::path includeFilePath(path);
|
||||
|
||||
if (includeFilePath.is_relative())
|
||||
includeFilePath = this->rootPath / includeFilePath;
|
||||
|
||||
try {
|
||||
includeFilePath = Opm::filesystem::canonical(includeFilePath);
|
||||
} catch (const Opm::filesystem::filesystem_error& fs_error) {
|
||||
includeFilePath = std::filesystem::canonical(includeFilePath);
|
||||
} catch (const std::filesystem::filesystem_error& fs_error) {
|
||||
parseContext.handleError( ParseContext::PARSE_MISSING_INCLUDE , fmt::format("No such file: {}", includeFilePath.string()), {}, errors);
|
||||
return {};
|
||||
}
|
||||
@ -1013,7 +1012,7 @@ bool parseState( ParserState& parserState, const Parser& parser ) {
|
||||
|
||||
if (includeFile.has_value()) {
|
||||
auto& deck_tree = parserState.deck.tree();
|
||||
deck_tree.add_include(filesystem::absolute(parserState.current_path()), includeFile.value() );
|
||||
deck_tree.add_include(std::filesystem::absolute(parserState.current_path()), includeFile.value() );
|
||||
parserState.loadFile( includeFile.value() );
|
||||
}
|
||||
continue;
|
||||
@ -1185,9 +1184,9 @@ bool parseState( ParserState& parserState, const Parser& parser ) {
|
||||
*/
|
||||
std::string data_file;
|
||||
if (dataFileName[0] == '/')
|
||||
data_file = Opm::filesystem::canonical(dataFileName).string();
|
||||
data_file = std::filesystem::canonical(dataFileName).string();
|
||||
else
|
||||
data_file = Opm::proximate( Opm::filesystem::canonical(dataFileName) );
|
||||
data_file = std::filesystem::proximate( std::filesystem::canonical(dataFileName) );
|
||||
|
||||
ParserState parserState( this->codeKeywords(), parseContext, errors, data_file, ignore_sections);
|
||||
parseState( parserState, *this );
|
||||
@ -1341,7 +1340,7 @@ std::vector<std::string> Parser::getAllDeckNames () const {
|
||||
throw std::invalid_argument("Input JSON object is not an array");
|
||||
}
|
||||
|
||||
bool Parser::loadKeywordFromFile(const Opm::filesystem::path& configFile) {
|
||||
bool Parser::loadKeywordFromFile(const std::filesystem::path& configFile) {
|
||||
|
||||
try {
|
||||
Json::JsonObject jsonKeyword(configFile);
|
||||
@ -1354,13 +1353,13 @@ std::vector<std::string> Parser::getAllDeckNames () const {
|
||||
}
|
||||
|
||||
|
||||
void Parser::loadKeywordsFromDirectory(const Opm::filesystem::path& directory, bool recursive) {
|
||||
if (!Opm::filesystem::exists(directory))
|
||||
void Parser::loadKeywordsFromDirectory(const std::filesystem::path& directory, bool recursive) {
|
||||
if (!std::filesystem::exists(directory))
|
||||
throw std::invalid_argument("Directory: " + directory.string() + " does not exist.");
|
||||
else {
|
||||
Opm::filesystem::directory_iterator end;
|
||||
for (Opm::filesystem::directory_iterator iter(directory); iter != end; iter++) {
|
||||
if (Opm::filesystem::is_directory(*iter)) {
|
||||
std::filesystem::directory_iterator end;
|
||||
for (std::filesystem::directory_iterator iter(directory); iter != end; iter++) {
|
||||
if (std::filesystem::is_directory(*iter)) {
|
||||
if (recursive)
|
||||
loadKeywordsFromDirectory(*iter, recursive);
|
||||
} else {
|
||||
|
@ -25,12 +25,13 @@ error BUG: The PyRunModule.hpp header should *not* be included in a configuratio
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include "src/opm/parser/eclipse/Python/PyRunModule.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
PyRunModule::PyRunModule(std::shared_ptr<const Python> python, const std::string& fname) {
|
||||
if (python->enabled())
|
||||
|
@ -18,10 +18,10 @@
|
||||
|
||||
#include <opm/utility/EModel.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
@ -44,7 +44,7 @@ EModel::EModel(const std::string& filename) :
|
||||
else
|
||||
OPM_THROW(std::invalid_argument, "Input to EModel should be a binary INIT file");
|
||||
|
||||
if ( Opm::filesystem::exists(rootN + ".EGRID") )
|
||||
if ( std::filesystem::exists(rootN + ".EGRID") )
|
||||
grid = Opm::EclipseGrid(rootN + ".EGRID");
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ EModel::EModel(const std::string& filename) :
|
||||
}
|
||||
}
|
||||
|
||||
if ( Opm::filesystem::exists( rootN + ".UNRST" ) )
|
||||
if ( std::filesystem::exists( rootN + ".UNRST" ) )
|
||||
{
|
||||
rstfile = Opm::EclIO::ERst(rootN + ".UNRST");
|
||||
std::vector<int> rstepList = rstfile->listOfReportStepNumbers();
|
||||
|
@ -30,13 +30,13 @@
|
||||
|
||||
#include <opm/output/eclipse/RestartIO.hpp>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/common/utility/numeric/cmp.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <filesystem>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
@ -998,7 +998,7 @@ void ECLRegressionTest::results_smry()
|
||||
}
|
||||
}
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
std::string rsm_file = rootName2 + ".RSM";
|
||||
if (fs::is_regular_file(fs::path(rsm_file))) {
|
||||
auto rsm = ERsm(rsm_file);
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <filesystem>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <tuple>
|
||||
@ -99,7 +100,7 @@ int main(int argc, char **argv) {
|
||||
std::unique_ptr<Opm::EclIO::ExtESmry> ext_esmry;
|
||||
|
||||
std::string filename = argv[argOffset];
|
||||
Opm::filesystem::path inputFileName(filename);
|
||||
std::filesystem::path inputFileName(filename);
|
||||
|
||||
if (inputFileName.extension()=="")
|
||||
inputFileName+=".SMSPEC";
|
||||
|
@ -30,21 +30,21 @@ namespace {
|
||||
{
|
||||
public:
|
||||
explicit WorkArea(const std::string& subdir = "")
|
||||
: root_(Opm::filesystem::temp_directory_path() /
|
||||
: root_(std::filesystem::temp_directory_path() /
|
||||
Opm::unique_path("wrk-%%%%"))
|
||||
, area_(root_)
|
||||
, orig_(Opm::filesystem::current_path())
|
||||
, orig_(std::filesystem::current_path())
|
||||
{
|
||||
if (! subdir.empty())
|
||||
this->area_ /= subdir;
|
||||
|
||||
Opm::filesystem::create_directories(this->area_);
|
||||
Opm::filesystem::current_path(this->area_);
|
||||
std::filesystem::create_directories(this->area_);
|
||||
std::filesystem::current_path(this->area_);
|
||||
}
|
||||
|
||||
void copyIn(const std::string& filename) const
|
||||
{
|
||||
Opm::filesystem::copy_file(this->orig_ / filename,
|
||||
std::filesystem::copy_file(this->orig_ / filename,
|
||||
this->area_ / filename);
|
||||
}
|
||||
|
||||
@ -55,23 +55,23 @@ namespace {
|
||||
|
||||
void makeSubDir(const std::string& dirname)
|
||||
{
|
||||
Opm::filesystem::create_directories(this->area_ / dirname);
|
||||
std::filesystem::create_directories(this->area_ / dirname);
|
||||
}
|
||||
|
||||
~WorkArea()
|
||||
{
|
||||
Opm::filesystem::current_path(this->orig_);
|
||||
Opm::filesystem::remove_all(this->root_);
|
||||
std::filesystem::current_path(this->orig_);
|
||||
std::filesystem::remove_all(this->root_);
|
||||
}
|
||||
|
||||
std::string org_path(const std::string& fname) {
|
||||
return Opm::filesystem::canonical( this->orig_ / fname );
|
||||
return std::filesystem::canonical( this->orig_ / fname );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Opm::filesystem::path root_;
|
||||
Opm::filesystem::path area_;
|
||||
Opm::filesystem::path orig_;
|
||||
std::filesystem::path root_;
|
||||
std::filesystem::path area_;
|
||||
std::filesystem::path orig_;
|
||||
};
|
||||
} // Anonymous
|
||||
|
@ -18,13 +18,13 @@
|
||||
*/
|
||||
#include <stdexcept>
|
||||
#include <math.h>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
#define BOOST_TEST_MODULE jsonParserTests
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/json/JsonObject.hpp>
|
||||
|
||||
@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE(parseJSONObject_testType) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Parse_fileDoesNotExist_Throws) {
|
||||
Opm::filesystem::path jsonFile("file/does/not/exist");
|
||||
std::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];
|
||||
Opm::filesystem::path jsonFile(arg);
|
||||
std::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];
|
||||
Opm::filesystem::path jsonFile(arg);
|
||||
std::filesystem::path jsonFile(arg);
|
||||
Json::JsonObject parser(jsonFile);
|
||||
std::string json_string =
|
||||
"{\n"
|
||||
|
@ -23,13 +23,12 @@
|
||||
#include <opm/msim/msim.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Python/Python.hpp>
|
||||
#include <opm/io/eclipse/ERst.hpp>
|
||||
#include <opm/io/eclipse/ESmry.hpp>
|
||||
@ -81,10 +80,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 Opm::filesystem::path& name)
|
||||
bool is_file(const std::filesystem::path& name)
|
||||
{
|
||||
return Opm::filesystem::exists(name)
|
||||
&& Opm::filesystem::is_regular_file(name);
|
||||
return std::filesystem::exists(name)
|
||||
&& std::filesystem::is_regular_file(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,15 +23,15 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
|
||||
#include "tests/WorkArea.cpp"
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
@ -288,7 +288,7 @@ BOOST_AUTO_TEST_CASE(OutputPaths) {
|
||||
BOOST_CHECK_EQUAL( output_dir2, config2.getOutputDir() );
|
||||
BOOST_CHECK_EQUAL( "TESTSTRING", config2.getBaseName() );
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
Deck deck3;
|
||||
touch_file("path/to/testString.DATA");
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#define BOOST_TEST_MODULE ImportTests
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/io/eclipse/EclOutput.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@ -29,6 +28,7 @@
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <tests/WorkArea.cpp>
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/I.hpp>
|
||||
@ -37,7 +37,7 @@
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/Z.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateImportContainer) {
|
||||
WorkArea work;
|
||||
|
@ -21,8 +21,8 @@
|
||||
#define BOOST_TEST_MODULE ParserTests
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/common/utility/OpmInputError.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
|
||||
@ -38,7 +38,7 @@ inline std::string prefix() {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ParserKeyword_includeInvalid) {
|
||||
Opm::filesystem::path inputFilePath(prefix() + "includeInvalid.data");
|
||||
std::filesystem::path inputFilePath(prefix() + "includeInvalid.data");
|
||||
|
||||
Opm::Parser parser;
|
||||
Opm::ParseContext parseContext;
|
||||
@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(ParserKeyword_includeInvalid) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DATA_FILE_IS_SYMLINK) {
|
||||
Opm::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink4/path/case.data");
|
||||
std::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());
|
||||
@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(DATA_FILE_IS_SYMLINK) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Verify_find_includes_Data_file_is_a_symlink) {
|
||||
Opm::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink1/case_symlink.data");
|
||||
std::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink1/case_symlink.data");
|
||||
Opm::Parser parser;
|
||||
auto deck = parser.parseFile(inputFilePath.string());
|
||||
|
||||
@ -74,7 +74,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) {
|
||||
Opm::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink2/caseWithIncludedSymlink.data");
|
||||
std::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink2/caseWithIncludedSymlink.data");
|
||||
Opm::Parser parser;
|
||||
auto deck = parser.parseFile(inputFilePath.string());
|
||||
|
||||
@ -84,7 +84,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) {
|
||||
Opm::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink3/case.data");
|
||||
std::filesystem::path inputFilePath(prefix() + "includeSymlinkTestdata/symlink3/case.data");
|
||||
Opm::Parser parser;
|
||||
auto deck = parser.parseFile(inputFilePath.string());
|
||||
|
||||
@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(Verify_find_includes_Data_file_has_include_file_that_again_
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ParserKeyword_includeValid) {
|
||||
Opm::filesystem::path inputFilePath(prefix() + "includeValid.data");
|
||||
std::filesystem::path inputFilePath(prefix() + "includeValid.data");
|
||||
|
||||
Opm::Parser parser;
|
||||
auto deck = parser.parseFile(inputFilePath.string());
|
||||
@ -109,9 +109,9 @@ BOOST_AUTO_TEST_CASE(ParserKeyword_includeValid) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ParserKeyword_includeWrongCase) {
|
||||
Opm::filesystem::path inputFile1Path(prefix() + "includeWrongCase1.data");
|
||||
Opm::filesystem::path inputFile2Path(prefix() + "includeWrongCase2.data");
|
||||
Opm::filesystem::path inputFile3Path(prefix() + "includeWrongCase3.data");
|
||||
std::filesystem::path inputFile1Path(prefix() + "includeWrongCase1.data");
|
||||
std::filesystem::path inputFile2Path(prefix() + "includeWrongCase2.data");
|
||||
std::filesystem::path inputFile3Path(prefix() + "includeWrongCase3.data");
|
||||
|
||||
Opm::Parser parser;
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <opm/common/OpmLog/KeywordLocation.hpp>
|
||||
#include <opm/parser/eclipse/Utility/Typetools.hpp>
|
||||
#include <opm/common/utility/OpmInputError.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
@ -42,6 +41,7 @@
|
||||
#include "src/opm/parser/eclipse/Parser/raw/RawKeyword.hpp"
|
||||
#include "src/opm/parser/eclipse/Parser/raw/RawRecord.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
using namespace Opm;
|
||||
@ -193,28 +193,28 @@ BOOST_AUTO_TEST_CASE(loadKeywordsJSON_manyKeywords_returnstrue) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(loadKeywordFromFile_fileDoesNotExist_returnsFalse) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path configFile("File/does/not/exist");
|
||||
std::filesystem::path configFile("File/does/not/exist");
|
||||
BOOST_CHECK_EQUAL( false , parser.loadKeywordFromFile( configFile ));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(loadKeywordFromFile_invalidJson_returnsFalse) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path configFile(prefix() + "json/example_invalid_json");
|
||||
std::filesystem::path configFile(prefix() + "json/example_invalid_json");
|
||||
BOOST_CHECK_EQUAL( false , parser.loadKeywordFromFile( configFile ));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(loadKeywordFromFile_invalidConfig_returnsFalse) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path configFile(prefix() + "json/example_missing_name.json");
|
||||
std::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 );
|
||||
Opm::filesystem::path configFile(prefix() + "json/BPR");
|
||||
std::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") );
|
||||
@ -224,14 +224,14 @@ BOOST_AUTO_TEST_CASE(loadKeywordFromFile_validKeyword_returnsTrueHasKeyword) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_directoryDoesNotexist_throws) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path configPath("path/does/not/exist");
|
||||
std::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"));
|
||||
Opm::filesystem::path configPath(prefix() + "config/directory1");
|
||||
std::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"));
|
||||
@ -241,7 +241,7 @@ BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_notRecursive_allNames) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_notRecursive_strictNames) {
|
||||
Parser parser( false );
|
||||
Opm::filesystem::path configPath(prefix() + "config/directory1");
|
||||
std::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
|
||||
@ -254,7 +254,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"));
|
||||
Opm::filesystem::path configPath(prefix() + "config/directory1");
|
||||
std::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"));
|
||||
@ -265,7 +265,7 @@ BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_Recursive_allNames) {
|
||||
BOOST_AUTO_TEST_CASE(loadConfigFromDirectory_default) {
|
||||
Parser parser( false );
|
||||
BOOST_CHECK_EQUAL(false , parser.isRecognizedKeyword("BPR"));
|
||||
Opm::filesystem::path configPath(prefix() + "config/directory1");
|
||||
std::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
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
|
||||
@ -53,7 +53,7 @@ inline std::string prefix() {
|
||||
|
||||
BOOST_AUTO_TEST_CASE( PvtxNumTables1 ) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA");
|
||||
std::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA");
|
||||
auto deck = parser.parseFile(deckFile.string());
|
||||
BOOST_CHECK_EQUAL( PvtxTable::numTables( deck.getKeyword<ParserKeywords::PVTO>()) , 1);
|
||||
|
||||
@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE( PvtxNumTables1 ) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE( PvtxNumTables2 ) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path deckFile(prefix() + "TABLES/PVTO2.DATA");
|
||||
std::filesystem::path deckFile(prefix() + "TABLES/PVTO2.DATA");
|
||||
auto deck = parser.parseFile(deckFile.string());
|
||||
BOOST_CHECK_EQUAL( PvtxTable::numTables( deck.getKeyword<ParserKeywords::PVTO>()) , 3);
|
||||
|
||||
@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE( PvtxNumTables3 ) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE( PVTOSaturatedTable ) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA");
|
||||
std::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;
|
||||
Opm::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA");
|
||||
std::filesystem::path deckFile(prefix() + "TABLES/PVTX1.DATA");
|
||||
auto deck = parser.parseFile(deckFile.string());
|
||||
Opm::TableManager tables(deck);
|
||||
const auto& pvtgTables = tables.getPvtgTables( );
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/parser/eclipse/Python/Python.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
@ -47,12 +46,13 @@
|
||||
#include <opm/io/eclipse/RestartFileView.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
|
@ -21,8 +21,7 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <filesystem>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
@ -38,7 +37,7 @@ inline std::string prefix() {
|
||||
|
||||
inline Deck makeDeck(const std::string& fileName) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path boxFile(fileName);
|
||||
std::filesystem::path boxFile(fileName);
|
||||
return parser.parseFile(boxFile.string());
|
||||
}
|
||||
|
||||
|
@ -23,14 +23,14 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
inline std::string prefix() {
|
||||
@ -39,7 +39,7 @@ inline std::string prefix() {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateCPGrid) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA");
|
||||
std::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA");
|
||||
auto deck = parser.parseFile(scheduleFile.string());
|
||||
EclipseState es(deck);
|
||||
const auto& grid = es.getInputGrid();
|
||||
@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(CreateCPGrid) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA");
|
||||
std::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA");
|
||||
auto deck = parser.parseFile(scheduleFile.string());
|
||||
EclipseState es(deck);
|
||||
const auto& grid = es.getInputGrid();
|
||||
@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ExportFromCPGridAllActive) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA");
|
||||
std::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA");
|
||||
auto deck = parser.parseFile(scheduleFile.string());
|
||||
EclipseState es(deck);
|
||||
const auto& grid = es.getInputGrid();
|
||||
@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(ExportFromCPGridAllActive) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ExportFromCPGridACTNUM) {
|
||||
Parser parser;
|
||||
Opm::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA");
|
||||
std::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA");
|
||||
auto deck = parser.parseFile(scheduleFile.string());
|
||||
EclipseState es(deck);
|
||||
auto& grid = es.getInputGrid();
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
using namespace Opm::filesystem;
|
||||
using namespace std::filesystem;
|
||||
|
||||
static void
|
||||
createDeckWithInclude(path& datafile, std::string addEndKeyword)
|
||||
|
@ -20,7 +20,6 @@
|
||||
#define BOOST_TEST_MODULE ParserIntegrationTests
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
#include <opm/common/utility/OpmInputError.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@ -33,6 +32,8 @@
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
inline std::string pathprefix() {
|
||||
@ -71,7 +72,7 @@ Parser createWWCTParser() {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckReturned) {
|
||||
Opm::filesystem::path singleKeywordFile(pathprefix() + "wwct.data");
|
||||
std::filesystem::path singleKeywordFile(pathprefix() + "wwct.data");
|
||||
auto parser = createWWCTParser();
|
||||
BOOST_CHECK( parser.isRecognizedKeyword("WWCT"));
|
||||
BOOST_CHECK( parser.isRecognizedKeyword("SUMMARY"));
|
||||
@ -107,7 +108,7 @@ BOOST_AUTO_TEST_CASE(parse_streamWithWWCTKeyword_deckReturned) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckHasWWCT) {
|
||||
Opm::filesystem::path singleKeywordFile(pathprefix() + "wwct.data");
|
||||
std::filesystem::path singleKeywordFile(pathprefix() + "wwct.data");
|
||||
auto parser = createWWCTParser();
|
||||
auto deck = parser.parseFile(singleKeywordFile.string());
|
||||
BOOST_CHECK(deck.hasKeyword("SUMMARY"));
|
||||
@ -115,7 +116,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckHasWWCT) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_dataIsCorrect) {
|
||||
Opm::filesystem::path singleKeywordFile(pathprefix() + "wwct.data");
|
||||
std::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));
|
||||
@ -156,14 +157,14 @@ static Parser createBPRParser() {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_deckReturned) {
|
||||
Opm::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
|
||||
std::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
|
||||
auto parser = createBPRParser();
|
||||
|
||||
BOOST_CHECK_NO_THROW(parser.parseFile(singleKeywordFile.string()));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_DeckhasBRP) {
|
||||
Opm::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
|
||||
std::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
|
||||
|
||||
auto parser = createBPRParser();
|
||||
auto deck = parser.parseFile(singleKeywordFile.string());
|
||||
@ -172,7 +173,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_DeckhasBRP) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_dataiscorrect) {
|
||||
Opm::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
|
||||
std::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
|
||||
|
||||
auto parser = createBPRParser();
|
||||
auto deck = parser.parseFile(singleKeywordFile.string());
|
||||
|
@ -528,16 +528,16 @@ class RSet
|
||||
{
|
||||
public:
|
||||
explicit RSet(std::string base)
|
||||
: odir_(Opm::filesystem::temp_directory_path() /
|
||||
: odir_(std::filesystem::temp_directory_path() /
|
||||
Opm::unique_path("rset-%%%%"))
|
||||
, base_(std::move(base))
|
||||
{
|
||||
Opm::filesystem::create_directories(this->odir_);
|
||||
std::filesystem::create_directories(this->odir_);
|
||||
}
|
||||
|
||||
~RSet()
|
||||
{
|
||||
Opm::filesystem::remove_all(this->odir_);
|
||||
std::filesystem::remove_all(this->odir_);
|
||||
}
|
||||
|
||||
operator ::Opm::EclIO::OutputStream::ResultSet() const
|
||||
@ -546,7 +546,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Opm::filesystem::path odir_;
|
||||
std::filesystem::path odir_;
|
||||
std::string base_;
|
||||
};
|
||||
|
||||
|
@ -397,7 +397,7 @@ BOOST_AUTO_TEST_CASE(TestESmry_5) {
|
||||
|
||||
|
||||
|
||||
namespace fs = Opm::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
BOOST_AUTO_TEST_CASE(TestCreateRSM) {
|
||||
ESmry smry1("SPE1CASE1.SMSPEC");
|
||||
smry1.LoadData();
|
||||
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
+ Copyright 2021 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 <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
#define BOOST_TEST_MODULE FileSystem
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TestProximate) {
|
||||
|
||||
Opm::filesystem::path rel1("/a/b");
|
||||
Opm::filesystem::path input1("/a/b/c");
|
||||
auto test1 = Opm::proximate(input1, rel1);
|
||||
BOOST_CHECK_EQUAL(test1.string(), "c");
|
||||
|
||||
Opm::filesystem::path input2("/a/c");
|
||||
auto test2 = Opm::proximate(input2, rel1);
|
||||
BOOST_CHECK_EQUAL(test2.string(), "../c");
|
||||
|
||||
Opm::filesystem::path input3("c");
|
||||
auto test3 = Opm::proximate(input3, rel1);
|
||||
BOOST_CHECK_EQUAL(test3.string(), "c");
|
||||
|
||||
auto test4 = Opm::proximate(rel1, input3);
|
||||
BOOST_CHECK_EQUAL(test4.string(), "/a/b");
|
||||
}
|
@ -134,16 +134,16 @@ class RSet
|
||||
{
|
||||
public:
|
||||
explicit RSet(std::string base)
|
||||
: odir_(Opm::filesystem::temp_directory_path() /
|
||||
: odir_(std::filesystem::temp_directory_path() /
|
||||
Opm::unique_path("rset-%%%%"))
|
||||
, base_(std::move(base))
|
||||
{
|
||||
Opm::filesystem::create_directories(this->odir_);
|
||||
std::filesystem::create_directories(this->odir_);
|
||||
}
|
||||
|
||||
~RSet()
|
||||
{
|
||||
Opm::filesystem::remove_all(this->odir_);
|
||||
std::filesystem::remove_all(this->odir_);
|
||||
}
|
||||
|
||||
operator ::Opm::EclIO::OutputStream::ResultSet() const
|
||||
@ -152,7 +152,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Opm::filesystem::path odir_;
|
||||
std::filesystem::path odir_;
|
||||
std::string base_;
|
||||
};
|
||||
|
||||
|
@ -82,16 +82,16 @@ namespace {
|
||||
{
|
||||
public:
|
||||
explicit RSet(std::string base)
|
||||
: odir_(Opm::filesystem::temp_directory_path() /
|
||||
: odir_(std::filesystem::temp_directory_path() /
|
||||
Opm::unique_path("rset-%%%%"))
|
||||
, base_(std::move(base))
|
||||
{
|
||||
Opm::filesystem::create_directories(this->odir_);
|
||||
std::filesystem::create_directories(this->odir_);
|
||||
}
|
||||
|
||||
~RSet()
|
||||
{
|
||||
Opm::filesystem::remove_all(this->odir_);
|
||||
std::filesystem::remove_all(this->odir_);
|
||||
}
|
||||
|
||||
std::string outputDir() const
|
||||
@ -105,7 +105,7 @@ namespace {
|
||||
}
|
||||
|
||||
private:
|
||||
Opm::filesystem::path odir_;
|
||||
std::filesystem::path odir_;
|
||||
std::string base_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user