From 56261a07e12c0bfaa0b5959ee4974bf1ff57231c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Mar 2017 08:30:14 +0100 Subject: [PATCH 01/61] #1311 Added find_package for HDF5 --- ApplicationCode/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index f7cdbed500..3330eb7508 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -178,6 +178,21 @@ endif() add_subdirectory(GeoMech/GeoMechDataModel) +# +# HDF5 +# +option(RESINSIGHT_ENABLE_HDF5 "Use HDF5" OFF) +if(RESINSIGHT_ENABLE_HDF5) + find_package(HDF5 REQUIRED) + if (HDF5_FOUND) + add_definitions(-DUSE_HDF5) + set(RESINSIGHT_USE_HDF5 1) + if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + message( STATUS "Using HD5 from : ${HDF5_C_LIBRARY}" ) + endif() + endif() +endif() + ############################################################################# # Qt specifics: Moc, ui, resources ############################################################################# From 8175ae8efec79dd2cd360ae97cedd46c07ce0a15 Mon Sep 17 00:00:00 2001 From: Stein Inge Dale Date: Mon, 13 Mar 2017 12:22:11 +0100 Subject: [PATCH 02/61] #1311 Modified build config --- ApplicationCode/CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 3330eb7508..118ea3e2cc 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -183,10 +183,17 @@ add_subdirectory(GeoMech/GeoMechDataModel) # option(RESINSIGHT_ENABLE_HDF5 "Use HDF5" OFF) if(RESINSIGHT_ENABLE_HDF5) - find_package(HDF5 REQUIRED) + add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB) + find_package(HDF5 REQUIRED COMPONENTS CXX) if (HDF5_FOUND) - add_definitions(-DUSE_HDF5) - set(RESINSIGHT_USE_HDF5 1) + add_definitions(${HDF5_DEFINITIONS}) + include_directories(${HDF5_INCLUDE_DIRS}) + add_definitions(-DUSE_HDF5) + + list(APPEND THIRD_PARTY_LIBRARIES + ${HDF5_LIBRARIES} + ) + if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") message( STATUS "Using HD5 from : ${HDF5_C_LIBRARY}" ) endif() From 8c8de5269f56e9f60579c7afd4c3e8a2251fe3e6 Mon Sep 17 00:00:00 2001 From: Stein Inge Dale Date: Mon, 13 Mar 2017 12:23:03 +0100 Subject: [PATCH 03/61] #1312 Initial infrastructure for test --- .../UnitTests/CMakeLists_files.cmake | 1 + .../UnitTests/HDF5FileReader-Test.cpp | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 ApplicationCode/UnitTests/HDF5FileReader-Test.cpp diff --git a/ApplicationCode/UnitTests/CMakeLists_files.cmake b/ApplicationCode/UnitTests/CMakeLists_files.cmake index 099fe43849..0e8eec0d3f 100644 --- a/ApplicationCode/UnitTests/CMakeLists_files.cmake +++ b/ApplicationCode/UnitTests/CMakeLists_files.cmake @@ -24,6 +24,7 @@ ${CEE_CURRENT_LIST_DIR}WellPathAsciiFileReader-Test.cpp ${CEE_CURRENT_LIST_DIR}opm-parser-Test.cpp ${CEE_CURRENT_LIST_DIR}opm-parser-Performance-Test.cpp ${CEE_CURRENT_LIST_DIR}opm-flowdiagnostics-Test.cpp +${CEE_CURRENT_LIST_DIR}HDF5FileReader-Test.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp b/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp new file mode 100644 index 0000000000..cb01fcdfc9 --- /dev/null +++ b/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp @@ -0,0 +1,46 @@ +#include "gtest/gtest.h" + +#include "H5Cpp.h" + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +/* +TEST(RimWellPathAsciiFileReaderTest, TestWellNameNoColon) +{ +QTemporaryFile file; +if (file.open()) +{ +QString wellName = "My test Wellname"; +{ +QTextStream out(&file); +out << "name " << wellName << "\n"; +out << "1 2 3"; +} + +RifWellPathAsciiFileReader reader; +RifWellPathAsciiFileReader::WellData wpData = reader.readWellData(file.fileName(), 0); +EXPECT_TRUE(wpData.m_name == wellName); +} +} +*/ + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST(HDFTests, BasicFileRead) +{ + std::string file_path; + + // Check file exists + H5::H5File file(file_path, H5F_ACC_RDONLY); + H5::Group group = H5::Group(file.openGroup("name")); +/* + Group group = Group(file.openGroup(GROUP_NAME_FLOW_TRANSPORT)); + auto dataset_exists = H5Lexists(group.getId(), "GRIDPROPTIME", H5F_ACC_RDONLY); + std::vector> sgas, soil, swat; +*/ +} + From a180b72af5b4526c75d3b5962916d6ceac6c73e2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Mar 2017 14:25:04 +0100 Subject: [PATCH 04/61] #1311 Show link libraries on Linux also --- ApplicationCode/CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 118ea3e2cc..046c0fc2b5 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -188,15 +188,14 @@ if(RESINSIGHT_ENABLE_HDF5) if (HDF5_FOUND) add_definitions(${HDF5_DEFINITIONS}) include_directories(${HDF5_INCLUDE_DIRS}) - add_definitions(-DUSE_HDF5) list(APPEND THIRD_PARTY_LIBRARIES ${HDF5_LIBRARIES} ) - if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") - message( STATUS "Using HD5 from : ${HDF5_C_LIBRARY}" ) - endif() + add_definitions(-DUSE_HDF5) + # TODO add_subdirectory(HDF/Hdf5Reader) + message( STATUS "Linking HD5 libraries : ${HDF5_LIBRARIES}" ) endif() endif() From 7bd879b16bd1a86ba4930858e649d162ed503175 Mon Sep 17 00:00:00 2001 From: Stein Inge Dale Date: Tue, 14 Mar 2017 14:46:38 +0100 Subject: [PATCH 05/61] First iteration gtest for HDF data access. --- .../UnitTests/HDF5FileReader-Test.cpp | 149 ++++++++++++++---- 1 file changed, 117 insertions(+), 32 deletions(-) diff --git a/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp b/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp index cb01fcdfc9..8135c9979f 100644 --- a/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp +++ b/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp @@ -1,46 +1,131 @@ #include "gtest/gtest.h" #include "H5Cpp.h" +#include - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -/* -TEST(RimWellPathAsciiFileReaderTest, TestWellNameNoColon) -{ -QTemporaryFile file; -if (file.open()) -{ -QString wellName = "My test Wellname"; -{ -QTextStream out(&file); -out << "name " << wellName << "\n"; -out << "1 2 3"; -} - -RifWellPathAsciiFileReader reader; -RifWellPathAsciiFileReader::WellData wpData = reader.readWellData(file.fileName(), 0); -EXPECT_TRUE(wpData.m_name == wellName); -} -} -*/ - +#include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- TEST(HDFTests, BasicFileRead) { - std::string file_path; + std::string file_path = "D:/ResInsight/SourSim/PKMUNK_NOV_TEST_SS.sourpre.00001"; - // Check file exists - H5::H5File file(file_path, H5F_ACC_RDONLY); - H5::Group group = H5::Group(file.openGroup("name")); -/* - Group group = Group(file.openGroup(GROUP_NAME_FLOW_TRANSPORT)); - auto dataset_exists = H5Lexists(group.getId(), "GRIDPROPTIME", H5F_ACC_RDONLY); - std::vector> sgas, soil, swat; + try + { + H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately + + H5::H5File file(file_path.c_str(), H5F_ACC_RDONLY); + + { + H5::Group timestep = file.openGroup("Timestep_00001"); + H5::Attribute attr = timestep.openAttribute("timestep"); + + double timestep_value = 0.0; + + H5::DataType type = attr.getDataType(); + attr.read(type, ×tep_value); + + //std::cout << "Timestep value " << timestep_value << std::endl; + EXPECT_NEAR(timestep_value, 1.0, 1e-1); + } + + + { + // Group size is not an attribute! + + H5::Group GridFunctions = file.openGroup("Timestep_00001/GridParts/GridPart_00000/GridFunctions"); + + hsize_t group_size = GridFunctions.getNumObjs(); + + //std::cout << "GridFunctions group_size " << group_size << std::endl; + EXPECT_EQ(group_size, 20); + +/* for (hsize_t i = 0; i < group_size; i++) + { + // H5std_string node_name = GridFunctions.getObjnameByIdx(i); // crashes on VS2017 due to lib/heap/runtime differences to HDF5 VS2015 lib + + std::string node_name; + node_name.resize(1024); + + ssize_t slen = GridFunctions.getObjnameByIdx(i, &node_name[0], 1023); + + node_name.resize(slen + 1); + + std::cout << "GridFunctions sub-node name " << node_name << std::endl; + } */ + + std::string first_subnode(1024, '\0'); + + ssize_t slen = GridFunctions.getObjnameByIdx(0, &first_subnode[0], 1023); + first_subnode.resize(slen + 1); + + EXPECT_TRUE(first_subnode.compare(0, slen, "GridFunction_00002") == 0); + } + + + { + H5::Group GridFunction_00002 = file.openGroup("Timestep_00001/GridParts/GridPart_00000/GridFunctions/GridFunction_00002"); + H5::Attribute attr = GridFunction_00002.openAttribute("limits_max"); + + double limits_max = 0.0; + + H5::DataType type = attr.getDataType(); + attr.read(type, &limits_max); + +// std::cout << "limits_max " << limits_max << std::endl; + EXPECT_NEAR(limits_max, 0.3970204292629652, 1e-10); + } + + + { + H5::Group GridFunction_00002 = file.openGroup("Timestep_00001/GridParts/GridPart_00000/GridFunctions/GridFunction_00002"); + H5::DataSet dataset = H5::DataSet(GridFunction_00002.openDataSet("values")); + + hsize_t dims[2]; + H5::DataSpace dataspace = dataset.getSpace(); + dataspace.getSimpleExtentDims(dims, NULL); + + std::vector values; + values.resize(dims[0]); + dataset.read(values.data(), H5::PredType::NATIVE_DOUBLE); + +/* for (hsize_t i = 0; i < dims[0]; i++) + { + std::cout << "value " << i << " " << values[i] << std::endl; + + } +*/ + EXPECT_NEAR(values[0], 0.32356910366452146, 1e-10); + EXPECT_NEAR(values[dims[0] - 1], 0.12200070891582514, 1e-10); + } + + + + } // end of try block + + + catch (H5::FileIException error) // catch failure caused by the H5File operations + { + std::cout << error.getCDetailMsg(); + } + + catch (H5::DataSetIException error) // catch failure caused by the DataSet operations + { + std::cout << error.getCDetailMsg(); + } + + catch (H5::DataSpaceIException error) // catch failure caused by the DataSpace operations + { + std::cout << error.getCDetailMsg(); + } + + catch (H5::DataTypeIException error) // catch failure caused by the DataSpace operations + { + std::cout << error.getCDetailMsg(); + } + } From b29f66472325f048651089356c4a334467b28d21 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 23 Mar 2017 07:00:00 +0100 Subject: [PATCH 06/61] #1356 Application code for reading of HDF data into ResInsight --- ApplicationCode/CMakeLists.txt | 7 ++ .../FileInterface/CMakeLists_files.cmake | 8 ++ .../FileInterface/RifHdf5Reader.cpp | 102 ++++++++++++++++++ ApplicationCode/FileInterface/RifHdf5Reader.h | 48 +++++++++ .../FileInterface/RifHdf5ReaderInterface.cpp | 20 ++++ .../FileInterface/RifHdf5ReaderInterface.h | 39 +++++++ .../FileInterface/RifReaderEclipseOutput.cpp | 93 ++++++++++++++++ .../FileInterface/RifReaderEclipseOutput.h | 10 +- .../ProjectDataModel/RimEclipseResultCase.cpp | 23 +++- .../ProjectDataModel/RimEclipseResultCase.h | 2 + .../UnitTests/HDF5FileReader-Test.cpp | 3 + .../UnitTests/RifReaderEclipseOutput-Test.cpp | 22 ++++ 12 files changed, 374 insertions(+), 3 deletions(-) create mode 100644 ApplicationCode/FileInterface/RifHdf5Reader.cpp create mode 100644 ApplicationCode/FileInterface/RifHdf5Reader.h create mode 100644 ApplicationCode/FileInterface/RifHdf5ReaderInterface.cpp create mode 100644 ApplicationCode/FileInterface/RifHdf5ReaderInterface.h diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 046c0fc2b5..40ab67352f 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -193,6 +193,13 @@ if(RESINSIGHT_ENABLE_HDF5) ${HDF5_LIBRARIES} ) + list( APPEND CPP_SOURCES + FileInterface/RifHdf5Reader.h + FileInterface/RifHdf5Reader.cpp + ) + + source_group( "FileInterface" FILES FileInterface/RifHdf5Reader.h FileInterface/RifHdf5Reader.cpp ) + add_definitions(-DUSE_HDF5) # TODO add_subdirectory(HDF/Hdf5Reader) message( STATUS "Linking HD5 libraries : ${HDF5_LIBRARIES}" ) diff --git a/ApplicationCode/FileInterface/CMakeLists_files.cmake b/ApplicationCode/FileInterface/CMakeLists_files.cmake index f4620e1bfb..a75f47533a 100644 --- a/ApplicationCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationCode/FileInterface/CMakeLists_files.cmake @@ -20,6 +20,10 @@ ${CEE_CURRENT_LIST_DIR}RifReaderMockModel.h ${CEE_CURRENT_LIST_DIR}RifReaderSettings.h ${CEE_CURRENT_LIST_DIR}RifEclipseSummaryAddress.h ${CEE_CURRENT_LIST_DIR}RifReaderOpmParserInput.h +${CEE_CURRENT_LIST_DIR}RifHdf5ReaderInterface.h + +# HDF5 file reader is directly included in ResInsight main CmakeList.txt +#${CEE_CURRENT_LIST_DIR}RifHdf5Reader.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -38,6 +42,10 @@ ${CEE_CURRENT_LIST_DIR}RifReaderMockModel.cpp ${CEE_CURRENT_LIST_DIR}RifReaderSettings.cpp ${CEE_CURRENT_LIST_DIR}RifEclipseSummaryAddress.cpp ${CEE_CURRENT_LIST_DIR}RifReaderOpmParserInput.cpp +${CEE_CURRENT_LIST_DIR}RifHdf5ReaderInterface.cpp + +# HDF5 file reader is directly included in ResInsight main CmakeList.txt +#${CEE_CURRENT_LIST_DIR}RifHdf5Reader.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.cpp b/ApplicationCode/FileInterface/RifHdf5Reader.cpp new file mode 100644 index 0000000000..ed6fab95d8 --- /dev/null +++ b/ApplicationCode/FileInterface/RifHdf5Reader.cpp @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RifHdf5Reader.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifHdf5Reader::RifHdf5Reader(const QString& fileName) + : m_fileName(fileName) +{ + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifHdf5Reader::~RifHdf5Reader() +{ + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifHdf5Reader::dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const +{ + QStringList myProps = propertyNames(); + +// if (std::find(begin(myProps), end(myProps), result) != end(myProps)) + if (myProps.indexOf(result) != -1) + { + for (size_t i = 0; i < 16336; i++) + { + values->push_back(i); + } + + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifHdf5Reader::timeSteps() const +{ + std::vector times; + + QDateTime dt; + times.push_back(dt); + times.push_back(dt.addDays(1)); + times.push_back(dt.addDays(2)); + + return times; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RifHdf5Reader::propertyNames() const +{ + QStringList myProps; + + myProps.push_back("msj1"); + myProps.push_back("msj2"); + myProps.push_back("msj3"); + + return myProps; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifHdf5Reader::resultNames(QStringList* resultNames, std::vector* resultDataItemCounts) +{ + *resultNames = propertyNames(); + + for (size_t i = 0; i < propertyNames().size(); i++) + { + resultDataItemCounts->push_back(16336); + } +} diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.h b/ApplicationCode/FileInterface/RifHdf5Reader.h new file mode 100644 index 0000000000..49443b9e67 --- /dev/null +++ b/ApplicationCode/FileInterface/RifHdf5Reader.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RifHdf5ReaderInterface.h" + +#include + +//================================================================================================== +// +// +//================================================================================================== +class RifHdf5Reader : public RifHdf5ReaderInterface +{ +public: + explicit RifHdf5Reader(const QString& fileName); + virtual ~RifHdf5Reader(); + + bool dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const; + + + std::vector timeSteps() const; + + + virtual QStringList propertyNames() const override; + + + virtual void resultNames(QStringList* resultNames, std::vector* resultDataItemCounts) override; + +private: + QString m_fileName; +}; diff --git a/ApplicationCode/FileInterface/RifHdf5ReaderInterface.cpp b/ApplicationCode/FileInterface/RifHdf5ReaderInterface.cpp new file mode 100644 index 0000000000..f16ef071b9 --- /dev/null +++ b/ApplicationCode/FileInterface/RifHdf5ReaderInterface.cpp @@ -0,0 +1,20 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RifHdf5ReaderInterface.h" + diff --git a/ApplicationCode/FileInterface/RifHdf5ReaderInterface.h b/ApplicationCode/FileInterface/RifHdf5ReaderInterface.h new file mode 100644 index 0000000000..207800ae06 --- /dev/null +++ b/ApplicationCode/FileInterface/RifHdf5ReaderInterface.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +class QString; +class QDateTime; +class QStringList; + +#include +#include + +//================================================================================================== +// +// +//================================================================================================== +class RifHdf5ReaderInterface +{ +public: + virtual std::vector timeSteps() const = 0; + virtual QStringList propertyNames() const = 0; + virtual void resultNames(QStringList* resultNames, std::vector* resultDataItemCounts) = 0; + virtual bool dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const = 0; +}; diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 829737ea06..0264d9d328 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -20,12 +20,18 @@ #include "RifReaderEclipseOutput.h" +#include "RiaLogging.h" + #include "RifEclipseInputFileTools.h" #include "RifEclipseOutputFileTools.h" #include "RifEclipseRestartFilesetAccess.h" #include "RifEclipseUnifiedRestartFileAccess.h" #include "RifReaderOpmParserInput.h" +#ifdef USE_HDF5 +#include "RifHdf5Reader.h" +#endif + #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" @@ -438,6 +444,83 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) +{ + CVF_ASSERT(m_eclipseCase); + + RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RifReaderInterface::MATRIX_RESULTS); + CVF_ASSERT(matrixModelResults); + + std::unique_ptr myReader; +#ifdef USE_HDF5 + myReader = std::unique_ptr(new RifHdf5Reader(fileName)); +#endif // USE_HDF5 + + if (!myReader) return; + + std::vector hdfTimeSteps = myReader->timeSteps(); + if (m_timeSteps.size() > 0) + { + if (hdfTimeSteps.size() != m_timeSteps.size()) + { + RiaLogging::error("HDF: Time step count does not match"); + return; + } + + for (size_t i = 0; i < m_timeSteps.size(); i++) + { + if (hdfTimeSteps[i] != m_timeSteps[i]) + { + RiaLogging::error("HDF: Time steps does not match"); + + return; + } + } + } + else + { + // Use time steps from HDF to define the time steps + m_timeSteps = hdfTimeSteps; + } + + std::vector reportNumbers; + if (m_dynamicResultsAccess.notNull()) + { + reportNumbers = m_dynamicResultsAccess->reportNumbers(); + } + + QStringList resultNames; + std::vector resultNamesDataItemCounts; + myReader->resultNames(&resultNames, &resultNamesDataItemCounts); + if (resultNames.size() != static_cast(resultNamesDataItemCounts.size())) + { + RiaLogging::error("HDF: Result name vectors and result name data item count does not match"); + + return; + } + + size_t activeCellCount = 0; + matrixModelResults->activeCellInfo()->gridActiveCellCounts(0, activeCellCount); + + for (int i = 0; i < resultNames.size(); ++i) + { + if (activeCellCount != resultNamesDataItemCounts[i]) + { + RiaLogging::error("HDF: Number of active cells does not match"); + } + else + { + size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false); + matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers); + } + } + + m_hdfReaderInterface = std::move(myReader); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -855,6 +938,16 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelRe //-------------------------------------------------------------------------------------------------- bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values) { +#ifdef USE_HDF5 + if (m_hdfReaderInterface) + { + if (m_hdfReaderInterface->dynamicResult(result, stepIndex, values)) + { + return true; + } + } +#endif + if (m_dynamicResultsAccess.isNull()) { m_dynamicResultsAccess = createDynamicResultsAccess(); diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h index aef7025aa3..3648ff22d2 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h @@ -27,12 +27,15 @@ #include #include +#include + class RifEclipseOutputFileTools; class RifEclipseRestartDataAccess; -class RigGridBase; -class RigMainGrid; +class RifHdf5ReaderInterface; class RigActiveCellInfo; class RigFault; +class RigGridBase; +class RigMainGrid; struct RigWellResultPoint; @@ -52,6 +55,7 @@ public: virtual ~RifReaderEclipseOutput(); bool open(const QString& fileName, RigEclipseCaseData* eclipseCase); + void setHdf5FileName(const QString& fileName); virtual bool openAndReadActiveCellData(const QString& fileName, const std::vector& mainCaseTimeSteps, RigEclipseCaseData* eclipseCase); void close(); @@ -97,4 +101,6 @@ private: ecl_file_type* m_ecl_init_file; // File access to static results cvf::ref m_dynamicResultsAccess; // File access to dynamic results + + std::unique_ptr m_hdfReaderInterface; }; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index 03b8a07a1e..4687193d1a 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -70,7 +70,8 @@ RimEclipseResultCase::RimEclipseResultCase() flipYAxis.xmlCapability()->setIOWritable(true); //flipYAxis.uiCapability()->setUiHidden(true); - + CAF_PDM_InitField(&m_sourSimFileName, "SourSimFileName", QString(), "SourSim File Name", "", "", ""); + //m_sourSimFileName.uiCapability()->setUiReadOnly(true); m_activeCellInfoIsReadFromFile = false; m_gridAndWellDataIsReadFromFile = false; @@ -141,6 +142,12 @@ bool RimEclipseResultCase::openEclipseGridFile() m_flowDiagSolutions.push_back(new RimFlowDiagSolution()); } } + + if (!m_sourSimFileName().isEmpty()) + { + RifReaderEclipseOutput* outReader = dynamic_cast(readerInterface.p()); + outReader->setHdf5FileName(m_sourSimFileName()); + } return true; } @@ -410,6 +417,20 @@ void RimEclipseResultCase::setCaseInfo(const QString& userDescription, const QSt proj->assignCaseIdToCase(this); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultCase::setSourSimFileName(const QString& fileName) +{ + m_sourSimFileName = fileName; + + RifReaderEclipseOutput* rifReaderOutput = dynamic_cast(results(RifReaderInterface::FRACTURE_RESULTS)->readerInterface()); + if (rifReaderOutput) + { + rifReaderOutput->setHdf5FileName(fileName); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h index 35243183b2..630514ffc1 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h @@ -42,6 +42,7 @@ public: void setGridFileName(const QString& caseFileName); void setCaseInfo(const QString& userDescription, const QString& caseFileName); + void setSourSimFileName(const QString& fileName); virtual bool openEclipseGridFile(); bool openAndReadActiveCellData(RigEclipseCaseData* mainEclipseCase); @@ -68,6 +69,7 @@ private: // Fields: caf::PdmField caseFileName; caf::PdmChildArrayField m_flowDiagSolutions; + caf::PdmField m_sourSimFileName; // Obsolete field diff --git a/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp b/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp index 8135c9979f..5a14d16e3b 100644 --- a/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp +++ b/ApplicationCode/UnitTests/HDF5FileReader-Test.cpp @@ -1,3 +1,5 @@ +#ifdef USE_HDF5 + #include "gtest/gtest.h" #include "H5Cpp.h" @@ -129,3 +131,4 @@ TEST(HDFTests, BasicFileRead) } +#endif //USE_HDF5 \ No newline at end of file diff --git a/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp b/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp index e58cb7a0f2..8c76083cc8 100644 --- a/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp +++ b/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp @@ -461,3 +461,25 @@ TEST(RigReservoirTest, WellTest) #endif +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST(RigReservoirTest, WellTest) +{ + cvf::ref readerInterfaceEcl = new RifReaderEclipseOutput; + cvf::ref reservoir = new RigEclipseCaseData; + + // Location of test dataset received from HÃ¥kon Høgstøl in July 2011 with 10k active cells +#ifdef WIN32 + QString filename("d:/Models/Statoil/soursim/PKMUNK_NOV_TEST_SS.GRID"); + QString sourSim("d:/Models/Statoil/soursim/result.sourres"); +#else + QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID"); + QString sourSim("d:/Models/Statoil/soursim/result.sourres"); +#endif + + bool result = readerInterfaceEcl->open(filename, reservoir.p()); + EXPECT_TRUE(result); + + readerInterfaceEcl->setHdf5FileName(sourSim); +} \ No newline at end of file From c4cd1972c42f38231d4bedd115535a476e7c3943 Mon Sep 17 00:00:00 2001 From: Stein Inge Dale Date: Fri, 24 Mar 2017 10:06:49 +0100 Subject: [PATCH 07/61] WIP: Inclusion of HDF5 access functions --- .../FileInterface/RifHdf5Reader.cpp | 247 ++++++++++++++++-- ApplicationCode/FileInterface/RifHdf5Reader.h | 14 + 2 files changed, 246 insertions(+), 15 deletions(-) diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.cpp b/ApplicationCode/FileInterface/RifHdf5Reader.cpp index ed6fab95d8..bf6dedbd8a 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.cpp +++ b/ApplicationCode/FileInterface/RifHdf5Reader.cpp @@ -21,6 +21,11 @@ #include #include +#include "H5Cpp.h" +#include + + + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -45,18 +50,30 @@ bool RifHdf5Reader::dynamicResult(const QString& result, size_t stepIndex, std:: { QStringList myProps = propertyNames(); -// if (std::find(begin(myProps), end(myProps), result) != end(myProps)) - if (myProps.indexOf(result) != -1) - { - for (size_t i = 0; i < 16336; i++) - { - values->push_back(i); - } + try + { + H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately - return true; - } + std::string fileName = m_fileName.toStdString(); // her ligger trøbbel mht Unicode or det smalt i H5File med direkte bruk av c_str() - return false; + H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY); + + std::string groupName = "/Timestep_00001/GridFunctions/GridPart_00000/GridFunction_00002"; + + getElementResultValues(file, groupName, values); + + return true; + } + + catch (H5::FileIException error) // catch failure caused by the H5File operations + { + return false; + } + + catch (H5::DataSetIException error) // catch failure caused by the DataSet operations + { + return false; + } } //-------------------------------------------------------------------------------------------------- @@ -79,13 +96,22 @@ std::vector RifHdf5Reader::timeSteps() const //-------------------------------------------------------------------------------------------------- QStringList RifHdf5Reader::propertyNames() const { - QStringList myProps; + QStringList propNames; - myProps.push_back("msj1"); - myProps.push_back("msj2"); - myProps.push_back("msj3"); + std::string str = m_fileName.toStdString(); // her ligger trøbbel mht Unicode or det smalt i H5File med direkte bruk av c_str() - return myProps; + H5::H5File file(str.c_str(), H5F_ACC_RDONLY); + + std::string groupName = "/Timestep_00001/GridFunctions/GridPart_00000"; + + std::vector resultNames = getResultNames(file, groupName); + + for (std::vector::iterator it = resultNames.begin(); it != resultNames.end(); it++) + { + propNames.push_back(it->c_str()); + } + + return propNames; } //-------------------------------------------------------------------------------------------------- @@ -100,3 +126,194 @@ void RifHdf5Reader::resultNames(QStringList* resultNames, std::vector* r resultDataItemCounts->push_back(16336); } } + + + + + +//=========================== PRIVATE METHODS ===================================================== +// +// +// +//================================================================================================== + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifHdf5Reader::getIntAttribute(H5::H5File file, std::string groupName, std::string attributeName) const +{ + try + { + H5::Group group = file.openGroup(groupName.c_str()); + H5::Attribute attr = group.openAttribute(attributeName.c_str()); + + int value = 0; + + H5::DataType type = attr.getDataType(); + attr.read(type, &value); + + return value; + } + + catch (H5::AttributeIException error) + { + return 0; + } +} + + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RifHdf5Reader::getDoubleAttribute(H5::H5File file, std::string groupName, std::string attributeName) const +{ + try + { + H5::Group group = file.openGroup(groupName.c_str()); + H5::Attribute attr = group.openAttribute(attributeName.c_str()); + + double value = 0.0; + + H5::DataType type = attr.getDataType(); + attr.read(type, &value); + + return value; + } + + catch (H5::AttributeIException error) + { + return 0.0; + } +} + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RifHdf5Reader::getStringAttribute(H5::H5File file, std::string groupName, std::string attributeName) const +{ + try + { + H5::Group group = file.openGroup(groupName.c_str()); + H5::Attribute attr = group.openAttribute(attributeName.c_str()); + + std::string stringAttribute(1024, '\0'); + + H5::DataType nameType = attr.getDataType(); + attr.read(nameType, &stringAttribute[0]); + + return stringAttribute; + } + + catch (H5::AttributeIException error) + { + return ""; + } + +} + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifHdf5Reader::getSubGroupNames(H5::H5File file, std::string baseGroupName) const +{ + H5::Group baseGroup = file.openGroup(baseGroupName.c_str()); + + std::vector subGroupNames; + + hsize_t groupSize = baseGroup.getNumObjs(); + + for (hsize_t i = 0; i < groupSize; i++) + { + std::string nodeName(1024, '\0'); + + ssize_t slen = baseGroup.getObjnameByIdx(i, &nodeName[0], 1023); + + nodeName.resize(slen + 1); + + subGroupNames.push_back(nodeName); + } + + return subGroupNames; +} + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifHdf5Reader::getStepTimeValues(H5::H5File file, std::string baseGroupName) const +{ + std::vector subGroupNames = getSubGroupNames(file, baseGroupName); + std::vector stepTimeValues; + + for (std::vector::iterator it = subGroupNames.begin(); it != subGroupNames.end(); it++) + { + if (it->find("Timestep_") != std::string::npos) + { + std::string groupName = baseGroupName + *it; + + double timestep_value = getDoubleAttribute(file, groupName, "timestep"); + + stepTimeValues.push_back(timestep_value); + } + } + + return stepTimeValues; +} + + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifHdf5Reader::getResultNames(H5::H5File file, std::string baseGroupName) const +{ + H5::Group baseGroup = file.openGroup(baseGroupName.c_str()); + + std::vector subGroupNames = getSubGroupNames(file, baseGroupName); + + std::vector resultNames; + + for (std::vector::iterator it = subGroupNames.begin(); it != subGroupNames.end(); it++) + { + std::string groupName = baseGroupName + "/" + *it; + + std::string name = getStringAttribute(file, groupName, "name"); + + resultNames.push_back(name); + } + + return resultNames; +} + + + + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifHdf5Reader::getElementResultValues(H5::H5File file, std::string groupName, std::vector* resultValues) const +{ + H5::Group group = file.openGroup(groupName.c_str()); + H5::DataSet dataset = H5::DataSet(group.openDataSet("values")); + + hsize_t dims[2]; + H5::DataSpace dataspace = dataset.getSpace(); + dataspace.getSimpleExtentDims(dims, NULL); + + (*resultValues).resize(dims[0]); + dataset.read(resultValues->data(), H5::PredType::NATIVE_DOUBLE); +} + + + diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.h b/ApplicationCode/FileInterface/RifHdf5Reader.h index 49443b9e67..272595fec4 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.h +++ b/ApplicationCode/FileInterface/RifHdf5Reader.h @@ -22,6 +22,9 @@ #include +#include "H5Cpp.h" + + //================================================================================================== // // @@ -43,6 +46,17 @@ public: virtual void resultNames(QStringList* resultNames, std::vector* resultDataItemCounts) override; + +private: + int getIntAttribute(H5::H5File file, std::string groupName, std::string attributeName) const; + double getDoubleAttribute(H5::H5File file, std::string groupName, std::string attributeName) const; + std::string getStringAttribute(H5::H5File file, std::string groupName, std::string attributeName) const; + std::vector getSubGroupNames(H5::H5File file, std::string baseGroupName) const; + std::vector getStepTimeValues(H5::H5File file, std::string baseGroupName) const; + std::vector getResultNames(H5::H5File file, std::string baseGroupName) const; + void getElementResultValues(H5::H5File file, std::string groupName, std::vector* resultValues) const; + + private: QString m_fileName; }; From 34d9b1358ecfde7a66f85092c7898db39e736c24 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 24 Mar 2017 11:17:12 +0100 Subject: [PATCH 08/61] #1356 Do not check active cell count when reading result names --- .../FileInterface/RifHdf5Reader.cpp | 17 +----- ApplicationCode/FileInterface/RifHdf5Reader.h | 15 ++---- .../FileInterface/RifHdf5ReaderInterface.h | 1 - .../FileInterface/RifReaderEclipseOutput.cpp | 54 +++++++++++-------- .../UnitTests/RifReaderEclipseOutput-Test.cpp | 4 +- 5 files changed, 40 insertions(+), 51 deletions(-) diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.cpp b/ApplicationCode/FileInterface/RifHdf5Reader.cpp index bf6dedbd8a..313403111a 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.cpp +++ b/ApplicationCode/FileInterface/RifHdf5Reader.cpp @@ -54,8 +54,7 @@ bool RifHdf5Reader::dynamicResult(const QString& result, size_t stepIndex, std:: { H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately - std::string fileName = m_fileName.toStdString(); // her ligger trøbbel mht Unicode or det smalt i H5File med direkte bruk av c_str() - + std::string fileName = m_fileName.toStdString(); // her ligger tr�bbel mht Unicode or det smalt i H5File med direkte bruk av c_str( H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY); std::string groupName = "/Timestep_00001/GridFunctions/GridPart_00000/GridFunction_00002"; @@ -98,7 +97,7 @@ QStringList RifHdf5Reader::propertyNames() const { QStringList propNames; - std::string str = m_fileName.toStdString(); // her ligger trøbbel mht Unicode or det smalt i H5File med direkte bruk av c_str() + std::string str = m_fileName.toStdString(); // her ligger tr�bbel mht Unicode or det smalt i H5File med direkte bruk av c_str() H5::H5File file(str.c_str(), H5F_ACC_RDONLY); @@ -114,18 +113,6 @@ QStringList RifHdf5Reader::propertyNames() const return propNames; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RifHdf5Reader::resultNames(QStringList* resultNames, std::vector* resultDataItemCounts) -{ - *resultNames = propertyNames(); - - for (size_t i = 0; i < propertyNames().size(); i++) - { - resultDataItemCounts->push_back(16336); - } -} diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.h b/ApplicationCode/FileInterface/RifHdf5Reader.h index 272595fec4..802bd9d1ec 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.h +++ b/ApplicationCode/FileInterface/RifHdf5Reader.h @@ -35,17 +35,9 @@ public: explicit RifHdf5Reader(const QString& fileName); virtual ~RifHdf5Reader(); - bool dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const; - - - std::vector timeSteps() const; - - - virtual QStringList propertyNames() const override; - - - virtual void resultNames(QStringList* resultNames, std::vector* resultDataItemCounts) override; - + std::vector timeSteps() const override; + virtual QStringList propertyNames() const override; + bool dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const override; private: int getIntAttribute(H5::H5File file, std::string groupName, std::string attributeName) const; @@ -56,7 +48,6 @@ private: std::vector getResultNames(H5::H5File file, std::string baseGroupName) const; void getElementResultValues(H5::H5File file, std::string groupName, std::vector* resultValues) const; - private: QString m_fileName; }; diff --git a/ApplicationCode/FileInterface/RifHdf5ReaderInterface.h b/ApplicationCode/FileInterface/RifHdf5ReaderInterface.h index 207800ae06..b5fb340258 100644 --- a/ApplicationCode/FileInterface/RifHdf5ReaderInterface.h +++ b/ApplicationCode/FileInterface/RifHdf5ReaderInterface.h @@ -34,6 +34,5 @@ class RifHdf5ReaderInterface public: virtual std::vector timeSteps() const = 0; virtual QStringList propertyNames() const = 0; - virtual void resultNames(QStringList* resultNames, std::vector* resultDataItemCounts) = 0; virtual bool dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const = 0; }; diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 0264d9d328..24cdeb3ce6 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -491,31 +491,20 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) { reportNumbers = m_dynamicResultsAccess->reportNumbers(); } - - QStringList resultNames; - std::vector resultNamesDataItemCounts; - myReader->resultNames(&resultNames, &resultNamesDataItemCounts); - if (resultNames.size() != static_cast(resultNamesDataItemCounts.size())) + else { - RiaLogging::error("HDF: Result name vectors and result name data item count does not match"); - - return; + for (size_t i = 0; i < m_timeSteps.size(); i++) + { + reportNumbers.push_back(static_cast(i)); + } } - size_t activeCellCount = 0; - matrixModelResults->activeCellInfo()->gridActiveCellCounts(0, activeCellCount); + QStringList resultNames = myReader->propertyNames(); for (int i = 0; i < resultNames.size(); ++i) { - if (activeCellCount != resultNamesDataItemCounts[i]) - { - RiaLogging::error("HDF: Number of active cells does not match"); - } - else - { - size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false); - matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers); - } + size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false); + matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers); } m_hdfReaderInterface = std::move(myReader); @@ -941,10 +930,33 @@ bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelR #ifdef USE_HDF5 if (m_hdfReaderInterface) { - if (m_hdfReaderInterface->dynamicResult(result, stepIndex, values)) + if (m_eclipseCase->mainGrid()->gridCount() == 0) { - return true; + RiaLogging::error("No grids available"); + + return false; } + + size_t activeCellCount = cvf::UNDEFINED_SIZE_T; + { + RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); + fracActCellInfo->gridActiveCellCounts(0, activeCellCount); + } + + bool readCellResultOk = m_hdfReaderInterface->dynamicResult(result, stepIndex, values); + + if (activeCellCount != values->size()) + { + for (size_t i=0; i < values->size(); i++) + { + values->at(i) = HUGE_VAL; + } + + RiaLogging::error("No grids available"); + return false; + } + + return readCellResultOk; } #endif diff --git a/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp b/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp index 8c76083cc8..e7d16360b6 100644 --- a/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp +++ b/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp @@ -472,7 +472,7 @@ TEST(RigReservoirTest, WellTest) // Location of test dataset received from HÃ¥kon Høgstøl in July 2011 with 10k active cells #ifdef WIN32 QString filename("d:/Models/Statoil/soursim/PKMUNK_NOV_TEST_SS.GRID"); - QString sourSim("d:/Models/Statoil/soursim/result.sourres"); + QString sourSim("d:/Models/Statoil/soursim/result.sourres.00001"); #else QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID"); QString sourSim("d:/Models/Statoil/soursim/result.sourres"); @@ -482,4 +482,4 @@ TEST(RigReservoirTest, WellTest) EXPECT_TRUE(result); readerInterfaceEcl->setHdf5FileName(sourSim); -} \ No newline at end of file +} From 6a251fd2586c5becd593cd735be970dd632bd1a1 Mon Sep 17 00:00:00 2001 From: Stein Inge Dale Date: Wed, 29 Mar 2017 11:45:40 +0200 Subject: [PATCH 09/61] WIP: First attempt to read multiple SourSimRL result files (restricted to one main file and a set of files containing one time step per file). --- .../FileInterface/RifHdf5Reader.cpp | 200 +++++++++++++++--- ApplicationCode/FileInterface/RifHdf5Reader.h | 11 +- 2 files changed, 176 insertions(+), 35 deletions(-) diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.cpp b/ApplicationCode/FileInterface/RifHdf5Reader.cpp index 313403111a..bb620e9379 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.cpp +++ b/ApplicationCode/FileInterface/RifHdf5Reader.cpp @@ -23,16 +23,25 @@ #include "H5Cpp.h" #include +#include "QDir" + +#include "cvfAssert.h" //-------------------------------------------------------------------------------------------------- /// +///std::string dateString = getStringAttribute(file, "/KaseStudy/TransientSections", "initial_date"); +///QDateTime initalDateTime = sourSimDateTimeToQDateTime(dateString); // may rearrange/change to be a call in timeSteps() //-------------------------------------------------------------------------------------------------- RifHdf5Reader::RifHdf5Reader(const QString& fileName) : m_fileName(fileName) { + H5::H5File file(fileName.toStdString().c_str(), H5F_ACC_RDONLY); // evt fileName.toLatin1().data() + int fileStrategy = getIntAttribute(file, "/", "file_strategy"); // fileStrategy == 1 means one time step per file + + m_timeStepFiles = getSourSimTimeStepFiles(fileName); } //-------------------------------------------------------------------------------------------------- @@ -48,28 +57,29 @@ RifHdf5Reader::~RifHdf5Reader() //-------------------------------------------------------------------------------------------------- bool RifHdf5Reader::dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const { - QStringList myProps = propertyNames(); + QStringList props = propertyNames(); + QStringList::iterator it = std::find(props.begin(), props.end(), result); + + int propIdx = (it != props.end()) ? it - props.begin() : 0; // index to 'result' in QStringList props (usually size_t but int gave no warning) + try { - H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately + H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately + + std::string fileName = m_timeStepFiles[stepIndex]; + std::string timeStepGroup = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName); - std::string fileName = m_fileName.toStdString(); // her ligger tr�bbel mht Unicode or det smalt i H5File med direkte bruk av c_str( H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY); - std::string groupName = "/Timestep_00001/GridFunctions/GridPart_00000/GridFunction_00002"; + std::string groupName = timeStepGroup + "/GridFunctions/GridPart_00000/GridFunction_" + IntTo5DigitString(propIdx + 1); // adjust to HDF5 one based indexing getElementResultValues(file, groupName, values); return true; } - catch (H5::FileIException error) // catch failure caused by the H5File operations - { - return false; - } - - catch (H5::DataSetIException error) // catch failure caused by the DataSet operations + catch (...) // catch any failure { return false; } @@ -80,37 +90,74 @@ bool RifHdf5Reader::dynamicResult(const QString& result, size_t stepIndex, std:: //-------------------------------------------------------------------------------------------------- std::vector RifHdf5Reader::timeSteps() const { - std::vector times; + try + { + H5::H5File mainFile(m_fileName.toStdString().c_str(), H5F_ACC_RDONLY); // initial date part is an attribute of SourSimRL main file [Qt alternative fileName.toLatin1().data()] - QDateTime dt; - times.push_back(dt); - times.push_back(dt.addDays(1)); - times.push_back(dt.addDays(2)); + std::string dateString = getStringAttribute(mainFile, "/KaseStudy/TransientSections", "initial_date"); - return times; + std::vector times; + + QDateTime dtInitial = sourSimDateTimeToQDateTime(dateString); + + for (size_t i = 0; i < m_timeStepFiles.size(); i++) + { + std::string fileName = m_timeStepFiles[i]; + std::string timeStepGroup = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName); + + H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY); + + double timeStepValue = getDoubleAttribute(file, timeStepGroup, "timestep"); // Assumes only one time step per file + int timeStepDays = (int)timeStepValue; // NB: open question: unit of SourSimRL time step values, days? + + QDateTime dt = dtInitial; + + times.push_back(dt.addDays(timeStepDays)); // NB: open question: unit of SourSimRL time step values, days? + } + + return times; + } + + catch (...) // catch any failure + { + std::vector no_times; + + return no_times; + } } + //-------------------------------------------------------------------------------------------------- /// +//std::string groupName = "/Timestep_00001/GridFunctions/GridPart_00000"; //-------------------------------------------------------------------------------------------------- QStringList RifHdf5Reader::propertyNames() const { - QStringList propNames; - - std::string str = m_fileName.toStdString(); // her ligger tr�bbel mht Unicode or det smalt i H5File med direkte bruk av c_str() - - H5::H5File file(str.c_str(), H5F_ACC_RDONLY); - - std::string groupName = "/Timestep_00001/GridFunctions/GridPart_00000"; - - std::vector resultNames = getResultNames(file, groupName); - - for (std::vector::iterator it = resultNames.begin(); it != resultNames.end(); it++) + try { - propNames.push_back(it->c_str()); + QStringList propNames; + + std::string fileName = m_timeStepFiles[0]; // assume the result variables to be identical across time steps => extract names from first time step file + + std::string groupName = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName) + "/GridFunctions/GridPart_00000"; + + H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY); + + std::vector resultNames = getResultNames(file, groupName); + + for (std::vector::iterator it = resultNames.begin(); it != resultNames.end(); it++) + { + propNames.push_back(it->c_str()); + } + + return propNames; } - return propNames; + catch (...) // catch any failure + { + QStringList no_propNames; + return no_propNames; + } } @@ -125,6 +172,91 @@ QStringList RifHdf5Reader::propertyNames() const //================================================================================================== +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifHdf5Reader::getSourSimTimeStepFiles(const QString& fileName) const +{ + QFileInfo fi(fileName); + QString name = fi.fileName(); + QString dir = fi.path(); + + QDir baseDir(dir); + baseDir.setFilter(QDir::Files); + + + QStringList nameFilters; + nameFilters << name + ".?????"; + baseDir.setNameFilters(nameFilters); + + QStringList fileNames = baseDir.entryList(); + + std::vector timeStepFileNames; + + for (int i = 0; i < fileNames.size(); i++) + { + std::string fullPath = dir.toStdString() + "/" + fileNames[i].toStdString(); + + timeStepFileNames.push_back(fullPath); + } + + return timeStepFileNames; +} + + + +//-------------------------------------------------------------------------------------------------- +/// Build a QDateTime based on a SourSimRL HDF date attribute +/// Did not succeed with QDateTime dt = QDateTime::fromString(dateString, "YYYY MM DD hh mm ss"); +/// Thus a conversion of substrings via integers +//-------------------------------------------------------------------------------------------------- +QDateTime RifHdf5Reader::sourSimDateTimeToQDateTime(std::string dateString) const +{ + int year = std::stoi(dateString.substr(0, 4)); + int month = std::stoi(dateString.substr(5, 2)); + int day = std::stoi(dateString.substr(8, 2)); + + int hours = std::stoi(dateString.substr(11, 2)); + int minutes = std::stoi(dateString.substr(14, 2)); + int seconds = std::stoi(dateString.substr(17, 2)); + + QDate d(year, month, day); + QTime t(hours, minutes, seconds); + + QDateTime dt; + dt.setDate(d); + dt.setTime(t); + + return dt; +} + + + + +//-------------------------------------------------------------------------------------------------- +/// Build a string based on an int that consists of exactly 5 characters for HDF5 numbering +//-------------------------------------------------------------------------------------------------- +std::string RifHdf5Reader::getTimeStepNumberAs5DigitString(std::string fileName) const +{ + return fileName.substr(fileName.size() - 5); // extract the 5 last characters/digits +} + + + + + +//-------------------------------------------------------------------------------------------------- +/// Build a string based on an int that consists of exactly 5 characters for HDF5 numbering +//-------------------------------------------------------------------------------------------------- +std::string RifHdf5Reader::IntTo5DigitString(int i) const +{ + std::string numString = "00000" + std::to_string(i); + + return numString.substr(numString.size() - 5); // extract the 5 last characters/digits +} + + + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -143,7 +275,7 @@ int RifHdf5Reader::getIntAttribute(H5::H5File file, std::string groupName, std:: return value; } - catch (H5::AttributeIException error) + catch (...) { return 0; } @@ -170,7 +302,7 @@ double RifHdf5Reader::getDoubleAttribute(H5::H5File file, std::string groupName, return value; } - catch (H5::AttributeIException error) + catch (...) { return 0.0; } @@ -196,7 +328,7 @@ std::string RifHdf5Reader::getStringAttribute(H5::H5File file, std::string group return stringAttribute; } - catch (H5::AttributeIException error) + catch (...) { return ""; } @@ -233,7 +365,7 @@ std::vector RifHdf5Reader::getSubGroupNames(H5::H5File file, std::s //-------------------------------------------------------------------------------------------------- -/// +/// Intended for finding all timesteps of one SourSimRL result file //-------------------------------------------------------------------------------------------------- std::vector RifHdf5Reader::getStepTimeValues(H5::H5File file, std::string baseGroupName) const { @@ -271,7 +403,7 @@ std::vector RifHdf5Reader::getResultNames(H5::H5File file, std::str for (std::vector::iterator it = subGroupNames.begin(); it != subGroupNames.end(); it++) { - std::string groupName = baseGroupName + "/" + *it; + std::string groupName = baseGroupName + "/" + *it; // NB: possibly dangerous to hardcode separator / (should use Qt separator?) std::string name = getStringAttribute(file, groupName, "name"); diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.h b/ApplicationCode/FileInterface/RifHdf5Reader.h index 802bd9d1ec..2bc6585da1 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.h +++ b/ApplicationCode/FileInterface/RifHdf5Reader.h @@ -40,14 +40,23 @@ public: bool dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const override; private: + std::vector getSourSimTimeStepFiles(const QString& fileName) const; + QDateTime sourSimDateTimeToQDateTime(std::string dateString) const; + + std::string getTimeStepNumberAs5DigitString(std::string fileName) const; + std::string IntTo5DigitString(int i) const; + int getIntAttribute(H5::H5File file, std::string groupName, std::string attributeName) const; double getDoubleAttribute(H5::H5File file, std::string groupName, std::string attributeName) const; std::string getStringAttribute(H5::H5File file, std::string groupName, std::string attributeName) const; + std::vector getSubGroupNames(H5::H5File file, std::string baseGroupName) const; std::vector getStepTimeValues(H5::H5File file, std::string baseGroupName) const; std::vector getResultNames(H5::H5File file, std::string baseGroupName) const; void getElementResultValues(H5::H5File file, std::string groupName, std::vector* resultValues) const; private: - QString m_fileName; + QString m_fileName; // name of SourSimRL main file given by user + + std::vector m_timeStepFiles; // files containing transient SourSimRL results, one time step per file }; From 50e4723578feb73fab9807548510a5cfaa339699 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 29 Mar 2017 14:46:11 +0200 Subject: [PATCH 10/61] #1357 Always use vector largest item count when producing time step strings --- .../ProjectDataModel/RimEclipseCase.cpp | 26 +++++++------------ .../ProjectDataModel/RimEclipseCase.h | 2 -- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 2ef806de91..a18ce1e41b 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -561,7 +561,7 @@ QStringList RimEclipseCase::timeStepStrings() { QStringList stringList; - int timeStepCount = static_cast(results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepCount(0)); + int timeStepCount = static_cast(results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->maxTimeStepCount()); for (int i = 0; i < timeStepCount; i++) { stringList += this->timeStepName(i); @@ -576,45 +576,37 @@ QStringList RimEclipseCase::timeStepStrings() QString RimEclipseCase::timeStepName(int frameIdx) { + std::vector timeStepDates = this->timeStepDates(); + CVF_ASSERT(frameIdx < timeStepDates.size()); + if (m_timeStepFormatString.isEmpty()) { - std::vector timeStepDates = results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0); - - bool hasHrsAndMinutesInTimesteps = false; + bool hasHoursAndMinutesInTimesteps = false; for (size_t i = 0; i < timeStepDates.size(); i++) { if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0) { - hasHrsAndMinutesInTimesteps = true; + hasHoursAndMinutesInTimesteps = true; break; } } m_timeStepFormatString = "dd.MMM yyyy"; - if (hasHrsAndMinutesInTimesteps) + if (hasHoursAndMinutesInTimesteps) { m_timeStepFormatString += " - hh:mm"; } } + QDateTime date = timeStepDates.at(frameIdx); - QDateTime date = results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDate(0,frameIdx); return date.toString(m_timeStepFormatString); - } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QDateTime RimEclipseCase::timeStepDate(int frameIdx) -{ - return results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDate(0,frameIdx); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimEclipseCase::timeStepDates() +std::vector RimEclipseCase::timeStepDates() { return results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index bef4d9e096..8dc66f567a 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -86,8 +86,6 @@ public: virtual std::vector views(); virtual QStringList timeStepStrings(); virtual QString timeStepName(int frameIdx); - virtual QDateTime timeStepDate(int frameIdx); - std::vector timeStepDates(); virtual cvf::BoundingBox activeCellsBoundingBox() const; From aad3094cdf51c03e69271a3886d515222a2f8489 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 29 Mar 2017 15:17:37 +0200 Subject: [PATCH 11/61] #1357 Fixes issue in previous commit --- ApplicationCode/ProjectDataModel/RimEclipseCase.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index 8dc66f567a..2c3f2f6522 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -86,6 +86,7 @@ public: virtual std::vector views(); virtual QStringList timeStepStrings(); virtual QString timeStepName(int frameIdx); + std::vector timeStepDates(); virtual cvf::BoundingBox activeCellsBoundingBox() const; From b38f50c6333840751c0da5ed924936a5de753888 Mon Sep 17 00:00:00 2001 From: Stein Inge Dale Date: Fri, 31 Mar 2017 09:40:51 +0200 Subject: [PATCH 12/61] WIP: first prototype reading SourSimRL transient results (one timestep per file) --- .../FileInterface/RifHdf5Reader.cpp | 116 +++++++++++------- ApplicationCode/FileInterface/RifHdf5Reader.h | 8 +- 2 files changed, 74 insertions(+), 50 deletions(-) diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.cpp b/ApplicationCode/FileInterface/RifHdf5Reader.cpp index bb620e9379..97c2e98c09 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.cpp +++ b/ApplicationCode/FileInterface/RifHdf5Reader.cpp @@ -18,30 +18,44 @@ #include "RifHdf5Reader.h" -#include -#include +#include "RiaLogging.h" #include "H5Cpp.h" -#include -#include "QDir" +#include "H5Exception.h" #include "cvfAssert.h" +#include "cvfMath.h" + +#include +#include +#include //-------------------------------------------------------------------------------------------------- -/// +/// May reduce constructor content upon discussion of overlying framework. +/// ///std::string dateString = getStringAttribute(file, "/KaseStudy/TransientSections", "initial_date"); ///QDateTime initalDateTime = sourSimDateTimeToQDateTime(dateString); // may rearrange/change to be a call in timeSteps() //-------------------------------------------------------------------------------------------------- RifHdf5Reader::RifHdf5Reader(const QString& fileName) - : m_fileName(fileName) + : m_fileName(fileName), m_fileStrategy(0) { - H5::H5File file(fileName.toStdString().c_str(), H5F_ACC_RDONLY); // evt fileName.toLatin1().data() + try + { + H5::H5File file(fileName.toStdString().c_str(), H5F_ACC_RDONLY); // evt fileName.toLatin1().data() - int fileStrategy = getIntAttribute(file, "/", "file_strategy"); // fileStrategy == 1 means one time step per file + m_fileStrategy = getIntAttribute(file, "/", "file_strategy"); // fileStrategy == 1 means one time step per file - m_timeStepFiles = getSourSimTimeStepFiles(fileName); + if (m_fileStrategy == 1) + { + m_timeStepFileNames = getSourSimTimeStepFileNames(fileName); + } + } + + catch (...) // catch any failure + { + } } //-------------------------------------------------------------------------------------------------- @@ -49,7 +63,6 @@ RifHdf5Reader::RifHdf5Reader(const QString& fileName) //-------------------------------------------------------------------------------------------------- RifHdf5Reader::~RifHdf5Reader() { - } //-------------------------------------------------------------------------------------------------- @@ -57,17 +70,19 @@ RifHdf5Reader::~RifHdf5Reader() //-------------------------------------------------------------------------------------------------- bool RifHdf5Reader::dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const { - QStringList props = propertyNames(); + if (m_fileStrategy != 1) return false; // NB: currently incapable of handling all results in one sourres file - QStringList::iterator it = std::find(props.begin(), props.end(), result); - - int propIdx = (it != props.end()) ? it - props.begin() : 0; // index to 'result' in QStringList props (usually size_t but int gave no warning) - try { + QStringList props = propertyNames(); + + QStringList::iterator it = std::find(props.begin(), props.end(), result); + + int propIdx = (it != props.end()) ? it - props.begin() : 0; // index to 'result' in QStringList props (usually size_t but int gave no warning) + H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately - std::string fileName = m_timeStepFiles[stepIndex]; + std::string fileName = m_timeStepFileNames[stepIndex]; std::string timeStepGroup = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName); H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY); @@ -81,83 +96,92 @@ bool RifHdf5Reader::dynamicResult(const QString& result, size_t stepIndex, std:: catch (...) // catch any failure { + RiaLogging::error(QString("Failed to read SourSimRL dynamic results")); + return false; } } //-------------------------------------------------------------------------------------------------- -/// +/// Qt alternative fileName.toLatin1().data() //-------------------------------------------------------------------------------------------------- std::vector RifHdf5Reader::timeSteps() const { - try + std::vector times; + + if (m_fileStrategy != 1) return times; // NB: currently incapable of handling all results in one sourres file + + try { - H5::H5File mainFile(m_fileName.toStdString().c_str(), H5F_ACC_RDONLY); // initial date part is an attribute of SourSimRL main file [Qt alternative fileName.toLatin1().data()] + H5::H5File mainFile(m_fileName.toStdString().c_str(), H5F_ACC_RDONLY); // initial date part is an attribute of SourSimRL main file std::string dateString = getStringAttribute(mainFile, "/KaseStudy/TransientSections", "initial_date"); - std::vector times; QDateTime dtInitial = sourSimDateTimeToQDateTime(dateString); - for (size_t i = 0; i < m_timeStepFiles.size(); i++) + for (size_t i = 0; i < m_timeStepFileNames.size(); i++) { - std::string fileName = m_timeStepFiles[i]; + std::string fileName = m_timeStepFileNames[i]; std::string timeStepGroup = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName); H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY); double timeStepValue = getDoubleAttribute(file, timeStepGroup, "timestep"); // Assumes only one time step per file - int timeStepDays = (int)timeStepValue; // NB: open question: unit of SourSimRL time step values, days? + int timeStepDays = cvf::Math::floor(timeStepValue); // NB: open question: unit of SourSimRL time step values, days? QDateTime dt = dtInitial; - times.push_back(dt.addDays(timeStepDays)); // NB: open question: unit of SourSimRL time step values, days? + times.push_back(dt.addDays(timeStepDays)); // NB: open question: unit of SourSimRL time step values, days? } - - return times; } catch (...) // catch any failure { - std::vector no_times; + times.clear(); - return no_times; + RiaLogging::error(QString("Failed to read SourSimRL time steps")); } + + return times; } -//-------------------------------------------------------------------------------------------------- -/// -//std::string groupName = "/Timestep_00001/GridFunctions/GridPart_00000"; -//-------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------- +/// Result variables of first timestep listed by HDF5 subgroups to the following base group: +/// "/Timestep_00001/GridFunctions/GridPart_00000" +/// According to sourres file description, it seems safe to assume equal presence for all time steps. +//--------------------------------------------------------------------------------------------------- QStringList RifHdf5Reader::propertyNames() const { + QStringList propNames; + + if (m_fileStrategy != 1) return propNames; // NB: currently incapable of handling all results in one sourres file + + std::string fileName = m_timeStepFileNames[0]; // assume the result variables to be identical across time steps => extract names from first time step file + + std::string groupName = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName) + "/GridFunctions/GridPart_00000"; + try { - QStringList propNames; - - std::string fileName = m_timeStepFiles[0]; // assume the result variables to be identical across time steps => extract names from first time step file - - std::string groupName = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName) + "/GridFunctions/GridPart_00000"; - H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY); std::vector resultNames = getResultNames(file, groupName); - for (std::vector::iterator it = resultNames.begin(); it != resultNames.end(); it++) + for (const std::string& s : resultNames) { - propNames.push_back(it->c_str()); + propNames.push_back(s.c_str()); } - - return propNames; } catch (...) // catch any failure { - QStringList no_propNames; - return no_propNames; + propNames.clear(); + + RiaLogging::error(QString("Failed to read properties from file : '%1'").arg(fileName.c_str())); } + + return propNames; } @@ -175,7 +199,7 @@ QStringList RifHdf5Reader::propertyNames() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RifHdf5Reader::getSourSimTimeStepFiles(const QString& fileName) const +std::vector RifHdf5Reader::getSourSimTimeStepFileNames(const QString& fileName) const { QFileInfo fi(fileName); QString name = fi.fileName(); @@ -403,7 +427,7 @@ std::vector RifHdf5Reader::getResultNames(H5::H5File file, std::str for (std::vector::iterator it = subGroupNames.begin(); it != subGroupNames.end(); it++) { - std::string groupName = baseGroupName + "/" + *it; // NB: possibly dangerous to hardcode separator / (should use Qt separator?) + std::string groupName = baseGroupName + "/" + *it; std::string name = getStringAttribute(file, groupName, "name"); diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.h b/ApplicationCode/FileInterface/RifHdf5Reader.h index 2bc6585da1..5018a0a5bd 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.h +++ b/ApplicationCode/FileInterface/RifHdf5Reader.h @@ -40,7 +40,7 @@ public: bool dynamicResult(const QString& result, size_t stepIndex, std::vector* values) const override; private: - std::vector getSourSimTimeStepFiles(const QString& fileName) const; + std::vector getSourSimTimeStepFileNames(const QString& fileName) const; QDateTime sourSimDateTimeToQDateTime(std::string dateString) const; std::string getTimeStepNumberAs5DigitString(std::string fileName) const; @@ -56,7 +56,7 @@ private: void getElementResultValues(H5::H5File file, std::string groupName, std::vector* resultValues) const; private: - QString m_fileName; // name of SourSimRL main file given by user - - std::vector m_timeStepFiles; // files containing transient SourSimRL results, one time step per file + QString m_fileName; // name of SourSimRL main file given by user + int m_fileStrategy; // SourSimRL file strategy, fileStrategy == 1 means one time step per file + std::vector m_timeStepFileNames; // files containing transient SourSimRL results, one time step per file }; From 14deedab77436b0e5da6d48fcccff4267d93f253 Mon Sep 17 00:00:00 2001 From: Stein Inge Dale Date: Fri, 31 Mar 2017 10:25:53 +0200 Subject: [PATCH 13/61] WIP: improved file handling in case of no SourSimRL time step files. --- ApplicationCode/FileInterface/RifHdf5Reader.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.cpp b/ApplicationCode/FileInterface/RifHdf5Reader.cpp index 97c2e98c09..7bea872700 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.cpp +++ b/ApplicationCode/FileInterface/RifHdf5Reader.cpp @@ -158,9 +158,14 @@ QStringList RifHdf5Reader::propertyNames() const if (m_fileStrategy != 1) return propNames; // NB: currently incapable of handling all results in one sourres file - std::string fileName = m_timeStepFileNames[0]; // assume the result variables to be identical across time steps => extract names from first time step file + if (m_timeStepFileNames.empty()) + { + RiaLogging::error(QString("Failed to read properties. Transient data does not exist.")); + return propNames; + } - std::string groupName = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName) + "/GridFunctions/GridPart_00000"; + std::string fileName = m_timeStepFileNames[0]; // assume the result variables to be identical across time steps => extract names from first time step file + std::string groupName = "/Timestep_" + getTimeStepNumberAs5DigitString(fileName) + "/GridFunctions/GridPart_00000"; try { From 62d345cf1ec45d216fff30f0c4a9157d2e56960e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 31 Mar 2017 11:35:53 +0200 Subject: [PATCH 14/61] #1387 Added support for delete of existing sour sim data --- .../RigCaseCellResultsData.cpp | 27 +++++++++++++++++++ .../RigCaseCellResultsData.h | 11 +++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index eddd5f422d..7c174368d5 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -619,6 +619,33 @@ void RigCaseCellResultsData::setMustBeCalculated(size_t scalarResultIndex) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCaseCellResultsData::setSourSimData(size_t scalarResultIndex) +{ + CVF_ASSERT(scalarResultIndex < m_resultInfos.size()); + + m_resultInfos[scalarResultIndex].m_isSourSimData = true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCaseCellResultsData::eraseAllSourSimData() +{ + std::vector sourSimIndices; + + for (size_t i = 0; i < m_resultInfos.size(); i++) + { + ResultInfo& ri = m_resultInfos[i]; + if (ri.m_isSourSimData) + { + ri.m_resultType = RimDefines::REMOVED; + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h index 89839fc59d..557c32d410 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -109,7 +109,13 @@ public: { public: ResultInfo(RimDefines::ResultCatType resultType, bool needsToBeStored, bool mustBeCalculated, QString resultName, size_t gridScalarResultIndex) - : m_resultType(resultType), m_needsToBeStored(needsToBeStored), m_resultName(resultName), m_gridScalarResultIndex(gridScalarResultIndex), m_mustBeCalculated(mustBeCalculated) { } + : m_resultType(resultType), + m_needsToBeStored(needsToBeStored), + m_resultName(resultName), + m_gridScalarResultIndex(gridScalarResultIndex), + m_mustBeCalculated(mustBeCalculated), + m_isSourSimData(false) + { } public: RimDefines::ResultCatType m_resultType; @@ -119,12 +125,15 @@ public: size_t m_gridScalarResultIndex; std::vector m_timeStepDates; std::vector m_timeStepReportNumbers; + bool m_isSourSimData; }; const std::vector& infoForEachResultIndex() { return m_resultInfos;} bool mustBeCalculated(size_t scalarResultIndex) const; void setMustBeCalculated(size_t scalarResultIndex); + void setSourSimData(size_t scalarResultIndex); + void eraseAllSourSimData(); public: From 24d4e6d094d89d6f04373f508b79d0e1ce1d45a6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 31 Mar 2017 11:37:07 +0200 Subject: [PATCH 15/61] #1356 Added possibility to change sour sim file for eclipse result case --- .../FileInterface/RifReaderEclipseOutput.cpp | 18 +++++++++- .../ProjectDataModel/RimEclipseResultCase.cpp | 36 +++++++++++++++---- .../ProjectDataModel/RimEclipseResultCase.h | 7 ++++ 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 24cdeb3ce6..028e17b3d2 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -454,12 +454,27 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RifReaderInterface::MATRIX_RESULTS); CVF_ASSERT(matrixModelResults); + RiaLogging::info(QString("HDF: Start import of data from : ").arg(fileName)); + + RiaLogging::info("HDF: Removing all existing Sour Sim data ..."); + matrixModelResults->eraseAllSourSimData(); + + if (m_dynamicResultsAccess.isNull()) + { + m_timeSteps.clear(); + } + std::unique_ptr myReader; #ifdef USE_HDF5 myReader = std::unique_ptr(new RifHdf5Reader(fileName)); #endif // USE_HDF5 - if (!myReader) return; + if (!myReader) + { + RiaLogging::error("HDF: Failed to import Sour Sim data "); + + return; + } std::vector hdfTimeSteps = myReader->timeSteps(); if (m_timeSteps.size() > 0) @@ -505,6 +520,7 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) { size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false); matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers); + matrixModelResults->setSourSimData(resIndex); } m_hdfReaderInterface = std::move(myReader); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index 6fcb86fb3d..20014d7a1c 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -39,6 +39,7 @@ #include "RigFlowDiagSolverInterface.h" #include "cafPdmSettings.h" +#include "cafPdmUiFilePathEditor.h" #include "cafPdmUiPropertyViewDialog.h" #include "cafProgressInfo.h" @@ -71,7 +72,7 @@ RimEclipseResultCase::RimEclipseResultCase() //flipYAxis.uiCapability()->setUiHidden(true); CAF_PDM_InitField(&m_sourSimFileName, "SourSimFileName", QString(), "SourSim File Name", "", "", ""); - //m_sourSimFileName.uiCapability()->setUiReadOnly(true); + m_sourSimFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); m_activeCellInfoIsReadFromFile = false; m_gridAndWellDataIsReadFromFile = false; @@ -209,6 +210,20 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultCase::loadAndUpdateSourSimData() +{ + if (!results(RifReaderInterface::MATRIX_RESULTS)) return; + + RifReaderEclipseOutput* rifReaderOutput = dynamic_cast(results(RifReaderInterface::MATRIX_RESULTS)->readerInterface()); + if (rifReaderOutput) + { + rifReaderOutput->setHdf5FileName(m_sourSimFileName); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -421,11 +436,7 @@ void RimEclipseResultCase::setSourSimFileName(const QString& fileName) { m_sourSimFileName = fileName; - RifReaderEclipseOutput* rifReaderOutput = dynamic_cast(results(RifReaderInterface::FRACTURE_RESULTS)->readerInterface()); - if (rifReaderOutput) - { - rifReaderOutput->setHdf5FileName(fileName); - } + loadAndUpdateSourSimData(); } //-------------------------------------------------------------------------------------------------- @@ -455,3 +466,16 @@ void RimEclipseResultCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde uiOrdering.add(&caseFileName); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +{ + if (changedField == &m_sourSimFileName) + { + loadAndUpdateSourSimData(); + } + + return RimEclipseCase::fieldChangedByUi(changedField, oldValue, newValue); +} + diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h index 630514ffc1..b3fa94a77c 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h @@ -57,6 +57,12 @@ public: std::vector flowDiagSolutions(); RigFlowDiagSolverInterface* flowDiagSolverInterface(); +protected: + virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + +private: + void loadAndUpdateSourSimData(); + private: cvf::ref createMockModel(QString modelName); @@ -77,4 +83,5 @@ private: bool m_gridAndWellDataIsReadFromFile; bool m_activeCellInfoIsReadFromFile; + }; From 021cd5f1e06a49ad371a3af03217fd5917a9f414 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 31 Mar 2017 12:00:40 +0200 Subject: [PATCH 16/61] Fixed compare between signed/unsigned --- ApplicationCode/ProjectDataModel/RimEclipseCase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index a18ce1e41b..e748014b95 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -577,7 +577,7 @@ QStringList RimEclipseCase::timeStepStrings() QString RimEclipseCase::timeStepName(int frameIdx) { std::vector timeStepDates = this->timeStepDates(); - CVF_ASSERT(frameIdx < timeStepDates.size()); + CVF_ASSERT(frameIdx < static_cast(timeStepDates.size())); if (m_timeStepFormatString.isEmpty()) { From b130dd691d9c378f385f030bc9af8a30b46fce54 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 31 Mar 2017 13:30:26 +0200 Subject: [PATCH 17/61] #1356 Fixed compile without HDF library --- ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 028e17b3d2..866b2368d8 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -27,6 +27,7 @@ #include "RifEclipseRestartFilesetAccess.h" #include "RifEclipseUnifiedRestartFileAccess.h" #include "RifReaderOpmParserInput.h" +#include "RifHdf5ReaderInterface.h" #ifdef USE_HDF5 #include "RifHdf5Reader.h" From 3d7c6a4234aebbcaf4a6a6625b1407d8fc069f9d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 6 Apr 2017 13:10:43 +0200 Subject: [PATCH 18/61] Always use HDF5 when building (consider as option later) --- ApplicationCode/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 40ab67352f..d1ed7f3469 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -180,8 +180,8 @@ add_subdirectory(GeoMech/GeoMechDataModel) # # HDF5 -# -option(RESINSIGHT_ENABLE_HDF5 "Use HDF5" OFF) +#option(RESINSIGHT_ENABLE_HDF5 "Use HDF5" OFF) +set(RESINSIGHT_ENABLE_HDF5 true) if(RESINSIGHT_ENABLE_HDF5) add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB) find_package(HDF5 REQUIRED COMPONENTS CXX) From 74133bacd0333847579c862f59659887f861d76c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 24 Apr 2017 13:03:52 +0200 Subject: [PATCH 19/61] Improved reporting of timestep mismatch --- .../FileInterface/RifReaderEclipseOutput.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 223b5870d8..5f56c7bb10 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -481,18 +481,29 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) if (hdfTimeSteps.size() != m_timeSteps.size()) { RiaLogging::error("HDF: Time step count does not match"); + RiaLogging::error(QString("HDF: Elicpse count %1").arg(m_timeSteps.size())); + RiaLogging::error(QString("HDF: HDF count %1").arg(hdfTimeSteps.size())); + return; } + bool isTimeStampsEqual = true; for (size_t i = 0; i < m_timeSteps.size(); i++) { - if (hdfTimeSteps[i] != m_timeSteps[i]) + if (hdfTimeSteps[i].date() != m_timeSteps[i].date()) { RiaLogging::error("HDF: Time steps does not match"); - return; + QString dateStr("yyyy.MMM.ddd hh:mm"); + + RiaLogging::error(QString("HDF: Elicpse date %1").arg(m_timeSteps[i].toString(dateStr))); + RiaLogging::error(QString("HDF: HDF date %1").arg(hdfTimeSteps[i].toString(dateStr))); + + isTimeStampsEqual = false; } } + + if (!isTimeStampsEqual) return; } else { From be42bbcb980dee36df4394d1d579830efa44c089 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 26 Apr 2017 14:19:55 +0200 Subject: [PATCH 20/61] Add missing include on Linux --- ApplicationCode/FileInterface/RifHdf5Reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/FileInterface/RifHdf5Reader.cpp b/ApplicationCode/FileInterface/RifHdf5Reader.cpp index 7bea872700..c26641f790 100644 --- a/ApplicationCode/FileInterface/RifHdf5Reader.cpp +++ b/ApplicationCode/FileInterface/RifHdf5Reader.cpp @@ -30,7 +30,7 @@ #include #include - +#include //-------------------------------------------------------------------------------------------------- /// May reduce constructor content upon discussion of overlying framework. From 956798afd6a6b5cfbdb502b63189dda6380140b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 22 Jun 2017 11:51:46 +0200 Subject: [PATCH 21/61] #1641 Update libecl to latest revision from master --- .../Ert/.github/PULL_REQUEST_TEMPLATE.md | 11 + ThirdParty/Ert/.travis.yml | 36 +- ThirdParty/Ert/CMakeLists.txt | 285 +++++-- ThirdParty/Ert/applications/CMakeLists.txt | 87 ++ .../applications/block_fs/bcp.c | 0 .../applications/block_fs/bfs_extract.c | 0 .../applications/block_fs/block_fs_test.c | 0 .../applications/block_fs/bls.c | 0 .../applications/block_fs/brm.c | 0 .../applications/block_fs/brot.c | 0 .../ecl}/convert.c | 0 .../ecl}/ecl_pack.c | 0 .../ecl}/ecl_quantile.c | 0 .../ecl}/ecl_unpack.c | 7 +- .../ecl}/esummary.c | 0 .../ecl}/grdecl_grid.c | 0 .../ecl}/grdecl_test.c | 0 .../ecl}/grid_dump.c | 0 .../ecl}/grid_dump_ascii.c | 0 .../ecl}/grid_info.c | 0 .../ecl}/grid_layer.c | 0 .../ecl}/key_list.c | 0 .../ecl}/kw_extract.c | 2 +- .../ecl}/kw_list.c | 0 .../ecl}/load_test.c | 0 .../ecl}/make_grid.c | 0 .../ecl}/run_gravity.c | 0 .../ecl}/select_test.c | 0 .../ecl}/sum_write.c | 0 .../ecl}/summary2csv2.c | 0 .../ecl}/view_restart.c | 0 .../ecl}/view_rft.c | 0 .../ecl}/view_summary.c | 0 .../ecl}/vprofile.c | 0 .../applications/example_ens_plot_batch_file | 0 .../applications/irap_test.c | 0 .../man/man1/ecl_summary.1 | 0 .../applications/polygon_test.c | 0 .../well}/ri_well_test.c | 0 .../well}/segment_info.c | 0 .../well}/well_CF_dump.c | 0 .../Ert/cmake/Modules/FindCXX11Features.cmake | 29 +- ThirdParty/Ert/cmake/ert_api_check.cmake | 67 -- ThirdParty/Ert/cmake/ert_build_check.cmake | 72 -- ThirdParty/Ert/cmake/ert_lib_check.cmake | 27 - ThirdParty/Ert/docs/CMakeLists.txt | 104 +-- ThirdParty/Ert/lib/CMakeLists.txt | 766 ++++++++++++++++++ .../ert/util => lib}/build_config.h.in | 0 .../{libeclxx/src => lib/ecl}/EclFilename.cpp | 0 .../Ert/{libeclxx/src => lib/ecl}/FortIO.cpp | 0 .../Ert/{libeclxx/src => lib/ecl}/Smspec.cpp | 9 +- .../Ert/{libecl/src => lib/ecl}/ecl_box.c | 0 .../{libecl/src => lib/ecl}/ecl_coarse_cell.c | 0 .../Ert/{libecl/src => lib/ecl}/ecl_file.c | 202 ++++- .../Ert/{libecl/src => lib/ecl}/ecl_file_kw.c | 1 + .../{libecl/src => lib/ecl}/ecl_file_view.c | 0 .../Ert/{libecl/src => lib/ecl}/ecl_grav.c | 0 .../{libecl/src => lib/ecl}/ecl_grav_calc.c | 0 .../{libecl/src => lib/ecl}/ecl_grav_common.c | 0 .../Ert/{libecl/src => lib/ecl}/ecl_grid.c | 100 ++- .../{libecl/src => lib/ecl}/ecl_grid_cache.c | 0 .../{libecl/src => lib/ecl}/ecl_grid_dims.c | 0 .../{libecl/src => lib/ecl}/ecl_init_file.c | 0 .../{libecl/src => lib/ecl}/ecl_io_config.c | 0 .../Ert/{libecl/src => lib/ecl}/ecl_kw.c | 24 +- .../src => lib/ecl}/ecl_kw_functions.c | 0 .../{libecl/src => lib/ecl}/ecl_kw_grdecl.c | 101 +-- ThirdParty/Ert/lib/ecl/ecl_nnc_data.c | 280 +++++++ .../{libecl/src => lib/ecl}/ecl_nnc_export.c | 0 .../src => lib/ecl}/ecl_nnc_geometry.c | 8 + .../Ert/{libecl/src => lib/ecl}/ecl_region.c | 0 .../{libecl/src => lib/ecl}/ecl_rft_cell.c | 0 .../{libecl/src => lib/ecl}/ecl_rft_file.c | 0 .../{libecl/src => lib/ecl}/ecl_rft_node.c | 0 .../{libecl/src => lib/ecl}/ecl_rst_file.c | 0 .../Ert/{libecl/src => lib/ecl}/ecl_rsthead.c | 8 +- .../Ert/{libecl/src => lib/ecl}/ecl_smspec.c | 0 .../{libecl/src => lib/ecl}/ecl_subsidence.c | 0 .../Ert/{libecl/src => lib/ecl}/ecl_sum.c | 0 .../{libecl/src => lib/ecl}/ecl_sum_data.c | 246 +++--- .../{libecl/src => lib/ecl}/ecl_sum_file.c | 0 .../{libecl/src => lib/ecl}/ecl_sum_index.c | 0 .../{libecl/src => lib/ecl}/ecl_sum_tstep.c | 0 .../{libecl/src => lib/ecl}/ecl_sum_vector.c | 0 .../Ert/{libecl/src => lib/ecl}/ecl_type.c | 0 .../{libecl/src => lib/ecl}/ecl_type_python.c | 0 .../Ert/{libecl/src => lib/ecl}/ecl_util.c | 0 .../Ert/{libecl/src => lib/ecl}/fault_block.c | 5 +- .../src => lib/ecl}/fault_block_layer.c | 14 +- .../Ert/{libecl/src => lib/ecl}/fortio.c | 49 +- .../Ert/{libecl/src => lib/ecl}/grid_dims.c | 0 .../Ert/{libecl/src => lib/ecl}/layer.c | 0 .../Ert/{libecl/src => lib/ecl}/nnc_info.c | 0 .../Ert/{libecl/src => lib/ecl}/nnc_vector.c | 0 .../Ert/{libecl/src => lib/ecl}/overview.txt | 0 .../{libecl/src => lib/ecl}/readme.overview | 0 .../Ert/{libecl/src => lib/ecl}/smspec_node.c | 0 .../{libecl => lib/ecl}/tests/data/num_cpu1 | 0 .../{libecl => lib/ecl}/tests/data/num_cpu2 | 0 .../{libecl => lib/ecl}/tests/data/num_cpu3 | 0 .../{libecl => lib/ecl}/tests/data/num_cpu4 | 0 .../ecl}/tests/ecl_alloc_cpgrid.c | 0 .../ecl}/tests/ecl_alloc_grid_dxv_dyv_dzv.c | 0 .../ecl}/tests/ecl_coarse_test.c | 0 .../Ert/{libecl => lib/ecl}/tests/ecl_dualp.c | 0 .../ecl_fault_block_collection_statoil.c | 0 .../ecl}/tests/ecl_fault_block_layer.c | 0 .../tests/ecl_fault_block_layer_statoil.c | 0 ThirdParty/Ert/lib/ecl/tests/ecl_file.c | 92 +++ .../ecl/tests/ecl_file_statoil.c} | 4 +- .../Ert/{libecl => lib/ecl}/tests/ecl_fmt.c | 0 .../{libecl => lib/ecl}/tests/ecl_fortio.c | 21 + .../ecl}/tests/ecl_get_num_cpu_test.c | 0 .../ecl}/tests/ecl_grid_DEPTHZ.c | 0 .../ecl}/tests/ecl_grid_add_nnc.c | 0 .../{libecl => lib/ecl}/tests/ecl_grid_case.c | 0 .../ecl}/tests/ecl_grid_cell_contains.c | 0 .../tests/ecl_grid_cell_contains_wellpath.c | 33 +- .../ecl}/tests/ecl_grid_cell_volume.c | 0 .../{libecl => lib/ecl}/tests/ecl_grid_copy.c | 0 .../ecl}/tests/ecl_grid_copy_statoil.c | 0 .../ecl}/tests/ecl_grid_corner.c | 0 .../ecl}/tests/ecl_grid_create.c | 0 .../{libecl => lib/ecl}/tests/ecl_grid_dims.c | 0 .../ecl}/tests/ecl_grid_export.c | 0 .../ecl}/tests/ecl_grid_fwrite.c | 0 .../ecl}/tests/ecl_grid_init_fwrite.c | 0 .../ecl}/tests/ecl_grid_layer_contains.c | 0 .../ecl}/tests/ecl_grid_lgr_name.c | 0 .../ecl}/tests/ecl_grid_reset_actnum.c | 0 .../ecl}/tests/ecl_grid_simple.c | 0 .../ecl}/tests/ecl_grid_volume.c | 0 .../{libecl => lib/ecl}/tests/ecl_init_file.c | 0 .../ecl}/tests/ecl_kw_cmp_string.c | 0 .../{libecl => lib/ecl}/tests/ecl_kw_equal.c | 0 .../{libecl => lib/ecl}/tests/ecl_kw_fread.c | 51 ++ .../{libecl => lib/ecl}/tests/ecl_kw_grdecl.c | 0 .../{libecl => lib/ecl}/tests/ecl_kw_init.c | 0 .../Ert/{libecl => lib/ecl}/tests/ecl_layer.c | 0 .../ecl}/tests/ecl_layer_statoil.c | 0 .../Ert/{libecl => lib/ecl}/tests/ecl_lfs.c | 0 .../{libecl => lib/ecl}/tests/ecl_lgr_name.c | 0 .../{libecl => lib/ecl}/tests/ecl_lgr_test.c | 0 .../ecl}/tests/ecl_nnc_export.c | 7 + .../ecl}/tests/ecl_nnc_export_get_tran.c | 2 +- .../ecl}/tests/ecl_nnc_geometry.c | 42 +- .../ecl}/tests/ecl_nnc_index_list.c | 0 .../ecl}/tests/ecl_nnc_index_list_grid.c | 0 .../ecl}/tests/ecl_nnc_info_test.c | 0 ThirdParty/Ert/lib/ecl/tests/ecl_nnc_pair.c | 45 + .../{libecl => lib/ecl}/tests/ecl_nnc_test.c | 0 .../ecl}/tests/ecl_nnc_vector.c | 0 .../{libecl => lib/ecl}/tests/ecl_region.c | 0 .../ecl}/tests/ecl_region2region_test.c | 0 .../ecl}/tests/ecl_restart_test.c | 0 .../Ert/{libecl => lib/ecl}/tests/ecl_rft.c | 0 .../{libecl => lib/ecl}/tests/ecl_rft_cell.c | 0 .../{libecl => lib/ecl}/tests/ecl_rst_file.c | 0 .../{libecl => lib/ecl}/tests/ecl_rsthead.c | 0 .../{libecl => lib/ecl}/tests/ecl_smspec.c | 0 .../ecl}/tests/ecl_sum_case_exists.c | 0 .../tests/ecl_sum_report_step_compatible.c | 0 .../ecl}/tests/ecl_sum_report_step_equal.c | 0 .../{libecl => lib/ecl}/tests/ecl_sum_test.c | 0 .../ecl}/tests/ecl_sum_writer.c | 0 .../ecl}/tests/ecl_util_make_date_no_shift.c | 0 .../ecl}/tests/ecl_util_make_date_shift.c | 0 .../ecl}/tests/ecl_util_month_range.c | 0 .../ecl}/tests/ecl_valid_basename.c | 0 .../ecl}/tests/eclxx_filename.cpp | 0 .../ecl}/tests/eclxx_fortio.cpp | 0 .../{libeclxx => lib/ecl}/tests/eclxx_kw.cpp | 0 .../ecl}/tests/eclxx_smspec.cpp | 7 + .../ecl}/tests/eclxx_types.cpp | 0 .../Ert/{libecl => lib/ecl}/tests/rft_test.c | 0 .../Ert/lib/ecl/tests/test_ecl_nnc_data.c | 102 +++ .../tests/test_ecl_nnc_data_statoil_root.c | 128 +++ .../ecl}/tests/well_branch_collection.c | 0 .../ecl}/tests/well_conn.c | 0 .../ecl}/tests/well_conn_CF.c | 0 .../ecl}/tests/well_conn_collection.c | 0 .../ecl}/tests/well_conn_load.c | 0 .../ecl}/tests/well_dualp.c | 0 .../ecl}/tests/well_info.c | 0 .../ecl}/tests/well_lgr_load.c | 0 .../ecl}/tests/well_segment.c | 0 .../tests/well_segment_branch_conn_load.c | 0 .../ecl}/tests/well_segment_collection.c | 0 .../ecl}/tests/well_segment_conn.c | 0 .../ecl}/tests/well_segment_conn_load.c | 0 .../ecl}/tests/well_segment_load.c | 0 .../ecl}/tests/well_state.c | 0 .../ecl}/tests/well_state_load.c | 0 .../ecl}/tests/well_state_load_missing_RSEG.c | 0 .../{libecl_well => lib/ecl}/tests/well_ts.c | 0 .../src => lib/ecl}/well_branch_collection.c | 0 .../{libecl_well/src => lib/ecl}/well_conn.c | 0 .../src => lib/ecl}/well_conn_collection.c | 0 .../{libecl_well/src => lib/ecl}/well_info.c | 0 .../src => lib/ecl}/well_rseg_loader.c | 0 .../src => lib/ecl}/well_segment.c | 0 .../src => lib/ecl}/well_segment_collection.c | 0 .../{libecl_well/src => lib/ecl}/well_state.c | 0 .../{libecl_well/src => lib/ecl}/well_ts.c | 0 .../ert/util => lib}/ert_api_config.h.in | 0 .../src => lib/geometry}/geo_pointset.c | 0 .../src => lib/geometry}/geo_polygon.c | 0 .../geometry}/geo_polygon_collection.c | 0 .../src => lib/geometry}/geo_region.c | 0 .../src => lib/geometry}/geo_surface.c | 0 .../src => lib/geometry}/geo_util.c | 0 .../geometry}/tests/geo_polygon.c | 0 .../geometry}/tests/geo_polygon_collection.c | 0 .../geometry}/tests/geo_surface.c | 0 .../geometry}/tests/geo_util_xlines.c | 0 .../include/ert/ecl/EclFilename.hpp | 0 .../include/ert/ecl/EclKW.hpp | 0 .../include/ert/ecl/FortIO.hpp | 0 .../include/ert/ecl/Smspec.hpp | 0 .../{libecl => lib}/include/ert/ecl/ecl_box.h | 0 .../include/ert/ecl/ecl_coarse_cell.h | 0 .../include/ert/ecl/ecl_endian_flip.h | 0 .../include/ert/ecl/ecl_file.h | 1 + .../include/ert/ecl/ecl_file_kw.h | 0 .../Ert/lib/include/ert/ecl/ecl_file_view.h | 108 +++ .../include/ert/ecl/ecl_grav.h | 0 .../include/ert/ecl/ecl_grav_calc.h | 0 .../include/ert/ecl/ecl_grav_common.h | 0 .../include/ert/ecl/ecl_grid.h | 1 + .../include/ert/ecl/ecl_grid_cache.h | 0 .../include/ert/ecl/ecl_grid_dims.h | 0 .../include/ert/ecl/ecl_init_file.h | 0 .../include/ert/ecl/ecl_io_config.h | 0 .../{libecl => lib}/include/ert/ecl/ecl_kw.h | 2 +- .../include/ert/ecl/ecl_kw_grdecl.h | 0 .../include/ert/ecl/ecl_kw_magic.h | 11 + .../Ert/lib/include/ert/ecl/ecl_nnc_data.h | 46 ++ .../include/ert/ecl/ecl_nnc_export.h | 0 .../include/ert/ecl/ecl_nnc_geometry.h | 1 + .../include/ert/ecl/ecl_region.h | 0 .../include/ert/ecl/ecl_rft_cell.h | 0 .../include/ert/ecl/ecl_rft_file.h | 0 .../include/ert/ecl/ecl_rft_node.h | 0 .../include/ert/ecl/ecl_rst_file.h | 0 .../include/ert/ecl/ecl_rsthead.h | 0 .../include/ert/ecl/ecl_smspec.h | 0 .../include/ert/ecl/ecl_subsidence.h | 0 .../{libecl => lib}/include/ert/ecl/ecl_sum.h | 0 .../include/ert/ecl/ecl_sum_data.h | 0 .../include/ert/ecl/ecl_sum_index.h | 0 .../include/ert/ecl/ecl_sum_tstep.h | 0 .../include/ert/ecl/ecl_sum_vector.h | 0 .../include/ert/ecl/ecl_type.h | 39 +- .../include/ert/ecl/ecl_units.h | 0 .../include/ert/ecl/ecl_util.h | 0 .../include/ert/ecl/fault_block.h | 0 .../include/ert/ecl/fault_block_layer.h | 0 .../{libecl => lib}/include/ert/ecl/fortio.h | 2 + .../include/ert/ecl/grid_dims.h | 0 .../{libecl => lib}/include/ert/ecl/layer.h | 0 .../include/ert/ecl/nnc_info.h | 0 .../include/ert/ecl/nnc_vector.h | 0 .../include/ert/ecl/smspec_node.h | 0 .../ert/ecl_well/well_branch_collection.h | 0 .../include/ert/ecl_well/well_conn.h | 0 .../ert/ecl_well/well_conn_collection.h | 0 .../include/ert/ecl_well/well_const.h | 0 .../include/ert/ecl_well/well_info.h | 0 .../include/ert/ecl_well/well_rseg_loader.h | 0 .../include/ert/ecl_well/well_segment.h | 0 .../ert/ecl_well/well_segment_collection.h | 0 .../include/ert/ecl_well/well_state.h | 0 .../include/ert/ecl_well/well_ts.h | 0 .../include/ert/geometry/geo_pointset.h | 0 .../include/ert/geometry/geo_polygon.h | 0 .../ert/geometry/geo_polygon_collection.h | 0 .../include/ert/geometry/geo_region.h | 0 .../include/ert/geometry/geo_surface.h | 0 .../include/ert/geometry/geo_util.h | 0 .../include/ert/util/TestArea.hpp | 0 .../include/ert/util/arg_pack.h | 0 .../include/ert/util/atomic.h | 0 .../include/ert/util/block_fs.h | 0 .../include/ert/util/buffer.h | 0 .../include/ert/util/buffer_string.h | 0 .../include/ert/util/ert_unique_ptr.hpp | 0 .../include/ert/util/ert_version.h | 0 .../include/ert/util/hash.h | 0 .../include/ert/util/hash_node.h | 0 .../include/ert/util/hash_sll.h | 0 .../include/ert/util/lars.h | 0 .../include/ert/util/log.h | 11 + .../include/ert/util/lookup_table.h | 0 .../include/ert/util/matrix.h | 0 .../include/ert/util/matrix_blas.h | 0 .../include/ert/util/matrix_lapack.h | 0 .../include/ert/util/matrix_stat.h | 0 .../include/ert/util/menu.h | 0 .../include/ert/util/msg.h | 0 .../include/ert/util/msvc_stdbool.h | 0 .../include/ert/util/mzran.h | 0 .../include/ert/util/node_ctype.h | 0 .../include/ert/util/node_data.h | 0 .../include/ert/util/parser.h | 0 .../include/ert/util/path_fmt.h | 0 .../include/ert/util/path_stack.h | 0 .../include/ert/util/perm_vector.h | 0 .../include/ert/util/regression.h | 0 .../include/ert/util/rng.h | 0 .../include/ert/util/set.h | 0 .../include/ert/util/ssize_t.h | 0 .../include/ert/util/statistics.h | 0 .../include/ert/util/stepwise.h | 0 .../include/ert/util/string_util.h | 0 .../include/ert/util/stringlist.h | 0 .../include/ert/util/struct_vector.h | 0 .../include/ert/util/subst_func.h | 0 .../include/ert/util/subst_list.h | 0 .../include/ert/util/template.h | 0 .../include/ert/util/test_util.h | 0 .../include/ert/util/test_util.hpp | 0 .../include/ert/util/test_work_area.h | 0 .../include/ert/util/thread_pool.h | 0 .../include/ert/util/thread_pool1.h | 0 .../include/ert/util/time_interval.h | 0 .../include/ert/util/timer.h | 0 .../include/ert/util/type_macros.h | 0 .../include/ert/util/type_vector_functions.h | 0 .../include/ert/util/ui_return.h | 0 .../include/ert/util/util.h | 2 +- .../include/ert/util/util_endian.h | 0 .../include/ert/util/util_env.h | 0 .../include/ert/util/vector.h | 0 .../src => lib/util}/TestArea.cpp | 0 .../{libert_util/src => lib/util}/arg_pack.c | 0 .../{libert_util/src => lib/util}/block_fs.c | 0 .../{libert_util/src => lib/util}/buffer.c | 127 ++- .../src => lib/util}/config_test_input | 0 .../src => lib/util}/dependencies | 0 .../Ert/lib/util/ert/util/template_type.h | 34 + .../src => lib/util}/ert_version.c | 11 +- .../Ert/{libert_util/src => lib/util}/hash.c | 0 .../{libert_util/src => lib/util}/hash_node.c | 0 .../{libert_util/src => lib/util}/hash_sll.c | 0 .../Ert/{libert_util/src => lib/util}/lars.c | 0 .../Ert/{libert_util/src => lib/util}/log.c | 14 +- .../src => lib/util}/lookup_table.c | 0 .../{libert_util/src => lib/util}/matrix.c | 0 .../src => lib/util}/matrix_blas.c | 0 .../src => lib/util}/matrix_lapack.c | 7 +- .../src => lib/util}/matrix_stat.c | 0 .../Ert/{libert_util/src => lib/util}/menu.c | 0 .../Ert/{libert_util/src => lib/util}/msg.c | 0 .../Ert/{libert_util/src => lib/util}/mzran.c | 0 .../src => lib/util}/node_ctype.c | 0 .../{libert_util/src => lib/util}/node_data.c | 0 .../{libert_util/src => lib/util}/parser.c | 0 .../{libert_util/src => lib/util}/path_fmt.c | 0 .../src => lib/util}/path_stack.c | 0 .../src => lib/util}/perm_vector.c | 0 .../src => lib/util}/readme.overview | 0 .../src => lib/util}/regression.c | 0 .../Ert/{libert_util/src => lib/util}/rng.c | 0 .../Ert/{libert_util/src => lib/util}/set.c | 0 .../src => lib/util}/statistics.c | 0 .../{libert_util/src => lib/util}/stepwise.c | 0 .../src => lib/util}/string_util.c | 0 .../src => lib/util}/stringlist.c | 0 .../src => lib/util}/struct_vector.c | 0 .../src => lib/util}/subst_func.c | 0 .../src => lib/util}/subst_list.c | 0 .../{libert_util/src => lib/util}/template.c | 37 +- .../src => lib/util}/template_loop.c | 40 +- .../{libert_util/src => lib/util}/test_util.c | 0 .../src => lib/util}/test_work_area.c | 2 +- .../util}/tests/data/file1.txt | 0 .../util}/tests/data/file2.txt | 0 .../util}/tests/data2/dir2/file4 | 0 .../util}/tests/data2/file1 | 0 .../util}/tests/data2/file2 | 0 .../util}/tests/data2/file3 | 0 .../util}/tests/ert_util_PATH_test.c | 32 +- .../util}/tests/ert_util_abort_gnu_tests.c | 0 .../util}/tests/ert_util_addr2line.c | 0 .../tests/ert_util_alloc_file_components.c | 0 .../util}/tests/ert_util_approx_equal.c | 0 .../util}/tests/ert_util_arg_pack.c | 0 .../util}/tests/ert_util_before_after.c | 0 .../util}/tests/ert_util_binary_split.c | 0 .../util}/tests/ert_util_block_fs.c | 0 .../util}/tests/ert_util_buffer.c | 0 .../util}/tests/ert_util_clamp.c | 0 .../util}/tests/ert_util_copy_file.c | 0 .../util}/tests/ert_util_cwd_test.c | 0 .../Ert/lib/util/tests/ert_util_datetime.c | 52 ++ .../util}/tests/ert_util_file_readable.c | 0 .../util}/tests/ert_util_filename.c | 0 .../util}/tests/ert_util_hash_test.c | 0 .../util}/tests/ert_util_logh.c | 0 .../util}/tests/ert_util_matrix.c | 0 .../util}/tests/ert_util_matrix_lapack.c | 0 .../util}/tests/ert_util_matrix_stat.c | 0 .../util}/tests/ert_util_parent_path.c | 0 .../util}/tests/ert_util_path_stack_test.c | 0 .../util}/tests/ert_util_ping.c | 0 .../util}/tests/ert_util_realpath.c | 0 .../util}/tests/ert_util_relpath_test.c | 0 .../util}/tests/ert_util_rng.c | 0 .../util}/tests/ert_util_spawn.c | 0 .../util}/tests/ert_util_sprintf_escape.c | 0 .../util}/tests/ert_util_sscan_test.c | 0 .../util}/tests/ert_util_statistics.c | 0 .../util}/tests/ert_util_strcat_test.c | 0 .../util}/tests/ert_util_string_util.c | 0 .../util}/tests/ert_util_stringlist_test.c | 0 .../util}/tests/ert_util_strstr_int_format.c | 0 .../util}/tests/ert_util_struct_vector.c | 7 +- .../util}/tests/ert_util_subst_list.c | 0 .../util}/tests/ert_util_test_area_xx.cpp | 0 .../util}/tests/ert_util_time_interval.c | 0 .../tests/ert_util_type_vector_functions.c | 0 .../util}/tests/ert_util_type_vector_test.c | 0 .../util}/tests/ert_util_ui_return.c | 0 .../util}/tests/ert_util_unique_ptr.cpp | 0 .../util}/tests/ert_util_vector_test.c | 0 .../util}/tests/ert_util_work_area.c | 0 .../util}/tests/test_thread_pool.c | 0 .../src => lib/util}/thread_pool.c | 0 .../src => lib/util}/thread_pool1.c | 0 .../src => lib/util}/thread_pool_posix.c | 0 .../src => lib/util}/time_interval.c | 0 .../Ert/{libert_util/src => lib/util}/timer.c | 0 .../src => lib/util}/type_vector_functions.c | 0 .../{libert_util/src => lib/util}/ui_return.c | 0 .../Ert/{libert_util/src => lib/util}/util.c | 381 +++++++-- .../src => lib/util}/util_abort_gnu.c | 18 + .../src => lib/util}/util_abort_simple.c | 8 +- .../src => lib/util}/util_endian.c | 0 .../{libert_util/src => lib/util}/util_env.c | 2 + .../src => lib/util}/util_getuid.c | 9 + .../{libert_util/src => lib/util}/util_lfs.c | 2 + .../src => lib/util}/util_lockf.c | 9 + .../src => lib/util}/util_opendir.c | 10 + .../src => lib/util}/util_spawn.c | 18 +- .../src => lib/util}/util_symlink.c | 27 +- .../{libert_util/src => lib/util}/util_zlib.c | 7 + .../{libert_util/src => lib/util}/vector.c | 0 .../src => lib/util}/vector_template.c | 0 .../vector_template.h.in} | 0 ThirdParty/Ert/libecl/CMakeLists.txt | 5 - .../Ert/libecl/applications/CMakeLists.txt | 81 -- .../Ert/libecl/applications/link_static.sh | 2 - .../libecl/include/ert/ecl/ecl_file_view.h | 108 --- ThirdParty/Ert/libecl/src/CMakeLists.txt | 116 --- .../Ert/libecl/src/ecl_file_deprecated.c | 117 --- ThirdParty/Ert/libecl/src/ecl_rstfile.c | 116 --- ThirdParty/Ert/libecl/tests/CMakeLists.txt | 19 - .../Ert/libecl/tests/statoil_tests.cmake | 295 ------- ThirdParty/Ert/libecl/tests/tests.cmake | 119 --- ThirdParty/Ert/libecl_well/CMakeLists.txt | 8 - .../libecl_well/applications/CMakeLists.txt | 28 - ThirdParty/Ert/libecl_well/src/CMakeLists.txt | 51 -- .../Ert/libecl_well/tests/CMakeLists.txt | 12 - .../Ert/libecl_well/tests/statoil_tests.cmake | 100 --- ThirdParty/Ert/libecl_well/tests/tests.cmake | 35 - ThirdParty/Ert/libeclxx/CMakeLists.txt | 5 - ThirdParty/Ert/libeclxx/src/CMakeLists.txt | 28 - ThirdParty/Ert/libeclxx/tests/CMakeLists.txt | 19 - ThirdParty/Ert/libert_util/CMakeLists.txt | 10 - .../libert_util/applications/CMakeLists.txt | 3 - .../applications/block_fs/CMakeLists.txt | 18 - .../include/ert/util/CMakeLists.txt | 29 - ThirdParty/Ert/libert_util/src/CMakeLists.txt | 183 ----- .../Ert/libert_util/src/buffer_string.c | 57 -- ThirdParty/Ert/libert_util/src/buffer_zlib.c | 74 -- ThirdParty/Ert/libert_util/src/util_chdir.c | 38 - ThirdParty/Ert/libert_util/src/util_path.c | 307 ------- .../Ert/libert_util/tests/CMakeLists.txt | 196 ----- ThirdParty/Ert/libert_utilxx/CMakeLists.txt | 6 - .../Ert/libert_utilxx/src/CMakeLists.txt | 24 - .../Ert/libert_utilxx/tests/CMakeLists.txt | 7 - ThirdParty/Ert/libgeometry/CMakeLists.txt | 10 - ThirdParty/Ert/libgeometry/src/CMakeLists.txt | 20 - .../Ert/libgeometry/tests/CMakeLists.txt | 25 - .../cmake/Modules/add_python_package.cmake | 4 +- .../cmake/Modules/add_python_test.cmake | 2 +- .../cmake/Modules/find_python_package.cmake | 24 +- .../python/cmake/Modules/init_python.cmake | 29 +- ThirdParty/Ert/python/doc/install.txt | 14 +- ThirdParty/Ert/python/python/CMakeLists.txt | 5 +- .../Ert/python/python/bin/CMakeLists.txt | 24 - .../Ert/python/python/bin/ert_tcp_server | 53 -- .../Ert/python/python/bin/ert_upgrade_fs107 | 76 -- ThirdParty/Ert/python/python/bin/ertshell | 35 - ThirdParty/Ert/python/python/cwrap/clib.py | 14 - .../Ert/python/python/cwrap/prototype.py | 3 + .../Ert/python/python/ecl/ecl/ecl_grid.py | 65 +- .../python/ecl/ecl/ecl_grid_generator.py | 560 ++++++++++--- .../Ert/python/python/ecl/geo/__init__.py | 2 +- .../python/ecl/test/extended_testcase.py | 7 +- .../python/ecl/test/import_test_case.py | 3 + .../Ert/python/python/ecl/util/__init__.py | 2 +- .../Ert/python/python/ecl/well/__init__.py | 2 +- .../Ert/python/python/ecl/well/well_info.py | 22 + .../python/python/legacy/ert/CMakeLists.txt | 11 + .../Ert/python/python/legacy/ert/__init__.py | 0 .../python/python/legacy/ert/ecl/__init__.py | 26 + .../python/legacy/ert/ecl/faults/__init__.py | 7 + .../python/python/legacy/ert/geo/__init__.py | 8 + .../python/python/legacy/ert/test/__init__.py | 10 + .../python/python/legacy/ert/util/__init__.py | 25 + .../python/python/legacy/ert/well/__init__.py | 7 + ThirdParty/Ert/python/tests/CMakeLists.txt | 4 + .../Ert/python/tests/cwrap/test_basecvalue.py | 2 +- .../Ert/python/tests/cwrap/test_cfile.py | 2 +- .../Ert/python/tests/cwrap/test_metawrap.py | 3 +- .../Ert/python/tests/ecl/CMakeLists.txt | 4 + .../Ert/python/tests/ecl/test_ecl_file.py | 30 + .../Ert/python/tests/ecl/test_ecl_util.py | 4 +- .../Ert/python/tests/ecl/test_fk_user_data.py | 48 ++ ThirdParty/Ert/python/tests/ecl/test_grid.py | 61 +- .../python/tests/ecl/test_grid_generator.py | 272 +++++++ .../Ert/python/tests/ecl/test_grid_statoil.py | 19 + ThirdParty/Ert/python/tests/ecl/test_sum.py | 2 +- .../Ert/python/tests/install/test_install.py | 13 + .../Ert/python/tests/legacy/CMakeLists.txt | 16 + .../Ert/python/tests/legacy/__init__.py | 0 .../Ert/python/tests/legacy/test_ecl.py | 41 + .../Ert/python/tests/legacy/test_geo.py | 14 + .../Ert/python/tests/legacy/test_test.py | 16 + .../Ert/python/tests/legacy/test_util.py | 31 + .../Ert/python/tests/legacy/test_well.py | 13 + ThirdParty/Ert/python/tests/test_install.in | 6 + .../Ert/python/tests/util/test_arg_pack.py | 2 +- .../Ert/python/tests/util/test_cstring.py | 2 +- .../python/tests/util/test_cthread_pool.py | 2 +- .../python/tests/util/test_path_context.py | 6 +- ThirdParty/Ert/python/tests/util/test_rng.py | 4 +- .../Ert/python/tests/util/test_spawn.py | 2 +- .../Ert/python/tests/util/test_ui_return.py | 2 +- .../Ert/python/tests/well/CMakeLists.txt | 6 +- .../Ert/python/tests/well/test_ecl_well.py | 14 +- .../local/ECLIPSE/faarikaal/faarikaal1.EGRID | Bin 0 -> 258624 bytes .../local/ECLIPSE/faarikaal/faarikaal1.txt | 22 + .../local/ECLIPSE/faarikaal/faarikaal2.EGRID | Bin 0 -> 29440 bytes .../local/ECLIPSE/faarikaal/faarikaal2.txt | 6 + .../local/ECLIPSE/faarikaal/faarikaal3.EGRID | Bin 0 -> 8192 bytes .../local/ECLIPSE/faarikaal/faarikaal3.txt | 2 + .../local/ECLIPSE/faarikaal/faarikaal4.EGRID | Bin 0 -> 2928 bytes .../local/ECLIPSE/faarikaal/faarikaal4.txt | 2 + .../local/ECLIPSE/faarikaal/faarikaal5.EGRID | Bin 0 -> 78968 bytes .../local/ECLIPSE/faarikaal/faarikaal5.txt | 7 + .../local/ECLIPSE/faarikaal/faarikaal6.EGRID | Bin 0 -> 8192 bytes .../local/ECLIPSE/faarikaal/faarikaal6.txt | 2 + .../local/ECLIPSE/faarikaal/faarikaal7.EGRID | Bin 0 -> 78968 bytes .../local/ECLIPSE/faarikaal/faarikaal7.txt | 7 + 556 files changed, 4579 insertions(+), 3573 deletions(-) create mode 100644 ThirdParty/Ert/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 ThirdParty/Ert/applications/CMakeLists.txt rename ThirdParty/Ert/{libert_util => }/applications/block_fs/bcp.c (100%) rename ThirdParty/Ert/{libert_util => }/applications/block_fs/bfs_extract.c (100%) rename ThirdParty/Ert/{libert_util => }/applications/block_fs/block_fs_test.c (100%) rename ThirdParty/Ert/{libert_util => }/applications/block_fs/bls.c (100%) rename ThirdParty/Ert/{libert_util => }/applications/block_fs/brm.c (100%) rename ThirdParty/Ert/{libert_util => }/applications/block_fs/brot.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/convert.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/ecl_pack.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/ecl_quantile.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/ecl_unpack.c (92%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/esummary.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/grdecl_grid.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/grdecl_test.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/grid_dump.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/grid_dump_ascii.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/grid_info.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/grid_layer.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/key_list.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/kw_extract.c (97%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/kw_list.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/load_test.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/make_grid.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/run_gravity.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/select_test.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/sum_write.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/summary2csv2.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/view_restart.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/view_rft.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/view_summary.c (100%) rename ThirdParty/Ert/{libecl/applications => applications/ecl}/vprofile.c (100%) rename ThirdParty/Ert/{libecl => }/applications/example_ens_plot_batch_file (100%) rename ThirdParty/Ert/{libgeometry => }/applications/irap_test.c (100%) rename ThirdParty/Ert/{docs => applications}/man/man1/ecl_summary.1 (100%) rename ThirdParty/Ert/{libgeometry => }/applications/polygon_test.c (100%) rename ThirdParty/Ert/{libecl_well/applications => applications/well}/ri_well_test.c (100%) rename ThirdParty/Ert/{libecl_well/applications => applications/well}/segment_info.c (100%) rename ThirdParty/Ert/{libecl_well/applications => applications/well}/well_CF_dump.c (100%) create mode 100644 ThirdParty/Ert/lib/CMakeLists.txt rename ThirdParty/Ert/{libert_util/include/ert/util => lib}/build_config.h.in (100%) rename ThirdParty/Ert/{libeclxx/src => lib/ecl}/EclFilename.cpp (100%) rename ThirdParty/Ert/{libeclxx/src => lib/ecl}/FortIO.cpp (100%) rename ThirdParty/Ert/{libeclxx/src => lib/ecl}/Smspec.cpp (92%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_box.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_coarse_cell.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_file.c (79%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_file_kw.c (99%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_file_view.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_grav.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_grav_calc.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_grav_common.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_grid.c (99%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_grid_cache.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_grid_dims.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_init_file.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_io_config.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_kw.c (99%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_kw_functions.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_kw_grdecl.c (86%) create mode 100644 ThirdParty/Ert/lib/ecl/ecl_nnc_data.c rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_nnc_export.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_nnc_geometry.c (95%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_region.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_rft_cell.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_rft_file.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_rft_node.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_rst_file.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_rsthead.c (96%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_smspec.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_subsidence.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_sum.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_sum_data.c (90%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_sum_file.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_sum_index.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_sum_tstep.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_sum_vector.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_type.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_type_python.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/ecl_util.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/fault_block.c (98%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/fault_block_layer.c (97%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/fortio.c (95%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/grid_dims.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/layer.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/nnc_info.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/nnc_vector.c (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/overview.txt (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/readme.overview (100%) rename ThirdParty/Ert/{libecl/src => lib/ecl}/smspec_node.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/data/num_cpu1 (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/data/num_cpu2 (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/data/num_cpu3 (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/data/num_cpu4 (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_alloc_cpgrid.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_alloc_grid_dxv_dyv_dzv.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_coarse_test.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_dualp.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_fault_block_collection_statoil.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_fault_block_layer.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_fault_block_layer_statoil.c (100%) create mode 100644 ThirdParty/Ert/lib/ecl/tests/ecl_file.c rename ThirdParty/Ert/{libecl/tests/ecl_file.c => lib/ecl/tests/ecl_file_statoil.c} (97%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_fmt.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_fortio.c (93%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_get_num_cpu_test.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_DEPTHZ.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_add_nnc.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_case.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_cell_contains.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_cell_contains_wellpath.c (65%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_cell_volume.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_copy.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_copy_statoil.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_corner.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_create.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_dims.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_export.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_fwrite.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_init_fwrite.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_layer_contains.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_lgr_name.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_reset_actnum.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_simple.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_grid_volume.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_init_file.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_kw_cmp_string.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_kw_equal.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_kw_fread.c (57%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_kw_grdecl.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_kw_init.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_layer.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_layer_statoil.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_lfs.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_lgr_name.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_lgr_test.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_nnc_export.c (97%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_nnc_export_get_tran.c (99%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_nnc_geometry.c (56%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_nnc_index_list.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_nnc_index_list_grid.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_nnc_info_test.c (100%) create mode 100644 ThirdParty/Ert/lib/ecl/tests/ecl_nnc_pair.c rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_nnc_test.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_nnc_vector.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_region.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_region2region_test.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_restart_test.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_rft.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_rft_cell.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_rst_file.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_rsthead.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_smspec.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_sum_case_exists.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_sum_report_step_compatible.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_sum_report_step_equal.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_sum_test.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_sum_writer.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_util_make_date_no_shift.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_util_make_date_shift.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_util_month_range.c (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/ecl_valid_basename.c (100%) rename ThirdParty/Ert/{libeclxx => lib/ecl}/tests/eclxx_filename.cpp (100%) rename ThirdParty/Ert/{libeclxx => lib/ecl}/tests/eclxx_fortio.cpp (100%) rename ThirdParty/Ert/{libeclxx => lib/ecl}/tests/eclxx_kw.cpp (100%) rename ThirdParty/Ert/{libeclxx => lib/ecl}/tests/eclxx_smspec.cpp (96%) rename ThirdParty/Ert/{libeclxx => lib/ecl}/tests/eclxx_types.cpp (100%) rename ThirdParty/Ert/{libecl => lib/ecl}/tests/rft_test.c (100%) create mode 100644 ThirdParty/Ert/lib/ecl/tests/test_ecl_nnc_data.c create mode 100644 ThirdParty/Ert/lib/ecl/tests/test_ecl_nnc_data_statoil_root.c rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_branch_collection.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_conn.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_conn_CF.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_conn_collection.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_conn_load.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_dualp.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_info.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_lgr_load.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_segment.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_segment_branch_conn_load.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_segment_collection.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_segment_conn.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_segment_conn_load.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_segment_load.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_state.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_state_load.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_state_load_missing_RSEG.c (100%) rename ThirdParty/Ert/{libecl_well => lib/ecl}/tests/well_ts.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_branch_collection.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_conn.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_conn_collection.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_info.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_rseg_loader.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_segment.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_segment_collection.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_state.c (100%) rename ThirdParty/Ert/{libecl_well/src => lib/ecl}/well_ts.c (100%) rename ThirdParty/Ert/{libert_util/include/ert/util => lib}/ert_api_config.h.in (100%) rename ThirdParty/Ert/{libgeometry/src => lib/geometry}/geo_pointset.c (100%) rename ThirdParty/Ert/{libgeometry/src => lib/geometry}/geo_polygon.c (100%) rename ThirdParty/Ert/{libgeometry/src => lib/geometry}/geo_polygon_collection.c (100%) rename ThirdParty/Ert/{libgeometry/src => lib/geometry}/geo_region.c (100%) rename ThirdParty/Ert/{libgeometry/src => lib/geometry}/geo_surface.c (100%) rename ThirdParty/Ert/{libgeometry/src => lib/geometry}/geo_util.c (100%) rename ThirdParty/Ert/{libgeometry => lib/geometry}/tests/geo_polygon.c (100%) rename ThirdParty/Ert/{libgeometry => lib/geometry}/tests/geo_polygon_collection.c (100%) rename ThirdParty/Ert/{libgeometry => lib/geometry}/tests/geo_surface.c (100%) rename ThirdParty/Ert/{libgeometry => lib/geometry}/tests/geo_util_xlines.c (100%) rename ThirdParty/Ert/{libeclxx => lib}/include/ert/ecl/EclFilename.hpp (100%) rename ThirdParty/Ert/{libeclxx => lib}/include/ert/ecl/EclKW.hpp (100%) rename ThirdParty/Ert/{libeclxx => lib}/include/ert/ecl/FortIO.hpp (100%) rename ThirdParty/Ert/{libeclxx => lib}/include/ert/ecl/Smspec.hpp (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_box.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_coarse_cell.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_endian_flip.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_file.h (98%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_file_kw.h (100%) create mode 100644 ThirdParty/Ert/lib/include/ert/ecl/ecl_file_view.h rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_grav.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_grav_calc.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_grav_common.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_grid.h (99%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_grid_cache.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_grid_dims.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_init_file.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_io_config.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_kw.h (99%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_kw_grdecl.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_kw_magic.h (97%) create mode 100644 ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_data.h rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_nnc_export.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_nnc_geometry.h (92%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_region.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_rft_cell.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_rft_file.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_rft_node.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_rst_file.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_rsthead.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_smspec.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_subsidence.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_sum.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_sum_data.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_sum_index.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_sum_tstep.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_sum_vector.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_type.h (86%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_units.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/ecl_util.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/fault_block.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/fault_block_layer.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/fortio.h (97%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/grid_dims.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/layer.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/nnc_info.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/nnc_vector.h (100%) rename ThirdParty/Ert/{libecl => lib}/include/ert/ecl/smspec_node.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_branch_collection.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_conn.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_conn_collection.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_const.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_info.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_rseg_loader.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_segment.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_segment_collection.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_state.h (100%) rename ThirdParty/Ert/{libecl_well => lib}/include/ert/ecl_well/well_ts.h (100%) rename ThirdParty/Ert/{libgeometry => lib}/include/ert/geometry/geo_pointset.h (100%) rename ThirdParty/Ert/{libgeometry => lib}/include/ert/geometry/geo_polygon.h (100%) rename ThirdParty/Ert/{libgeometry => lib}/include/ert/geometry/geo_polygon_collection.h (100%) rename ThirdParty/Ert/{libgeometry => lib}/include/ert/geometry/geo_region.h (100%) rename ThirdParty/Ert/{libgeometry => lib}/include/ert/geometry/geo_surface.h (100%) rename ThirdParty/Ert/{libgeometry => lib}/include/ert/geometry/geo_util.h (100%) rename ThirdParty/Ert/{libert_utilxx => lib}/include/ert/util/TestArea.hpp (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/arg_pack.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/atomic.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/block_fs.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/buffer.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/buffer_string.h (100%) rename ThirdParty/Ert/{libert_utilxx => lib}/include/ert/util/ert_unique_ptr.hpp (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/ert_version.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/hash.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/hash_node.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/hash_sll.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/lars.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/log.h (75%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/lookup_table.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/matrix.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/matrix_blas.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/matrix_lapack.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/matrix_stat.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/menu.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/msg.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/msvc_stdbool.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/mzran.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/node_ctype.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/node_data.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/parser.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/path_fmt.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/path_stack.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/perm_vector.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/regression.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/rng.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/set.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/ssize_t.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/statistics.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/stepwise.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/string_util.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/stringlist.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/struct_vector.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/subst_func.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/subst_list.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/template.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/test_util.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/test_util.hpp (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/test_work_area.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/thread_pool.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/thread_pool1.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/time_interval.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/timer.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/type_macros.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/type_vector_functions.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/ui_return.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/util.h (99%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/util_endian.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/util_env.h (100%) rename ThirdParty/Ert/{libert_util => lib}/include/ert/util/vector.h (100%) rename ThirdParty/Ert/{libert_utilxx/src => lib/util}/TestArea.cpp (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/arg_pack.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/block_fs.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/buffer.c (84%) rename ThirdParty/Ert/{libert_util/src => lib/util}/config_test_input (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/dependencies (100%) create mode 100644 ThirdParty/Ert/lib/util/ert/util/template_type.h rename ThirdParty/Ert/{libert_util/src => lib/util}/ert_version.c (77%) rename ThirdParty/Ert/{libert_util/src => lib/util}/hash.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/hash_node.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/hash_sll.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/lars.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/log.c (91%) rename ThirdParty/Ert/{libert_util/src => lib/util}/lookup_table.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/matrix.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/matrix_blas.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/matrix_lapack.c (99%) rename ThirdParty/Ert/{libert_util/src => lib/util}/matrix_stat.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/menu.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/msg.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/mzran.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/node_ctype.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/node_data.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/parser.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/path_fmt.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/path_stack.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/perm_vector.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/readme.overview (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/regression.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/rng.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/set.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/statistics.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/stepwise.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/string_util.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/stringlist.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/struct_vector.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/subst_func.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/subst_list.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/template.c (84%) rename ThirdParty/Ert/{libert_util/src => lib/util}/template_loop.c (91%) rename ThirdParty/Ert/{libert_util/src => lib/util}/test_util.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/test_work_area.c (99%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/data/file1.txt (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/data/file2.txt (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/data2/dir2/file4 (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/data2/file1 (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/data2/file2 (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/data2/file3 (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_PATH_test.c (81%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_abort_gnu_tests.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_addr2line.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_alloc_file_components.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_approx_equal.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_arg_pack.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_before_after.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_binary_split.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_block_fs.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_buffer.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_clamp.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_copy_file.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_cwd_test.c (100%) create mode 100644 ThirdParty/Ert/lib/util/tests/ert_util_datetime.c rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_file_readable.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_filename.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_hash_test.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_logh.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_matrix.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_matrix_lapack.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_matrix_stat.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_parent_path.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_path_stack_test.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_ping.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_realpath.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_relpath_test.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_rng.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_spawn.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_sprintf_escape.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_sscan_test.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_statistics.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_strcat_test.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_string_util.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_stringlist_test.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_strstr_int_format.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_struct_vector.c (96%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_subst_list.c (100%) rename ThirdParty/Ert/{libert_utilxx => lib/util}/tests/ert_util_test_area_xx.cpp (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_time_interval.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_type_vector_functions.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_type_vector_test.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_ui_return.c (100%) rename ThirdParty/Ert/{libert_utilxx => lib/util}/tests/ert_util_unique_ptr.cpp (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_vector_test.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/ert_util_work_area.c (100%) rename ThirdParty/Ert/{libert_util => lib/util}/tests/test_thread_pool.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/thread_pool.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/thread_pool1.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/thread_pool_posix.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/time_interval.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/timer.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/type_vector_functions.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/ui_return.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util.c (94%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_abort_gnu.c (94%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_abort_simple.c (89%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_endian.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_env.c (99%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_getuid.c (96%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_lfs.c (99%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_lockf.c (95%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_opendir.c (97%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_spawn.c (91%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_symlink.c (89%) rename ThirdParty/Ert/{libert_util/src => lib/util}/util_zlib.c (98%) rename ThirdParty/Ert/{libert_util/src => lib/util}/vector.c (100%) rename ThirdParty/Ert/{libert_util/src => lib/util}/vector_template.c (100%) rename ThirdParty/Ert/{libert_util/include/ert/util/vector_template.h => lib/vector_template.h.in} (100%) delete mode 100644 ThirdParty/Ert/libecl/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libecl/applications/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libecl/applications/link_static.sh delete mode 100644 ThirdParty/Ert/libecl/include/ert/ecl/ecl_file_view.h delete mode 100644 ThirdParty/Ert/libecl/src/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libecl/src/ecl_file_deprecated.c delete mode 100644 ThirdParty/Ert/libecl/src/ecl_rstfile.c delete mode 100644 ThirdParty/Ert/libecl/tests/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libecl/tests/statoil_tests.cmake delete mode 100644 ThirdParty/Ert/libecl/tests/tests.cmake delete mode 100644 ThirdParty/Ert/libecl_well/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libecl_well/applications/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libecl_well/src/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libecl_well/tests/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libecl_well/tests/statoil_tests.cmake delete mode 100644 ThirdParty/Ert/libecl_well/tests/tests.cmake delete mode 100644 ThirdParty/Ert/libeclxx/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libeclxx/src/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libeclxx/tests/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_util/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_util/applications/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_util/applications/block_fs/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_util/include/ert/util/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_util/src/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_util/src/buffer_string.c delete mode 100644 ThirdParty/Ert/libert_util/src/buffer_zlib.c delete mode 100644 ThirdParty/Ert/libert_util/src/util_chdir.c delete mode 100644 ThirdParty/Ert/libert_util/src/util_path.c delete mode 100644 ThirdParty/Ert/libert_util/tests/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_utilxx/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_utilxx/src/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libert_utilxx/tests/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libgeometry/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libgeometry/src/CMakeLists.txt delete mode 100644 ThirdParty/Ert/libgeometry/tests/CMakeLists.txt delete mode 100644 ThirdParty/Ert/python/python/bin/CMakeLists.txt delete mode 100644 ThirdParty/Ert/python/python/bin/ert_tcp_server delete mode 100644 ThirdParty/Ert/python/python/bin/ert_upgrade_fs107 delete mode 100644 ThirdParty/Ert/python/python/bin/ertshell create mode 100644 ThirdParty/Ert/python/python/legacy/ert/CMakeLists.txt create mode 100644 ThirdParty/Ert/python/python/legacy/ert/__init__.py create mode 100644 ThirdParty/Ert/python/python/legacy/ert/ecl/__init__.py create mode 100644 ThirdParty/Ert/python/python/legacy/ert/ecl/faults/__init__.py create mode 100644 ThirdParty/Ert/python/python/legacy/ert/geo/__init__.py create mode 100644 ThirdParty/Ert/python/python/legacy/ert/test/__init__.py create mode 100644 ThirdParty/Ert/python/python/legacy/ert/util/__init__.py create mode 100644 ThirdParty/Ert/python/python/legacy/ert/well/__init__.py create mode 100644 ThirdParty/Ert/python/tests/ecl/test_fk_user_data.py create mode 100644 ThirdParty/Ert/python/tests/ecl/test_grid_generator.py create mode 100644 ThirdParty/Ert/python/tests/install/test_install.py create mode 100644 ThirdParty/Ert/python/tests/legacy/CMakeLists.txt create mode 100644 ThirdParty/Ert/python/tests/legacy/__init__.py create mode 100644 ThirdParty/Ert/python/tests/legacy/test_ecl.py create mode 100644 ThirdParty/Ert/python/tests/legacy/test_geo.py create mode 100644 ThirdParty/Ert/python/tests/legacy/test_test.py create mode 100644 ThirdParty/Ert/python/tests/legacy/test_util.py create mode 100644 ThirdParty/Ert/python/tests/legacy/test_well.py create mode 100644 ThirdParty/Ert/python/tests/test_install.in create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal1.EGRID create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal1.txt create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal2.EGRID create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal2.txt create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal3.EGRID create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal3.txt create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal4.EGRID create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal4.txt create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal5.EGRID create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal5.txt create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal6.EGRID create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal6.txt create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal7.EGRID create mode 100644 ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal7.txt diff --git a/ThirdParty/Ert/.github/PULL_REQUEST_TEMPLATE.md b/ThirdParty/Ert/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..85c76997e0 --- /dev/null +++ b/ThirdParty/Ert/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +**Task** +_Short description of the task_ + + +**Approach** +_Short description of the approach_ + + +**Pre un-WIP checklist** +- [ ] Statoil tests pass locally +- [ ] Have completed graphical integration test steps diff --git a/ThirdParty/Ert/.travis.yml b/ThirdParty/Ert/.travis.yml index 81671386ce..dfcf1b0442 100644 --- a/ThirdParty/Ert/.travis.yml +++ b/ThirdParty/Ert/.travis.yml @@ -1,7 +1,16 @@ -dist: trusty -sudo: false language: c +matrix: + fast_finish: true + include: + - os: osx + osx_image: xcode7.3 + compiler: clang + - os: linux + sudo: false + compiler: gcc + dist: trusty + addons: apt: sources: @@ -11,6 +20,9 @@ addons: - valgrind - gcc-4.8 - g++-4.8 + - clang + - cmake + - cmake-data env: global: @@ -18,7 +30,18 @@ env: install: - if [[ "$CC" == "gcc" ]]; then export CXX="g++-4.8"; fi -- wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + export CONDA_OS=MacOSX; + else + export CONDA_OS=Linux; + fi +- export TRAVIS_PYTHON_VERSION="2.7" +# We do this conditionally because it saves us some downloading if the version is the same. +- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then + wget https://repo.continuum.io/miniconda/Miniconda2-latest-${CONDA_OS}-x86_64.sh -O miniconda.sh; + else + wget https://repo.continuum.io/miniconda/Miniconda3-latest-${CONDA_OS}-x86_64.sh -O miniconda.sh; + fi - bash miniconda.sh -b -p $HOME/miniconda - export CONDA_HOME="$HOME/miniconda" - export PATH="$CONDA_HOME/bin:$PATH" @@ -29,10 +52,7 @@ install: - conda install pylint numpy pandas before_script: -- mkdir build -- cd build -- cmake -DBUILD_TESTS=ON -DBUILD_PYTHON=ON -DERT_BUILD_CXX=ON -DBUILD_APPLICATIONS=ON .. + - wget https://raw.githubusercontent.com/Statoil/ert/master/travis/build_total.py script: -- make -- ctest --output-on-failure -E ert_util_ping + - python build_total.py ecl diff --git a/ThirdParty/Ert/CMakeLists.txt b/ThirdParty/Ert/CMakeLists.txt index cb4d90eb8f..500b0adecf 100644 --- a/ThirdParty/Ert/CMakeLists.txt +++ b/ThirdParty/Ert/CMakeLists.txt @@ -1,6 +1,8 @@ -cmake_minimum_required( VERSION 2.8 ) +cmake_minimum_required( VERSION 2.8.12 ) project( ERT C CXX ) +include(GNUInstallDirs) + if(POLICY CMP0042) cmake_policy(SET CMP0042 OLD) endif() @@ -19,15 +21,13 @@ set( ERT_VERSION_MICRO git ) # with "new in Ert Version X.X.X"! option( BUILD_TESTS "Should the tests be built" OFF) option( BUILD_APPLICATIONS "Should we build small utility applications" OFF) option( BUILD_ECL_SUMMARY "Build the commandline application ecl_summary" OFF) -option( BUILD_PYTHON "Run py_compile on the python wrappers" ON ) +option( BUILD_PYTHON "Run py_compile on the python wrappers" OFF) option( BUILD_SHARED_LIBS "Build shared libraries" ON ) -option( INSTALL_ERT "Should anything be installed when issuing make install?" ON ) option( ERT_USE_OPENMP "Use OpenMP" OFF ) -option( ERT_DOC "Build ERT documantation" OFF) +option( RST_DOC "Build RST documentation" OFF) option( ERT_BUILD_CXX "Build some CXX wrappers" ON) - - - +option( USE_RPATH "Don't strip RPATH from libraries and binaries" OFF) +option( INSTALL_ERT_LEGACY "Add ert legacy wrappers" OFF) set(STATOIL_TESTDATA_ROOT "" CACHE PATH "Root to Statoil internal testdata") @@ -39,12 +39,22 @@ if (EXISTS ${STATOIL_TESTDATA_ROOT}) EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink "${STATOIL_TESTDATA_ROOT}" "${LINK}") message(STATUS "Linking testdata: ${LINK} -> ${STATOIL_TESTDATA_ROOT}") + + set(_statoil_test_data ${CMAKE_SOURCE_DIR}/test-data/Statoil) + set(_eclpath ${_statoil_test_data}/ECLIPSE) + set(_geopath ${_statoil_test_data}/Geometry) endif() +# output libs to some lib/ path for testing +set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin) + +if (USE_RPATH) + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +endif () -include( CheckFunctionExists ) -include( CheckTypeSize ) ENABLE_TESTING() if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -66,7 +76,7 @@ endif() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") - set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" @@ -84,90 +94,221 @@ if (MSVC) endif() -if (ERT_USE_OPENMP) - find_package(OpenMP) - if (OPENMP_FOUND) - message(STATUS "Enabling OpenMP support") - # The actual use of OpenMP is only in the libecl library - the compile flags is only applied there. - else() - set( ERT_USE_OPENMP OFF ) - message(STATUS "OpenMP package not found - OpenMP disabled") - endif() -endif() - list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) find_package(CXX11Features) +#----------------------------------------------------------------- +# create targets for (required and optional) dependencies to link to + +find_package(OpenMP) +if (NOT OPENMP_FOUND) + message(STATUS "OpenMP package not found") + set(ERT_USE_OPENMP OFF) +endif () + +if (NOT ERT_USE_OPENMP) + message(STATUS "OpenMP disabled") +endif () + +# when cmake can be upgraded to >= 3.0, dependencies should be implemented +# either via target-providing FindLib.cmake: +# ``` +# find_package(Threads) +# target_link_libraries(lib Threads::Threads) +# ``` +# +# or via INTERFACE libraries: +# add_library(m INTERFACE) +# find_library(M_LIBRARY NAMES m) +# if (M_LIBRARY) +# target_link_libraries(m ${M_LIBRARY}) +# endif () +# target_link_libraries(m ${M_LIBRARY}) +# +# These targets can then be exported along with targets provided by this +# project. Linking against cmake interface targets will handle include +# directories better than raw names given to target_link_libraries + +set(CMAKE_THREAD_PREFER_PTHREAD ON) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads) +if (CMAKE_USE_PTHREADS_INIT) + set(HAVE_PTHREAD TRUE) + set(ERT_HAVE_THREAD_POOL ON) + + set(pthread "${CMAKE_THREAD_LIBS_INIT}") + + if (THREADS_HAVE_PTHREAD_ARG) + set(pthreadarg "-pthread") + endif () +endif () + +set(dl "${CMAKE_DL_LIBS}") + +find_library(M_LIBRARY NAMES m) +if(M_LIBRARY) + set(m m) +endif () + +find_package(BLAS) +if (BLAS_FOUND) + set(blas "${BLAS_LIBRARIES}") +endif () + +set(ERT_HAVE_LAPACK OFF) +find_package(LAPACK) +if (LAPACK_FOUND) + set(ERT_HAVE_LAPACK ON) + list(APPEND lapack ${LAPACK_LIBRARIES} ${LAPACK_LINKER_FLAGS}) +endif() + +find_package(ZLIB) +if (ZLIB_FOUND) + set(ERT_HAVE_ZLIB ON) + set(zlib "${ZLIB_LIBRARIES}") +endif () + +find_library(SHLWAPI_LIBRARY NAMES Shlwapi) +if (SHLWAPI_LIBRARY) + set(shlwapi ${SHLWAPI_LIBRARY}) +endif () #----------------------------------------------------------------- -# Checking based on compiling. Some of the code generates warnings, so we just cut down to bare-bone compiler flags. +# feature tests +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckSymbolExists) +include(CheckTypeSize) -set( CMAKE_C_FLAGS_main ${CMAKE_C_FLAGS} ) -set( CMAKE_CXX_FLAGS_main ${CMAKE_CXX_FLAGS} ) +check_function_exists( chdir HAVE_POSIX_CHDIR ) +check_function_exists( _chdir HAVE_WINDOWS_CHDIR ) +check_function_exists( chmod HAVE_CHMOD ) +check_function_exists( fnmatch HAVE_FNMATCH ) +check_function_exists( fork HAVE_FORK ) +check_function_exists( fseeko HAVE_FSEEKO ) +check_function_exists( fsync HAVE_FSYNC ) +check_function_exists( ftruncate HAVE_FTRUNCATE ) +check_function_exists( getcwd HAVE_POSIX_GETCWD) +check_function_exists( _getcwd HAVE_WINDOWS_GETCWD) +check_function_exists( getpwuid HAVE_GETPWUID ) +check_function_exists( GetTempPath HAVE_WINDOWS_GET_TEMP_PATH ) +check_function_exists( getuid ERT_HAVE_GETUID ) +check_function_exists( glob ERT_HAVE_GLOB ) +check_function_exists( gmtime_r HAVE_GMTIME_R ) +check_function_exists( localtime_r HAVE_LOCALTIME_R ) +check_function_exists( lockf ERT_HAVE_LOCKF ) +check_function_exists( mkdir HAVE_POSIX_MKDIR) +check_function_exists( _mkdir HAVE_WINDOWS_MKDIR) +check_function_exists( opendir ERT_HAVE_OPENDIR ) +check_function_exists( posix_spawn ERT_HAVE_SPAWN ) +check_function_exists( pthread_timedjoin_np HAVE_TIMEDJOIN) +check_function_exists( pthread_yield HAVE_YIELD) +check_function_exists( pthread_yield_np HAVE_YIELD_NP) +check_function_exists( readlinkat ERT_HAVE_READLINKAT ) +check_function_exists( realpath HAVE_REALPATH ) +check_function_exists( regexec ERT_HAVE_REGEXP ) +check_function_exists( round HAVE_ROUND ) +check_function_exists( setenv HAVE_POSIX_SETENV ) +check_function_exists( symlink ERT_HAVE_SYMLINK ) +check_function_exists( timegm HAVE_TIMEGM ) +check_function_exists( usleep HAVE__USLEEP ) -if (NOT ERT_WINDOWS) - set( CMAKE_C_FLAGS_main "${CMAKE_C_FLAGS} -std=gnu99" ) +check_symbol_exists(_tzname time.h HAVE_WINDOWS_TZNAME) +check_symbol_exists( tzname time.h HAVE_TZNAME) + +check_include_file(execinfo.h HAVE_EXECINFO) +check_include_file(getopt.h ERT_HAVE_GETOPT) +check_include_file(unistd.h ERT_HAVE_UNISTD) + +check_type_size(time_t SIZE_OF_TIME_T) +if (${SIZE_OF_TIME_T} EQUAL 8) + try_run(RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_mktime_before1970.c) + if (${COMPILE_RESULT}) + if (${RUN_RESULT} EQUAL 0) + set( ERT_TIME_T_64BIT_ACCEPT_PRE1970 ON ) + endif() + endif() endif() -set( ERT_EXTERNAL_UTIL_LIBS "" ) -include(cmake/ert_build_check.cmake) -include(cmake/ert_api_check.cmake) -include(cmake/ert_lib_check.cmake) +try_compile( HAVE_VA_COPY ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_va_copy.c ) +try_compile( HAVE_SIGBUS ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_have_sigbus.c ) +try_compile( HAVE_PID_T ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_pid_t.c ) +try_compile( HAVE_MODE_T ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_mode_t.c ) +try_compile( ERT_HAVE_ISFINITE ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_isfinite.c) -set( CMAKE_C_FLAGS ${CMAKE_C_FLAGS_main} ) -set( CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_main} ) +set( BUILD_CXX ON ) +try_compile( HAVE_CXX_SHARED_PTR ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_shared_ptr.cpp ) +if (NOT HAVE_CXX_SHARED_PTR) + set( BUILD_CXX OFF ) +endif() -include(cmake/Modules/UseMultiArch.cmake) -include(cmake/ert_link.cmake) +if (HAVE_FORK AND HAVE_PTHREAD AND HAVE_EXECINFO AND HAVE_GETPWUID) + set( HAVE_UTIL_ABORT_INTERCEPT ON) + set( HAVE_BACKTRACE ON) +endif() + +if (ERT_WINDOWS) + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set( ERT_WINDOWS_LFS ON ) + endif() +endif() + +find_program(PING_PATH NAMES ping) +if (PING_PATH) + set(ERT_HAVE_PING ON) +endif() + +find_package(Git) +if(GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_SHORT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +else() + set( GIT_COMMIT "unknown (git not found!)") + set( GIT_COMMIT_SHORT "unknown (git not found!)") + message( WARNING "Git not found. Build will not contain git revision info." ) +endif() + +if (ERT_WINDOWS) + execute_process(COMMAND cmd.exe /c "echo %date% %time%" OUTPUT_VARIABLE BUILD_TIME) +else() # Linux or Darwin + execute_process(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE BUILD_TIME) +endif() +string(STRIP ${BUILD_TIME} BUILD_TIME) #----------------------------------------------------------------- set(INSTALL_GROUP "" CACHE STRING "Group to install as - blank to install as current group") -set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin) - - if (MSVC) add_definitions( -D__func__="\\"????\\"") endif() +if (ERT_WINDOWS) + message(WARNING "Python is not supported on Windows") + set( BUILD_PYTHON OFF ) +endif () + if (ERT_LINUX) - set( NEED_LIBM TRUE ) - set( LINK_STATIC FALSE ) add_definitions( -DHAVE_PROC ) -else() - set( NEED_LIBM FALSE ) - set( LINK_STATIC TRUE ) endif() -include_directories( ${PROJECT_SOURCE_DIR}/libert_util/include ) -include_directories( ${PROJECT_BINARY_DIR}/libert_util/include ) -if (MSVC) - include_directories( ${PROJECT_BINARY_DIR}/libert_util/include/ert/util ) -endif() -add_subdirectory( libert_util ) +add_subdirectory( lib ) +add_subdirectory( applications ) -include_directories( ${PROJECT_SOURCE_DIR}/libgeometry/include ) -add_subdirectory( libgeometry ) - -include_directories( ${PROJECT_SOURCE_DIR}/libecl/include ) -add_subdirectory( libecl ) - -if (ERT_BUILD_CXX) - include_directories( ${PROJECT_SOURCE_DIR}/libert_utilxx/include ) - include_directories( ${PROJECT_SOURCE_DIR}/libeclxx/include ) - - add_subdirectory( libert_utilxx ) - add_subdirectory( libeclxx ) -endif() - -include_directories( ${PROJECT_SOURCE_DIR}/libecl_well/include ) -add_subdirectory( libecl_well ) - if (BUILD_PYTHON) if (ERT_WINDOWS) message(WARNING "Python is not supported on Windows") @@ -178,7 +319,7 @@ if (BUILD_PYTHON) # will be set to OFF. add_subdirectory( python ) - if(ERT_DOC) + if(RST_DOC) add_subdirectory( docs ) endif() endif() @@ -190,10 +331,6 @@ if (BUILD_PYTHON) endif() endif() - - -configure_file( cmake/libecl-config.cmake.in libecl-config.cmake @ONLY) -configure_file( cmake/libecl-config-version.cmake.in libecl-config-version.cmake @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libecl-config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/libecl-config-version.cmake - DESTINATION lib/libecl ) +install(EXPORT ecl-config DESTINATION share/cmake/ecl) +export(TARGETS ecl FILE eclConfig.cmake) +export(PACKAGE ecl) diff --git a/ThirdParty/Ert/applications/CMakeLists.txt b/ThirdParty/Ert/applications/CMakeLists.txt new file mode 100644 index 0000000000..bc6d65b81b --- /dev/null +++ b/ThirdParty/Ert/applications/CMakeLists.txt @@ -0,0 +1,87 @@ +project(libecl-applications) + +if (NOT BUILD_APPLICATIONS) + return () +endif () + +add_executable(sum_write ecl/sum_write.c) +add_executable(make_grid ecl/make_grid.c) +add_executable(grdecl_grid ecl/grdecl_grid.c) +add_executable(summary ecl/view_summary.c) +target_link_libraries(sum_write ecl) +target_link_libraries(make_grid ecl) +target_link_libraries(grdecl_grid ecl) +target_link_libraries(summary ecl) + +list(APPEND apps make_grid grdecl_grid summary) + +foreach (app ecl_pack + ecl_unpack + kw_extract + grid_info + grid_dump + grid_dump_ascii + select_test + load_test + ) + add_executable(${app} ecl/${app}.c) + target_link_libraries(${app} ecl) + list(APPEND apps ${app}) + if (ERT_LINUX) + # The stupid .x extension creates problems on windows + set_target_properties(${app} PROPERTIES SUFFIX ".x") + endif () +endforeach () + + +if (ERT_LINUX) + foreach (app convert esummary grdecl_test kw_list) + add_executable(${app} ecl/${app}.c) + target_link_libraries(${app} ecl) + # The stupid .x extension creates problems on windows + set_target_properties(${app} PROPERTIES SUFFIX ".x") + list(APPEND apps ${app}) + endforeach () + + set_target_properties(summary PROPERTIES SUFFIX ".x") +endif () + + +# This minor eclipse application depends on the config parser library +# and should be moved to the libres repository - it can not be +# built here. +if (BUILD_ERT) + add_executable( ecl_quantile ecl/ecl_quantile.c ) + target_link_libraries( ecl_quantile config ) + list(APPEND apps ecl_quantile) +endif() + +if (BUILD_ECL_SUMMARY) + add_executable(ecl_summary ecl/view_summary.c) + target_link_libraries(ecl_summary ecl) + list(APPEND apps ecl_summary) + + install(FILES ${PROJECT_SOURCE_DIR}/man/man1/ecl_summary.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +endif() + +if (PTHREAD_LIBRARY) + add_executable(bls block_fs/bls.c) + target_link_libraries(bls ecl) + list(APPEND apps bls) +endif () + +add_executable(segment_info well/segment_info.c) +add_executable(CF_dump well/well_CF_dump.c) +add_executable(ri_well_test well/ri_well_test.c) + +target_link_libraries(segment_info ecl) +target_link_libraries(CF_dump ecl) +target_link_libraries(ri_well_test ecl) + +list(APPEND apps segment_info CF_dump ri_well_test) + +install(TARGETS ${apps} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/ThirdParty/Ert/libert_util/applications/block_fs/bcp.c b/ThirdParty/Ert/applications/block_fs/bcp.c similarity index 100% rename from ThirdParty/Ert/libert_util/applications/block_fs/bcp.c rename to ThirdParty/Ert/applications/block_fs/bcp.c diff --git a/ThirdParty/Ert/libert_util/applications/block_fs/bfs_extract.c b/ThirdParty/Ert/applications/block_fs/bfs_extract.c similarity index 100% rename from ThirdParty/Ert/libert_util/applications/block_fs/bfs_extract.c rename to ThirdParty/Ert/applications/block_fs/bfs_extract.c diff --git a/ThirdParty/Ert/libert_util/applications/block_fs/block_fs_test.c b/ThirdParty/Ert/applications/block_fs/block_fs_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/applications/block_fs/block_fs_test.c rename to ThirdParty/Ert/applications/block_fs/block_fs_test.c diff --git a/ThirdParty/Ert/libert_util/applications/block_fs/bls.c b/ThirdParty/Ert/applications/block_fs/bls.c similarity index 100% rename from ThirdParty/Ert/libert_util/applications/block_fs/bls.c rename to ThirdParty/Ert/applications/block_fs/bls.c diff --git a/ThirdParty/Ert/libert_util/applications/block_fs/brm.c b/ThirdParty/Ert/applications/block_fs/brm.c similarity index 100% rename from ThirdParty/Ert/libert_util/applications/block_fs/brm.c rename to ThirdParty/Ert/applications/block_fs/brm.c diff --git a/ThirdParty/Ert/libert_util/applications/block_fs/brot.c b/ThirdParty/Ert/applications/block_fs/brot.c similarity index 100% rename from ThirdParty/Ert/libert_util/applications/block_fs/brot.c rename to ThirdParty/Ert/applications/block_fs/brot.c diff --git a/ThirdParty/Ert/libecl/applications/convert.c b/ThirdParty/Ert/applications/ecl/convert.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/convert.c rename to ThirdParty/Ert/applications/ecl/convert.c diff --git a/ThirdParty/Ert/libecl/applications/ecl_pack.c b/ThirdParty/Ert/applications/ecl/ecl_pack.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/ecl_pack.c rename to ThirdParty/Ert/applications/ecl/ecl_pack.c diff --git a/ThirdParty/Ert/libecl/applications/ecl_quantile.c b/ThirdParty/Ert/applications/ecl/ecl_quantile.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/ecl_quantile.c rename to ThirdParty/Ert/applications/ecl/ecl_quantile.c diff --git a/ThirdParty/Ert/libecl/applications/ecl_unpack.c b/ThirdParty/Ert/applications/ecl/ecl_unpack.c similarity index 92% rename from ThirdParty/Ert/libecl/applications/ecl_unpack.c rename to ThirdParty/Ert/applications/ecl/ecl_unpack.c index 409d989c1f..71c6f3492d 100644 --- a/ThirdParty/Ert/libecl/applications/ecl_unpack.c +++ b/ThirdParty/Ert/applications/ecl/ecl_unpack.c @@ -72,13 +72,13 @@ void unpack_file(const char * filename) { break; if (target_type == ECL_SUMMARY_FILE) { - active_view = ecl_file_alloc_global_blockview(src_file, SEQHDR_KW, block_index); + active_view = ecl_file_get_global_blockview(src_file, SEQHDR_KW, block_index); report_step += 1; offset = 0; } else { ecl_kw_type * seqnum_kw; - active_view = ecl_file_alloc_global_blockview(src_file, SEQNUM_KW, block_index); - seqnum_kw = ecl_file_iget_named_kw( src_file , SEQNUM_KW , 0); + active_view = ecl_file_get_global_blockview(src_file, SEQNUM_KW, block_index); + seqnum_kw = ecl_file_view_iget_named_kw( active_view , SEQNUM_KW , 0); report_step = ecl_kw_iget_int( seqnum_kw , 0); offset = 1; } @@ -100,7 +100,6 @@ void unpack_file(const char * filename) { free(target_file); } block_index++; - ecl_file_view_free( active_view ); } ecl_file_close( src_file ); util_safe_free(path); diff --git a/ThirdParty/Ert/libecl/applications/esummary.c b/ThirdParty/Ert/applications/ecl/esummary.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/esummary.c rename to ThirdParty/Ert/applications/ecl/esummary.c diff --git a/ThirdParty/Ert/libecl/applications/grdecl_grid.c b/ThirdParty/Ert/applications/ecl/grdecl_grid.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/grdecl_grid.c rename to ThirdParty/Ert/applications/ecl/grdecl_grid.c diff --git a/ThirdParty/Ert/libecl/applications/grdecl_test.c b/ThirdParty/Ert/applications/ecl/grdecl_test.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/grdecl_test.c rename to ThirdParty/Ert/applications/ecl/grdecl_test.c diff --git a/ThirdParty/Ert/libecl/applications/grid_dump.c b/ThirdParty/Ert/applications/ecl/grid_dump.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/grid_dump.c rename to ThirdParty/Ert/applications/ecl/grid_dump.c diff --git a/ThirdParty/Ert/libecl/applications/grid_dump_ascii.c b/ThirdParty/Ert/applications/ecl/grid_dump_ascii.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/grid_dump_ascii.c rename to ThirdParty/Ert/applications/ecl/grid_dump_ascii.c diff --git a/ThirdParty/Ert/libecl/applications/grid_info.c b/ThirdParty/Ert/applications/ecl/grid_info.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/grid_info.c rename to ThirdParty/Ert/applications/ecl/grid_info.c diff --git a/ThirdParty/Ert/libecl/applications/grid_layer.c b/ThirdParty/Ert/applications/ecl/grid_layer.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/grid_layer.c rename to ThirdParty/Ert/applications/ecl/grid_layer.c diff --git a/ThirdParty/Ert/libecl/applications/key_list.c b/ThirdParty/Ert/applications/ecl/key_list.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/key_list.c rename to ThirdParty/Ert/applications/ecl/key_list.c diff --git a/ThirdParty/Ert/libecl/applications/kw_extract.c b/ThirdParty/Ert/applications/ecl/kw_extract.c similarity index 97% rename from ThirdParty/Ert/libecl/applications/kw_extract.c rename to ThirdParty/Ert/applications/ecl/kw_extract.c index 04256d7979..a578b5abfa 100644 --- a/ThirdParty/Ert/libecl/applications/kw_extract.c +++ b/ThirdParty/Ert/applications/ecl/kw_extract.c @@ -65,7 +65,7 @@ int main(int argc, char ** argv) { { ecl_kw_type * ecl_kw = ecl_kw_alloc_empty(); while (true) { - if (ecl_kw_fread_header( ecl_kw , fortio_src )) { + if (ecl_kw_fread_header( ecl_kw , fortio_src ) == ECL_KW_READ_OK) { const char * header = ecl_kw_get_header( ecl_kw ); if (set_has_key( kw_set , header )) { ecl_kw_fread_realloc_data(ecl_kw , fortio_src ); diff --git a/ThirdParty/Ert/libecl/applications/kw_list.c b/ThirdParty/Ert/applications/ecl/kw_list.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/kw_list.c rename to ThirdParty/Ert/applications/ecl/kw_list.c diff --git a/ThirdParty/Ert/libecl/applications/load_test.c b/ThirdParty/Ert/applications/ecl/load_test.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/load_test.c rename to ThirdParty/Ert/applications/ecl/load_test.c diff --git a/ThirdParty/Ert/libecl/applications/make_grid.c b/ThirdParty/Ert/applications/ecl/make_grid.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/make_grid.c rename to ThirdParty/Ert/applications/ecl/make_grid.c diff --git a/ThirdParty/Ert/libecl/applications/run_gravity.c b/ThirdParty/Ert/applications/ecl/run_gravity.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/run_gravity.c rename to ThirdParty/Ert/applications/ecl/run_gravity.c diff --git a/ThirdParty/Ert/libecl/applications/select_test.c b/ThirdParty/Ert/applications/ecl/select_test.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/select_test.c rename to ThirdParty/Ert/applications/ecl/select_test.c diff --git a/ThirdParty/Ert/libecl/applications/sum_write.c b/ThirdParty/Ert/applications/ecl/sum_write.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/sum_write.c rename to ThirdParty/Ert/applications/ecl/sum_write.c diff --git a/ThirdParty/Ert/libecl/applications/summary2csv2.c b/ThirdParty/Ert/applications/ecl/summary2csv2.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/summary2csv2.c rename to ThirdParty/Ert/applications/ecl/summary2csv2.c diff --git a/ThirdParty/Ert/libecl/applications/view_restart.c b/ThirdParty/Ert/applications/ecl/view_restart.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/view_restart.c rename to ThirdParty/Ert/applications/ecl/view_restart.c diff --git a/ThirdParty/Ert/libecl/applications/view_rft.c b/ThirdParty/Ert/applications/ecl/view_rft.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/view_rft.c rename to ThirdParty/Ert/applications/ecl/view_rft.c diff --git a/ThirdParty/Ert/libecl/applications/view_summary.c b/ThirdParty/Ert/applications/ecl/view_summary.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/view_summary.c rename to ThirdParty/Ert/applications/ecl/view_summary.c diff --git a/ThirdParty/Ert/libecl/applications/vprofile.c b/ThirdParty/Ert/applications/ecl/vprofile.c similarity index 100% rename from ThirdParty/Ert/libecl/applications/vprofile.c rename to ThirdParty/Ert/applications/ecl/vprofile.c diff --git a/ThirdParty/Ert/libecl/applications/example_ens_plot_batch_file b/ThirdParty/Ert/applications/example_ens_plot_batch_file similarity index 100% rename from ThirdParty/Ert/libecl/applications/example_ens_plot_batch_file rename to ThirdParty/Ert/applications/example_ens_plot_batch_file diff --git a/ThirdParty/Ert/libgeometry/applications/irap_test.c b/ThirdParty/Ert/applications/irap_test.c similarity index 100% rename from ThirdParty/Ert/libgeometry/applications/irap_test.c rename to ThirdParty/Ert/applications/irap_test.c diff --git a/ThirdParty/Ert/docs/man/man1/ecl_summary.1 b/ThirdParty/Ert/applications/man/man1/ecl_summary.1 similarity index 100% rename from ThirdParty/Ert/docs/man/man1/ecl_summary.1 rename to ThirdParty/Ert/applications/man/man1/ecl_summary.1 diff --git a/ThirdParty/Ert/libgeometry/applications/polygon_test.c b/ThirdParty/Ert/applications/polygon_test.c similarity index 100% rename from ThirdParty/Ert/libgeometry/applications/polygon_test.c rename to ThirdParty/Ert/applications/polygon_test.c diff --git a/ThirdParty/Ert/libecl_well/applications/ri_well_test.c b/ThirdParty/Ert/applications/well/ri_well_test.c similarity index 100% rename from ThirdParty/Ert/libecl_well/applications/ri_well_test.c rename to ThirdParty/Ert/applications/well/ri_well_test.c diff --git a/ThirdParty/Ert/libecl_well/applications/segment_info.c b/ThirdParty/Ert/applications/well/segment_info.c similarity index 100% rename from ThirdParty/Ert/libecl_well/applications/segment_info.c rename to ThirdParty/Ert/applications/well/segment_info.c diff --git a/ThirdParty/Ert/libecl_well/applications/well_CF_dump.c b/ThirdParty/Ert/applications/well/well_CF_dump.c similarity index 100% rename from ThirdParty/Ert/libecl_well/applications/well_CF_dump.c rename to ThirdParty/Ert/applications/well/well_CF_dump.c diff --git a/ThirdParty/Ert/cmake/Modules/FindCXX11Features.cmake b/ThirdParty/Ert/cmake/Modules/FindCXX11Features.cmake index 0b79c32344..13b25e3856 100644 --- a/ThirdParty/Ert/cmake/Modules/FindCXX11Features.cmake +++ b/ThirdParty/Ert/cmake/Modules/FindCXX11Features.cmake @@ -1,19 +1,22 @@ # # Module that checks for supported C++11 (former C++0x) features. # -if(CMAKE_VERSION VERSION_LESS 3.1) - if(NOT MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif() - if(NOT ERT_WINDOWS) - set( CMAKE_CXX_FLAGS_main "${CMAKE_CXX_FLAGS} -std=c++11") - endif() -else() - if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) - endif() - set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) + +include(CheckCXXCompilerFlag) +if (NOT MSVC) + CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) + + if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + else() + message(SEND_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + endif() endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + set(CXX11FEATURES_FOUND TRUE) diff --git a/ThirdParty/Ert/cmake/ert_api_check.cmake b/ThirdParty/Ert/cmake/ert_api_check.cmake index 1362cd0235..4e0fbe9d74 100644 --- a/ThirdParty/Ert/cmake/ert_api_check.cmake +++ b/ThirdParty/Ert/cmake/ert_api_check.cmake @@ -8,72 +8,5 @@ # have a ERT_ prefix. The generated header is part of the api and can be # included by other header files in the ert source. -find_library( BLAS_LIBRARY NAMES blas) -if (BLAS_LIBRARY) - set(ERT_HAVE_BLAS ON) -endif() - -find_library( LAPACK_LIBRARY NAMES lapack) -if (LAPACK_LIBRARY) - set(ERT_HAVE_LAPACK ON) -else() - set(ERT_HAVE_LAPACK OFF) -endif() - #----------------------------------------------------------------- -find_library( ZLIB_LIBRARY NAMES z ) -find_path( ZLIB_HEADER zlib.h /usr/include ) -if (ZLIB_LIBRARY AND ZLIB_HEADER) - set( ERT_HAVE_ZLIB ON ) -else() - if(NOT DEFINED ZLIB_LIBRARY) - message(STATUS "ZLib library not found - zlib support will not be included." ) - endif() - if(NOT DEFINED ZLIB_HEADER) - message(STATUS "zlib.h not found - zlib support will not be included.") - endif() -endif() -#----------------------------------------------------------------- - -try_compile( ERT_HAVE_ISFINITE ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_isfinite.c ) -find_path( ERT_HAVE_GETOPT getopt.h /usr/include ) -find_path( ERT_HAVE_UNISTD unistd.h /usr/include ) - -check_function_exists( posix_spawn ERT_HAVE_SPAWN ) -check_function_exists( opendir ERT_HAVE_OPENDIR ) -check_function_exists( symlink ERT_HAVE_SYMLINK ) -check_function_exists( readlinkat ERT_HAVE_READLINKAT ) -check_function_exists( glob ERT_HAVE_GLOB ) -check_function_exists( getuid ERT_HAVE_GETUID ) -check_function_exists( regexec ERT_HAVE_REGEXP ) -check_function_exists( lockf ERT_HAVE_LOCKF ) - - -check_type_size(time_t SIZE_OF_TIME_T) -if (${SIZE_OF_TIME_T} EQUAL 8) - try_run( RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_mktime_before1970.c ) - if (${COMPILE_RESULT}) - if (${RUN_RESULT} EQUAL 0) - set( ERT_TIME_T_64BIT_ACCEPT_PRE1970 ON ) - endif() - endif() -endif() - - -if (ERT_WINDOWS) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set( ERT_WINDOWS_LFS ON ) - endif() -endif() - - -if (HAVE_PTHREAD) - set( ERT_HAVE_THREAD_POOL ON ) -endif() - - -find_program(PING_PATH NAMES ping) -if (PING_PATH) - set( ERT_HAVE_PING ON ) -endif() diff --git a/ThirdParty/Ert/cmake/ert_build_check.cmake b/ThirdParty/Ert/cmake/ert_build_check.cmake index ea9d7b9c14..14a2e474c3 100644 --- a/ThirdParty/Ert/cmake/ert_build_check.cmake +++ b/ThirdParty/Ert/cmake/ert_build_check.cmake @@ -6,75 +6,3 @@ # # Check which affect the final api are implemented in the # ert_api_check.cmake file. - -find_library( PTHREAD_LIBRARY NAMES pthread ) -if (PTHREAD_LIBRARY) - set( HAVE_PTHREAD ON ) - set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} pthread) -endif() - -if (UNIX) - set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m ) - set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} m ) -endif(UNIX) - - -check_function_exists( localtime_r HAVE_LOCALTIME_R ) -check_function_exists( gmtime_r HAVE_GMTIME_R ) -check_function_exists( realpath HAVE_REALPATH ) -check_function_exists( usleep HAVE__USLEEP ) -check_function_exists( fnmatch HAVE_FNMATCH ) -check_function_exists( ftruncate HAVE_FTRUNCATE ) -check_function_exists( round HAVE_ROUND ) -check_function_exists( GetTempPath HAVE_WINDOWS_GET_TEMP_PATH ) -check_function_exists( fork HAVE_FORK ) -check_function_exists( getpwuid HAVE_GETPWUID ) -check_function_exists( fsync HAVE_FSYNC ) -check_function_exists( setenv HAVE_POSIX_SETENV ) -check_function_exists( chmod HAVE_CHMOD ) -check_function_exists( pthread_timedjoin_np HAVE_TIMEDJOIN) -check_function_exists( pthread_yield_np HAVE_YIELD_NP) -check_function_exists( pthread_yield HAVE_YIELD) -check_function_exists( fseeko HAVE_FSEEKO ) -check_function_exists( timegm HAVE_TIMEGM ) - -check_function_exists( _mkdir HAVE_WINDOWS_MKDIR) -if (NOT HAVE_WINDOWS_MKDIR) - check_function_exists( mkdir HAVE_POSIX_MKDIR) -endif() - - -check_function_exists( _chdir HAVE_WINDOWS_CHDIR) -if (NOT HAVE_WINDOWS_CHDIR) - check_function_exists( chdir HAVE_POSIX_CHDIR) -endif() - -check_function_exists( _getcwd HAVE_WINDOWS_GETCWD) -if (NOT HAVE_WINDOWS_GETCWD) - check_function_exists( getcwd HAVE_POSIX_GETCWD) -endif() - - -include(CheckSymbolExists) -check_symbol_exists(_tzname time.h HAVE_WINDOWS_TZNAME) -check_symbol_exists( tzname time.h HAVE_TZNAME) - -find_path( HAVE_EXECINFO execinfo.h /usr/include ) - -try_compile( HAVE_VA_COPY ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_va_copy.c ) -try_compile( HAVE_SIGBUS ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_have_sigbus.c ) -try_compile( HAVE_PID_T ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_pid_t.c ) -try_compile( HAVE_MODE_T ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_mode_t.c ) - - -set( BUILD_CXX ON ) -try_compile( HAVE_CXX_SHARED_PTR ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_shared_ptr.cpp ) -if (NOT HAVE_CXX_SHARED_PTR) - set( BUILD_CXX OFF ) -endif() - -if (HAVE_FORK AND HAVE_PTHREAD AND HAVE_EXECINFO AND HAVE_GETPWUID) - set( HAVE_UTIL_ABORT_INTERCEPT ON) - set( HAVE_BACKTRACE ON) -endif() - diff --git a/ThirdParty/Ert/cmake/ert_lib_check.cmake b/ThirdParty/Ert/cmake/ert_lib_check.cmake index 2aa4c851f7..e8418d65ce 100644 --- a/ThirdParty/Ert/cmake/ert_lib_check.cmake +++ b/ThirdParty/Ert/cmake/ert_lib_check.cmake @@ -1,30 +1,3 @@ # This file contains various checks which will append to the list # $ERT_EXTERNAL_UTIL_LIBS which should contain all the external library # dependencies. Observe that all library dependencies go transitively -# through the ert_util library. - -if (ERT_HAVE_LAPACK) - set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} ${LAPACK_LIBRARY} ${BLAS_LIBRARY}) - set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LAPACK_LIBRARY} ${BLAS_LIBRARY}) -endif() - - -if (ERT_WINDOWS) - find_library( SHLWAPI_LIBRARY NAMES Shlwapi ) - set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} Shlwapi ) -endif() - - -if (ERT_HAVE_ZLIB) - set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} ${ZLIB_LIBRARY} ) -endif() - -if (HAVE_PTHREAD) - set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} ${PTHREAD_LIBRARY} ) -endif() - -find_library( DL_LIBRARY NAMES dl ) -find_path( DLFUNC_HEADER dlfcn.h ) -if (DL_LIBRARY AND DLFUNC_HEADER) - set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} ${DL_LIBRARY} ) -endif() \ No newline at end of file diff --git a/ThirdParty/Ert/docs/CMakeLists.txt b/ThirdParty/Ert/docs/CMakeLists.txt index 512cb8408a..3df3fbdcd6 100644 --- a/ThirdParty/Ert/docs/CMakeLists.txt +++ b/ThirdParty/Ert/docs/CMakeLists.txt @@ -1,85 +1,39 @@ -option( ERT_RST_DOC "Build RST based documentation" ON) -option( ERT_DOXY_DOC "Build doxygen documentation" ON) -option( ERT_DOXY_GRAPHICAL "Add graphics to doxygen documentation" OFF) +find_package(Sphinx REQUIRED) +if (SPHINX_FOUND) + set( ERT_DOC_INSTALL_PATH "" CACHE PATH "Absolute path to install documentation *in addition* to $PREFIX/documentation") + set( ERT_DOC_EXTERNAL_ROOT "" CACHE PATH "Path to site local ERT documentation") -if (NOT BUILD_ERT) - if (ERT_RST_DOC) - message(WARNING "Turning off ERT_RST_DOC. Depends on BUILD_ERT.") - set (ERT_RST_DOC OFF) - endif() - if (ERT_DOXY_DOC) - message(WARNING "Turning off ERT_DOXY_DOC. Depends on BUILD_ERT.") - set (ERT_DOXY_DOC OFF) - endif() -endif() - -if (ERT_RST_DOC) - find_package(Sphinx REQUIRED) - if (SPHINX_FOUND) - set( ERT_DOC_INSTALL_PATH "" CACHE PATH "Absolute path to install documentation *in addition* to $PREFIX/documentation") - set( ERT_DOC_EXTERNAL_ROOT "" CACHE PATH "Path to site local ERT documentation") - - file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/doc-src") - file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/doc-src/_static") - EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/user" "${PROJECT_BINARY_DIR}/doc-src/user") - - if (ERT_DOC_EXTERNAL_ROOT) - EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink "${ERT_DOC_EXTERNAL_ROOT}" "${PROJECT_BINARY_DIR}/doc-src/external-doc") - message(STATUS "Adding documentation link ${PROJECT_BINARY_DIR}/doc-src/external-doc -> ${ERT_DOC_EXTERNAL_ROOT}") - set( ERT_DOC_LINK external-doc/index ) - else() - set( ERT_DOC_LINK "" ) - endif() - - configure_file(index.rst.in ${PROJECT_BINARY_DIR}/doc-src/index.rst) - configure_file(conf.py.in ${PROJECT_BINARY_DIR}/doc-src/conf.py) - - if (BUILD_PYTHON) - EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/code" "${PROJECT_BINARY_DIR}/doc-src/code") - add_custom_target(api-doc ALL - COMMAND sphinx-apidoc -e -o doc-src/API/python ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} - DEPENDS enkf - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) - endif() - - add_custom_target(rst-doc ALL - COMMAND sphinx-build -b html -d doc-src/doctrees doc-src documentation/rst - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - DEPENDS api-doc - ) + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/doc-src") + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/doc-src/_static") + EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/user" "${PROJECT_BINARY_DIR}/doc-src/user") + if (ERT_DOC_EXTERNAL_ROOT) + EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink "${ERT_DOC_EXTERNAL_ROOT}" "${PROJECT_BINARY_DIR}/doc-src/external-doc") + message(STATUS "Adding documentation link ${PROJECT_BINARY_DIR}/doc-src/external-doc -> ${ERT_DOC_EXTERNAL_ROOT}") + set( ERT_DOC_LINK external-doc/index ) else() - message(STATUS "Sphinx documentation tool not found - documentation not generated") + set( ERT_DOC_LINK "" ) endif() -endif() + configure_file(index.rst.in ${PROJECT_BINARY_DIR}/doc-src/index.rst) + configure_file(conf.py.in ${PROJECT_BINARY_DIR}/doc-src/conf.py) -if (ERT_DOXY_DOC) - find_package(Doxygen) - if (DOXYGEN_FOUND) - file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/documentation/doxy") - set( DOXYGEN_HAVE_DOT "NO" ) - if ( ERT_DOXY_GRAPHICAL) - if (DOXYGEN_DOT_FOUND) - set( DOXYGEN_HAVE_DOT "YES" ) - endif() - endif() - - if (BUILD_ERT) - SET( DOXYGEN_INPUT "${PROJECT_SOURCE_DIR}/libanalysis ${PROJECT_SOURCE_DIR}/libconfig ${PROJECT_SOURCE_DIR}/libecl ${PROJECT_SOURCE_DIR}/libecl_well ${PROJECT_SOURCE_DIR}/libeclxx ${PROJECT_SOURCE_DIR}/libenkf ${PROJECT_SOURCE_DIR}/libert_util ${PROJECT_SOURCE_DIR}/libert_utilxx ${PROJECT_SOURCE_DIR}/libgeometry ${PROJECT_SOURCE_DIR}/libjob_queue ${PROJECT_SOURCE_DIR}/librms ${PROJECT_SOURCE_DIR}/libsched") - else() - SET( DOXYGEN_INPUT "${PROJECT_SOURCE_DIR}/libecl ${PROJECT_SOURCE_DIR}/libecl_well ${PROJECT_SOURCE_DIR}/libeclxx ${PROJECT_SOURCE_DIR}/libert_util ${PROJECT_SOURCE_DIR}/libert_utilxx ${PROJECT_SOURCE_DIR}/libgeometry") - endif() - - configure_file(doxygen.cfg.in ${PROJECT_BINARY_DIR}/doxygen.cfg) - add_custom_target(doxy ALL - COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doxygen.cfg - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/../ - COMMENT "Generating doxygen documentation" - DEPENDS enkf) - + if (BUILD_PYTHON) + add_custom_target(api-doc ALL + COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/code" "${PROJECT_BINARY_DIR}/doc-src/code" + COMMAND sphinx-apidoc -e -o doc-src/API/python ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} + DEPENDS ecl + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) endif() -endif() + add_custom_target(rst-doc ALL + COMMAND sphinx-build -b html -d doc-src/doctrees doc-src documentation/rst + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + DEPENDS api-doc + ) + +else() + message(STATUS "Sphinx documentation tool not found - documentation not generated") +endif() INSTALL( DIRECTORY ${PROJECT_BINARY_DIR}/documentation DESTINATION ${CMAKE_INSTALL_PREFIX} ) diff --git a/ThirdParty/Ert/lib/CMakeLists.txt b/ThirdParty/Ert/lib/CMakeLists.txt new file mode 100644 index 0000000000..450bc95758 --- /dev/null +++ b/ThirdParty/Ert/lib/CMakeLists.txt @@ -0,0 +1,766 @@ +project(libecl-ecl C CXX) + +if (HAVE_PTHREAD) + # The block_fs filesystem is so heavily dependant on pthreads that it is + # not built if de not have pthreads. + list(APPEND opt_srcs util/thread_pool.c util/block_fs.c) +endif () + +if (LAPACK_FOUND) + list(APPEND opt_srcs util/matrix_lapack.c + util/matrix_blas.c + util/matrix_stat.c + util/regression.c + util/lars.c + util/stepwise.c +) +endif () + +if (HAVE_BACKTRACE) + list(APPEND opt_srcs util/util_abort_gnu.c) +else() + list(APPEND opt_srcs util/util_abort_simple.c) +endif() + +if (ERT_HAVE_GETUID AND ERT_HAVE_OPENDIR) + list(APPEND opt_srcs util/test_work_area.c util/util_getuid.c) +endif() + +if (ERT_HAVE_OPENDIR) + list(APPEND opt_srcs util/util_opendir.c) +endif() + +if (ERT_HAVE_SPAWN) + list(APPEND opt_srcs util/util_spawn.c) +endif() + +if (ERT_HAVE_LOCKF) + list(APPEND opt_srcs util/util_lockf.c) +endif () + +if (ERT_HAVE_REGEXP) + list(APPEND opt_srcs util/template_loop.c) +endif () + +if (ERT_HAVE_UNISTD) + list(APPEND opt_srcs util/path_stack.c) +endif () + +if (MSVC) + configure_file(include/ert/util/msvc_stdbool.h ert/util/stdbool.h) +endif () + +foreach (type int double bool long time_t size_t float) + set(TYPE ${type}) + configure_file(vector_template.h.in include/ert/util/${type}_vector.h) + configure_file(util/vector_template.c ${type}_vector.c) + list(APPEND opt_srcs ${CMAKE_CURRENT_BINARY_DIR}/${type}_vector.c) +endforeach () + +if (ZLIB_FOUND) + list(APPEND opt_srcs util/util_zlib.c) +endif () + +if (ERT_BUILD_CXX) + list(APPEND opt_srcs util/TestArea.cpp + ecl/FortIO.cpp + ecl/Smspec.cpp + ecl/EclFilename.cpp +) +endif () + +configure_file(build_config.h.in include/ert/util/build_config.h) +configure_file(ert_api_config.h.in include/ert/util/ert_api_config.h) + +add_library(ecl util/rng.c + util/lookup_table.c + util/statistics.c + util/mzran.c + util/set.c + util/hash_node.c + util/hash_sll.c + util/hash.c + util/node_data.c + util/node_ctype.c + util/util.c + util/util_env.c + util/util_symlink.c + util/util_lfs.c + util/msg.c + util/arg_pack.c + util/path_fmt.c + util/menu.c + util/subst_list.c + util/subst_func.c + util/vector.c + util/parser.c + util/stringlist.c + util/matrix.c + util/buffer.c + util/log.c + util/template.c + util/timer.c + util/time_interval.c + util/string_util.c + util/type_vector_functions.c + util/ui_return.c + util/ert_version.c + util/struct_vector.c + util/perm_vector.c + util/test_util.c + ${opt_srcs} + + ecl/ecl_rsthead.c + ecl/ecl_sum_tstep.c + ecl/ecl_rst_file.c + ecl/ecl_init_file.c + ecl/ecl_grid_cache.c + ecl/smspec_node.c + ecl/ecl_kw_grdecl.c + ecl/ecl_file_kw.c + ecl/ecl_file_view.c + ecl/ecl_grav.c + ecl/ecl_grav_calc.c + ecl/ecl_smspec.c + ecl/ecl_sum_data.c + ecl/ecl_util.c + ecl/ecl_kw.c + ecl/ecl_sum.c + ecl/ecl_sum_vector.c + ecl/fortio.c + ecl/ecl_rft_file.c + ecl/ecl_rft_node.c + ecl/ecl_rft_cell.c + ecl/ecl_grid.c + ecl/ecl_coarse_cell.c + ecl/ecl_box.c + ecl/ecl_io_config.c + ecl/ecl_file.c + ecl/ecl_region.c + ecl/ecl_subsidence.c + ecl/ecl_grid_dims.c + ecl/grid_dims.c + ecl/nnc_info.c + ecl/ecl_grav_common.c + ecl/nnc_vector.c + ecl/ecl_nnc_export.c + ecl/ecl_nnc_data.c + ecl/ecl_nnc_geometry.c + ecl/layer.c + ecl/fault_block.c + ecl/fault_block_layer.c + ecl/ecl_type.c + ecl/ecl_type_python.c + ecl/well_state.c + ecl/well_conn.c + ecl/well_info.c + ecl/well_ts.c + ecl/well_conn_collection.c + ecl/well_segment.c + ecl/well_segment_collection.c + ecl/well_branch_collection.c + ecl/well_rseg_loader.c + + geometry/geo_surface.c + geometry/geo_util.c + geometry/geo_pointset.c + geometry/geo_region.c + geometry/geo_polygon.c + geometry/geo_polygon_collection.c +) + +target_link_libraries(ecl PUBLIC ${m} + ${dl} + ${pthread} + ${blas} + ${lapack} + ${zlib} + ${shlwapi} +) + +target_include_directories(ecl + PUBLIC $ + $ + $ + PRIVATE ${ZLIB_INCLUDE_DIRS} + util + include + ${CMAKE_CURRENT_BINARY_DIR}/include +) + +target_compile_definitions(ecl PRIVATE + -DGIT_COMMIT=${GIT_COMMIT} + -DGIT_COMMIT_SHORT=${GIT_COMMIT_SHORT} + -DERT_VERSION_MAJOR=${ERT_VERSION_MAJOR} + -DERT_VERSION_MINOR=${ERT_VERSION_MINOR} + -DERT_VERSION_MICRO=${ERT_VERSION_MICRO} +) + +target_compile_options(ecl PUBLIC ${pthreadarg}) + +if (PING_PATH) + target_compile_definitions(ecl PRIVATE -DPING_CMD=${PING_PATH}) +endif() + +if (ERT_USE_OPENMP) + target_compile_options(ecl PUBLIC ${OpenMP_C_FLAGS}) + target_link_libraries( ecl PUBLIC ${OpenMP_C_FLAGS}) + target_link_libraries( ecl PUBLIC ${OpenMP_EXE_LINKER_FLAGS}) +endif () + +set_target_properties(ecl PROPERTIES + VERSION ${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR} + SOVERSION ${ERT_VERSION_MAJOR}) + +install(TARGETS ecl + EXPORT ecl-config + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(DIRECTORY include/ + DESTINATION include + PATTERN *.h +) +install(DIRECTORY include/ + DESTINATION include + PATTERN *.hpp EXCLUDE +) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ + DESTINATION include + PATTERN *.h +) + +if (ERT_BUILD_CXX) + install(DIRECTORY include/ + DESTINATION include + PATTERN *.hpp +) +endif () + +if (NOT BUILD_TESTS) + return () +endif () + +foreach (name ert_util_alloc_file_components + ert_util_approx_equal + ert_util_arg_pack + ert_util_before_after + ert_util_binary_split + ert_util_buffer + ert_util_clamp + ert_util_filename + ert_util_hash_test + ert_util_logh + ert_util_matrix + ert_util_parent_path + ert_util_PATH_test + ert_util_realpath + ert_util_relpath_test + ert_util_rng + ert_util_sprintf_escape + ert_util_sscan_test + ert_util_statistics + ert_util_strcat_test + ert_util_stringlist_test + ert_util_string_util + ert_util_strstr_int_format + ert_util_subst_list + ert_util_time_interval + ert_util_type_vector_functions + ert_util_ui_return + ert_util_vector_test + ert_util_datetime + ) + + add_executable(${name} util/tests/${name}.c) + target_link_libraries(${name} ecl) + add_test(NAME ${name} COMMAND ${name}) +endforeach () + +add_executable(ert_util_work_area util/tests/ert_util_work_area.c) +target_link_libraries(ert_util_work_area ecl) +add_test(NAME ert_util_work_area + COMMAND ert_util_work_area data2/file1 + ${CMAKE_CURRENT_SOURCE_DIR}/util/tests/data2/file2 + data2 + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/util/tests +) + +find_library( VALGRIND NAMES valgr ) +if (VALGRIND) + set(valgrind_cmd valgrind --error-exitcode=1 --tool=memcheck) +endif () + +add_executable(test_thread_pool util/tests/test_thread_pool.c) +target_link_libraries(test_thread_pool ecl) +add_test(NAME test_thread_pool COMMAND ${valgrind_cmd} test_thread_pool) + +add_executable(ert_util_cwd_test util/tests/ert_util_cwd_test.c) +target_link_libraries(ert_util_cwd_test ecl) +add_test(NAME ert_util_cwd_test COMMAND ert_util_cwd_test ${CMAKE_CURRENT_BINARY_DIR}) + +add_executable(ert_util_copy_file util/tests/ert_util_copy_file.c) +target_link_libraries(ert_util_copy_file ecl) +add_test(NAME ert_util_copy_file + COMMAND ert_util_copy_file + $) + +add_executable(ert_util_file_readable util/tests/ert_util_file_readable.c) +target_link_libraries(ert_util_file_readable ecl) +add_test(NAME ert_util_file_readable COMMAND ert_util_file_readable) + +add_executable(ert_util_path_stack_test util/tests/ert_util_path_stack_test.c) +target_link_libraries(ert_util_path_stack_test ecl) +add_test(NAME ert_util_path_stack_test COMMAND ert_util_path_stack_test + ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + +if (LAPACK_FOUND) + add_executable(ert_util_matrix_lapack util/tests/ert_util_matrix_lapack.c) + target_link_libraries(ert_util_matrix_lapack ecl) + add_test(NAME ert_util_matrix_lapack COMMAND ert_util_matrix_lapack) + + add_executable(ert_util_matrix_stat util/tests/ert_util_matrix_stat.c) + target_link_libraries(ert_util_matrix_stat ecl) + add_test(NAME ert_util_matrix_stat COMMAND ert_util_matrix_stat) +endif() + +if (HAVE_BACKTRACE) + add_executable(ert_util_abort_gnu_tests util/tests/ert_util_abort_gnu_tests.c) + target_link_libraries(ert_util_abort_gnu_tests ecl) + add_test(NAME ert_util_abort_gnu_tests COMMAND ert_util_abort_gnu_tests) + + add_executable(ert_util_addr2line util/tests/ert_util_addr2line.c) + target_link_libraries(ert_util_addr2line ecl) + add_test(NAME ert_util_addr2line COMMAND ert_util_addr2line) +endif() + +if (HAVE_UTIL_ABORT_INTERCEPT) + add_executable(ert_util_block_fs util/tests/ert_util_block_fs.c) + target_link_libraries(ert_util_block_fs ecl) + add_test(NAME ert_util_block_fs COMMAND ert_util_block_fs) + + add_executable(ert_util_struct_vector util/tests/ert_util_struct_vector.c) + target_link_libraries(ert_util_struct_vector ecl) + add_test(NAME ert_util_struct_vector COMMAND ert_util_struct_vector) + + add_executable(ert_util_type_vector_test util/tests/ert_util_type_vector_test.c) + target_link_libraries(ert_util_type_vector_test ecl) + add_test(NAME ert_util_type_vector_test COMMAND ert_util_type_vector_test) +endif() + +if (ERT_HAVE_SPAWN) + add_executable(ert_util_spawn util/tests/ert_util_spawn.c) + target_link_libraries(ert_util_spawn ecl) + add_test(NAME ert_util_spawn COMMAND ert_util_spawn) +endif() + +# +# ecl +# + +foreach (name ecl_alloc_cpgrid + ecl_alloc_grid_dxv_dyv_dzv + ecl_fault_block_layer + ecl_grid_add_nnc + ecl_grid_copy + ecl_grid_create + ecl_grid_DEPTHZ + ecl_grid_export + ecl_grid_init_fwrite + ecl_grid_reset_actnum + ecl_init_file + ecl_kw_cmp_string + ecl_kw_equal + ecl_kw_fread + ecl_kw_grdecl + ecl_kw_init + ecl_nnc_geometry + ecl_nnc_info_test + ecl_nnc_vector + ecl_rft_cell + ecl_rst_file + ecl_sum_writer + ecl_util_make_date_no_shift + ecl_util_month_range + ecl_valid_basename + test_ecl_nnc_data + ecl_nnc_pair + well_conn_collection + well_branch_collection + well_conn + well_state + well_segment + well_segment_conn + well_segment_collection + ecl_file + ) + add_executable(${name} ecl/tests/${name}.c) + target_link_libraries(${name} ecl) + add_test(NAME ${name} COMMAND ${name}) +endforeach () + +add_executable(ecl_grid_cell_contains ecl/tests/ecl_grid_cell_contains.c) +target_link_libraries(ecl_grid_cell_contains ecl) +add_test(NAME ecl_grid_cell_contains1 COMMAND ecl_grid_cell_contains) + +if (HAVE_UTIL_ABORT_INTERCEPT) + add_executable(ecl_grid_corner ecl/tests/ecl_grid_corner.c) + target_link_libraries(ecl_grid_corner ecl) + add_test(NAME ecl_grid_corner COMMAND ecl_grid_corner) + + add_executable(ecl_layer ecl/tests/ecl_layer.c) + target_link_libraries(ecl_layer ecl) + add_test(NAME ecl_layer COMMAND ecl_layer) +endif() + +add_executable(ecl_get_num_cpu ecl/tests/ecl_get_num_cpu_test.c) +target_link_libraries(ecl_get_num_cpu ecl) +add_test(NAME ecl_get_num_cpu COMMAND ecl_get_num_cpu + ${CMAKE_CURRENT_SOURCE_DIR}/ecl/tests/data/num_cpu1 + ${CMAKE_CURRENT_SOURCE_DIR}/ecl/tests/data/num_cpu2 + ${CMAKE_CURRENT_SOURCE_DIR}/ecl/tests/data/num_cpu3 + ${CMAKE_CURRENT_SOURCE_DIR}/ecl/tests/data/num_cpu4) + +# The ecl_win64 application is not built as a proper test integrated +# into the CTEST system. Should be invoked manually on Windows. +if (ERT_WINDOWS) + add_executable(ecl_lfs ecl/tests/ecl_lfs.c) + target_link_libraries(ecl_lfs ecl) +endif() + +# +# geometry +# + + +foreach (name geo_util_xlines geo_polygon geo_polygon_collection) + add_executable(${name} geometry/tests/${name}.c) + target_link_libraries(${name} ecl) + add_test(NAME ${name} COMMAND ${name}) +endforeach () + +if (ERT_BUILD_CXX) + foreach (test ert_util_unique_ptr ert_util_test_area_xx) + add_executable(${test} util/tests/${test}.cpp) + target_link_libraries(${test} ecl) + add_test(NAME ${test} COMMAND ${test}) + endforeach() + + foreach (test eclxx_kw eclxx_fortio eclxx_smspec eclxx_filename eclxx_types) + add_executable(${test} ecl/tests/${test}.cpp) + target_link_libraries(${test} ecl) + add_test(NAME ${test} COMMAND ${test}) + endforeach () +endif () + +if (NOT STATOIL_TESTDATA_ROOT) + return () +endif() + +# +# ecl +# + +if (PING_PATH) + add_executable(ert_util_ping util/tests/ert_util_ping.c) + target_link_libraries(ert_util_ping ecl) + add_test(NAME ert_util_ping COMMAND ert_util_ping) +endif () + + +add_executable(ecl_coarse_test ecl/tests/ecl_coarse_test.c) +target_link_libraries(ecl_coarse_test ecl) +add_test(NAME ecl_coarse_test COMMAND ecl_coarse_test + ${_eclpath}/LGCcase/LGC_TESTCASE2) + +add_executable(ecl_grid_layer_contains ecl/tests/ecl_grid_layer_contains.c) +target_link_libraries(ecl_grid_layer_contains ecl) +add_test(NAME ecl_grid_layer_contains1 COMMAND ecl_grid_layer_contains + ${_eclpath}/Gurbat/ECLIPSE.EGRID) +add_test(NAME ecl_grid_layer_contains2 COMMAND ecl_grid_layer_contains + ${_eclpath}/Mariner/MARINER.EGRID) + +add_executable(ecl_restart_test ecl/tests/ecl_restart_test.c) +target_link_libraries(ecl_restart_test ecl) +add_test(NAME ecl_restart_test COMMAND ecl_restart_test + ${_eclpath}/Gurbat/ECLIPSE.UNRST) + +add_executable(ecl_nnc_export ecl/tests/ecl_nnc_export.c) +target_link_libraries(ecl_nnc_export ecl) +add_test(NAME ecl_nnc_export1 COMMAND ecl_nnc_export ${_eclpath}/Gurbat/ECLIPSE TRUE) +add_test(NAME ecl_nnc_export2 COMMAND ecl_nnc_export ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC TRUE) +add_test(NAME ecl_nnc_export3 COMMAND ecl_nnc_export ${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3 TRUE) +add_test(NAME ecl_nnc_export4 COMMAND ecl_nnc_export ${_eclpath}/DualPoro/DUAL_DIFF TRUE) +add_test(NAME ecl_nnc_export5 COMMAND ecl_nnc_export ${_eclpath}/DualPoro/DUALPORO TRUE) +add_test(NAME ecl_nnc_export6 COMMAND ecl_nnc_export ${_eclpath}/nestedLGRcase/TESTCASE_NESTEDLGR TRUE) +add_test(NAME ecl_nnc_export7 COMMAND ecl_nnc_export ${_eclpath}/TYRIHANS/BASE20150218_MULTFLT FALSE) + +add_executable(ecl_nnc_export_get_tran ecl/tests/ecl_nnc_export_get_tran.c) +target_link_libraries(ecl_nnc_export_get_tran ecl) +add_test(NAME ecl_nnc_export_get_tran COMMAND ecl_nnc_export_get_tran + ${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3) + +add_executable(ecl_nnc_data_statoil_root ecl/tests/test_ecl_nnc_data_statoil_root.c) +target_link_libraries(ecl_nnc_data_statoil_root ecl) +add_test(NAME ecl_nnc_data_statoil_root COMMAND ecl_nnc_data_statoil_root + ${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3 + ${_eclpath}/flow-nnc/Simple4/SIMPLE_SUMMARY4 + ${_eclpath}/flow-nnc/Gullfaks/GF_ACT_NEW_TEMP) + +add_executable(ecl_util_make_date_shift ecl/tests/ecl_util_make_date_shift.c) +target_link_libraries(ecl_util_make_date_shift ecl) +add_test(NAME ecl_util_make_date_shift COMMAND ecl_util_make_date_shift) + +add_executable(ecl_sum_case_exists ecl/tests/ecl_sum_case_exists.c) +target_link_libraries(ecl_sum_case_exists ecl) +add_test(NAME ecl_sum_case_exists COMMAND ecl_sum_case_exists + ${_eclpath}/Gurbat/ECLIPSE + ${_eclpath}/GurbatSummary/missingHeader/ECLIPSE + ${_eclpath}/GurbatSummary/missingData/ECLIPSE) + + +add_executable(ecl_grid_lgr_name ecl/tests/ecl_grid_lgr_name.c) +target_link_libraries(ecl_grid_lgr_name ecl) +add_test(NAME ecl_grid_lgr_name COMMAND ecl_grid_lgr_name + ${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID) + +add_executable(ecl_region ecl/tests/ecl_region.c) +target_link_libraries(ecl_region ecl) +add_test(NAME ecl_region COMMAND ecl_region ${_eclpath}/Gurbat/ECLIPSE.EGRID) + +add_test(NAME ecl_grid_cell_contains2 COMMAND ecl_grid_cell_contains ${_eclpath}/Gurbat/ECLIPSE.EGRID) +add_test(NAME ecl_grid_cell_contains3 COMMAND ecl_grid_cell_contains ${_eclpath}/FF12/FF12_2013B2.EGRID) +add_test(NAME ecl_grid_cell_contains4 COMMAND ecl_grid_cell_contains ${_eclpath}/Brazil/R3_ICD.EGRID) + +add_executable(ecl_grid_cell_contains_wellpath ecl/tests/ecl_grid_cell_contains_wellpath.c) +target_link_libraries(ecl_grid_cell_contains_wellpath ecl) +add_test(NAME ecl_grid_cell_contains_wellpath1 + COMMAND ecl_grid_cell_contains_wellpath + ${_eclpath}/CellContains/model/SMS-0.EGRID + ${_eclpath}/CellContains/R_PB-4H.jira) + +add_executable(ecl_grid_cell_volume ecl/tests/ecl_grid_cell_volume.c) +target_link_libraries(ecl_grid_cell_volume ecl) +add_test(NAME ecl_grid_cell_volume1 COMMAND ecl_grid_cell_volume) +add_test(NAME ecl_grid_cell_volume2 COMMAND ecl_grid_cell_volume ${_eclpath}/Gurbat/ECLIPSE.EGRID) +add_test(NAME ecl_grid_cell_volume3 COMMAND ecl_grid_cell_volume ${_eclpath}/Heidrun/Summary/FF12_2013B3_CLEAN_RS.EGRID) + +add_executable(ecl_region2region ecl/tests/ecl_region2region_test.c) +target_link_libraries(ecl_region2region ecl) +add_test(NAME ecl_region2region COMMAND ecl_region2region ${_eclpath}/R2R/R2R.SMSPEC) + +add_executable(ecl_grid_case ecl/tests/ecl_grid_case.c) +target_link_libraries(ecl_grid_case ecl) +add_test(NAME ecl_grid_case COMMAND ecl_grid_case + ${_eclpath}/Gurbat/ECLIPSE.EGRID + ${_eclpath}/Gurbat/ECLIPSE) + +add_executable(ecl_lgr_test ecl/tests/ecl_lgr_test.c) +target_link_libraries(ecl_lgr_test ecl) +add_test(NAME ecl_lgr_test1 COMMAND ecl_lgr_test ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.EGRID) +add_test(NAME ecl_lgr_test2 COMMAND ecl_lgr_test ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.GRID) +add_test(NAME ecl_lgr_test3 COMMAND ecl_lgr_test ${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID) + +add_executable(ecl_grid_simple ecl/tests/ecl_grid_simple.c) +target_link_libraries(ecl_grid_simple ecl) +add_test(NAME ecl_grid_simple COMMAND ecl_grid_simple ${_eclpath}/Gurbat/ECLIPSE.EGRID) + +add_test(NAME ecl_grid_ecl2015_2 COMMAND ecl_grid_simple + ${_eclpath}/Eclipse2015_NNC_BUG/FF15_2015B2_LGRM_RDI15_HIST_RDIREAL1_20142.EGRID) + +add_executable(ecl_grid_export_statoil ecl/tests/ecl_grid_export.c) +target_link_libraries(ecl_grid_export_statoil ecl) +add_test(NAME ecl_grid_export_statoil + COMMAND ecl_grid_export_statoil ${_eclpath}/Gurbat/ECLIPSE.EGRID) + +add_executable(ecl_grid_volume ecl/tests/ecl_grid_volume.c) +target_link_libraries(ecl_grid_volume ecl) +add_test(NAME ecl_grid_volume1 COMMAND ecl_grid_volume ${_eclpath}/Gurbat/ECLIPSE) +add_test(NAME ecl_grid_volume2 COMMAND ecl_grid_volume ${_eclpath}/VolumeTest/TEST1) +add_test(NAME ecl_grid_volume3 COMMAND ecl_grid_volume ${_eclpath}/OsebergSyd/Omega/OMEGA-0) +add_test(NAME ecl_grid_volume4 COMMAND ecl_grid_volume ${_eclpath}/Norne/reservoir_models/Norne_ATW2013/NORNE_ATW2013) + +# The grid volume test fails miserably on the test case given as example five; looking at +# the failures one could actually suspect that the ECLIPSE algorithm for PORV calculations +# has been different in this file - i.e. that the absolute value of the individual +# tetrahedron parts have been taken during the sum, and not at the end. At least the ert +# algorithm gets volumes ~ 0 whereas ECLIPSE reports ~10^9 for the same cell. +# add_test( ecl_grid_volume5 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_volume ${_eclpath}/Heidrun/Summary/FF12_2013B3_CLEAN_RS) + +add_executable(ecl_grid_dims ecl/tests/ecl_grid_dims.c) +target_link_libraries(ecl_grid_dims ecl) +add_test(NAME ecl_grid_dims0 COMMAND ecl_grid_dims) +add_test(NAME ecl_grid_dims1 COMMAND ecl_grid_dims ${_eclpath}/Gurbat/ECLIPSE.EGRID ${_eclpath}/Gurbat/ECLIPSE.INIT) +add_test(NAME ecl_grid_dims2 COMMAND ecl_grid_dims ${_eclpath}/Gurbat/ECLIPSE.GRID ${_eclpath}/Gurbat/ECLIPSE.INIT) +add_test(NAME ecl_grid_dims3 COMMAND ecl_grid_dims ${_eclpath}/Gurbat/ECLIPSE.EGRID) +add_test(NAME ecl_grid_dims4 COMMAND ecl_grid_dims ${_eclpath}/Gurbat/ECLIPSE.GRID ) +add_test(NAME ecl_grid_dims5 COMMAND ecl_grid_dims ${_eclpath}/AmalgLGRcase/TESTCASE_AMALG_LGR.EGRID) + +add_executable(ecl_nnc_test ecl/tests/ecl_nnc_test.c) +target_link_libraries(ecl_nnc_test ecl) +add_test(NAME ecl_nnc_test1 COMMAND ecl_nnc_test ${_eclpath}/Gurbat/ECLIPSE.EGRID ) +add_test(NAME ecl_nnc_test2 COMMAND ecl_nnc_test ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.EGRID ) +add_test(NAME ecl_nnc_test3 COMMAND ecl_nnc_test ${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID) +add_test(NAME ecl_nnc_test4 COMMAND ecl_nnc_test ${_eclpath}/DualPoro/DUAL_DIFF.EGRID ) +add_test(NAME ecl_nnc_test5 COMMAND ecl_nnc_test ${_eclpath}/nestedLGRcase/TESTCASE_NESTEDLGR.EGRID) + +add_executable(ecl_layer_statoil ecl/tests/ecl_layer_statoil.c) +target_link_libraries(ecl_layer_statoil ecl) +add_test(NAME ecl_layer_statoil COMMAND ecl_layer_statoil + ${_eclpath}/Mariner/MARINER.EGRID + ${_eclpath}/Mariner/faultblock.grdecl) + +add_executable(ecl_dualp ecl/tests/ecl_dualp.c) +target_link_libraries(ecl_dualp ecl) +add_test(NAME ecl_dualp COMMAND ecl_dualp ${_eclpath}/LGCcase/LGC_TESTCASE2) + +add_executable(ecl_sum_test ecl/tests/ecl_sum_test.c) +target_link_libraries(ecl_sum_test ecl) +add_test(NAME ecl_sum_test COMMAND ecl_sum_test ${_eclpath}/Gurbat/ECLIPSE) + +add_executable(ecl_sum_report_step_equal ecl/tests/ecl_sum_report_step_equal.c) +target_link_libraries(ecl_sum_report_step_equal ecl) +add_test(NAME ecl_sum_report_step_equal1 COMMAND ecl_sum_report_step_equal ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/Snorre/SNORRE FALSE) +add_test(NAME ecl_sum_report_step_equal2 COMMAND ecl_sum_report_step_equal ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/Gurbat/ECLIPSE TRUE) +add_test(NAME ecl_sum_report_step_equal3 COMMAND ecl_sum_report_step_equal ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/modGurbat/extraMinistep/ECLIPSE TRUE) +add_test(NAME ecl_sum_report_step_equal4 COMMAND ecl_sum_report_step_equal ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/modGurbat/short/ECLIPSE FALSE) +add_test(NAME ecl_sum_report_step_equal5 COMMAND ecl_sum_report_step_equal ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/modGurbat/enkf/ECLIPSE FALSE) +add_test(NAME ecl_sum_report_step_equal6 COMMAND ecl_sum_report_step_equal ${_eclpath}/Snorre/SNORRE ${_eclpath}/Snorre2/SNORRE2 FALSE) + +add_executable(ecl_sum_report_step_compatible ecl/tests/ecl_sum_report_step_compatible.c) +target_link_libraries(ecl_sum_report_step_compatible ecl) +add_test(NAME ecl_sum_report_step_compatible1 COMMAND ecl_sum_report_step_compatible ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/Snorre/SNORRE FALSE) +add_test(NAME ecl_sum_report_step_compatible2 COMMAND ecl_sum_report_step_compatible ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/Gurbat/ECLIPSE TRUE) +add_test(NAME ecl_sum_report_step_compatible3 COMMAND ecl_sum_report_step_compatible ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/modGurbat/extraMinistep/ECLIPSE TRUE) +add_test(NAME ecl_sum_report_step_compatible4 COMMAND ecl_sum_report_step_compatible ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/modGurbat/short/ECLIPSE TRUE) +add_test(NAME ecl_sum_report_step_compatible5 COMMAND ecl_sum_report_step_compatible ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/modGurbat/enkf/ECLIPSE TRUE) +add_test(NAME ecl_sum_report_step_compatible6 COMMAND ecl_sum_report_step_equal ${_eclpath}/Snorre/SNORRE ${_eclpath}/Snorre2/SNORRE2 FALSE) + +add_executable(ecl_file_statoil ecl/tests/ecl_file_statoil.c) +target_link_libraries(ecl_file_statoil ecl) +add_test(NAME ecl_file_statoil + COMMAND ecl_file_statoil ${_eclpath}/Gurbat/ECLIPSE.UNRST ECLIPSE.UNRST) + +add_executable(ecl_fmt ecl/tests/ecl_fmt.c) +target_link_libraries(ecl_fmt ecl) +add_test(NAME ecl_fmt COMMAND ecl_fmt + ${_eclpath}/Gurbat/ECLIPSE.UNRST + ${_eclpath}/Gurbat/ECLIPSE.DATA) + + +add_executable(ecl_rsthead ecl/tests/ecl_rsthead.c) +target_link_libraries(ecl_rsthead ecl) +add_test(NAME ecl_rsthead COMMAND ecl_rsthead + ${_eclpath}/Gurbat/ECLIPSE.UNRST + ${_eclpath}/DualPoro/DUALPORO.X0005) + +add_executable(ecl_smspec ecl/tests/ecl_smspec.c) +target_link_libraries(ecl_smspec ecl) +add_test(NAME ecl_smspec COMMAND ecl_smspec + ${_eclpath}/Gurbat/ECLIPSE.SMSPEC + ${_eclpath}/Heidrun/Summary/FF12_2013B3_CLEAN_RS.SMSPEC) + + +add_executable(ecl_rft ecl/tests/ecl_rft.c) +target_link_libraries(ecl_rft ecl) +add_test(NAME ecl_rft_rft COMMAND ecl_rft ${_eclpath}/Gurbat/ECLIPSE.RFT RFT) +add_test(NAME ecl_rft_rft_rw COMMAND ecl_rft ${_eclpath}/Gurbat/ECLIPSE.RFT RFT_RW) +add_test(NAME ecl_rft_plt COMMAND ecl_rft ${_eclpath}/RFT/TEST1_1A.RFT PLT) +add_test(NAME ecl_rft_mswplt COMMAND ecl_rft ${_eclpath}/RFT/RFT2.RFT MSW-PLT) + +add_executable(ecl_grid_copy_statoil ecl/tests/ecl_grid_copy_statoil.c) +target_link_libraries(ecl_grid_copy_statoil ecl) + +add_test(NAME ecl_grid_copy_statoil1 COMMAND ecl_grid_copy_statoil ${_eclpath}/Gurbat/ECLIPSE.EGRID) +add_test(NAME ecl_grid_copy_statoil2 COMMAND ecl_grid_copy_statoil ${_eclpath}/Mariner/MARINER.EGRID) +add_test(NAME ecl_grid_copy_statoil3 COMMAND ecl_grid_copy_statoil ${_eclpath}/LGCcase/LGC_TESTCASE2.EGRID) +add_test(NAME ecl_grid_copy_statoil4 COMMAND ecl_grid_copy_statoil ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.EGRID) + +add_executable(ecl_fault_block_layer_statoil ecl/tests/ecl_fault_block_layer_statoil.c) +target_link_libraries(ecl_fault_block_layer_statoil ecl) +add_test(NAME ecl_fault_block_layer_statoil COMMAND ecl_fault_block_layer_statoil + ${_eclpath}/Mariner/MARINER.EGRID + ${_eclpath}/Mariner/faultblock.grdecl) + +if (HAVE_UTIL_ABORT_INTERCEPT) + add_executable(ecl_fortio ecl/tests/ecl_fortio.c) + target_link_libraries( ecl_fortio ecl) + add_test(NAME ecl_fortio COMMAND ecl_fortio ${_eclpath}/Gurbat/ECLIPSE.UNRST) +endif() + +add_executable(well_state_load ecl/tests/well_state_load.c) +target_link_libraries( well_state_load ecl) + +add_executable(well_state_load_missing_RSEG ecl/tests/well_state_load_missing_RSEG.c) +target_link_libraries(well_state_load_missing_RSEG ecl) + +add_test(NAME well_state_load1 COMMAND well_state_load ${_eclpath}/Gurbat/ECLIPSE.EGRID + ${_eclpath}/Gurbat/ECLIPSE.X0030) +add_test(NAME well_state_load2 COMMAND well_state_load ${_eclpath}/MSWcase/MSW_CASE.EGRID + ${_eclpath}/MSWcase/MSW_CASE.X0021) +add_test(NAME well_state_load3 COMMAND well_state_load ${_eclpath}/Troll/MSW/MSW.EGRID + ${_eclpath}/Troll/MSW/MSW.X0123) +add_test(NAME well_state_load4 COMMAND well_state_load ${_eclpath}/Troll/MSW_LGR/LGR.EGRID + ${_eclpath}/Troll/MSW_LGR/LGR.X0095) +add_test(NAME well_state_load5 COMMAND well_state_load ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.EGRID + ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.X0061) +add_test(NAME well_state_load_missing_RSEG1 + COMMAND well_state_load_missing_RSEG ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.EGRID + ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.X0061) +add_test(NAME well_state_load_missing_RSEG2 + COMMAND well_state_load_missing_RSEG ${_eclpath}/Troll/MSW/MSW.EGRID + ${_eclpath}/Troll/MSW/MSW.X0123) + +add_executable(well_segment_load ecl/tests/well_segment_load.c) +target_link_libraries(well_segment_load ecl) +add_test(NAME well_segment_load + COMMAND well_segment_load ${_eclpath}/MSWcase/MSW_CASE.X0021) + +add_executable(well_segment_branch_conn_load ecl/tests/well_segment_branch_conn_load.c) +target_link_libraries(well_segment_branch_conn_load ecl) +add_test(NAME well_segment_branch_conn_load + COMMAND well_segment_branch_conn_load ${_eclpath}/MSWcase/MSW_CASE.X0021) + +add_executable(well_info ecl/tests/well_info.c) +target_link_libraries(well_info ecl) +add_test(NAME well_info COMMAND well_info ${_eclpath}/Gurbat/ECLIPSE.EGRID) + +add_executable(well_conn_CF ecl/tests/well_conn_CF.c) +target_link_libraries(well_conn_CF ecl) +add_test(NAME well_conn_CF COMMAND well_conn_CF ${_eclpath}/Gurbat/ECLIPSE.X0060) + +add_executable(well_conn_load ecl/tests/well_conn_load.c) +target_link_libraries(well_conn_load ecl) +add_test(NAME well_conn_load1 COMMAND well_conn_load ${_eclpath}/Gurbat/ECLIPSE.X0030 F) +add_test(NAME well_conn_load2 COMMAND well_conn_load ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.X0021 F) +add_test(NAME well_conn_load3 COMMAND well_conn_load ${_eclpath}/MSWcase/MSW_CASE.X0021 T) +add_test(NAME well_conn_load4 COMMAND well_conn_load ${_eclpath}/AmalgLGRcase/TESTCASE_AMALG_LGR.X0021 F) +add_test(NAME well_conn_load5 COMMAND well_conn_load ${_eclpath}/DualPoro/DUALPORO.X0009 F) +add_test(NAME well_conn_load6 COMMAND well_conn_load ${_eclpath}/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003 F) + +add_executable(well_ts ecl/tests/well_ts.c) +target_link_libraries(well_ts ecl) +add_test(NAME well_ts COMMAND well_ts ${_eclpath}/CO2case/BASE_CASE) + +add_executable(well_dualp ecl/tests/well_dualp.c) +target_link_libraries(well_dualp ecl) +add_test(NAME well_dualp COMMAND well_dualp + ${_eclpath}/Gurbat/ECLIPSE.UNRST + ${_eclpath}/DualPoro/DUALPORO.X0005) + +add_executable(well_lgr_load ecl/tests/well_lgr_load.c) +target_link_libraries(well_lgr_load ecl) + +add_test(NAME well_lgr_load1 COMMAND well_lgr_load ${_eclpath}/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.EGRID + ${_eclpath}/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003) +add_test(NAME well_lgr_load2 COMMAND well_lgr_load ${_eclpath}/AmalgLGRcase/TESTCASE_AMALG_LGR.EGRID + ${_eclpath}/AmalgLGRcase/TESTCASE_AMALG_LGR.X0016) + +# +# geometry +# +add_executable(geo_surface geometry/tests/geo_surface.c) +target_link_libraries(geo_surface ecl) +add_test(NAME geo_surface COMMAND geo_surface + ${_geopath}/Surface.irap + ${_geopath}/Surface_incompatible.irap) diff --git a/ThirdParty/Ert/libert_util/include/ert/util/build_config.h.in b/ThirdParty/Ert/lib/build_config.h.in similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/build_config.h.in rename to ThirdParty/Ert/lib/build_config.h.in diff --git a/ThirdParty/Ert/libeclxx/src/EclFilename.cpp b/ThirdParty/Ert/lib/ecl/EclFilename.cpp similarity index 100% rename from ThirdParty/Ert/libeclxx/src/EclFilename.cpp rename to ThirdParty/Ert/lib/ecl/EclFilename.cpp diff --git a/ThirdParty/Ert/libeclxx/src/FortIO.cpp b/ThirdParty/Ert/lib/ecl/FortIO.cpp similarity index 100% rename from ThirdParty/Ert/libeclxx/src/FortIO.cpp rename to ThirdParty/Ert/lib/ecl/FortIO.cpp diff --git a/ThirdParty/Ert/libeclxx/src/Smspec.cpp b/ThirdParty/Ert/lib/ecl/Smspec.cpp similarity index 92% rename from ThirdParty/Ert/libeclxx/src/Smspec.cpp rename to ThirdParty/Ert/lib/ecl/Smspec.cpp index c12223f3f5..5e13d6917f 100644 --- a/ThirdParty/Ert/libeclxx/src/Smspec.cpp +++ b/ThirdParty/Ert/lib/ecl/Smspec.cpp @@ -37,8 +37,13 @@ namespace ERT { {} smspec_node::smspec_node( const std::string& keyword ) : - smspec_node( ECL_SMSPEC_FIELD_VAR, "", keyword.c_str(), - "", default_join, dummy_dims, 0 ) + smspec_node( ecl_smspec_identify_var_type( keyword.c_str() ), + "", + keyword.c_str(), + "", + default_join, + dummy_dims, + 0 ) {} smspec_node::smspec_node( diff --git a/ThirdParty/Ert/libecl/src/ecl_box.c b/ThirdParty/Ert/lib/ecl/ecl_box.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_box.c rename to ThirdParty/Ert/lib/ecl/ecl_box.c diff --git a/ThirdParty/Ert/libecl/src/ecl_coarse_cell.c b/ThirdParty/Ert/lib/ecl/ecl_coarse_cell.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_coarse_cell.c rename to ThirdParty/Ert/lib/ecl/ecl_coarse_cell.c diff --git a/ThirdParty/Ert/libecl/src/ecl_file.c b/ThirdParty/Ert/lib/ecl/ecl_file.c similarity index 79% rename from ThirdParty/Ert/libecl/src/ecl_file.c rename to ThirdParty/Ert/lib/ecl/ecl_file.c index 5a5f3c695f..aab15002d7 100644 --- a/ThirdParty/Ert/libecl/src/ecl_file.c +++ b/ThirdParty/Ert/lib/ecl/ecl_file.c @@ -677,12 +677,87 @@ void ecl_file_free__(void * arg) { /****************************************************************************/ -/* Here we include a file with functions specialized to work with - restart files. Observe that the files ecl_rstfile.c is compiled as - part of the same compilation unit as ecl_file.c +/* Functions specialized to work with restart files. */ + +/* Query functions. */ +/** + Will look through all the INTEHEAD kw instances of the current + ecl_file and look for @sim_time. If the value is found true is + returned, otherwise false. */ -#include "ecl_rstfile.c" +bool ecl_file_has_sim_time( const ecl_file_type * ecl_file , time_t sim_time) { + return ecl_file_view_has_sim_time( ecl_file->active_view , sim_time ); +} + + +/* + This function will determine the restart block corresponding to the + world time @sim_time; if @sim_time can not be found the function + will return 0. + + The returned index is the 'occurence number' in the restart file, + i.e. in the (quite typical case) that not all report steps are + present the return value will not agree with report step. + + The return value from this function can then be used to get a + corresponding solution field directly, or the file map can + restricted to this block. + + Direct access: + + int index = ecl_file_get_restart_index( ecl_file , sim_time ); + if (index >= 0) { + ecl_kw_type * pressure_kw = ecl_file_iget_named_kw( ecl_file , "PRESSURE" , index ); + .... + } + + + Using block restriction: + + int index = ecl_file_get_restart_index( ecl_file , sim_time ); + if (index >= 0) { + ecl_file_iselect_rstblock( ecl_file , index ); + { + ecl_kw_type * pressure_kw = ecl_file_iget_named_kw( ecl_file , "PRESSURE" , 0 ); + .... + } + } + + Specially in the case of LGRs the block restriction should be used. + */ + +int ecl_file_get_restart_index( const ecl_file_type * ecl_file , time_t sim_time) { + int active_index = ecl_file_view_find_sim_time( ecl_file->active_view , sim_time ); + return active_index; +} + + +/** + Will look through all the SEQNUM kw instances of the current + ecl_file and look for @report_step. If the value is found true is + returned, otherwise false. +*/ + +bool ecl_file_has_report_step( const ecl_file_type * ecl_file , int report_step) { + return ecl_file_view_has_report_step( ecl_file->active_view , report_step ); +} + + +/** + This function will look up the INTEHEAD keyword in a ecl_file_type + instance, and calculate simulation date from this instance. + + Will return -1 if the requested INTEHEAD keyword can not be found. +*/ + +time_t ecl_file_iget_restart_sim_date( const ecl_file_type * restart_file , int index ) { + return ecl_file_view_iget_restart_sim_date( restart_file->active_view , index ); +} + +double ecl_file_iget_restart_sim_days( const ecl_file_type * restart_file , int index ) { + return ecl_file_view_iget_restart_sim_days( restart_file->active_view , index ); +} /*****************************************************************/ /* Two small lookup functions which consider the INTEHEAD keyword, @@ -799,4 +874,121 @@ bool ecl_file_save_kw( const ecl_file_type * ecl_file , const ecl_kw_type * ecl_ } -#include "ecl_file_deprecated.c" +/* DEPRECATED */ +void ecl_file_push_block( ecl_file_type * ecl_file ) { + vector_append_ref( ecl_file->map_stack , ecl_file->active_view ); +} + +void ecl_file_pop_block( ecl_file_type * ecl_file ) { + ecl_file->active_view = vector_pop_back( ecl_file->map_stack ); +} + + +static ecl_file_view_type * ecl_file_get_relative_blockview( ecl_file_type * ecl_file , const char * kw , int occurence) { + ecl_file_view_type * view = ecl_file_view_add_blockview( ecl_file->active_view , kw , occurence ); + return view; +} + + + +bool ecl_file_subselect_block( ecl_file_type * ecl_file , const char * kw , int occurence) { + ecl_file_view_type * blockmap = ecl_file_get_relative_blockview( ecl_file , kw , occurence); + if (blockmap != NULL) { + ecl_file->active_view = blockmap; + return true; + } else + return false; +} + + +bool ecl_file_select_block( ecl_file_type * ecl_file , const char * kw , int occurence ) { + ecl_file_view_type * blockmap = ecl_file_get_global_blockview( ecl_file , kw , occurence); + if (blockmap != NULL) { + ecl_file->active_view = blockmap; + return true; + } else + return false; +} + + +/* + Will select restart block nr @seqnum_index - without considering + report_steps or simulation time. +*/ +bool ecl_file_iselect_rstblock( ecl_file_type * ecl_file , int seqnum_index ) { + return ecl_file_select_block( ecl_file , SEQNUM_KW , seqnum_index ); +} + + +bool ecl_file_select_rstblock_sim_time( ecl_file_type * ecl_file , time_t sim_time) { + int seqnum_index = ecl_file_view_seqnum_index_from_sim_time( ecl_file->global_view , sim_time ); + + if (seqnum_index >= 0) + return ecl_file_iselect_rstblock( ecl_file , seqnum_index); + else + return false; +} + + +bool ecl_file_select_rstblock_report_step( ecl_file_type * ecl_file , int report_step) { + int global_index = ecl_file_view_find_kw_value( ecl_file->global_view , SEQNUM_KW , &report_step); + if ( global_index >= 0) { + int seqnum_index = ecl_file_view_iget_occurence( ecl_file->global_view , global_index ); + return ecl_file_iselect_rstblock( ecl_file , seqnum_index); + } else + return false; +} + + +/******************************************************************/ + +static ecl_file_type * ecl_file_open_rstblock_report_step__( const char * filename , int report_step , int flags) { + ecl_file_type * ecl_file = ecl_file_open( filename , flags ); + if (ecl_file) { + if (!ecl_file_select_rstblock_report_step( ecl_file , report_step )) { + ecl_file_close( ecl_file ); + ecl_file = NULL; + } + } + return ecl_file; +} + +ecl_file_type * ecl_file_open_rstblock_report_step( const char * filename , int report_step , int flags) { + return ecl_file_open_rstblock_report_step__(filename , report_step , flags ); +} + + +/******************************************************************/ + +static ecl_file_type * ecl_file_open_rstblock_sim_time__( const char * filename , time_t sim_time, int flags ) { + ecl_file_type * ecl_file = ecl_file_open( filename , flags ); + if (ecl_file) { + if (!ecl_file_select_rstblock_sim_time( ecl_file , sim_time)) { + ecl_file_close( ecl_file ); + ecl_file = NULL; + } + } + return ecl_file; +} + +ecl_file_type * ecl_file_open_rstblock_sim_time( const char * filename , time_t sim_time, int flags) { + return ecl_file_open_rstblock_sim_time__( filename , sim_time , flags ); +} + +/******************************************************************/ + +static ecl_file_type * ecl_file_iopen_rstblock__( const char * filename , int seqnum_index, int flags ) { + ecl_file_type * ecl_file = ecl_file_open( filename , flags ); + if (ecl_file) { + if (!ecl_file_iselect_rstblock( ecl_file , seqnum_index )) { + ecl_file_close( ecl_file ); + ecl_file = NULL; + } + } + return ecl_file; +} + + +ecl_file_type * ecl_file_iopen_rstblock( const char * filename , int seqnum_index , int flags) { + return ecl_file_iopen_rstblock__(filename , seqnum_index , flags ); +} diff --git a/ThirdParty/Ert/libecl/src/ecl_file_kw.c b/ThirdParty/Ert/lib/ecl/ecl_file_kw.c similarity index 99% rename from ThirdParty/Ert/libecl/src/ecl_file_kw.c rename to ThirdParty/Ert/lib/ecl/ecl_file_kw.c index 4a137974c2..ab72cdbedb 100644 --- a/ThirdParty/Ert/libecl/src/ecl_file_kw.c +++ b/ThirdParty/Ert/lib/ecl/ecl_file_kw.c @@ -318,6 +318,7 @@ void ecl_file_kw_inplace_fwrite( ecl_file_kw_type * file_kw , fortio_type * fort ecl_file_kw_assert_kw( file_kw ); fortio_fseek( fortio , file_kw->file_offset , SEEK_SET ); ecl_kw_fskip_header( fortio ); + fortio_fclean(fortio); ecl_kw_fwrite_data( file_kw->kw , fortio ); } diff --git a/ThirdParty/Ert/libecl/src/ecl_file_view.c b/ThirdParty/Ert/lib/ecl/ecl_file_view.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_file_view.c rename to ThirdParty/Ert/lib/ecl/ecl_file_view.c diff --git a/ThirdParty/Ert/libecl/src/ecl_grav.c b/ThirdParty/Ert/lib/ecl/ecl_grav.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_grav.c rename to ThirdParty/Ert/lib/ecl/ecl_grav.c diff --git a/ThirdParty/Ert/libecl/src/ecl_grav_calc.c b/ThirdParty/Ert/lib/ecl/ecl_grav_calc.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_grav_calc.c rename to ThirdParty/Ert/lib/ecl/ecl_grav_calc.c diff --git a/ThirdParty/Ert/libecl/src/ecl_grav_common.c b/ThirdParty/Ert/lib/ecl/ecl_grav_common.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_grav_common.c rename to ThirdParty/Ert/lib/ecl/ecl_grav_common.c diff --git a/ThirdParty/Ert/libecl/src/ecl_grid.c b/ThirdParty/Ert/lib/ecl/ecl_grid.c similarity index 99% rename from ThirdParty/Ert/libecl/src/ecl_grid.c rename to ThirdParty/Ert/lib/ecl/ecl_grid.c index 0e2dd610ef..945f6d41f7 100644 --- a/ThirdParty/Ert/libecl/src/ecl_grid.c +++ b/ThirdParty/Ert/lib/ecl/ecl_grid.c @@ -3953,20 +3953,6 @@ static bool tetrahedron_by_points_contains(const point_type * p0, return tetrahedron_contains(pro_tet, *p); } -static bool tetrahedron_positive_volume(const point_type * p0, - const point_type * p1, - const point_type * p2, - const point_type * p3) { - - tetrahedron_type pro_tet; - pro_tet.p0 = *p0; - pro_tet.p1 = *p1; - pro_tet.p2 = *p2; - pro_tet.p3 = *p3; - - return tetrahedron_volume6(pro_tet) >= 0; -} - /* Returns true if and only if the cell "cell" decomposed by "method" contains the point "p". This is done by decomposing the cell into 5 tetrahedrons according to the decomposition @@ -4001,34 +3987,19 @@ static bool concave_cell_contains( const ecl_cell_type * cell, int method, const }; // Test for containment in cell core - bool contained = tetrahedron_by_points_contains(dia[0][0], dia[1][0], dia[0][1], dia[1][1], p); + if (tetrahedron_by_points_contains(dia[0][0], dia[1][0], dia[0][1], dia[1][1], p)) + return true; // Test for containment in protrusions for(int i = 0; i < 2; ++i) { - if(tetrahedron_by_points_contains(dia[i][0], dia[i][1], dia[(i+1)%2][0], extra[i][0], p)) { - contained = true; + if(tetrahedron_by_points_contains(dia[i][0], dia[i][1], dia[(i+1)%2][0], extra[i][0], p)) + return true; - bool on_inner_faces = false; - on_inner_faces |= triangle_contains3d(dia[i][0], dia[(i+1)%2][0], extra[i][0], p); - on_inner_faces |= triangle_contains3d(dia[i][1], dia[(i+1)%2][0], extra[i][0], p); - - if(!on_inner_faces && !tetrahedron_positive_volume(dia[i][0], dia[i][1], dia[(i+1)%2][0], extra[i][0])) - return false; - } - - if(tetrahedron_by_points_contains(dia[i][0], dia[(i+1)%2][1], dia[i][1], extra[i][1], p)) { - contained = true; - - bool on_inner_faces = false; - on_inner_faces |= triangle_contains3d(dia[i][0], dia[(i+1)%2][1], extra[i][1], p); - on_inner_faces |= triangle_contains3d(dia[i][1], dia[(i+1)%2][1], extra[i][1], p); - - if(!on_inner_faces && !tetrahedron_positive_volume(dia[i][0], dia[(i+1)%2][1], dia[i][1], extra[i][1])) - return false; - } + if(tetrahedron_by_points_contains(dia[i][0], dia[(i+1)%2][1], dia[i][1], extra[i][1], p)) + return true; } - return contained; + return false; } /* @@ -4066,14 +4037,8 @@ bool ecl_grid_cell_contains_xyz3( const ecl_grid_type * ecl_grid , int i, int j bool max_k = (k == ecl_grid->nz-1); face_status_enum face_status = ecl_grid_on_cell_face(cell, method, &p, max_i, max_j, max_k); - if(face_status != NOT_ON_FACE) { - // Since we might get false positives in the case when the cells - // projections to the xy-plane is concave, we still check whether - // the point is contained in the cell if it face_status is - // BELONGS_TO_CELL. - if(face_status == BELONGS_TO_OTHER) - return false; - } + if(face_status != NOT_ON_FACE) + return face_status == BELONGS_TO_CELL; // Twisted cells if (ecl_cell_get_twist(cell) > 0) { @@ -5068,6 +5033,9 @@ ecl_grid_type * ecl_grid_get_lgr(const ecl_grid_type * main_grid, const char * _ */ bool ecl_grid_has_lgr(const ecl_grid_type * main_grid, const char * __lgr_name) { + if(!__lgr_name) + return false; + __assert_main_grid( main_grid ); { char * lgr_name = util_alloc_strip_copy( __lgr_name ); @@ -5077,6 +5045,18 @@ bool ecl_grid_has_lgr(const ecl_grid_type * main_grid, const char * __lgr_name) } } +bool ecl_grid_has_lgr_nr(const ecl_grid_type * main_grid, int lgr_nr) { + __assert_main_grid( main_grid ); + { + if (int_vector_size( main_grid->lgr_index_map ) > lgr_nr) + return true; + else + return false; + } +} + + + int ecl_grid_get_num_coarse_groups( const ecl_grid_type * main_grid ) { return vector_get_size( main_grid->coarse_cells ); @@ -5812,8 +5792,8 @@ static const float * ecl_grid_get_mapaxes( const ecl_grid_type * grid ) { return grid->mapaxes; } -static ecl_kw_type * ecl_grid_alloc_mapaxes_kw( const float * mapaxes ) { - return ecl_kw_alloc_new( MAPAXES_KW , 6 , ECL_FLOAT , mapaxes); +ecl_kw_type * ecl_grid_alloc_mapaxes_kw( const ecl_grid_type * grid ) { + return ecl_kw_alloc_new( MAPAXES_KW , 6 , ECL_FLOAT , grid->mapaxes); } static ecl_kw_type * ecl_grid_alloc_mapunits_kw( ert_ecl_unit_enum output_unit ) { @@ -5872,8 +5852,8 @@ static float ecl_grid_output_scaling( const ecl_grid_type * grid , ert_ecl_unit_ } -static void ecl_grid_fwrite_mapaxes( const float * mapaxes , fortio_type * fortio) { - ecl_kw_type * mapaxes_kw = ecl_grid_alloc_mapaxes_kw( mapaxes ); +static void ecl_grid_fwrite_mapaxes( const ecl_grid_type * grid , fortio_type * fortio) { + ecl_kw_type * mapaxes_kw = ecl_grid_alloc_mapaxes_kw( grid ); ecl_kw_fwrite( mapaxes_kw , fortio ); ecl_kw_free( mapaxes_kw ); } @@ -5896,7 +5876,7 @@ static void ecl_grid_fwrite_main_GRID_headers( const ecl_grid_type * ecl_grid , ecl_grid_fwrite_mapunits( fortio , output_unit ); if (ecl_grid->use_mapaxes) - ecl_grid_fwrite_mapaxes( ecl_grid->mapaxes , fortio ); + ecl_grid_fwrite_mapaxes( ecl_grid , fortio ); ecl_grid_fwrite_gridunits( fortio , output_unit ); } @@ -6035,7 +6015,7 @@ static void ecl_grid_fwrite_main_EGRID_header( const ecl_grid_type * grid , fort ecl_grid_fwrite_mapunits( fortio , output_unit ); if (mapaxes != NULL) - ecl_grid_fwrite_mapaxes( mapaxes , fortio ); + ecl_grid_fwrite_mapaxes( grid , fortio ); ecl_grid_fwrite_gridunits( fortio , output_unit); } @@ -6286,11 +6266,25 @@ float * ecl_grid_alloc_zcorn_data( const ecl_grid_type * grid ) { ecl_kw_type * ecl_grid_alloc_zcorn_kw( const ecl_grid_type * grid ) { - ecl_kw_type * zcorn_kw = ecl_kw_alloc( ZCORN_KW , 8 * grid->size , ECL_FLOAT); - ecl_grid_init_zcorn_data( grid , ecl_kw_get_void_ptr( zcorn_kw )); + ecl_kw_type * zcorn_kw = ecl_kw_alloc( ZCORN_KW , ecl_grid_get_zcorn_size(grid), ECL_FLOAT); + ecl_grid_init_zcorn_data(grid , ecl_kw_get_void_ptr(zcorn_kw)); return zcorn_kw; } +ecl_kw_type * ecl_grid_alloc_coord_kw( const ecl_grid_type * grid) { + if(grid->coord_kw) + return ecl_kw_alloc_copy(grid->coord_kw); + + ecl_kw_type * coord_kw = ecl_kw_alloc( + COORD_KW, + ECL_GRID_COORD_SIZE(grid->nx, grid->ny), + ECL_FLOAT + ); + ecl_grid_init_coord_data(grid, ecl_kw_get_float_ptr(coord_kw)); + + return coord_kw; +} + int ecl_grid_get_coord_size( const ecl_grid_type * grid) { return ECL_GRID_COORD_SIZE( grid->nx , grid->ny ); @@ -6681,7 +6675,7 @@ void ecl_grid_fprintf_grdecl2(ecl_grid_type * grid , FILE * stream , ert_ecl_uni } if (grid->use_mapaxes) { - ecl_kw_type * mapaxes_kw = ecl_grid_alloc_mapaxes_kw( grid->mapaxes ); + ecl_kw_type * mapaxes_kw = ecl_grid_alloc_mapaxes_kw( grid ); ecl_kw_fprintf_grdecl( mapaxes_kw , stream ); ecl_kw_free( mapaxes_kw ); } diff --git a/ThirdParty/Ert/libecl/src/ecl_grid_cache.c b/ThirdParty/Ert/lib/ecl/ecl_grid_cache.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_grid_cache.c rename to ThirdParty/Ert/lib/ecl/ecl_grid_cache.c diff --git a/ThirdParty/Ert/libecl/src/ecl_grid_dims.c b/ThirdParty/Ert/lib/ecl/ecl_grid_dims.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_grid_dims.c rename to ThirdParty/Ert/lib/ecl/ecl_grid_dims.c diff --git a/ThirdParty/Ert/libecl/src/ecl_init_file.c b/ThirdParty/Ert/lib/ecl/ecl_init_file.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_init_file.c rename to ThirdParty/Ert/lib/ecl/ecl_init_file.c diff --git a/ThirdParty/Ert/libecl/src/ecl_io_config.c b/ThirdParty/Ert/lib/ecl/ecl_io_config.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_io_config.c rename to ThirdParty/Ert/lib/ecl/ecl_io_config.c diff --git a/ThirdParty/Ert/libecl/src/ecl_kw.c b/ThirdParty/Ert/lib/ecl/ecl_kw.c similarity index 99% rename from ThirdParty/Ert/libecl/src/ecl_kw.c rename to ThirdParty/Ert/lib/ecl/ecl_kw.c index d562f1a09a..34d1fd57c3 100644 --- a/ThirdParty/Ert/libecl/src/ecl_kw.c +++ b/ThirdParty/Ert/lib/ecl/ecl_kw.c @@ -474,9 +474,6 @@ static void ecl_kw_set_shared_ref(ecl_kw_type * ecl_kw , void *data_ptr) { static void ecl_kw_initialize(ecl_kw_type * ecl_kw , const char *header , int size , ecl_data_type data_type) { ecl_kw_set_data_type(ecl_kw, data_type); - if (strlen(header) > ECL_STRING8_LENGTH) - util_abort("%s: Fatal error: ecl_header_name:%s is longer than eight characters - aborting \n",__func__,header); - ecl_kw_set_header_name(ecl_kw , header); ecl_kw->size = size; } @@ -1474,11 +1471,17 @@ void ecl_kw_free_data(ecl_kw_type *ecl_kw) { void ecl_kw_set_header_name(ecl_kw_type * ecl_kw , const char * header) { ecl_kw->header8 = realloc(ecl_kw->header8 , ECL_STRING8_LENGTH + 1); - sprintf(ecl_kw->header8 , "%-8s" , header); + if (strlen(header) <= 8) { + sprintf(ecl_kw->header8 , "%-8s" , header); + + /* Internalizing a header without the trailing spaces as well. */ + util_safe_free( ecl_kw->header ); + ecl_kw->header = util_alloc_strip_copy( ecl_kw->header8 ); + } + else { + ecl_kw->header = util_alloc_copy(header, strlen( header ) + 1); + } - /* Internalizing a header without the trailing spaces as well. */ - util_safe_free( ecl_kw->header ); - ecl_kw->header = util_alloc_strip_copy( ecl_kw->header8 ); } @@ -1711,9 +1714,14 @@ void ecl_kw_fwrite_header(const ecl_kw_type *ecl_kw , fortio_type *fortio) { } -void ecl_kw_fwrite(const ecl_kw_type *ecl_kw , fortio_type *fortio) { +bool ecl_kw_fwrite(const ecl_kw_type *ecl_kw , fortio_type *fortio) { + if (strlen(ecl_kw_get_header( ecl_kw)) > ECL_STRING8_LENGTH) { + fortio_fwrite_error(fortio); + return false; + } ecl_kw_fwrite_header(ecl_kw , fortio); ecl_kw_fwrite_data(ecl_kw , fortio); + return true; } diff --git a/ThirdParty/Ert/libecl/src/ecl_kw_functions.c b/ThirdParty/Ert/lib/ecl/ecl_kw_functions.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_kw_functions.c rename to ThirdParty/Ert/lib/ecl/ecl_kw_functions.c diff --git a/ThirdParty/Ert/libecl/src/ecl_kw_grdecl.c b/ThirdParty/Ert/lib/ecl/ecl_kw_grdecl.c similarity index 86% rename from ThirdParty/Ert/libecl/src/ecl_kw_grdecl.c rename to ThirdParty/Ert/lib/ecl/ecl_kw_grdecl.c index bf44d6cff3..8149fca1dd 100644 --- a/ThirdParty/Ert/libecl/src/ecl_kw_grdecl.c +++ b/ThirdParty/Ert/lib/ecl/ecl_kw_grdecl.c @@ -25,6 +25,7 @@ #include #include +#define MAX_GRDECL_HEADER_SIZE 512 /* This file is devoted to different routines for reading and writing @@ -74,7 +75,7 @@ bool ecl_kw_grdecl_fseek_next_kw( FILE * stream ) { long start_pos = util_ftell( stream ); long current_pos; - char next_kw[256]; + char next_kw[MAX_GRDECL_HEADER_SIZE]; /* Determine if the current position of the file pointer is at the @@ -146,7 +147,7 @@ bool ecl_kw_grdecl_fseek_next_kw( FILE * stream ) { char * ecl_kw_grdecl_alloc_next_header( FILE * stream ) { if (ecl_kw_grdecl_fseek_next_kw( stream )) { - char next_kw[256]; + char next_kw[MAX_GRDECL_HEADER_SIZE]; fscanf( stream , "%s" , next_kw); return util_alloc_string_copy( next_kw ); } else @@ -187,89 +188,7 @@ static bool ecl_kw_grdecl_fseek_kw__(const char * kw , FILE * stream) { -// static bool ecl_kw_grdecl_fseek_kw__OLD(const char * kw , FILE * stream) { -// const int newline_char = '\n'; -// long int init_pos = ftell(stream); -// -// if (util_fseek_string(stream , kw , false , true)) { -// /* -// OK the keyword is found in the file; now we must verify that: -// -// 1. It is terminated with a blank, i.e. when searching for -// 'COORD' we do not want a positive on 'COORDSYS'. -// -// 2. That the keyword indeed starts with a isspace() character; we -// are not interested in the 'SYS' in 'COORDSYS'. -// -// 3. That the current location is not a comment section. -// */ -// long int kw_pos = ftell( stream ); -// bool valid_kw = false; -// int c; -// -// fseek( stream , strlen(kw) , SEEK_CUR); // Seek to end of kw -// c = fgetc( stream ); // Read one character -// fseek( stream , kw_pos , SEEK_SET ); // Seek back to beginning of kw -// -// if (isspace(c)) { -// if (kw_pos > 0) { -// fseek( stream , kw_pos - 1 , SEEK_SET); -// c = fgetc( stream ); -// if (isspace(c)) -// // OK - we have verifed that the kw string we have found both -// // starts and ends with a isspace() character. -// valid_kw = true; -// } else -// valid_kw = true; // kw is at the very beginning of the file. -// } -// -// -// if (valid_kw) { -// // OK - the kw is validly terminated with a space/tab/newline; now -// // we must verify that it is not in a comment section. -// if (kw_pos >= strlen(ECL_COMMENT_STRING) ) { // Must have this check to avoid infinite spinning -// // when the keyword is in the very beginning of the file. -// fseek( stream , 1 , SEEK_CUR ); -// while (true) { -// fseek( stream , -2 , SEEK_CUR ); -// c = fgetc( stream ); -// if ((c == newline_char) || (ftell(stream) == 0)) -// break; -// } -// { -// // We have gone as far back as necessary. -// int line_length = kw_pos - ftell( stream ); -// char * line = util_malloc(line_length + 1 , __func__); -// -// fread( stream , sizeof * line , line_length , stream); -// line[line_length] = '\0'; -// -// if (strstr( line , ECL_COMMENT_STRING) == NULL) -// // We are not in a commen section. -// valid_kw = true; -// else -// valid_kw = false; -// -// free( line ); -// } -// } -// } else -// valid_kw = false; -// -// if (valid_kw) -// return true; -// else { -// fseek( stream , strlen(kw) , SEEK_CUR ); // Skip over the kw so we don't find it again. -// if (ecl_kw_grdecl_fseek_kw__(kw , stream)) -// return true; -// else { -// fseek( stream , init_pos , SEEK_SET ); -// return false; -// } -// } -// } else -// return false; -// } + bool ecl_kw_grdecl_fseek_kw(const char * kw , bool rewind , FILE * stream) { @@ -291,7 +210,6 @@ bool ecl_kw_grdecl_fseek_kw(const char * kw , bool rewind , FILE * stream) { - /** Observe that this function does not preserve the '*' structure which (might) have been used in the input. @@ -476,9 +394,9 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_ The ecl_kw class has a quite deeply wired assumption that the header is a string of length 8 (I hope/think that is an ECLIPSE - limitation), and the the class is not able to create ecl_kw - instances with header length of more than 8 characters - code will - abort hard if @kw is longer than 8 characters. + limitation). The class cannot read/write kw with headers longer than 8 bytes. + ecl_kw_grdecl is a workaround allowing for reading/writing kw with long + headers. ----------------------------------------------------------------- @@ -517,6 +435,9 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_ */ static ecl_kw_type * __ecl_kw_fscanf_alloc_grdecl__(FILE * stream , const char * header , bool strict , int size , ecl_data_type data_type) { + if (header && strlen(header) >MAX_GRDECL_HEADER_SIZE) + util_abort("%s cannot read KW of more than %d bytes. strlen(header) == %d\n", __func__, MAX_GRDECL_HEADER_SIZE, strlen(header) ); + if (!ecl_type_is_numeric(data_type)) util_abort("%s: sorry only types FLOAT, INT and DOUBLE supported\n",__func__); @@ -525,7 +446,7 @@ static ecl_kw_type * __ecl_kw_fscanf_alloc_grdecl__(FILE * stream , const char * return NULL; /* Could not find it. */ { - char file_header[9]; + char file_header[MAX_GRDECL_HEADER_SIZE]; if (fscanf(stream , "%s" , file_header) == 1) { int kw_size; char * data = fscanf_alloc_grdecl_data( file_header , strict , data_type , &kw_size , stream ); diff --git a/ThirdParty/Ert/lib/ecl/ecl_nnc_data.c b/ThirdParty/Ert/lib/ecl/ecl_nnc_data.c new file mode 100644 index 0000000000..a8435278b8 --- /dev/null +++ b/ThirdParty/Ert/lib/ecl/ecl_nnc_data.c @@ -0,0 +1,280 @@ +/* + Copyright (C) 2017 Statoil ASA, Norway. + + The file 'ecl_file_view.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. +*/ + +#define ECL_NNC_DATA_TYPE_ID 83756236 + +#include +#include +#include +#include +#include +#include + +enum kw_data_type { + TRANS_DATA = 1, + WTR_FLUX_DATA = 2, + OIL_FLUX_DATA = 3, + GAS_FLUX_DATA = 4 +}; + +struct ecl_nnc_data_struct { + UTIL_TYPE_ID_DECLARATION; + int size; + double * values; +}; + + +static const char * ecl_nnc_data_get_str_kw(int kw_type, int grid1, int grid2) { + char * kw = NULL; + switch (kw_type) { + + case TRANS_DATA: + if (grid1 == grid2) + kw = TRANNNC_KW; + else if (grid1 == 0) + kw = TRANGL_KW; + else + kw = TRANLL_KW; + break; + + case WTR_FLUX_DATA: + if (grid1 == grid2) + kw = FLRWATNNC_KW; + else if (grid1 == 0) + kw = FLRWATLG_KW; + else + kw = FLRWATLL_KW; + break; + + case OIL_FLUX_DATA: + if (grid1 == grid2) + kw = FLROILNNC_KW; + else if (grid1 == 0) + kw = FLROILLG_KW; + else + kw = FLROILLL_KW; + break; + + case GAS_FLUX_DATA: + if (grid1 == grid2) + kw = FLRGASNNC_KW; + else if (grid1 == 0) + kw = FLRGASLG_KW; + else + kw = FLRGASLL_KW; + break; + + default: + kw = NULL; + + } + return kw; +} + + +static ecl_kw_type * ecl_nnc_data_get_gl_kw( const ecl_file_view_type * init_file_view , const char * kw, int kw_type, int lgr_nr) { + ecl_kw_type * return_kw = NULL; + + if (kw != NULL) + if (lgr_nr == 0) { + if(ecl_file_view_has_kw(init_file_view, kw)) + return_kw = ecl_file_view_iget_named_kw(init_file_view, kw, 0); + } else { + { + const int file_num_kw = ecl_file_view_get_size( init_file_view ); + int global_kw_index = 0; + bool finished = false; + bool correct_lgrheadi = false; + int head_index = 0; + int steps = 0; + + while(!finished){ + ecl_kw_type * ecl_kw = ecl_file_view_iget_kw( init_file_view , global_kw_index ); + const char *current_kw = ecl_kw_get_header(ecl_kw); + if (strcmp( LGRHEADI_KW , current_kw) == 0) { + if (ecl_kw_iget_int( ecl_kw , LGRHEADI_LGR_NR_INDEX) == lgr_nr) { + correct_lgrheadi = true; + head_index = global_kw_index; + }else{ + correct_lgrheadi = false; + } + } + if(correct_lgrheadi) { + if (strcmp(kw, current_kw) == 0) { + steps = global_kw_index - head_index; /* This is to calculate who fare from lgrheadi we found the TRANGL/TRANNNC key word */ + if (kw_type != TRANS_DATA || steps == 3 || steps == 4 || steps == 6) { /* We only support a file format where TRANNNC is 3 steps and TRANGL is 4 or 6 steps from LGRHEADI */ + return_kw = ecl_kw; + finished = true; + break; + } + } + } + global_kw_index++; + if (global_kw_index == file_num_kw) + finished = true; + } + } + } + return return_kw; +} + + +static ecl_kw_type * ecl_nnc_data_get_tranll_kw( const ecl_grid_type * grid , const ecl_file_view_type * init_file_view , int lgr_nr1, int lgr_nr2 ) { + const char * lgr_name1 = ecl_grid_get_lgr_name( grid , lgr_nr1 ); + const char * lgr_name2 = ecl_grid_get_lgr_name( grid , lgr_nr2 ); + + ecl_kw_type * tran_kw = NULL; + const int file_num_kw = ecl_file_view_get_size( init_file_view ); + int global_kw_index = 0; + + while (true) { + if (global_kw_index >= file_num_kw) + break; + { + ecl_kw_type * ecl_kw = ecl_file_view_iget_kw( init_file_view , global_kw_index ); + if (strcmp( LGRJOIN_KW , ecl_kw_get_header( ecl_kw)) == 0) { + + if (ecl_kw_icmp_string( ecl_kw , 0 , lgr_name1) && ecl_kw_icmp_string( ecl_kw , 1 , lgr_name2)) { + tran_kw = ecl_file_view_iget_kw( init_file_view , global_kw_index + 1); + break; + } + } + global_kw_index++; + } + } + + return tran_kw; +} + + +static ecl_kw_type * ecl_nnc_data_get_kw( const ecl_grid_type * grid, const ecl_file_view_type * init_file_view, int lgr_nr1, int lgr_nr2 , int kw_type) { + + const char * kw = ecl_nnc_data_get_str_kw(kw_type, lgr_nr1, lgr_nr2); + if (lgr_nr1 == 0 || lgr_nr1 == lgr_nr2) + return ecl_nnc_data_get_gl_kw( init_file_view , kw, kw_type, lgr_nr2 ); + else + if (kw_type == TRANS_DATA) + return ecl_nnc_data_get_tranll_kw( grid , init_file_view , lgr_nr1 , lgr_nr2 ); + else + return NULL; +} + +static void assert_correct_kw_count(ecl_kw_type * kw, char * function_name, bool check_kw_count, int correct_kw_count, int kw_count) { + if (check_kw_count & (correct_kw_count != kw_count)) + util_abort("In function %s, reading kw: %s. %d != %d", function_name, ecl_kw_get_header(kw), correct_kw_count, kw_count); +} + + +static void ecl_nnc_data_set_values(ecl_nnc_data_type * data, const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file, int kw_type) { + + int current_grid1 = -1; + int current_grid2 = -1; + ecl_kw_type * current_kw = NULL; + int correct_kw_count = 0; + int kw_count = 0; + bool check_kw_count = false; + int nnc_size = ecl_nnc_geometry_size( nnc_geo ); + + for (int nnc_index = 0; nnc_index < nnc_size; nnc_index++) { + const ecl_nnc_pair_type * pair = ecl_nnc_geometry_iget( nnc_geo, nnc_index ); + int grid1 = pair->grid_nr1; + int grid2 = pair->grid_nr2; + + if (grid1 != current_grid1 || grid2 != current_grid2) { + current_grid1 = grid1; + current_grid2 = grid2; + assert_correct_kw_count(current_kw, __func__, check_kw_count, correct_kw_count, kw_count); + current_kw = ecl_nnc_data_get_kw( grid, init_file, grid1 , grid2 , kw_type); + kw_count = 0; + if (current_kw) { + correct_kw_count = ecl_kw_get_size( current_kw ); + check_kw_count = true; + data->size = nnc_index + correct_kw_count; + } + else { + check_kw_count = false; + printf("Warning: failed to obtain kw from file in function %s. ", __func__); + printf("Grid1: %d, Grid2 %d\n", current_grid1, current_grid2); + } + } + if (current_kw) { + data->values[nnc_index] = ecl_kw_iget_as_double(current_kw, pair->input_index); + kw_count++; + } + else + data->values[nnc_index] = -1; + } + assert_correct_kw_count(current_kw, __func__, check_kw_count, correct_kw_count, kw_count); +} + +static ecl_nnc_data_type * ecl_nnc_data_alloc__(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file, int kw_type) { + ecl_nnc_data_type * data = util_malloc(sizeof * data); + + data->size = 0; + + int nnc_size = ecl_nnc_geometry_size( nnc_geo ); + + data->values = util_malloc( nnc_size * sizeof(double)); + + ecl_nnc_data_set_values(data, grid, nnc_geo, init_file, kw_type); + + return data; +} + +ecl_nnc_data_type * ecl_nnc_data_alloc_tran(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file) { + return ecl_nnc_data_alloc__(grid, nnc_geo, init_file, TRANS_DATA); +} + +ecl_nnc_data_type * ecl_nnc_data_alloc_wat_flux(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file) { + return ecl_nnc_data_alloc__(grid, nnc_geo, init_file, WTR_FLUX_DATA); +} + +ecl_nnc_data_type * ecl_nnc_data_alloc_oil_flux(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file) { + return ecl_nnc_data_alloc__(grid, nnc_geo, init_file, OIL_FLUX_DATA); +} + +ecl_nnc_data_type * ecl_nnc_data_alloc_gas_flux(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file) { + return ecl_nnc_data_alloc__(grid, nnc_geo, init_file, GAS_FLUX_DATA); +} + +void ecl_nnc_data_free(ecl_nnc_data_type * data) { + free(data->values); + free(data); +} + + + +int ecl_nnc_data_get_size(ecl_nnc_data_type * data) { + return data->size; +} + +const double * ecl_nnc_data_get_values( const ecl_nnc_data_type * data ) { + return data->values; +} + + +double ecl_nnc_data_iget_value(const ecl_nnc_data_type * data, int index) { + if (index < data->size) + return data->values[index]; + else + util_abort("%s: index value:%d out range: [0,%d) \n",__func__ , index , data->size); +} + + + + diff --git a/ThirdParty/Ert/libecl/src/ecl_nnc_export.c b/ThirdParty/Ert/lib/ecl/ecl_nnc_export.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_nnc_export.c rename to ThirdParty/Ert/lib/ecl/ecl_nnc_export.c diff --git a/ThirdParty/Ert/libecl/src/ecl_nnc_geometry.c b/ThirdParty/Ert/lib/ecl/ecl_nnc_geometry.c similarity index 95% rename from ThirdParty/Ert/libecl/src/ecl_nnc_geometry.c rename to ThirdParty/Ert/lib/ecl/ecl_nnc_geometry.c index 378112cced..064862c16a 100644 --- a/ThirdParty/Ert/libecl/src/ecl_nnc_geometry.c +++ b/ThirdParty/Ert/lib/ecl/ecl_nnc_geometry.c @@ -124,3 +124,11 @@ const ecl_nnc_pair_type * ecl_nnc_geometry_iget( const ecl_nnc_geometry_type * n return struct_vector_iget_ptr( nnc_geo->data , index ); } + + +bool ecl_nnc_geometry_same_kw( const ecl_nnc_pair_type * nnc1 , const ecl_nnc_pair_type * nnc2) { + if ((nnc1->grid_nr1 == nnc2->grid_nr1) && (nnc1->grid_nr2 == nnc2->grid_nr2)) + return true; + else + return false; +} diff --git a/ThirdParty/Ert/libecl/src/ecl_region.c b/ThirdParty/Ert/lib/ecl/ecl_region.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_region.c rename to ThirdParty/Ert/lib/ecl/ecl_region.c diff --git a/ThirdParty/Ert/libecl/src/ecl_rft_cell.c b/ThirdParty/Ert/lib/ecl/ecl_rft_cell.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_rft_cell.c rename to ThirdParty/Ert/lib/ecl/ecl_rft_cell.c diff --git a/ThirdParty/Ert/libecl/src/ecl_rft_file.c b/ThirdParty/Ert/lib/ecl/ecl_rft_file.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_rft_file.c rename to ThirdParty/Ert/lib/ecl/ecl_rft_file.c diff --git a/ThirdParty/Ert/libecl/src/ecl_rft_node.c b/ThirdParty/Ert/lib/ecl/ecl_rft_node.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_rft_node.c rename to ThirdParty/Ert/lib/ecl/ecl_rft_node.c diff --git a/ThirdParty/Ert/libecl/src/ecl_rst_file.c b/ThirdParty/Ert/lib/ecl/ecl_rst_file.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_rst_file.c rename to ThirdParty/Ert/lib/ecl/ecl_rst_file.c diff --git a/ThirdParty/Ert/libecl/src/ecl_rsthead.c b/ThirdParty/Ert/lib/ecl/ecl_rsthead.c similarity index 96% rename from ThirdParty/Ert/libecl/src/ecl_rsthead.c rename to ThirdParty/Ert/lib/ecl/ecl_rsthead.c index e515df45fd..e8d9cef33a 100644 --- a/ThirdParty/Ert/libecl/src/ecl_rsthead.c +++ b/ThirdParty/Ert/lib/ecl/ecl_rsthead.c @@ -88,8 +88,7 @@ ecl_rsthead_type * ecl_rsthead_alloc_from_kw( int report_step , const ecl_kw_typ // The only derived quantity rsthead->sim_time = rsthead_date( rsthead->day , rsthead->month , rsthead->year ); } - if (doubhead_kw) - rsthead->sim_days = ecl_kw_iget_double( doubhead_kw , DOUBHEAD_DAYS_INDEX ); + rsthead->sim_days = ecl_kw_iget_double( doubhead_kw , DOUBHEAD_DAYS_INDEX ); if (logihead_kw) rsthead->dualp = ecl_kw_iget_bool( logihead_kw , LOGIHEAD_DUALP_INDEX); @@ -110,15 +109,12 @@ ecl_rsthead_type * ecl_rsthead_alloc_from_kw( int report_step , const ecl_kw_typ ecl_rsthead_type * ecl_rsthead_alloc( const ecl_file_view_type * rst_view, int report_step) { const ecl_kw_type * intehead_kw = ecl_file_view_iget_named_kw( rst_view , INTEHEAD_KW , 0); - const ecl_kw_type * doubhead_kw = NULL; + const ecl_kw_type * doubhead_kw = ecl_file_view_iget_named_kw( rst_view , DOUBHEAD_KW , 0); const ecl_kw_type * logihead_kw = NULL; if (ecl_file_view_has_kw(rst_view, LOGIHEAD_KW)) logihead_kw = ecl_file_view_iget_named_kw( rst_view , LOGIHEAD_KW , 0); - if (ecl_file_view_has_kw(rst_view, DOUBHEAD_KW)) - doubhead_kw = ecl_file_view_iget_named_kw(rst_view, DOUBHEAD_KW, 0); - if (ecl_file_view_has_kw( rst_view , SEQNUM_KW)) { const ecl_kw_type * seqnum_kw = ecl_file_view_iget_named_kw( rst_view , SEQNUM_KW , 0); report_step = ecl_kw_iget_int( seqnum_kw , 0); diff --git a/ThirdParty/Ert/libecl/src/ecl_smspec.c b/ThirdParty/Ert/lib/ecl/ecl_smspec.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_smspec.c rename to ThirdParty/Ert/lib/ecl/ecl_smspec.c diff --git a/ThirdParty/Ert/libecl/src/ecl_subsidence.c b/ThirdParty/Ert/lib/ecl/ecl_subsidence.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_subsidence.c rename to ThirdParty/Ert/lib/ecl/ecl_subsidence.c diff --git a/ThirdParty/Ert/libecl/src/ecl_sum.c b/ThirdParty/Ert/lib/ecl/ecl_sum.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_sum.c rename to ThirdParty/Ert/lib/ecl/ecl_sum.c diff --git a/ThirdParty/Ert/libecl/src/ecl_sum_data.c b/ThirdParty/Ert/lib/ecl/ecl_sum_data.c similarity index 90% rename from ThirdParty/Ert/libecl/src/ecl_sum_data.c rename to ThirdParty/Ert/lib/ecl/ecl_sum_data.c index c8871fb84d..c8cdffd078 100644 --- a/ThirdParty/Ert/libecl/src/ecl_sum_data.c +++ b/ThirdParty/Ert/lib/ecl/ecl_sum_data.c @@ -471,18 +471,13 @@ double ecl_sum_data_get_sim_length( const ecl_sum_data_type * data ) { */ bool ecl_sum_data_check_sim_time( const ecl_sum_data_type * data , time_t sim_time) { - if (time_interval_contains( data->sim_time , sim_time ) || (sim_time == time_interval_get_end( data->sim_time))) - return true; - else - return false; + return (time_interval_contains(data->sim_time, sim_time) + || (sim_time == time_interval_get_end(data->sim_time))); } bool ecl_sum_data_check_sim_days( const ecl_sum_data_type * data , double sim_days) { - if ((sim_days < data->days_start) || ( sim_days > data->sim_length)) - return false; - else - return true; + return sim_days >= data->days_start && sim_days <= data->sim_length; } @@ -526,10 +521,10 @@ bool ecl_sum_data_check_sim_days( const ecl_sum_data_type * data , double sim_da static int ecl_sum_data_get_index_from_sim_time( const ecl_sum_data_type * data , time_t sim_time) { - time_t data_start_time = time_interval_get_start( data->sim_time ); - time_t sim_end = time_interval_get_end( data->sim_time ); + time_t data_start_time = time_interval_get_start(data->sim_time); + time_t sim_end = time_interval_get_end(data->sim_time); - if (!ecl_sum_data_check_sim_time( data , sim_time )) { + if (!ecl_sum_data_check_sim_time(data, sim_time)) { fprintf(stderr , "Simulation start: "); util_fprintf_date_utc( ecl_smspec_get_start_time( data->smspec ) , stderr ); fprintf(stderr , "Data start......: "); util_fprintf_date_utc( data_start_time , stderr ); fprintf(stderr , "Simulation end .: "); util_fprintf_date_utc( sim_end , stderr ); @@ -543,47 +538,25 @@ static int ecl_sum_data_get_index_from_sim_time( const ecl_sum_data_type * data perfectly well be 'holes' in the time domain, because of e.g. the RPTONLY keyword. */ - { - int low_index = 0; - int high_index = vector_get_size( data->data ); - int internal_index = INVALID_MINISTEP_NR; + int low_index = 0; + int high_index = vector_get_size(data->data) - 1; - while (internal_index < 0) { - if (low_index == high_index) - internal_index = low_index; - else { - int center_index = 0.5*( low_index + high_index ); - const ecl_sum_tstep_type * ministep = ecl_sum_data_iget_ministep( data , center_index ); + // perform binary search + while (low_index+1 < high_index) { + int center_index = (low_index + high_index) / 2; + const ecl_sum_tstep_type * center_step = ecl_sum_data_iget_ministep(data, center_index); + const time_t center_time = ecl_sum_tstep_get_sim_time(center_step); - if ((high_index - low_index) == 1) { - /* Degenerate special case. */ - if (sim_time < ecl_sum_tstep_get_sim_time( ministep )) - internal_index = low_index; - else - internal_index = high_index; - } else { - if (sim_time > ecl_sum_tstep_get_sim_time( ministep )) /* Low-----Center---X---High */ - low_index = center_index; - else { - time_t prev_time = data_start_time; - if (center_index > 0) { - const ecl_sum_tstep_type * prev_step = ecl_sum_data_iget_ministep( data , center_index - 1 ); - prev_time = ecl_sum_tstep_get_sim_time( prev_step ); - } - - if (prev_time < sim_time) - internal_index = center_index; /* Found it */ - else - high_index = center_index; - } - } - } - } - return internal_index; + if (sim_time > center_time) + low_index = center_index; + else + high_index = center_index; } -} + const ecl_sum_tstep_type * low_step = ecl_sum_data_iget_ministep(data, low_index); + return sim_time <= ecl_sum_tstep_get_sim_time(low_step) ? low_index : high_index; +} int ecl_sum_data_get_index_from_sim_days( const ecl_sum_data_type * data , double sim_days) { time_t sim_time = ecl_smspec_get_start_time( data->smspec ); @@ -594,7 +567,7 @@ int ecl_sum_data_get_index_from_sim_days( const ecl_sum_data_type * data , doubl /** This function will take a true time 'sim_time' as input. The - ministep indices bracketing this sim_time is identified, and the + ministep indices bracketing this sim_time are identified, and the corresponding weights are calculated. The actual value we are interested in can then be computed with the @@ -616,40 +589,40 @@ int ecl_sum_data_get_index_from_sim_days( const ecl_sum_data_type * data , doubl function should be used), consult documentation at the top of this file. */ +void ecl_sum_data_init_interp_from_sim_time(const ecl_sum_data_type* data, + time_t sim_time, + int* index1, + int* index2, + double* weight1, + double* weight2) { + int idx = ecl_sum_data_get_index_from_sim_time(data, sim_time); - - -void ecl_sum_data_init_interp_from_sim_time( const ecl_sum_data_type * data , time_t sim_time, int *_index1, int *_index2 , double * _weight1 , double *_weight2) { - int index2 = ecl_sum_data_get_index_from_sim_time( data , sim_time); - int index1; - const ecl_sum_tstep_type * ministep2 = ecl_sum_data_iget_ministep( data , index2 ); - const ecl_sum_tstep_type * ministep1; - time_t sim_time2 = ecl_sum_tstep_get_sim_time( ministep2 ); - - - index1 = index2; - while (true) { - index1--; - ministep1 = ecl_sum_data_iget_ministep( data , index1 ); - { - time_t sim_time1 = ecl_sum_tstep_get_sim_time( ministep1 ); - if (sim_time1 < sim_time2) - break; - } - if (index1 == 0) - util_abort("%s: Hmm internal error?? \n",__func__); + // if sim_time is first date, idx=0 and then we cannot interpolate, so we give + // weight 1 to index1=index2=0. + if (idx == 0) { + *index1 = 0; + *index2 = 0; + *weight1 = 1; + *weight2 = 0; + return; } - { - double weight2 = (sim_time - ecl_sum_tstep_get_sim_time( ministep1 )); - double weight1 = -(sim_time - ecl_sum_tstep_get_sim_time( ministep2 )); + const ecl_sum_tstep_type * ministep1 = ecl_sum_data_iget_ministep(data, idx-1); + const ecl_sum_tstep_type * ministep2 = ecl_sum_data_iget_ministep(data, idx); + time_t sim_time1 = ecl_sum_tstep_get_sim_time(ministep1); + time_t sim_time2 = ecl_sum_tstep_get_sim_time(ministep2); - *_index1 = index1; - *_index2 = index2; - *_weight1 = weight1 / ( weight1 + weight2 ); - *_weight2 = weight2 / ( weight1 + weight2 ); - } + *index1 = idx-1; + *index2 = idx; + + // weights the interpolation each of the ministeps according to distance from sim_time + double time_diff = sim_time2 - sim_time1; + double time_dist1 = (sim_time - sim_time1); + double time_dist2 = -(sim_time - sim_time2); + + *weight1 = time_dist2 / time_diff; + *weight2 = time_dist1 / time_diff; } @@ -661,51 +634,42 @@ void ecl_sum_data_init_interp_from_sim_days( const ecl_sum_data_type * data , do } -double_vector_type * ecl_sum_data_alloc_seconds_solution( const ecl_sum_data_type * data , const smspec_node_type * node , double cmp_value, bool rates_clamp_lower) { - double_vector_type * solution = double_vector_alloc( 0, 0); - const int param_index = smspec_node_get_params_index( node ); - const int size = vector_get_size( data->data); - const double is_rate = smspec_node_is_rate( node ); +double_vector_type * ecl_sum_data_alloc_seconds_solution(const ecl_sum_data_type * data, const smspec_node_type * node, double cmp_value, bool rates_clamp_lower) { + double_vector_type * solution = double_vector_alloc(0, 0); + const int param_index = smspec_node_get_params_index(node); + const int size = vector_get_size(data->data); - if (size > 1) { - int index = 0; - const ecl_sum_tstep_type * ministep = ecl_sum_data_iget_ministep( data , index ); - const ecl_sum_tstep_type * prev_ministep; - double value = ecl_sum_tstep_iget( ministep , param_index ); - double prev_value; + if (size <= 1) + return solution; - while (true) { - index++; - if (index >= size) - break; + for (int index = 0; index < size; ++index) { + int prev_index = util_int_max(0, index-1); - prev_ministep = ministep; - prev_value = value; + const ecl_sum_tstep_type * ministep = ecl_sum_data_iget_ministep(data, index); + const ecl_sum_tstep_type * prev_ministep = ecl_sum_data_iget_ministep(data, prev_index); + double value = ecl_sum_tstep_iget(ministep, param_index); + double prev_value = ecl_sum_tstep_iget(prev_ministep, param_index); - ministep = ecl_sum_data_iget_ministep( data , index ); - value = ecl_sum_tstep_iget( ministep , param_index ); + // cmp_value in interval value (closed) and prev_value (open) + bool contained = value == cmp_value; + contained |= (util_double_min(prev_value, value) < cmp_value) && + (cmp_value < util_double_max(prev_value, value)); - if ((value == cmp_value) || - (((value - cmp_value) * (cmp_value - prev_value)) > 0)) { - double time1 = ecl_sum_tstep_get_sim_seconds( prev_ministep ); - double time2 = ecl_sum_tstep_get_sim_seconds( ministep ); + if (!contained) + continue; - if (is_rate) { - if (rates_clamp_lower) - double_vector_append( solution , time1 + 1 ); - else - double_vector_append( solution , time2 ); - } else { - double slope = (value - prev_value) / (time2 - time1); - double seconds = (cmp_value - prev_value) / slope + time1; + double prev_time = ecl_sum_tstep_get_sim_seconds(prev_ministep); + double time = ecl_sum_tstep_get_sim_seconds(ministep); - double_vector_append( solution , seconds ); - } + if (smspec_node_is_rate(node)) { + double_vector_append(solution, rates_clamp_lower ? prev_time + 1 : time); + } else { + double slope = (value - prev_value) / (time - prev_time); + double seconds = (cmp_value - prev_value)/slope + prev_time; - } + double_vector_append(solution, seconds); } } - return solution; } @@ -1216,35 +1180,32 @@ double ecl_sum_data_interp_get(const ecl_sum_data_type * data , int time_index1 } -void ecl_sum_data_fwrite_interp_csv_line(const ecl_sum_data_type * data , time_t sim_time, const ecl_sum_vector_type * keylist, FILE *fp){ - int num_keywords = ecl_sum_vector_get_size(keylist); - double weight1 , weight2; - int time_index1 , time_index2; +void ecl_sum_data_fwrite_interp_csv_line(const ecl_sum_data_type * data, time_t sim_time, const ecl_sum_vector_type * keylist, FILE *fp){ + int num_keywords = ecl_sum_vector_get_size(keylist); + double weight1, weight2; + int time_index1, time_index2; + + ecl_sum_data_init_interp_from_sim_time(data, sim_time, &time_index1, &time_index2, &weight1, &weight2); + + for (int i = 0; i < num_keywords; i++) { + int params_index = ecl_sum_vector_iget_param_index(keylist, i); + double value = 0.0; - int i; - - ecl_sum_data_init_interp_from_sim_time( data , sim_time , &time_index1 , &time_index2 , &weight1 , &weight2); - for(i = 0; i< num_keywords; i++ ){ - bool is_rate = ecl_sum_vector_iget_is_rate(keylist, i); - int params_index = ecl_sum_vector_iget_param_index(keylist , i); - if(is_rate){ - int time_index; - if (sim_time == time_interval_get_start( data->sim_time )) - time_index = 0; - else - time_index = ecl_sum_data_get_index_from_sim_time( data , sim_time ); - - value = ecl_sum_data_iget( data , time_index , params_index); - } else { - value = ecl_sum_data_interp_get( data , time_index1 , time_index2 , weight1 , weight2 , params_index); - - } - if(i == 0){ - fprintf(fp , "%f",value); - }else{ - fprintf(fp , ",%f",value); - } + bool is_rate = ecl_sum_vector_iget_is_rate(keylist, i); + if (is_rate) { + int time_index = ecl_sum_data_get_index_from_sim_time(data, sim_time); + // uses step function since it is a rate + value = ecl_sum_data_iget(data, time_index, params_index); + } else { + // uses interpolation between timesteps + value = ecl_sum_data_interp_get(data, time_index1, time_index2, weight1, weight2, params_index); } + + if (i == 0) + fprintf(fp, "%f", value); + else + fprintf(fp, ",%f", value); + } } @@ -1253,7 +1214,6 @@ void ecl_sum_data_fwrite_interp_csv_line(const ecl_sum_data_type * data , time_t double ecl_sum_data_get_from_sim_time( const ecl_sum_data_type * data , time_t sim_time , const smspec_node_type * smspec_node) { int params_index = smspec_node_get_params_index( smspec_node ); if (smspec_node_is_rate( smspec_node )) { - int time_index; /* In general the mapping from sim_time to index is based on half open intervals, which are closed in the upper end: @@ -1267,11 +1227,7 @@ double ecl_sum_data_get_from_sim_time( const ecl_sum_data_type * data , time_t s with the ECLIPSE results if you ask for a value interpolated to the starting time. */ - if (sim_time == time_interval_get_start( data->sim_time )) - time_index = 0; - else - time_index = ecl_sum_data_get_index_from_sim_time( data , sim_time ); - + int time_index = ecl_sum_data_get_index_from_sim_time( data , sim_time ); return ecl_sum_data_iget( data , time_index , params_index); } else { /* Interpolated lookup based on two (hopefully) consecutive ministeps. */ diff --git a/ThirdParty/Ert/libecl/src/ecl_sum_file.c b/ThirdParty/Ert/lib/ecl/ecl_sum_file.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_sum_file.c rename to ThirdParty/Ert/lib/ecl/ecl_sum_file.c diff --git a/ThirdParty/Ert/libecl/src/ecl_sum_index.c b/ThirdParty/Ert/lib/ecl/ecl_sum_index.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_sum_index.c rename to ThirdParty/Ert/lib/ecl/ecl_sum_index.c diff --git a/ThirdParty/Ert/libecl/src/ecl_sum_tstep.c b/ThirdParty/Ert/lib/ecl/ecl_sum_tstep.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_sum_tstep.c rename to ThirdParty/Ert/lib/ecl/ecl_sum_tstep.c diff --git a/ThirdParty/Ert/libecl/src/ecl_sum_vector.c b/ThirdParty/Ert/lib/ecl/ecl_sum_vector.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_sum_vector.c rename to ThirdParty/Ert/lib/ecl/ecl_sum_vector.c diff --git a/ThirdParty/Ert/libecl/src/ecl_type.c b/ThirdParty/Ert/lib/ecl/ecl_type.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_type.c rename to ThirdParty/Ert/lib/ecl/ecl_type.c diff --git a/ThirdParty/Ert/libecl/src/ecl_type_python.c b/ThirdParty/Ert/lib/ecl/ecl_type_python.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_type_python.c rename to ThirdParty/Ert/lib/ecl/ecl_type_python.c diff --git a/ThirdParty/Ert/libecl/src/ecl_util.c b/ThirdParty/Ert/lib/ecl/ecl_util.c similarity index 100% rename from ThirdParty/Ert/libecl/src/ecl_util.c rename to ThirdParty/Ert/lib/ecl/ecl_util.c diff --git a/ThirdParty/Ert/libecl/src/fault_block.c b/ThirdParty/Ert/lib/ecl/fault_block.c similarity index 98% rename from ThirdParty/Ert/libecl/src/fault_block.c rename to ThirdParty/Ert/lib/ecl/fault_block.c index cb84df721e..d0b4f91e86 100644 --- a/ThirdParty/Ert/libecl/src/fault_block.c +++ b/ThirdParty/Ert/lib/ecl/fault_block.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #define FAULT_BLOCK_ID 3297376 @@ -50,7 +51,7 @@ UTIL_IS_INSTANCE_FUNCTION( fault_block , FAULT_BLOCK_ID ) static UTIL_SAFE_CAST_FUNCTION( fault_block , FAULT_BLOCK_ID ) -static fault_block_type * fault_block_alloc( const fault_block_layer_type * parent_layer , int block_id ) { +fault_block_type * fault_block_alloc( const fault_block_layer_type * parent_layer , int block_id ) { fault_block_type * block = util_malloc( sizeof * block ); UTIL_TYPE_ID_INIT( block , FAULT_BLOCK_ID ); block->parent_layer = parent_layer; @@ -77,7 +78,7 @@ int fault_block_get_id( const fault_block_type * block ) { } -static void fault_block_free( fault_block_type * block ) { +void fault_block_free( fault_block_type * block ) { int_vector_free( block->i_list ); int_vector_free( block->j_list ); int_vector_free( block->region_list ); diff --git a/ThirdParty/Ert/libecl/src/fault_block_layer.c b/ThirdParty/Ert/lib/ecl/fault_block_layer.c similarity index 97% rename from ThirdParty/Ert/libecl/src/fault_block_layer.c rename to ThirdParty/Ert/lib/ecl/fault_block_layer.c index 87c899f118..9466515b42 100644 --- a/ThirdParty/Ert/libecl/src/fault_block_layer.c +++ b/ThirdParty/Ert/lib/ecl/fault_block_layer.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #define FAULT_BLOCK_LAYER_ID 2297476 @@ -34,21 +35,18 @@ the fault_block.c file; however the fault blocks should be closely linked to the layer object in the fault_block_layer structure - it is therefor not possible/legal to create a fault block instance by - itself. To support that encapsulation the fault_block.c file is - included here, and the functions: + itself. To support that encapsulation the fault_block.c file is included + here, and the functions: fault_block_alloc(); fault_block_free(); Which must be called through the fault_block_layer class are made - static. + declared here. */ -static fault_block_type * fault_block_alloc( const fault_block_layer_type * parent_layer , int block_id ); -static void fault_block_free( fault_block_type * block ); - -#include "fault_block.c" - +fault_block_type * fault_block_alloc( const fault_block_layer_type * parent_layer , int block_id ); +void fault_block_free( fault_block_type * block, int block_id ); struct fault_block_layer_struct { UTIL_TYPE_ID_DECLARATION; diff --git a/ThirdParty/Ert/libecl/src/fortio.c b/ThirdParty/Ert/lib/ecl/fortio.c similarity index 95% rename from ThirdParty/Ert/libecl/src/fortio.c rename to ThirdParty/Ert/lib/ecl/fortio.c index 5cc6f43860..8b3856b6e5 100644 --- a/ThirdParty/Ert/libecl/src/fortio.c +++ b/ThirdParty/Ert/lib/ecl/fortio.c @@ -88,7 +88,7 @@ struct fortio_struct { Observe that the semantics of the fortio_fseek() function depends on whether the file is writable. */ - bool readable; + bool writable; offset_type read_size; }; @@ -96,15 +96,16 @@ struct fortio_struct { UTIL_IS_INSTANCE_FUNCTION( fortio , FORTIO_ID ); UTIL_SAFE_CAST_FUNCTION( fortio, FORTIO_ID ); -static fortio_type * fortio_alloc__(const char *filename , bool fmt_file , bool endian_flip_header , bool stream_owner , bool readable) { +static fortio_type * fortio_alloc__(const char *filename , bool fmt_file , bool endian_flip_header , bool stream_owner , bool writable) { fortio_type * fortio = util_malloc(sizeof * fortio ); UTIL_TYPE_ID_INIT( fortio, FORTIO_ID ); fortio->filename = util_alloc_string_copy(filename); fortio->endian_flip_header = endian_flip_header; fortio->fmt_file = fmt_file; fortio->stream_owner = stream_owner; - fortio->read_size = 0; - fortio->readable = readable; + fortio->writable = writable; + fortio->read_size = 0; + return fortio; } @@ -207,10 +208,9 @@ static void fortio_init_size(fortio_type * fortio) { -fortio_type * fortio_alloc_FILE_wrapper(const char *filename , bool endian_flip_header , bool fmt_file , bool readable , FILE * stream) { - fortio_type * fortio = fortio_alloc__(filename , fmt_file , endian_flip_header , false , readable); +fortio_type * fortio_alloc_FILE_wrapper(const char *filename , bool endian_flip_header , bool fmt_file , bool writable , FILE * stream) { + fortio_type * fortio = fortio_alloc__(filename , fmt_file , endian_flip_header , false , writable); fortio->stream = stream; - fortio_init_size( fortio ); return fortio; } @@ -291,7 +291,7 @@ static FILE * fortio_fopen_append( const char * filename , bool fmt_file ) { fortio_type * fortio_open_reader(const char *filename , bool fmt_file , bool endian_flip_header) { FILE * stream = fortio_fopen_read( filename , fmt_file ); if (stream) { - fortio_type *fortio = fortio_alloc__(filename , fmt_file , endian_flip_header , true , true); + fortio_type *fortio = fortio_alloc__(filename , fmt_file , endian_flip_header , true , false); fortio->stream = stream; fortio->fopen_mode = fortio_fopen_read_mode( fmt_file ); fortio_init_size( fortio ); @@ -306,7 +306,7 @@ fortio_type * fortio_open_reader(const char *filename , bool fmt_file , bool end fortio_type * fortio_open_writer(const char *filename , bool fmt_file , bool endian_flip_header ) { FILE * stream = fortio_fopen_write( filename , fmt_file ); if (stream) { - fortio_type *fortio = fortio_alloc__(filename , fmt_file , endian_flip_header, true , false); + fortio_type *fortio = fortio_alloc__(filename , fmt_file , endian_flip_header, true , true); fortio->stream = stream; fortio->fopen_mode = fortio_fopen_write_mode( fmt_file ); fortio_init_size( fortio ); @@ -333,7 +333,7 @@ fortio_type * fortio_open_readwrite(const char *filename , bool fmt_file , bool fortio_type * fortio_open_append(const char *filename , bool fmt_file , bool endian_flip_header) { FILE * stream = fortio_fopen_append( filename , fmt_file ); if (stream) { - fortio_type *fortio = fortio_alloc__(filename , fmt_file , endian_flip_header , true , false); + fortio_type *fortio = fortio_alloc__(filename , fmt_file , endian_flip_header , true , true); fortio->stream = stream; fortio->fopen_mode = fortio_fopen_append_mode( fmt_file ); @@ -488,6 +488,17 @@ void fortio_data_fseek(fortio_type* fortio, offset_type data_offset, size_t data } } +int fortio_fclean(fortio_type * fortio) { + long current_pos = ftell(fortio->stream); + if(current_pos == -1) + return -1; + + int flush_status = fflush(fortio->stream); + if(flush_status != 0) + return flush_status; + + return fseek(fortio->stream, current_pos, SEEK_SET); +} bool fortio_complete_read(fortio_type *fortio , int record_size) { int trailer; @@ -749,16 +760,17 @@ static bool fortio_fseek__(fortio_type * fortio , offset_type offset , int whenc The semantics of this function depends on the readbale flag of the fortio structure: - readable == false: Ordinary fseek() semantics. + writable == true: Ordinary fseek() semantics which can potentially + grow the file. - readable == true: The function will only seek within the range of + writable == false: The function will only seek within the range of the file, and fail if you try to seek beyond the EOF marker. */ bool fortio_fseek( fortio_type * fortio , offset_type offset , int whence) { - if (!fortio->readable) + if (fortio->writable) return fortio_fseek__( fortio , offset , whence ); else { offset_type new_offset = 0; @@ -819,6 +831,17 @@ bool fortio_read_at_eof( fortio_type * fortio ) { } +/* + When this function is called the underlying file is unlinked, and + the entry will be removed from the filsystem. Subsequent calls which + write to this file will still (superficially) succeed. +*/ + +void fortio_fwrite_error(fortio_type * fortio) { + if (fortio->writable) + unlink( fortio->filename ); +} + /*****************************************************************/ void fortio_fflush(fortio_type * fortio) { fflush( fortio->stream); } diff --git a/ThirdParty/Ert/libecl/src/grid_dims.c b/ThirdParty/Ert/lib/ecl/grid_dims.c similarity index 100% rename from ThirdParty/Ert/libecl/src/grid_dims.c rename to ThirdParty/Ert/lib/ecl/grid_dims.c diff --git a/ThirdParty/Ert/libecl/src/layer.c b/ThirdParty/Ert/lib/ecl/layer.c similarity index 100% rename from ThirdParty/Ert/libecl/src/layer.c rename to ThirdParty/Ert/lib/ecl/layer.c diff --git a/ThirdParty/Ert/libecl/src/nnc_info.c b/ThirdParty/Ert/lib/ecl/nnc_info.c similarity index 100% rename from ThirdParty/Ert/libecl/src/nnc_info.c rename to ThirdParty/Ert/lib/ecl/nnc_info.c diff --git a/ThirdParty/Ert/libecl/src/nnc_vector.c b/ThirdParty/Ert/lib/ecl/nnc_vector.c similarity index 100% rename from ThirdParty/Ert/libecl/src/nnc_vector.c rename to ThirdParty/Ert/lib/ecl/nnc_vector.c diff --git a/ThirdParty/Ert/libecl/src/overview.txt b/ThirdParty/Ert/lib/ecl/overview.txt similarity index 100% rename from ThirdParty/Ert/libecl/src/overview.txt rename to ThirdParty/Ert/lib/ecl/overview.txt diff --git a/ThirdParty/Ert/libecl/src/readme.overview b/ThirdParty/Ert/lib/ecl/readme.overview similarity index 100% rename from ThirdParty/Ert/libecl/src/readme.overview rename to ThirdParty/Ert/lib/ecl/readme.overview diff --git a/ThirdParty/Ert/libecl/src/smspec_node.c b/ThirdParty/Ert/lib/ecl/smspec_node.c similarity index 100% rename from ThirdParty/Ert/libecl/src/smspec_node.c rename to ThirdParty/Ert/lib/ecl/smspec_node.c diff --git a/ThirdParty/Ert/libecl/tests/data/num_cpu1 b/ThirdParty/Ert/lib/ecl/tests/data/num_cpu1 similarity index 100% rename from ThirdParty/Ert/libecl/tests/data/num_cpu1 rename to ThirdParty/Ert/lib/ecl/tests/data/num_cpu1 diff --git a/ThirdParty/Ert/libecl/tests/data/num_cpu2 b/ThirdParty/Ert/lib/ecl/tests/data/num_cpu2 similarity index 100% rename from ThirdParty/Ert/libecl/tests/data/num_cpu2 rename to ThirdParty/Ert/lib/ecl/tests/data/num_cpu2 diff --git a/ThirdParty/Ert/libecl/tests/data/num_cpu3 b/ThirdParty/Ert/lib/ecl/tests/data/num_cpu3 similarity index 100% rename from ThirdParty/Ert/libecl/tests/data/num_cpu3 rename to ThirdParty/Ert/lib/ecl/tests/data/num_cpu3 diff --git a/ThirdParty/Ert/libecl/tests/data/num_cpu4 b/ThirdParty/Ert/lib/ecl/tests/data/num_cpu4 similarity index 100% rename from ThirdParty/Ert/libecl/tests/data/num_cpu4 rename to ThirdParty/Ert/lib/ecl/tests/data/num_cpu4 diff --git a/ThirdParty/Ert/libecl/tests/ecl_alloc_cpgrid.c b/ThirdParty/Ert/lib/ecl/tests/ecl_alloc_cpgrid.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_alloc_cpgrid.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_alloc_cpgrid.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_alloc_grid_dxv_dyv_dzv.c b/ThirdParty/Ert/lib/ecl/tests/ecl_alloc_grid_dxv_dyv_dzv.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_alloc_grid_dxv_dyv_dzv.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_alloc_grid_dxv_dyv_dzv.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_coarse_test.c b/ThirdParty/Ert/lib/ecl/tests/ecl_coarse_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_coarse_test.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_coarse_test.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_dualp.c b/ThirdParty/Ert/lib/ecl/tests/ecl_dualp.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_dualp.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_dualp.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_fault_block_collection_statoil.c b/ThirdParty/Ert/lib/ecl/tests/ecl_fault_block_collection_statoil.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_fault_block_collection_statoil.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_fault_block_collection_statoil.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_fault_block_layer.c b/ThirdParty/Ert/lib/ecl/tests/ecl_fault_block_layer.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_fault_block_layer.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_fault_block_layer.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_fault_block_layer_statoil.c b/ThirdParty/Ert/lib/ecl/tests/ecl_fault_block_layer_statoil.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_fault_block_layer_statoil.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_fault_block_layer_statoil.c diff --git a/ThirdParty/Ert/lib/ecl/tests/ecl_file.c b/ThirdParty/Ert/lib/ecl/tests/ecl_file.c new file mode 100644 index 0000000000..2a8246e285 --- /dev/null +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_file.c @@ -0,0 +1,92 @@ + +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'ecl_file.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. +*/ +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +void test_writable(size_t data_size) { + test_work_area_type * work_area = test_work_area_alloc("ecl_file_writable"); + const char * data_file_name = "test_file"; + + ecl_kw_type * kw = ecl_kw_alloc("TEST_KW", data_size, ECL_INT); + for(int i = 0; i < data_size; ++i) + ecl_kw_iset_int(kw, i, ((i*37)+11)%data_size); + + fortio_type * fortio = fortio_open_writer(data_file_name, false, true); + ecl_kw_fwrite(kw, fortio); + fortio_fclose(fortio); + + for(int i = 0; i < 4; ++i) { + ecl_file_type * ecl_file = ecl_file_open(data_file_name, ECL_FILE_WRITABLE); + ecl_kw_type * loaded_kw = ecl_file_view_iget_kw( + ecl_file_get_global_view(ecl_file), + 0); + test_assert_true(ecl_kw_equal(kw, loaded_kw)); + + ecl_file_save_kw(ecl_file, loaded_kw); + ecl_file_close(ecl_file); + } + + ecl_kw_free(kw); + test_work_area_free( work_area ); +} + +void test_truncated() { + test_work_area_type * work_area = test_work_area_alloc("ecl_file_truncated" ); + { + ecl_grid_type * grid = ecl_grid_alloc_rectangular(20,20,20,1,1,1,NULL); + ecl_grid_fwrite_EGRID2( grid , "TEST.EGRID", ECL_METRIC_UNITS ); + ecl_grid_free( grid ); + } + { + ecl_file_type * ecl_file = ecl_file_open("TEST.EGRID" , 0 ); + test_assert_true( ecl_file_is_instance( ecl_file ) ); + ecl_file_close( ecl_file ); + } + + { + offset_type file_size = util_file_size( "TEST.EGRID"); + FILE * stream = util_fopen("TEST.EGRID" , "r+"); + util_ftruncate( stream , file_size / 2 ); + fclose( stream ); + } + { + ecl_file_type * ecl_file = ecl_file_open("TEST.EGRID" , 0 ); + test_assert_NULL( ecl_file ); + } + test_work_area_free( work_area ); +} + + +int main( int argc , char ** argv) { + test_writable(10); + test_writable(1337); + test_truncated(); + exit(0); +} diff --git a/ThirdParty/Ert/libecl/tests/ecl_file.c b/ThirdParty/Ert/lib/ecl/tests/ecl_file_statoil.c similarity index 97% rename from ThirdParty/Ert/libecl/tests/ecl_file.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_file_statoil.c index fa6d19995d..c1cbcc0d03 100644 --- a/ThirdParty/Ert/libecl/tests/ecl_file.c +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_file_statoil.c @@ -1,8 +1,8 @@ /* - Copyright (C) 2013 Statoil ASA, Norway. + Copyright (C) 2017 Statoil ASA, Norway. - The file 'ecl_file.c' is part of ERT - Ensemble based Reservoir Tool. + The file 'ecl_file_statoil.c' is part of ERT - Ensemble based Reservoir Tool. ERT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/ThirdParty/Ert/libecl/tests/ecl_fmt.c b/ThirdParty/Ert/lib/ecl/tests/ecl_fmt.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_fmt.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_fmt.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_fortio.c b/ThirdParty/Ert/lib/ecl/tests/ecl_fortio.c similarity index 93% rename from ThirdParty/Ert/libecl/tests/ecl_fortio.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_fortio.c index c722d49abd..58013a7039 100644 --- a/ThirdParty/Ert/libecl/tests/ecl_fortio.c +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_fortio.c @@ -276,6 +276,25 @@ void test_fseek() { +void test_write_failure() { + test_work_area_type * work_area = test_work_area_alloc("fortio_fseek" ); + { + fortio_type * fortio = fortio_open_writer("PRESSURE" , false , true); + void * buffer = util_malloc( 100 ); + + fortio_fwrite_record( fortio , buffer , 100); + test_assert_true( util_file_exists( "PRESSURE")); + fortio_fwrite_error( fortio ); + test_assert_false( util_file_exists( "PRESSURE")); + fortio_fwrite_record( fortio , buffer , 100); + free( buffer ); + fortio_fclose( fortio ); + test_assert_false( util_file_exists( "PRESSURE")); + + } + test_work_area_free( work_area ); +} + int main( int argc , char ** argv) { util_install_signals(); @@ -304,6 +323,8 @@ int main( int argc , char ** argv) { test_work_area_free( work_area ); } + test_write_failure(); + exit(0); } } diff --git a/ThirdParty/Ert/libecl/tests/ecl_get_num_cpu_test.c b/ThirdParty/Ert/lib/ecl/tests/ecl_get_num_cpu_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_get_num_cpu_test.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_get_num_cpu_test.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_DEPTHZ.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_DEPTHZ.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_DEPTHZ.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_DEPTHZ.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_add_nnc.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_add_nnc.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_add_nnc.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_add_nnc.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_case.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_case.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_case.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_case.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_cell_contains.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_cell_contains.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_cell_contains.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_cell_contains.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_cell_contains_wellpath.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_cell_contains_wellpath.c similarity index 65% rename from ThirdParty/Ert/libecl/tests/ecl_grid_cell_contains_wellpath.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_cell_contains_wellpath.c index 0afc83b1c1..3babe99cdb 100644 --- a/ThirdParty/Ert/libecl/tests/ecl_grid_cell_contains_wellpath.c +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_cell_contains_wellpath.c @@ -71,6 +71,25 @@ vector_type * load_expected( const ecl_grid_type * grid, const char * filename ) } +int test_well_point(const ecl_grid_type * grid, const point_type * expected) { + int g = ecl_grid_get_global_index_from_xyz(grid , expected->x, expected->y , expected->z , 0 ); + if (g != ecl_grid_get_global_index3(grid, expected->i,expected->j, expected->k)) { + int i,j,k; + ecl_grid_get_ijk1(grid, g, &i, &j, &k); + bool g_contains_xyz = ecl_grid_cell_contains_xyz1( grid, expected->g , expected->x , expected->y, expected->z); + fprintf(stderr, "(%g,%g,%g) differs: EclGrid: %d:(%d,%d,%d) Expected: %d:(%d,%d,%d) contains:%d\n", + expected->x, expected->y, expected->z, + g, i,j,k, + expected->g, expected->i, expected->j, expected->k, + g_contains_xyz); + } + if (!expected->skip) + test_assert_int_equal( g , ecl_grid_get_global_index3(grid, expected->i,expected->j, expected->k)); + else { + if ( g != ecl_grid_get_global_index3(grid, expected->i,expected->j, expected->k)) + fprintf(stderr," ** Skipping failed test for point: %g %g %g \n", expected->x, expected->y, expected->z); + } +} int main(int argc , char ** argv) { util_install_signals(); @@ -80,19 +99,7 @@ int main(int argc , char ** argv) { for (int c=0; c < vector_get_size( expected ); c++) { const point_type * p = vector_iget_const( expected , c ); - int g = ecl_grid_get_global_index_from_xyz(grid , p->x, p->y , p->z , 0 ); - if (g != ecl_grid_get_global_index3(grid, p->i,p->j, p->k)) { - int i,j,k; - ecl_grid_get_ijk1(grid, g, &i, &j, &k); - fprintf(stderr,"point:%d (%g,%g,%g), Simulated: %d:(%d,%d,%d) Expected: %d:(%d,%d,%d) contains:%d\n", - c , p->x, p->y, p->z, g, i,j,k, p->g, p->i, p->j, p->k, ecl_grid_cell_contains_xyz1( grid, p->g , p->x , p->y, p->z)); - } - if (!p->skip) - test_assert_int_equal( g , ecl_grid_get_global_index3(grid, p->i,p->j, p->k)); - else { - if ( g != ecl_grid_get_global_index3(grid, p->i,p->j, p->k)) - fprintf(stderr," ** Skipping failed test for point:%d \n",c); - } + test_well_point(grid, p); } ecl_grid_free( grid ); vector_free( expected ); diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_cell_volume.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_cell_volume.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_cell_volume.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_cell_volume.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_copy.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_copy.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_copy.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_copy.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_copy_statoil.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_copy_statoil.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_copy_statoil.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_copy_statoil.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_corner.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_corner.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_corner.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_corner.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_create.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_create.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_create.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_create.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_dims.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_dims.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_dims.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_dims.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_export.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_export.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_export.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_export.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_fwrite.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_fwrite.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_fwrite.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_fwrite.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_init_fwrite.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_init_fwrite.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_init_fwrite.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_init_fwrite.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_layer_contains.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_layer_contains.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_layer_contains.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_layer_contains.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_lgr_name.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_lgr_name.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_lgr_name.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_lgr_name.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_reset_actnum.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_reset_actnum.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_reset_actnum.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_reset_actnum.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_simple.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_simple.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_simple.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_simple.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_grid_volume.c b/ThirdParty/Ert/lib/ecl/tests/ecl_grid_volume.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_grid_volume.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_grid_volume.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_init_file.c b/ThirdParty/Ert/lib/ecl/tests/ecl_init_file.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_init_file.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_init_file.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_kw_cmp_string.c b/ThirdParty/Ert/lib/ecl/tests/ecl_kw_cmp_string.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_kw_cmp_string.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_kw_cmp_string.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_kw_equal.c b/ThirdParty/Ert/lib/ecl/tests/ecl_kw_equal.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_kw_equal.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_kw_equal.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_kw_fread.c b/ThirdParty/Ert/lib/ecl/tests/ecl_kw_fread.c similarity index 57% rename from ThirdParty/Ert/libecl/tests/ecl_kw_fread.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_kw_fread.c index be6fd6569b..4174a7e01c 100644 --- a/ThirdParty/Ert/libecl/tests/ecl_kw_fread.c +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_kw_fread.c @@ -22,8 +22,11 @@ #include #include +#include #include #include +#include +#include void test_truncated(const char * filename , offset_type truncate_size) { @@ -74,9 +77,57 @@ void test_fread_alloc() { test_work_area_free( work_area ); } +void test_kw_io_charlength() { + test_work_area_type * work_area = test_work_area_alloc("ecl_kw_io_charlength"); + { + const char * KW0 = "QWERTYUI"; + const char * KW1 = "ABCDEFGHIJTTTTTTTTTTTTTTTTTTTTTTABCDEFGHIJKLMNOP"; + ecl_kw_type * ecl_kw_out0 = ecl_kw_alloc(KW0 , 5, ECL_FLOAT); + ecl_kw_type * ecl_kw_out1 = ecl_kw_alloc(KW1 , 5, ECL_FLOAT); + for (int i=0; i < ecl_kw_get_size( ecl_kw_out1); i++) { + ecl_kw_iset_float( ecl_kw_out0 , i , i*1.5 ); + ecl_kw_iset_float( ecl_kw_out1 , i , i*1.5 ); + } + + { + fortio_type * f = fortio_open_writer( "TEST1" , false, ECL_ENDIAN_FLIP ); + test_assert_true( ecl_kw_fwrite( ecl_kw_out0, f )); + test_assert_false(ecl_kw_fwrite( ecl_kw_out1, f )); + fortio_fclose( f ); + } + + { + test_assert_false( util_file_exists( "TEST1")); + } + + { + FILE * file = util_fopen("TEST2", "w"); + ecl_kw_fprintf_grdecl(ecl_kw_out1 , file); + fclose(file); + } + + { + FILE * file = util_fopen("TEST2", "r"); + ecl_kw_type * ecl_kw_in = ecl_kw_fscanf_alloc_grdecl( file , KW1 , -1 , ECL_FLOAT); + test_assert_string_equal(KW1, ecl_kw_get_header(ecl_kw_in) ); + test_assert_int_equal(5, ecl_kw_get_size( ecl_kw_in) ); + + test_assert_double_equal(ecl_kw_iget_as_double(ecl_kw_in, 0), 0.0); + test_assert_double_equal(ecl_kw_iget_as_double(ecl_kw_in, 4), 6.0); + + fclose(file); + } + + ecl_kw_free( ecl_kw_out0 ); + ecl_kw_free( ecl_kw_out1 ); + } + test_work_area_free( work_area ); +} + int main(int argc , char ** argv) { test_fread_alloc(); + test_kw_io_charlength(); exit(0); } diff --git a/ThirdParty/Ert/libecl/tests/ecl_kw_grdecl.c b/ThirdParty/Ert/lib/ecl/tests/ecl_kw_grdecl.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_kw_grdecl.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_kw_grdecl.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_kw_init.c b/ThirdParty/Ert/lib/ecl/tests/ecl_kw_init.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_kw_init.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_kw_init.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_layer.c b/ThirdParty/Ert/lib/ecl/tests/ecl_layer.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_layer.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_layer.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_layer_statoil.c b/ThirdParty/Ert/lib/ecl/tests/ecl_layer_statoil.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_layer_statoil.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_layer_statoil.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_lfs.c b/ThirdParty/Ert/lib/ecl/tests/ecl_lfs.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_lfs.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_lfs.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_lgr_name.c b/ThirdParty/Ert/lib/ecl/tests/ecl_lgr_name.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_lgr_name.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_lgr_name.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_lgr_test.c b/ThirdParty/Ert/lib/ecl/tests/ecl_lgr_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_lgr_test.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_lgr_test.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_nnc_export.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_export.c similarity index 97% rename from ThirdParty/Ert/libecl/tests/ecl_nnc_export.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_nnc_export.c index 527530435a..6cafe9402e 100644 --- a/ThirdParty/Ert/libecl/tests/ecl_nnc_export.c +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_export.c @@ -28,6 +28,7 @@ #include #include #include +#include @@ -234,6 +235,9 @@ void test_export(const char * name, bool have_tran_data) { { ecl_nnc_geometry_type * nnc_geo = ecl_nnc_geometry_alloc( grid ); + ecl_file_view_type * view_file = ecl_file_get_global_view( init_file ); + ecl_nnc_data_type * nnc_geo_data = ecl_nnc_data_alloc_tran(grid, nnc_geo, view_file); + test_assert_int_equal( ecl_nnc_export_get_size( grid ), ecl_nnc_geometry_size( nnc_geo )); for (int i=0; i < ecl_nnc_geometry_size( nnc_geo ); i++) { const ecl_nnc_pair_type *nnc_pair = ecl_nnc_geometry_iget( nnc_geo , i ); @@ -243,7 +247,10 @@ void test_export(const char * name, bool have_tran_data) { test_assert_int_equal( nnc_pair->grid_nr2 , nnc1->grid_nr2 ); test_assert_int_equal( nnc_pair->global_index1 , nnc1->global_index1 ); test_assert_int_equal( nnc_pair->global_index2 , nnc1->global_index2 ); + test_assert_double_equal(ecl_nnc_data_iget_value(nnc_geo_data, i), nnc1->trans); + } + ecl_nnc_data_free (nnc_geo_data ); ecl_nnc_geometry_free( nnc_geo ); } diff --git a/ThirdParty/Ert/libecl/tests/ecl_nnc_export_get_tran.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_export_get_tran.c similarity index 99% rename from ThirdParty/Ert/libecl/tests/ecl_nnc_export_get_tran.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_nnc_export_get_tran.c index 8c2673837d..881a4d3265 100644 --- a/ThirdParty/Ert/libecl/tests/ecl_nnc_export_get_tran.c +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_export_get_tran.c @@ -7,7 +7,7 @@ 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. - + ll ERT 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. diff --git a/ThirdParty/Ert/libecl/tests/ecl_nnc_geometry.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_geometry.c similarity index 56% rename from ThirdParty/Ert/libecl/tests/ecl_nnc_geometry.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_nnc_geometry.c index 276a7a30c1..1b2d0af2d7 100644 --- a/ThirdParty/Ert/libecl/tests/ecl_nnc_geometry.c +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_geometry.c @@ -36,20 +36,38 @@ void test_create_empty() { } void test_create_simple() { - int nx = 10; - int ny = 10; - int nz = 10; - ecl_grid_type * grid0 = ecl_grid_alloc_rectangular(nx,ny,nz,1,1,1,NULL); - - ecl_grid_add_self_nnc(grid0, 0 ,nx*ny + 0, 0 ); - ecl_grid_add_self_nnc(grid0, 1 ,nx*ny + 1, 1 ); - ecl_grid_add_self_nnc(grid0, 2 ,nx*ny + 2, 2 ); + test_work_area_type * work_area = test_work_area_alloc("nnc-INIT"); { - ecl_nnc_geometry_type * nnc_geo = ecl_nnc_geometry_alloc( grid0 ); - test_assert_int_equal( ecl_nnc_geometry_size( nnc_geo ) , 3 ); - ecl_nnc_geometry_free( nnc_geo ); + int nx = 10; + int ny = 10; + int nz = 10; + ecl_grid_type * grid0 = ecl_grid_alloc_rectangular(nx,ny,nz,1,1,1,NULL); + + ecl_grid_add_self_nnc(grid0, 0 ,nx*ny + 0, 0 ); + ecl_grid_add_self_nnc(grid0, 1 ,nx*ny + 1, 1 ); + ecl_grid_add_self_nnc(grid0, 2 ,nx*ny + 2, 2 ); + { + ecl_nnc_geometry_type * nnc_geo = ecl_nnc_geometry_alloc( grid0 ); + test_assert_int_equal( ecl_nnc_geometry_size( nnc_geo ) , 3 ); + + /* + Create a dummy INIT file which *ony* contains a TRANNC keyword with the correct size. + */ + { + ecl_kw_type * trann_nnc = ecl_kw_alloc(TRANNNC_KW , ecl_nnc_geometry_size( nnc_geo ), ECL_FLOAT); + fortio_type * f = fortio_open_writer( "TEST.INIT" , false, ECL_ENDIAN_FLIP ); + + for (int i=0; i < ecl_kw_get_size( trann_nnc); i++) + ecl_kw_iset_float( trann_nnc , i , i*1.0 ); + + ecl_kw_fwrite( trann_nnc , f ); + fortio_fclose( f ); + ecl_kw_free( trann_nnc ); + } + } + ecl_grid_free( grid0 ); } - ecl_grid_free( grid0 ); + test_work_area_free( work_area ); } diff --git a/ThirdParty/Ert/libecl/tests/ecl_nnc_index_list.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_index_list.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_nnc_index_list.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_nnc_index_list.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_nnc_index_list_grid.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_index_list_grid.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_nnc_index_list_grid.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_nnc_index_list_grid.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_nnc_info_test.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_info_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_nnc_info_test.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_nnc_info_test.c diff --git a/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_pair.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_pair.c new file mode 100644 index 0000000000..4de0c83190 --- /dev/null +++ b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_pair.c @@ -0,0 +1,45 @@ +/* + Copyright (C) 2017 Statoil ASA, Norway. + + The file 'ecl_nnc_pair.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. +*/ +#include +#include + +#include +#include + +#include + +void test_pair( int grid1_1 , int grid1_2 , int grid2_1, int grid2_2, bool expected) { + ecl_nnc_pair_type pair1 = {.grid_nr1 = grid1_1, .grid_nr2 = grid1_2, + .global_index1 = 0, + .global_index2 = 0}; + + ecl_nnc_pair_type pair2 = {.grid_nr1 = grid2_1, .grid_nr2 = grid2_2, + .global_index1 = 0, + .global_index2 = 0}; + + test_assert_bool_equal( ecl_nnc_geometry_same_kw( &pair1 , &pair2 ), expected); +} + + + +int main(int argc , char ** argv) { + test_pair(1,1, 1,1, true); + test_pair(1,3, 1,3, true); + test_pair(1,1, 3,3, false); + test_pair(1,3, 3,1, false); +} diff --git a/ThirdParty/Ert/libecl/tests/ecl_nnc_test.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_nnc_test.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_nnc_test.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_nnc_vector.c b/ThirdParty/Ert/lib/ecl/tests/ecl_nnc_vector.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_nnc_vector.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_nnc_vector.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_region.c b/ThirdParty/Ert/lib/ecl/tests/ecl_region.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_region.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_region.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_region2region_test.c b/ThirdParty/Ert/lib/ecl/tests/ecl_region2region_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_region2region_test.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_region2region_test.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_restart_test.c b/ThirdParty/Ert/lib/ecl/tests/ecl_restart_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_restart_test.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_restart_test.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_rft.c b/ThirdParty/Ert/lib/ecl/tests/ecl_rft.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_rft.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_rft.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_rft_cell.c b/ThirdParty/Ert/lib/ecl/tests/ecl_rft_cell.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_rft_cell.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_rft_cell.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_rst_file.c b/ThirdParty/Ert/lib/ecl/tests/ecl_rst_file.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_rst_file.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_rst_file.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_rsthead.c b/ThirdParty/Ert/lib/ecl/tests/ecl_rsthead.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_rsthead.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_rsthead.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_smspec.c b/ThirdParty/Ert/lib/ecl/tests/ecl_smspec.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_smspec.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_smspec.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_sum_case_exists.c b/ThirdParty/Ert/lib/ecl/tests/ecl_sum_case_exists.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_sum_case_exists.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_sum_case_exists.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_sum_report_step_compatible.c b/ThirdParty/Ert/lib/ecl/tests/ecl_sum_report_step_compatible.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_sum_report_step_compatible.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_sum_report_step_compatible.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_sum_report_step_equal.c b/ThirdParty/Ert/lib/ecl/tests/ecl_sum_report_step_equal.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_sum_report_step_equal.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_sum_report_step_equal.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_sum_test.c b/ThirdParty/Ert/lib/ecl/tests/ecl_sum_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_sum_test.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_sum_test.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_sum_writer.c b/ThirdParty/Ert/lib/ecl/tests/ecl_sum_writer.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_sum_writer.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_sum_writer.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_util_make_date_no_shift.c b/ThirdParty/Ert/lib/ecl/tests/ecl_util_make_date_no_shift.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_util_make_date_no_shift.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_util_make_date_no_shift.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_util_make_date_shift.c b/ThirdParty/Ert/lib/ecl/tests/ecl_util_make_date_shift.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_util_make_date_shift.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_util_make_date_shift.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_util_month_range.c b/ThirdParty/Ert/lib/ecl/tests/ecl_util_month_range.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_util_month_range.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_util_month_range.c diff --git a/ThirdParty/Ert/libecl/tests/ecl_valid_basename.c b/ThirdParty/Ert/lib/ecl/tests/ecl_valid_basename.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/ecl_valid_basename.c rename to ThirdParty/Ert/lib/ecl/tests/ecl_valid_basename.c diff --git a/ThirdParty/Ert/libeclxx/tests/eclxx_filename.cpp b/ThirdParty/Ert/lib/ecl/tests/eclxx_filename.cpp similarity index 100% rename from ThirdParty/Ert/libeclxx/tests/eclxx_filename.cpp rename to ThirdParty/Ert/lib/ecl/tests/eclxx_filename.cpp diff --git a/ThirdParty/Ert/libeclxx/tests/eclxx_fortio.cpp b/ThirdParty/Ert/lib/ecl/tests/eclxx_fortio.cpp similarity index 100% rename from ThirdParty/Ert/libeclxx/tests/eclxx_fortio.cpp rename to ThirdParty/Ert/lib/ecl/tests/eclxx_fortio.cpp diff --git a/ThirdParty/Ert/libeclxx/tests/eclxx_kw.cpp b/ThirdParty/Ert/lib/ecl/tests/eclxx_kw.cpp similarity index 100% rename from ThirdParty/Ert/libeclxx/tests/eclxx_kw.cpp rename to ThirdParty/Ert/lib/ecl/tests/eclxx_kw.cpp diff --git a/ThirdParty/Ert/libeclxx/tests/eclxx_smspec.cpp b/ThirdParty/Ert/lib/ecl/tests/eclxx_smspec.cpp similarity index 96% rename from ThirdParty/Ert/libeclxx/tests/eclxx_smspec.cpp rename to ThirdParty/Ert/lib/ecl/tests/eclxx_smspec.cpp index fc18110fa9..0fd3e89a2f 100644 --- a/ThirdParty/Ert/libeclxx/tests/eclxx_smspec.cpp +++ b/ThirdParty/Ert/lib/ecl/tests/eclxx_smspec.cpp @@ -89,6 +89,12 @@ void test_smspec_block() { test_assert_true( block.num() == 556 ); } +void test_smspec_misc() { + ERT::smspec_node tcpu( "TCPU" ); + test_assert_true( tcpu.type() == ECL_SMSPEC_MISC_VAR ); +} + + void test_smspec_region() { std::string kw( "ROIP" ); int dims[ 3 ] = { 10, 10, 10 }; @@ -120,4 +126,5 @@ int main (int argc, char **argv) { test_smspec_block(); test_smspec_region(); test_smspec_completion(); + test_smspec_misc(); } diff --git a/ThirdParty/Ert/libeclxx/tests/eclxx_types.cpp b/ThirdParty/Ert/lib/ecl/tests/eclxx_types.cpp similarity index 100% rename from ThirdParty/Ert/libeclxx/tests/eclxx_types.cpp rename to ThirdParty/Ert/lib/ecl/tests/eclxx_types.cpp diff --git a/ThirdParty/Ert/libecl/tests/rft_test.c b/ThirdParty/Ert/lib/ecl/tests/rft_test.c similarity index 100% rename from ThirdParty/Ert/libecl/tests/rft_test.c rename to ThirdParty/Ert/lib/ecl/tests/rft_test.c diff --git a/ThirdParty/Ert/lib/ecl/tests/test_ecl_nnc_data.c b/ThirdParty/Ert/lib/ecl/tests/test_ecl_nnc_data.c new file mode 100644 index 0000000000..b1837bc107 --- /dev/null +++ b/ThirdParty/Ert/lib/ecl/tests/test_ecl_nnc_data.c @@ -0,0 +1,102 @@ +/* + Copyright (C) 2017 Statoil ASA, Norway. + + The file 'test_ecl_nnc_data.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. +*/ + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + + + +void test_alloc_global_only(bool data_in_file) { + test_work_area_type * work_area = test_work_area_alloc("nnc-INIT"); + { + int nx = 10; + int ny = 10; + int nz = 10; + ecl_grid_type * grid0 = ecl_grid_alloc_rectangular(nx,ny,nz,1,1,1,NULL); + + ecl_grid_add_self_nnc(grid0, 0 ,nx*ny + 0, 0 ); + ecl_grid_add_self_nnc(grid0, 1 ,nx*ny + 1, 1 ); + ecl_grid_add_self_nnc(grid0, 2 ,nx*ny + 2, 2 ); + { + ecl_nnc_geometry_type * nnc_geo = ecl_nnc_geometry_alloc( grid0 ); + test_assert_int_equal( ecl_nnc_geometry_size( nnc_geo ) , 3 ); + /* + Create a dummy INIT file which *ony* contains a TRANNC keyword with the correct size. + */ + { + ecl_kw_type * trann_nnc = ecl_kw_alloc(TRANNNC_KW , ecl_nnc_geometry_size( nnc_geo ), ECL_FLOAT); + fortio_type * f = fortio_open_writer( "TEST.INIT" , false, ECL_ENDIAN_FLIP ); + + if (data_in_file) { + for (int i=0; i < ecl_kw_get_size( trann_nnc); i++) + ecl_kw_iset_float( trann_nnc , i , i*1.5 ); + + ecl_kw_fwrite( trann_nnc , f ); + } + fortio_fclose( f ); + ecl_kw_free( trann_nnc ); + } + + ecl_file_type * init_file = ecl_file_open( "TEST.INIT" , 0 ); + ecl_file_view_type * view_file = ecl_file_get_global_view( init_file ); + + ecl_nnc_data_type * nnc_geo_data = ecl_nnc_data_alloc_tran(grid0, nnc_geo, view_file); + int nnc_data_size = ecl_nnc_data_get_size( nnc_geo_data ); + + if (data_in_file) { + + test_assert_true( ecl_file_view_has_kw( view_file, TRANNNC_KW) ); + test_assert_true(nnc_data_size == 3); + double * values = ecl_nnc_data_get_values( nnc_geo_data ); + test_assert_double_equal(values[0] , 0); + test_assert_double_equal(values[1] , 1.5); + test_assert_double_equal(values[2] , 3.0); + } + else + test_assert_true(nnc_data_size == 0); + + ecl_nnc_data_free( nnc_geo_data ); + ecl_nnc_geometry_free( nnc_geo ); + ecl_file_close(init_file); + } + ecl_grid_free( grid0 ); + } + test_work_area_free( work_area ); +} + + + + + +int main(int argc , char ** argv) { + + test_alloc_global_only(true); + test_alloc_global_only(false); + + return 0; +} diff --git a/ThirdParty/Ert/lib/ecl/tests/test_ecl_nnc_data_statoil_root.c b/ThirdParty/Ert/lib/ecl/tests/test_ecl_nnc_data_statoil_root.c new file mode 100644 index 0000000000..90bdf8accc --- /dev/null +++ b/ThirdParty/Ert/lib/ecl/tests/test_ecl_nnc_data_statoil_root.c @@ -0,0 +1,128 @@ +/* + Copyright (C) 2017 Statoil ASA, Norway. + + The file 'test_ecl_nnc_data_statoil.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. +*/ + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + + +void assert_data_values_read(ecl_nnc_data_type * nnc_data) { + int data_size = ecl_nnc_data_get_size(nnc_data); + for (int n = 0; n < data_size; n++) { + test_assert_double_not_equal(-1.0, ecl_nnc_data_iget_value(nnc_data, n)); + } +} + +int find_index(ecl_nnc_geometry_type * nnc_geo, int grid1, int grid2, int indx1, int indx2) { + int index = -1; + int nnc_size = ecl_nnc_geometry_size( nnc_geo ); + for (int n = 0; n < nnc_size; n++) { + ecl_nnc_pair_type * pair = ecl_nnc_geometry_iget( nnc_geo, n ); + if (pair->grid_nr1 == grid1 && pair->grid_nr2 == grid2) + if (pair->global_index1 == indx1 && pair->global_index2 ==indx2) { + index = n; + break; + } + } + return index; +} + + +void test_alloc_file_tran(char * filename) { + char * grid_file_name = ecl_util_alloc_filename(NULL , filename , ECL_EGRID_FILE , false , -1); + char * init_file_name = ecl_util_alloc_filename(NULL , filename , ECL_INIT_FILE , false , -1); + ecl_file_type * init_file = ecl_file_open( init_file_name , 0 ); + ecl_grid_type * grid = ecl_grid_alloc( grid_file_name ); + ecl_nnc_geometry_type * nnc_geo = ecl_nnc_geometry_alloc( grid ); + ecl_file_view_type * view_file = ecl_file_get_global_view( init_file ); + + ecl_nnc_data_type * nnc_geo_data = ecl_nnc_data_alloc_tran(grid, nnc_geo, view_file); + test_assert_true( ecl_nnc_geometry_size(nnc_geo) == ecl_nnc_data_get_size(nnc_geo_data) ); + + //These numerical values are hand-tuned the specific input file at: + //${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3 + int index; + + index = find_index( nnc_geo, 0, 0, 541, 14507); + test_assert_double_equal(13.784438, ecl_nnc_data_iget_value( nnc_geo_data, index) ); + + index = find_index( nnc_geo, 0, 0, 48365, 118191); + test_assert_double_equal(0.580284 , ecl_nnc_data_iget_value( nnc_geo_data, index) ); + + index = find_index( nnc_geo, 0, 19, 42830, 211); + test_assert_double_equal(0.571021 , ecl_nnc_data_iget_value( nnc_geo_data, index) ); + + index = find_index( nnc_geo, 0, 79, 132406, 76); + test_assert_double_equal(37.547710 , ecl_nnc_data_iget_value( nnc_geo_data, index) ); + + index = find_index( nnc_geo, 18, 12, 303, 115); + test_assert_double_equal(0.677443 , ecl_nnc_data_iget_value( nnc_geo_data, index) ); + + index = find_index( nnc_geo, 72, 71, 255, 179); + test_assert_double_equal(0.045813 , ecl_nnc_data_iget_value( nnc_geo_data, index) ); + + index = find_index( nnc_geo, 110, 109, 271, 275); + test_assert_double_equal(16.372242 , ecl_nnc_data_iget_value( nnc_geo_data, index) ); + + ecl_nnc_data_free(nnc_geo_data); + ecl_nnc_geometry_free(nnc_geo); + ecl_grid_free(grid); + ecl_file_close(init_file); + free(grid_file_name); + free(init_file_name); + +} + + +void test_alloc_file_flux(char * filename, int file_num) { + char * grid_file_name = ecl_util_alloc_filename(NULL , filename , ECL_EGRID_FILE , false , -1); + char * restart_file_name = ecl_util_alloc_filename(NULL , filename , ECL_RESTART_FILE , false , file_num); + + ecl_file_type * restart_file = ecl_file_open( restart_file_name , 0 ); + ecl_grid_type * grid = ecl_grid_alloc( grid_file_name ); + ecl_nnc_geometry_type * nnc_geo = ecl_nnc_geometry_alloc( grid ); + { + ecl_file_view_type * view_file = ecl_file_get_global_view( restart_file ); + + ecl_nnc_data_type * nnc_flux_data = ecl_nnc_data_alloc_wat_flux(grid, nnc_geo, view_file); + assert_data_values_read(nnc_flux_data); + ecl_nnc_data_free( nnc_flux_data ); + } + ecl_nnc_geometry_free(nnc_geo); + ecl_grid_free(grid); + ecl_file_close(restart_file); + free(grid_file_name); + free(restart_file_name); +} + + +int main(int argc , char ** argv) { + test_alloc_file_tran(argv[1]); + test_alloc_file_flux(argv[2], 0); + test_alloc_file_flux(argv[2], 6); + return 0; +} diff --git a/ThirdParty/Ert/libecl_well/tests/well_branch_collection.c b/ThirdParty/Ert/lib/ecl/tests/well_branch_collection.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_branch_collection.c rename to ThirdParty/Ert/lib/ecl/tests/well_branch_collection.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_conn.c b/ThirdParty/Ert/lib/ecl/tests/well_conn.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_conn.c rename to ThirdParty/Ert/lib/ecl/tests/well_conn.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_conn_CF.c b/ThirdParty/Ert/lib/ecl/tests/well_conn_CF.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_conn_CF.c rename to ThirdParty/Ert/lib/ecl/tests/well_conn_CF.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_conn_collection.c b/ThirdParty/Ert/lib/ecl/tests/well_conn_collection.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_conn_collection.c rename to ThirdParty/Ert/lib/ecl/tests/well_conn_collection.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_conn_load.c b/ThirdParty/Ert/lib/ecl/tests/well_conn_load.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_conn_load.c rename to ThirdParty/Ert/lib/ecl/tests/well_conn_load.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_dualp.c b/ThirdParty/Ert/lib/ecl/tests/well_dualp.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_dualp.c rename to ThirdParty/Ert/lib/ecl/tests/well_dualp.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_info.c b/ThirdParty/Ert/lib/ecl/tests/well_info.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_info.c rename to ThirdParty/Ert/lib/ecl/tests/well_info.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_lgr_load.c b/ThirdParty/Ert/lib/ecl/tests/well_lgr_load.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_lgr_load.c rename to ThirdParty/Ert/lib/ecl/tests/well_lgr_load.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_segment.c b/ThirdParty/Ert/lib/ecl/tests/well_segment.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_segment.c rename to ThirdParty/Ert/lib/ecl/tests/well_segment.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_segment_branch_conn_load.c b/ThirdParty/Ert/lib/ecl/tests/well_segment_branch_conn_load.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_segment_branch_conn_load.c rename to ThirdParty/Ert/lib/ecl/tests/well_segment_branch_conn_load.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_segment_collection.c b/ThirdParty/Ert/lib/ecl/tests/well_segment_collection.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_segment_collection.c rename to ThirdParty/Ert/lib/ecl/tests/well_segment_collection.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_segment_conn.c b/ThirdParty/Ert/lib/ecl/tests/well_segment_conn.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_segment_conn.c rename to ThirdParty/Ert/lib/ecl/tests/well_segment_conn.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_segment_conn_load.c b/ThirdParty/Ert/lib/ecl/tests/well_segment_conn_load.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_segment_conn_load.c rename to ThirdParty/Ert/lib/ecl/tests/well_segment_conn_load.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_segment_load.c b/ThirdParty/Ert/lib/ecl/tests/well_segment_load.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_segment_load.c rename to ThirdParty/Ert/lib/ecl/tests/well_segment_load.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_state.c b/ThirdParty/Ert/lib/ecl/tests/well_state.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_state.c rename to ThirdParty/Ert/lib/ecl/tests/well_state.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_state_load.c b/ThirdParty/Ert/lib/ecl/tests/well_state_load.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_state_load.c rename to ThirdParty/Ert/lib/ecl/tests/well_state_load.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_state_load_missing_RSEG.c b/ThirdParty/Ert/lib/ecl/tests/well_state_load_missing_RSEG.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_state_load_missing_RSEG.c rename to ThirdParty/Ert/lib/ecl/tests/well_state_load_missing_RSEG.c diff --git a/ThirdParty/Ert/libecl_well/tests/well_ts.c b/ThirdParty/Ert/lib/ecl/tests/well_ts.c similarity index 100% rename from ThirdParty/Ert/libecl_well/tests/well_ts.c rename to ThirdParty/Ert/lib/ecl/tests/well_ts.c diff --git a/ThirdParty/Ert/libecl_well/src/well_branch_collection.c b/ThirdParty/Ert/lib/ecl/well_branch_collection.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_branch_collection.c rename to ThirdParty/Ert/lib/ecl/well_branch_collection.c diff --git a/ThirdParty/Ert/libecl_well/src/well_conn.c b/ThirdParty/Ert/lib/ecl/well_conn.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_conn.c rename to ThirdParty/Ert/lib/ecl/well_conn.c diff --git a/ThirdParty/Ert/libecl_well/src/well_conn_collection.c b/ThirdParty/Ert/lib/ecl/well_conn_collection.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_conn_collection.c rename to ThirdParty/Ert/lib/ecl/well_conn_collection.c diff --git a/ThirdParty/Ert/libecl_well/src/well_info.c b/ThirdParty/Ert/lib/ecl/well_info.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_info.c rename to ThirdParty/Ert/lib/ecl/well_info.c diff --git a/ThirdParty/Ert/libecl_well/src/well_rseg_loader.c b/ThirdParty/Ert/lib/ecl/well_rseg_loader.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_rseg_loader.c rename to ThirdParty/Ert/lib/ecl/well_rseg_loader.c diff --git a/ThirdParty/Ert/libecl_well/src/well_segment.c b/ThirdParty/Ert/lib/ecl/well_segment.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_segment.c rename to ThirdParty/Ert/lib/ecl/well_segment.c diff --git a/ThirdParty/Ert/libecl_well/src/well_segment_collection.c b/ThirdParty/Ert/lib/ecl/well_segment_collection.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_segment_collection.c rename to ThirdParty/Ert/lib/ecl/well_segment_collection.c diff --git a/ThirdParty/Ert/libecl_well/src/well_state.c b/ThirdParty/Ert/lib/ecl/well_state.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_state.c rename to ThirdParty/Ert/lib/ecl/well_state.c diff --git a/ThirdParty/Ert/libecl_well/src/well_ts.c b/ThirdParty/Ert/lib/ecl/well_ts.c similarity index 100% rename from ThirdParty/Ert/libecl_well/src/well_ts.c rename to ThirdParty/Ert/lib/ecl/well_ts.c diff --git a/ThirdParty/Ert/libert_util/include/ert/util/ert_api_config.h.in b/ThirdParty/Ert/lib/ert_api_config.h.in similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/ert_api_config.h.in rename to ThirdParty/Ert/lib/ert_api_config.h.in diff --git a/ThirdParty/Ert/libgeometry/src/geo_pointset.c b/ThirdParty/Ert/lib/geometry/geo_pointset.c similarity index 100% rename from ThirdParty/Ert/libgeometry/src/geo_pointset.c rename to ThirdParty/Ert/lib/geometry/geo_pointset.c diff --git a/ThirdParty/Ert/libgeometry/src/geo_polygon.c b/ThirdParty/Ert/lib/geometry/geo_polygon.c similarity index 100% rename from ThirdParty/Ert/libgeometry/src/geo_polygon.c rename to ThirdParty/Ert/lib/geometry/geo_polygon.c diff --git a/ThirdParty/Ert/libgeometry/src/geo_polygon_collection.c b/ThirdParty/Ert/lib/geometry/geo_polygon_collection.c similarity index 100% rename from ThirdParty/Ert/libgeometry/src/geo_polygon_collection.c rename to ThirdParty/Ert/lib/geometry/geo_polygon_collection.c diff --git a/ThirdParty/Ert/libgeometry/src/geo_region.c b/ThirdParty/Ert/lib/geometry/geo_region.c similarity index 100% rename from ThirdParty/Ert/libgeometry/src/geo_region.c rename to ThirdParty/Ert/lib/geometry/geo_region.c diff --git a/ThirdParty/Ert/libgeometry/src/geo_surface.c b/ThirdParty/Ert/lib/geometry/geo_surface.c similarity index 100% rename from ThirdParty/Ert/libgeometry/src/geo_surface.c rename to ThirdParty/Ert/lib/geometry/geo_surface.c diff --git a/ThirdParty/Ert/libgeometry/src/geo_util.c b/ThirdParty/Ert/lib/geometry/geo_util.c similarity index 100% rename from ThirdParty/Ert/libgeometry/src/geo_util.c rename to ThirdParty/Ert/lib/geometry/geo_util.c diff --git a/ThirdParty/Ert/libgeometry/tests/geo_polygon.c b/ThirdParty/Ert/lib/geometry/tests/geo_polygon.c similarity index 100% rename from ThirdParty/Ert/libgeometry/tests/geo_polygon.c rename to ThirdParty/Ert/lib/geometry/tests/geo_polygon.c diff --git a/ThirdParty/Ert/libgeometry/tests/geo_polygon_collection.c b/ThirdParty/Ert/lib/geometry/tests/geo_polygon_collection.c similarity index 100% rename from ThirdParty/Ert/libgeometry/tests/geo_polygon_collection.c rename to ThirdParty/Ert/lib/geometry/tests/geo_polygon_collection.c diff --git a/ThirdParty/Ert/libgeometry/tests/geo_surface.c b/ThirdParty/Ert/lib/geometry/tests/geo_surface.c similarity index 100% rename from ThirdParty/Ert/libgeometry/tests/geo_surface.c rename to ThirdParty/Ert/lib/geometry/tests/geo_surface.c diff --git a/ThirdParty/Ert/libgeometry/tests/geo_util_xlines.c b/ThirdParty/Ert/lib/geometry/tests/geo_util_xlines.c similarity index 100% rename from ThirdParty/Ert/libgeometry/tests/geo_util_xlines.c rename to ThirdParty/Ert/lib/geometry/tests/geo_util_xlines.c diff --git a/ThirdParty/Ert/libeclxx/include/ert/ecl/EclFilename.hpp b/ThirdParty/Ert/lib/include/ert/ecl/EclFilename.hpp similarity index 100% rename from ThirdParty/Ert/libeclxx/include/ert/ecl/EclFilename.hpp rename to ThirdParty/Ert/lib/include/ert/ecl/EclFilename.hpp diff --git a/ThirdParty/Ert/libeclxx/include/ert/ecl/EclKW.hpp b/ThirdParty/Ert/lib/include/ert/ecl/EclKW.hpp similarity index 100% rename from ThirdParty/Ert/libeclxx/include/ert/ecl/EclKW.hpp rename to ThirdParty/Ert/lib/include/ert/ecl/EclKW.hpp diff --git a/ThirdParty/Ert/libeclxx/include/ert/ecl/FortIO.hpp b/ThirdParty/Ert/lib/include/ert/ecl/FortIO.hpp similarity index 100% rename from ThirdParty/Ert/libeclxx/include/ert/ecl/FortIO.hpp rename to ThirdParty/Ert/lib/include/ert/ecl/FortIO.hpp diff --git a/ThirdParty/Ert/libeclxx/include/ert/ecl/Smspec.hpp b/ThirdParty/Ert/lib/include/ert/ecl/Smspec.hpp similarity index 100% rename from ThirdParty/Ert/libeclxx/include/ert/ecl/Smspec.hpp rename to ThirdParty/Ert/lib/include/ert/ecl/Smspec.hpp diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_box.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_box.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_box.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_box.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_coarse_cell.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_coarse_cell.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_coarse_cell.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_coarse_cell.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_endian_flip.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_endian_flip.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_endian_flip.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_endian_flip.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_file.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_file.h similarity index 98% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_file.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_file.h index d7186ada55..8c2d2c78ee 100644 --- a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_file.h +++ b/ThirdParty/Ert/lib/include/ert/ecl/ecl_file.h @@ -85,6 +85,7 @@ extern "C" { int ecl_file_iget_named_size( const ecl_file_type * file , const char * kw , int ith); void ecl_file_indexed_read(const ecl_file_type * file , const char * kw, int index, const int_vector_type * index_map, char* buffer); + ecl_file_view_type * ecl_file_get_global_blockview( ecl_file_type * ecl_file , const char * kw , int occurence); ecl_file_view_type * ecl_file_alloc_global_blockview( ecl_file_type * ecl_file , const char * kw , int occurence); ecl_file_view_type * ecl_file_get_global_view( ecl_file_type * ecl_file ); ecl_file_view_type * ecl_file_get_active_view( ecl_file_type * ecl_file ); diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_file_kw.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_file_kw.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_file_kw.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_file_kw.h diff --git a/ThirdParty/Ert/lib/include/ert/ecl/ecl_file_view.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_file_view.h new file mode 100644 index 0000000000..152f007ea9 --- /dev/null +++ b/ThirdParty/Ert/lib/include/ert/ecl/ecl_file_view.h @@ -0,0 +1,108 @@ +/* + Copyright (C) 2016 Statoil ASA, Norway. + + This file is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. +*/ + + +#ifndef ERT_ECL_FILE_VIEW_H +#define ERT_ECL_FILE_VIEW_H + +#include +#include + +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + ECL_FILE_CLOSE_STREAM = 1 , /* + This flag will close the underlying FILE object between each access; this is + mainly to save filedescriptors in cases where many ecl_file instances are open at + the same time. */ + // + ECL_FILE_WRITABLE = 2 /* + This flag opens the file in a mode where it can be updated and modified, but it + must still exist and be readable. I.e. this should not compared with the normal: + fopen(filename , "w") where an existing file is truncated to zero upon successfull + open. + */ +} ecl_file_flag_type; + + +typedef struct ecl_file_view_struct ecl_file_view_type; + + bool ecl_file_view_flags_set( const ecl_file_view_type * file_view, int query_flags); + bool ecl_file_view_check_flags( int state_flags , int query_flags); + + ecl_file_view_type * ecl_file_view_alloc( fortio_type * fortio , int * flags , inv_map_type * inv_map , bool owner ); + int ecl_file_view_get_global_index( const ecl_file_view_type * ecl_file_view , const char * kw , int ith); + void ecl_file_view_make_index( ecl_file_view_type * ecl_file_view ); + bool ecl_file_view_has_kw( const ecl_file_view_type * ecl_file_view, const char * kw); + ecl_file_kw_type * ecl_file_view_iget_file_kw( const ecl_file_view_type * ecl_file_view , int global_index); + ecl_file_kw_type * ecl_file_view_iget_named_file_kw( const ecl_file_view_type * ecl_file_view , const char * kw, int ith); + ecl_kw_type * ecl_file_view_iget_kw( const ecl_file_view_type * ecl_file_view , int index); + void ecl_file_view_index_fload_kw(const ecl_file_view_type * ecl_file_view, const char* kw, int index, const int_vector_type * index_map, char* buffer); + int ecl_file_view_find_kw_value( const ecl_file_view_type * ecl_file_view , const char * kw , const void * value); + const char * ecl_file_view_iget_distinct_kw( const ecl_file_view_type * ecl_file_view , int index); + int ecl_file_view_get_num_distinct_kw( const ecl_file_view_type * ecl_file_view ); + int ecl_file_view_get_size( const ecl_file_view_type * ecl_file_view ); + ecl_data_type ecl_file_view_iget_data_type( const ecl_file_view_type * ecl_file_view , int index); + int ecl_file_view_iget_size( const ecl_file_view_type * ecl_file_view , int index); + const char * ecl_file_view_iget_header( const ecl_file_view_type * ecl_file_view , int index); + ecl_kw_type * ecl_file_view_iget_named_kw( const ecl_file_view_type * ecl_file_view , const char * kw, int ith); + ecl_data_type ecl_file_view_iget_named_data_type( const ecl_file_view_type * ecl_file_view , const char * kw , int ith); + int ecl_file_view_iget_named_size( const ecl_file_view_type * ecl_file_view , const char * kw , int ith); + void ecl_file_view_replace_kw( ecl_file_view_type * ecl_file_view , ecl_kw_type * old_kw , ecl_kw_type * new_kw , bool insert_copy); + bool ecl_file_view_load_all( ecl_file_view_type * ecl_file_view ); + void ecl_file_view_add_kw( ecl_file_view_type * ecl_file_view , ecl_file_kw_type * file_kw); + void ecl_file_view_free( ecl_file_view_type * ecl_file_view ); + void ecl_file_view_free__( void * arg ); + int ecl_file_view_get_num_named_kw(const ecl_file_view_type * ecl_file_view , const char * kw); + void ecl_file_view_fwrite( const ecl_file_view_type * ecl_file_view , fortio_type * target , int offset); + int ecl_file_view_iget_occurence( const ecl_file_view_type * ecl_file_view , int global_index); + void ecl_file_view_fprintf_kw_list(const ecl_file_view_type * ecl_file_view , FILE * stream); + ecl_file_view_type * ecl_file_view_add_blockview(const ecl_file_view_type * ecl_file_view , const char * header, int occurence); + ecl_file_view_type * ecl_file_view_add_blockview2(const ecl_file_view_type * ecl_file_view , const char * start_kw, const char * end_kw, int occurence); + ecl_file_view_type * ecl_file_view_add_restart_view(ecl_file_view_type * file_view , int seqnum_index, int report_step , time_t sim_time, double sim_days); + ecl_file_view_type * ecl_file_view_alloc_blockview(const ecl_file_view_type * ecl_file_view , const char * header, int occurence); + ecl_file_view_type * ecl_file_view_alloc_blockview2(const ecl_file_view_type * ecl_file_view , const char * start_kw, const char * end_kw, int occurence); + + void ecl_file_view_add_child( ecl_file_view_type * parent , ecl_file_view_type * child); + bool ecl_file_view_drop_flag( ecl_file_view_type * file_view , int flag); + void ecl_file_view_add_flag( ecl_file_view_type * file_view , int flag); + + int ecl_file_view_seqnum_index_from_sim_time( ecl_file_view_type * parent_map , time_t sim_time); + bool ecl_file_view_has_sim_time( const ecl_file_view_type * ecl_file_view , time_t sim_time); + int ecl_file_view_find_sim_time(const ecl_file_view_type * ecl_file_view , time_t sim_time); + double ecl_file_view_iget_restart_sim_days(const ecl_file_view_type * ecl_file_view , int seqnum_index); + time_t ecl_file_view_iget_restart_sim_date(const ecl_file_view_type * ecl_file_view , int seqnum_index); + bool ecl_file_view_has_report_step( const ecl_file_view_type * ecl_file_view , int report_step); + + ecl_file_view_type * ecl_file_view_add_summary_view( ecl_file_view_type * file_view , int report_step ); + const char * ecl_file_view_get_src_file( const ecl_file_view_type * file_view ); + void ecl_file_view_fclose_stream( ecl_file_view_type * file_view ); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_grav.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_grav.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_grav.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_grav.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_grav_calc.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_grav_calc.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_grav_calc.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_grav_calc.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_grav_common.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_grav_common.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_grav_common.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_grav_common.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_grid.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_grid.h similarity index 99% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_grid.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_grid.h index fdea668183..3c9cd71060 100644 --- a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_grid.h +++ b/ThirdParty/Ert/lib/include/ert/ecl/ecl_grid.h @@ -188,6 +188,7 @@ extern "C" { ecl_grid_type * ecl_grid_get_lgr_from_lgr_nr(const ecl_grid_type * main_grid, int lgr_nr); ecl_grid_type * ecl_grid_get_lgr(const ecl_grid_type * main_grid, const char * __lgr_name); bool ecl_grid_has_lgr(const ecl_grid_type * main_grid, const char * __lgr_name); + bool ecl_grid_has_lgr_nr(const ecl_grid_type * main_grid, int lgr_nr); const char * ecl_grid_iget_lgr_name( const ecl_grid_type * ecl_grid , int lgr_index); const char * ecl_grid_get_lgr_name( const ecl_grid_type * ecl_grid , int lgr_nr); stringlist_type * ecl_grid_alloc_lgr_name_list(const ecl_grid_type * ecl_grid); diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_grid_cache.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_grid_cache.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_grid_cache.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_grid_cache.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_grid_dims.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_grid_dims.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_grid_dims.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_grid_dims.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_init_file.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_init_file.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_init_file.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_init_file.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_io_config.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_io_config.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_io_config.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_io_config.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_kw.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_kw.h similarity index 99% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_kw.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_kw.h index 72a74fd20f..72fdc1d5f0 100644 --- a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_kw.h +++ b/ThirdParty/Ert/lib/include/ert/ecl/ecl_kw.h @@ -105,7 +105,7 @@ extern "C" { void ecl_kw_get_memcpy_double_data(const ecl_kw_type *ecl_kw , double *target); void ecl_kw_get_memcpy_int_data(const ecl_kw_type *ecl_kw , int *target); void ecl_kw_set_memcpy_data(ecl_kw_type * , const void *); - void ecl_kw_fwrite(const ecl_kw_type *, fortio_type *); + bool ecl_kw_fwrite(const ecl_kw_type *, fortio_type *); void ecl_kw_iget(const ecl_kw_type *, int , void *); void ecl_kw_iset(ecl_kw_type *ecl_kw , int i , const void *iptr); void ecl_kw_iset_char_ptr( ecl_kw_type * ecl_kw , int index, const char * s); diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_kw_grdecl.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_kw_grdecl.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_kw_grdecl.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_kw_grdecl.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_kw_magic.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_kw_magic.h similarity index 97% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_kw_magic.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_kw_magic.h index 846ad40765..238819a6c2 100644 --- a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_kw_magic.h +++ b/ThirdParty/Ert/lib/include/ert/ecl/ecl_kw_magic.h @@ -380,6 +380,17 @@ values (2e20) are denoted with '*'. #define RFIPWAT_KW "RFIPWAT" #define RFIPOIL_KW "RFIPOIL" +#define FLRWATNNC_KW "FLRWATN+" //nnc wtr flux, grid1 == grid2 +#define FLROILNNC_KW "FLROILN+" //nnc oil flux, grid1 == grid2 +#define FLRGASNNC_KW "FLRGASN+" //nnc gas flux, grid1 == grid2 + +#define FLRWATLG_KW "FLRWATL+" //nnc wtr flux, grid1 == 0, grid != 0 +#define FLROILLG_KW "FLROILL+" //nnc oil flux, grid1 == 0, grid != 0 +#define FLRGASLG_KW "FLRGASL+" //nnc gas flux, grid1 == 0, grid != 0 + +#define FLRWATLL_KW "FLRWATA+" //nnc wtr flux, grid1 != 0, grid2 != 0, grid1 != grid2 +#define FLROILLL_KW "FLROILA+" //nnc oil flux, grid1 != 0, grid2 != 0, grid1 != grid2 +#define FLRGASLL_KW "FLRGASA+" //nnc gas flux, grid1 != 0, grid2 != 0, grid1 != grid2 #define INTEHEAD_NWELLS_INDEX 16 // Number of wells #define INTEHEAD_NIWELZ_INDEX 24 // Number of elements pr. well in the IWEL array. diff --git a/ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_data.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_data.h new file mode 100644 index 0000000000..ffc7493bdf --- /dev/null +++ b/ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_data.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2017 Statoil ASA, Norway. + + The file 'ecl_nnc_geometry.h' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. +*/ + +#ifndef ECL_NNC_DATA_H +#define ECL_NNC_DATA_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include + +typedef struct ecl_nnc_data_struct ecl_nnc_data_type; + +ecl_nnc_data_type * ecl_nnc_data_alloc_tran(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file); +ecl_nnc_data_type * ecl_nnc_data_alloc_wat_flux(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file); +ecl_nnc_data_type * ecl_nnc_data_alloc_oil_flux(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file); +ecl_nnc_data_type * ecl_nnc_data_alloc_gas_flux(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file); +void ecl_nnc_data_free(ecl_nnc_data_type * data); + +int ecl_nnc_data_get_size(ecl_nnc_data_type * data); +const double * ecl_nnc_data_get_values( const ecl_nnc_data_type * data ); + +double ecl_nnc_data_iget_value(const ecl_nnc_data_type * data, int index); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_nnc_export.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_export.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_nnc_export.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_export.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_nnc_geometry.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_geometry.h similarity index 92% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_nnc_geometry.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_geometry.h index 743d45f33a..fdd002077c 100644 --- a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_nnc_geometry.h +++ b/ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_geometry.h @@ -43,6 +43,7 @@ void ecl_nnc_geometry_free( ecl_nnc_geometry_type * nnc_geo ecl_nnc_geometry_type * ecl_nnc_geometry_alloc( const ecl_grid_type * grid ); int ecl_nnc_geometry_size( const ecl_nnc_geometry_type * nnc_geo ); const ecl_nnc_pair_type * ecl_nnc_geometry_iget( const ecl_nnc_geometry_type * nnc_geo , int index); +bool ecl_nnc_geometry_same_kw( const ecl_nnc_pair_type * nnc1 , const ecl_nnc_pair_type * nnc2); #ifdef __cplusplus } diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_region.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_region.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_region.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_region.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_rft_cell.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_cell.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_rft_cell.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_cell.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_rft_file.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_file.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_rft_file.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_file.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_rft_node.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_node.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_rft_node.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_node.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_rst_file.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_rst_file.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_rst_file.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_rst_file.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_rsthead.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_rsthead.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_rsthead.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_rsthead.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_smspec.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_smspec.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_smspec.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_smspec.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_subsidence.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_subsidence.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_subsidence.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_subsidence.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_sum.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_sum.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum_data.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_sum_data.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum_data.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_sum_data.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum_index.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_sum_index.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum_index.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_sum_index.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum_tstep.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_sum_tstep.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum_tstep.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_sum_tstep.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum_vector.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_sum_vector.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_sum_vector.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_sum_vector.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_type.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_type.h similarity index 86% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_type.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_type.h index 7a596ddcf3..4848e34dc7 100644 --- a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_type.h +++ b/ThirdParty/Ert/lib/include/ert/ecl/ecl_type.h @@ -71,50 +71,35 @@ typedef enum { #define ECL_STRING10_LENGTH 10 // 'Normal' 8 characters 'CHAR' type. #define ECL_TYPE_LENGTH 4 - -#ifdef __cplusplus -} -#endif - - -#ifdef __cplusplus - struct ecl_type_struct { const ecl_type_enum type; const size_t element_size; - - ecl_type_struct( ecl_type_enum t, size_t es) : - type( t ), - element_size( es ) - {} }; -#define ECL_INT ecl_data_type( ECL_INT_TYPE, sizeof(int)) -#define ECL_FLOAT ecl_data_type( ECL_FLOAT_TYPE, sizeof(float)) -#define ECL_DOUBLE ecl_data_type( ECL_DOUBLE_TYPE, sizeof(double)) -#define ECL_BOOL ecl_data_type( ECL_BOOL_TYPE, sizeof(int)) -#define ECL_CHAR ecl_data_type( ECL_CHAR_TYPE, ECL_STRING8_LENGTH + 1) -#define ECL_MESS ecl_data_type( ECL_MESS_TYPE, 0) -#define ECL_STRING(size) ecl_data_type(ECL_STRING_TYPE, size + 1) +#ifdef __cplusplus + +#define ECL_INT ecl_data_type{ ECL_INT_TYPE, sizeof(int)} +#define ECL_FLOAT ecl_data_type{ ECL_FLOAT_TYPE, sizeof(float)} +#define ECL_DOUBLE ecl_data_type{ ECL_DOUBLE_TYPE, sizeof(double)} +#define ECL_BOOL ecl_data_type{ ECL_BOOL_TYPE, sizeof(int)} +#define ECL_CHAR ecl_data_type{ ECL_CHAR_TYPE, ECL_STRING8_LENGTH + 1} +#define ECL_MESS ecl_data_type{ ECL_MESS_TYPE, 0} +#define ECL_STRING(size) ecl_data_type{ECL_STRING_TYPE, (size) + 1} + +} #else -struct ecl_type_struct { - const ecl_type_enum type; - const size_t element_size; -}; - #define ECL_CHAR (ecl_data_type) {.type = ECL_CHAR_TYPE, .element_size = ECL_STRING8_LENGTH + 1} #define ECL_INT (ecl_data_type) {.type = ECL_INT_TYPE, .element_size = sizeof(int)} #define ECL_FLOAT (ecl_data_type) {.type = ECL_FLOAT_TYPE, .element_size = sizeof(float)} #define ECL_DOUBLE (ecl_data_type) {.type = ECL_DOUBLE_TYPE, .element_size = sizeof(double)} #define ECL_BOOL (ecl_data_type) {.type = ECL_BOOL_TYPE, .element_size = sizeof(int)} #define ECL_MESS (ecl_data_type) {.type = ECL_MESS_TYPE, .element_size = 0} -#define ECL_STRING(size) (ecl_data_type) {.type = ECL_STRING_TYPE, .element_size = size + 1} +#define ECL_STRING(size) (ecl_data_type) {.type = ECL_STRING_TYPE, .element_size = (size) + 1} #endif - #ifdef __cplusplus extern "C" { #endif diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_units.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_units.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_units.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_units.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_util.h b/ThirdParty/Ert/lib/include/ert/ecl/ecl_util.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/ecl_util.h rename to ThirdParty/Ert/lib/include/ert/ecl/ecl_util.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/fault_block.h b/ThirdParty/Ert/lib/include/ert/ecl/fault_block.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/fault_block.h rename to ThirdParty/Ert/lib/include/ert/ecl/fault_block.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/fault_block_layer.h b/ThirdParty/Ert/lib/include/ert/ecl/fault_block_layer.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/fault_block_layer.h rename to ThirdParty/Ert/lib/include/ert/ecl/fault_block_layer.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/fortio.h b/ThirdParty/Ert/lib/include/ert/ecl/fortio.h similarity index 97% rename from ThirdParty/Ert/libecl/include/ert/ecl/fortio.h rename to ThirdParty/Ert/lib/include/ert/ecl/fortio.h index 6781f25d06..55d253af06 100644 --- a/ThirdParty/Ert/libecl/include/ert/ecl/fortio.h +++ b/ThirdParty/Ert/lib/include/ert/ecl/fortio.h @@ -73,12 +73,14 @@ typedef struct fortio_struct fortio_type; void fortio_data_fseek(fortio_type* fortio, offset_type data_offset, size_t data_element, const int element_size, const int element_count, const int block_size); int fortio_fileno( fortio_type * fortio ); bool fortio_ftruncate( fortio_type * fortio , offset_type size); + int fortio_fclean(fortio_type * fortio); bool fortio_fclose_stream( fortio_type * fortio ); bool fortio_fopen_stream( fortio_type * fortio ); bool fortio_stream_is_open( const fortio_type * fortio ); bool fortio_assert_stream_open( fortio_type * fortio ); bool fortio_read_at_eof( fortio_type * fortio ); + void fortio_fwrite_error(fortio_type * fortio); UTIL_IS_INSTANCE_HEADER( fortio ); UTIL_SAFE_CAST_HEADER( fortio ); diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/grid_dims.h b/ThirdParty/Ert/lib/include/ert/ecl/grid_dims.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/grid_dims.h rename to ThirdParty/Ert/lib/include/ert/ecl/grid_dims.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/layer.h b/ThirdParty/Ert/lib/include/ert/ecl/layer.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/layer.h rename to ThirdParty/Ert/lib/include/ert/ecl/layer.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/nnc_info.h b/ThirdParty/Ert/lib/include/ert/ecl/nnc_info.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/nnc_info.h rename to ThirdParty/Ert/lib/include/ert/ecl/nnc_info.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/nnc_vector.h b/ThirdParty/Ert/lib/include/ert/ecl/nnc_vector.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/nnc_vector.h rename to ThirdParty/Ert/lib/include/ert/ecl/nnc_vector.h diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/smspec_node.h b/ThirdParty/Ert/lib/include/ert/ecl/smspec_node.h similarity index 100% rename from ThirdParty/Ert/libecl/include/ert/ecl/smspec_node.h rename to ThirdParty/Ert/lib/include/ert/ecl/smspec_node.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_branch_collection.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_branch_collection.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_branch_collection.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_branch_collection.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_conn.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_conn.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_conn.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_conn.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_conn_collection.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_conn_collection.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_conn_collection.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_conn_collection.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_const.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_const.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_const.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_const.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_info.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_info.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_info.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_info.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_rseg_loader.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_rseg_loader.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_rseg_loader.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_rseg_loader.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_segment.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_segment.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_segment.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_segment.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_segment_collection.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_segment_collection.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_segment_collection.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_segment_collection.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_state.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_state.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_state.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_state.h diff --git a/ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_ts.h b/ThirdParty/Ert/lib/include/ert/ecl_well/well_ts.h similarity index 100% rename from ThirdParty/Ert/libecl_well/include/ert/ecl_well/well_ts.h rename to ThirdParty/Ert/lib/include/ert/ecl_well/well_ts.h diff --git a/ThirdParty/Ert/libgeometry/include/ert/geometry/geo_pointset.h b/ThirdParty/Ert/lib/include/ert/geometry/geo_pointset.h similarity index 100% rename from ThirdParty/Ert/libgeometry/include/ert/geometry/geo_pointset.h rename to ThirdParty/Ert/lib/include/ert/geometry/geo_pointset.h diff --git a/ThirdParty/Ert/libgeometry/include/ert/geometry/geo_polygon.h b/ThirdParty/Ert/lib/include/ert/geometry/geo_polygon.h similarity index 100% rename from ThirdParty/Ert/libgeometry/include/ert/geometry/geo_polygon.h rename to ThirdParty/Ert/lib/include/ert/geometry/geo_polygon.h diff --git a/ThirdParty/Ert/libgeometry/include/ert/geometry/geo_polygon_collection.h b/ThirdParty/Ert/lib/include/ert/geometry/geo_polygon_collection.h similarity index 100% rename from ThirdParty/Ert/libgeometry/include/ert/geometry/geo_polygon_collection.h rename to ThirdParty/Ert/lib/include/ert/geometry/geo_polygon_collection.h diff --git a/ThirdParty/Ert/libgeometry/include/ert/geometry/geo_region.h b/ThirdParty/Ert/lib/include/ert/geometry/geo_region.h similarity index 100% rename from ThirdParty/Ert/libgeometry/include/ert/geometry/geo_region.h rename to ThirdParty/Ert/lib/include/ert/geometry/geo_region.h diff --git a/ThirdParty/Ert/libgeometry/include/ert/geometry/geo_surface.h b/ThirdParty/Ert/lib/include/ert/geometry/geo_surface.h similarity index 100% rename from ThirdParty/Ert/libgeometry/include/ert/geometry/geo_surface.h rename to ThirdParty/Ert/lib/include/ert/geometry/geo_surface.h diff --git a/ThirdParty/Ert/libgeometry/include/ert/geometry/geo_util.h b/ThirdParty/Ert/lib/include/ert/geometry/geo_util.h similarity index 100% rename from ThirdParty/Ert/libgeometry/include/ert/geometry/geo_util.h rename to ThirdParty/Ert/lib/include/ert/geometry/geo_util.h diff --git a/ThirdParty/Ert/libert_utilxx/include/ert/util/TestArea.hpp b/ThirdParty/Ert/lib/include/ert/util/TestArea.hpp similarity index 100% rename from ThirdParty/Ert/libert_utilxx/include/ert/util/TestArea.hpp rename to ThirdParty/Ert/lib/include/ert/util/TestArea.hpp diff --git a/ThirdParty/Ert/libert_util/include/ert/util/arg_pack.h b/ThirdParty/Ert/lib/include/ert/util/arg_pack.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/arg_pack.h rename to ThirdParty/Ert/lib/include/ert/util/arg_pack.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/atomic.h b/ThirdParty/Ert/lib/include/ert/util/atomic.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/atomic.h rename to ThirdParty/Ert/lib/include/ert/util/atomic.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/block_fs.h b/ThirdParty/Ert/lib/include/ert/util/block_fs.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/block_fs.h rename to ThirdParty/Ert/lib/include/ert/util/block_fs.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/buffer.h b/ThirdParty/Ert/lib/include/ert/util/buffer.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/buffer.h rename to ThirdParty/Ert/lib/include/ert/util/buffer.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/buffer_string.h b/ThirdParty/Ert/lib/include/ert/util/buffer_string.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/buffer_string.h rename to ThirdParty/Ert/lib/include/ert/util/buffer_string.h diff --git a/ThirdParty/Ert/libert_utilxx/include/ert/util/ert_unique_ptr.hpp b/ThirdParty/Ert/lib/include/ert/util/ert_unique_ptr.hpp similarity index 100% rename from ThirdParty/Ert/libert_utilxx/include/ert/util/ert_unique_ptr.hpp rename to ThirdParty/Ert/lib/include/ert/util/ert_unique_ptr.hpp diff --git a/ThirdParty/Ert/libert_util/include/ert/util/ert_version.h b/ThirdParty/Ert/lib/include/ert/util/ert_version.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/ert_version.h rename to ThirdParty/Ert/lib/include/ert/util/ert_version.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/hash.h b/ThirdParty/Ert/lib/include/ert/util/hash.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/hash.h rename to ThirdParty/Ert/lib/include/ert/util/hash.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/hash_node.h b/ThirdParty/Ert/lib/include/ert/util/hash_node.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/hash_node.h rename to ThirdParty/Ert/lib/include/ert/util/hash_node.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/hash_sll.h b/ThirdParty/Ert/lib/include/ert/util/hash_sll.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/hash_sll.h rename to ThirdParty/Ert/lib/include/ert/util/hash_sll.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/lars.h b/ThirdParty/Ert/lib/include/ert/util/lars.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/lars.h rename to ThirdParty/Ert/lib/include/ert/util/lars.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/log.h b/ThirdParty/Ert/lib/include/ert/util/log.h similarity index 75% rename from ThirdParty/Ert/libert_util/include/ert/util/log.h rename to ThirdParty/Ert/lib/include/ert/util/log.h index a8a58ff4e3..221fa2cb15 100644 --- a/ThirdParty/Ert/libert_util/include/ert/util/log.h +++ b/ThirdParty/Ert/lib/include/ert/util/log.h @@ -26,12 +26,23 @@ extern "C" { #include #include +//Same as pythons default log levels, but with different numeric values. +typedef enum { + LOG_CRITICAL=0, //OOM. + LOG_ERROR=1, //When something we really expected to work does not, e.g. IO failure. + LOG_WARNING=2, //Important, but not error. E.g. combination of settings which can be intended, but probably are not. + LOG_INFO=3, //Entering functions/parts of the code + LOG_DEBUG=4 //Inside the for-loop, when you need the nitty gritty details. Think TRACE. +} message_level_type; + + typedef struct log_struct log_type; FILE * log_get_stream(log_type * logh ); void log_reopen( log_type * logh , const char * filename ); log_type * log_open(const char *filename, int log_level); void log_add_message(log_type *logh, int message_level , FILE * dup_stream , char* message, bool free_message); + void log_add_message_str(log_type *logh, message_level_type message_level , const char* message); void log_add_fmt_message(log_type * logh , int message_level , FILE * dup_stream , const char * fmt , ...); int log_get_level( const log_type * logh); void log_set_level( log_type * logh , int new_level); diff --git a/ThirdParty/Ert/libert_util/include/ert/util/lookup_table.h b/ThirdParty/Ert/lib/include/ert/util/lookup_table.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/lookup_table.h rename to ThirdParty/Ert/lib/include/ert/util/lookup_table.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/matrix.h b/ThirdParty/Ert/lib/include/ert/util/matrix.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/matrix.h rename to ThirdParty/Ert/lib/include/ert/util/matrix.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/matrix_blas.h b/ThirdParty/Ert/lib/include/ert/util/matrix_blas.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/matrix_blas.h rename to ThirdParty/Ert/lib/include/ert/util/matrix_blas.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/matrix_lapack.h b/ThirdParty/Ert/lib/include/ert/util/matrix_lapack.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/matrix_lapack.h rename to ThirdParty/Ert/lib/include/ert/util/matrix_lapack.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/matrix_stat.h b/ThirdParty/Ert/lib/include/ert/util/matrix_stat.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/matrix_stat.h rename to ThirdParty/Ert/lib/include/ert/util/matrix_stat.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/menu.h b/ThirdParty/Ert/lib/include/ert/util/menu.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/menu.h rename to ThirdParty/Ert/lib/include/ert/util/menu.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/msg.h b/ThirdParty/Ert/lib/include/ert/util/msg.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/msg.h rename to ThirdParty/Ert/lib/include/ert/util/msg.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/msvc_stdbool.h b/ThirdParty/Ert/lib/include/ert/util/msvc_stdbool.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/msvc_stdbool.h rename to ThirdParty/Ert/lib/include/ert/util/msvc_stdbool.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/mzran.h b/ThirdParty/Ert/lib/include/ert/util/mzran.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/mzran.h rename to ThirdParty/Ert/lib/include/ert/util/mzran.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/node_ctype.h b/ThirdParty/Ert/lib/include/ert/util/node_ctype.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/node_ctype.h rename to ThirdParty/Ert/lib/include/ert/util/node_ctype.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/node_data.h b/ThirdParty/Ert/lib/include/ert/util/node_data.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/node_data.h rename to ThirdParty/Ert/lib/include/ert/util/node_data.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/parser.h b/ThirdParty/Ert/lib/include/ert/util/parser.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/parser.h rename to ThirdParty/Ert/lib/include/ert/util/parser.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/path_fmt.h b/ThirdParty/Ert/lib/include/ert/util/path_fmt.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/path_fmt.h rename to ThirdParty/Ert/lib/include/ert/util/path_fmt.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/path_stack.h b/ThirdParty/Ert/lib/include/ert/util/path_stack.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/path_stack.h rename to ThirdParty/Ert/lib/include/ert/util/path_stack.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/perm_vector.h b/ThirdParty/Ert/lib/include/ert/util/perm_vector.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/perm_vector.h rename to ThirdParty/Ert/lib/include/ert/util/perm_vector.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/regression.h b/ThirdParty/Ert/lib/include/ert/util/regression.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/regression.h rename to ThirdParty/Ert/lib/include/ert/util/regression.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/rng.h b/ThirdParty/Ert/lib/include/ert/util/rng.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/rng.h rename to ThirdParty/Ert/lib/include/ert/util/rng.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/set.h b/ThirdParty/Ert/lib/include/ert/util/set.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/set.h rename to ThirdParty/Ert/lib/include/ert/util/set.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/ssize_t.h b/ThirdParty/Ert/lib/include/ert/util/ssize_t.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/ssize_t.h rename to ThirdParty/Ert/lib/include/ert/util/ssize_t.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/statistics.h b/ThirdParty/Ert/lib/include/ert/util/statistics.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/statistics.h rename to ThirdParty/Ert/lib/include/ert/util/statistics.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/stepwise.h b/ThirdParty/Ert/lib/include/ert/util/stepwise.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/stepwise.h rename to ThirdParty/Ert/lib/include/ert/util/stepwise.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/string_util.h b/ThirdParty/Ert/lib/include/ert/util/string_util.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/string_util.h rename to ThirdParty/Ert/lib/include/ert/util/string_util.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/stringlist.h b/ThirdParty/Ert/lib/include/ert/util/stringlist.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/stringlist.h rename to ThirdParty/Ert/lib/include/ert/util/stringlist.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/struct_vector.h b/ThirdParty/Ert/lib/include/ert/util/struct_vector.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/struct_vector.h rename to ThirdParty/Ert/lib/include/ert/util/struct_vector.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/subst_func.h b/ThirdParty/Ert/lib/include/ert/util/subst_func.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/subst_func.h rename to ThirdParty/Ert/lib/include/ert/util/subst_func.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/subst_list.h b/ThirdParty/Ert/lib/include/ert/util/subst_list.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/subst_list.h rename to ThirdParty/Ert/lib/include/ert/util/subst_list.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/template.h b/ThirdParty/Ert/lib/include/ert/util/template.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/template.h rename to ThirdParty/Ert/lib/include/ert/util/template.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/test_util.h b/ThirdParty/Ert/lib/include/ert/util/test_util.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/test_util.h rename to ThirdParty/Ert/lib/include/ert/util/test_util.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/test_util.hpp b/ThirdParty/Ert/lib/include/ert/util/test_util.hpp similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/test_util.hpp rename to ThirdParty/Ert/lib/include/ert/util/test_util.hpp diff --git a/ThirdParty/Ert/libert_util/include/ert/util/test_work_area.h b/ThirdParty/Ert/lib/include/ert/util/test_work_area.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/test_work_area.h rename to ThirdParty/Ert/lib/include/ert/util/test_work_area.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/thread_pool.h b/ThirdParty/Ert/lib/include/ert/util/thread_pool.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/thread_pool.h rename to ThirdParty/Ert/lib/include/ert/util/thread_pool.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/thread_pool1.h b/ThirdParty/Ert/lib/include/ert/util/thread_pool1.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/thread_pool1.h rename to ThirdParty/Ert/lib/include/ert/util/thread_pool1.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/time_interval.h b/ThirdParty/Ert/lib/include/ert/util/time_interval.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/time_interval.h rename to ThirdParty/Ert/lib/include/ert/util/time_interval.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/timer.h b/ThirdParty/Ert/lib/include/ert/util/timer.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/timer.h rename to ThirdParty/Ert/lib/include/ert/util/timer.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/type_macros.h b/ThirdParty/Ert/lib/include/ert/util/type_macros.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/type_macros.h rename to ThirdParty/Ert/lib/include/ert/util/type_macros.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/type_vector_functions.h b/ThirdParty/Ert/lib/include/ert/util/type_vector_functions.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/type_vector_functions.h rename to ThirdParty/Ert/lib/include/ert/util/type_vector_functions.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/ui_return.h b/ThirdParty/Ert/lib/include/ert/util/ui_return.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/ui_return.h rename to ThirdParty/Ert/lib/include/ert/util/ui_return.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/util.h b/ThirdParty/Ert/lib/include/ert/util/util.h similarity index 99% rename from ThirdParty/Ert/libert_util/include/ert/util/util.h rename to ThirdParty/Ert/lib/include/ert/util/util.h index d8a134d8d1..7ec6d5a1c8 100644 --- a/ThirdParty/Ert/libert_util/include/ert/util/util.h +++ b/ThirdParty/Ert/lib/include/ert/util/util.h @@ -99,10 +99,10 @@ typedef enum {left_pad = 0, center_pad = 2} string_alignement_type; //#define UTIL_CXX_MALLOC(var , num_elm) (typeof (var)) util_malloc( (num_elm) * sizeof var) - void util_bitmask_on(int * , int ); char * util_get_timezone(void); time_t util_make_datetime_utc(int , int , int , int , int , int ); + bool util_make_datetime_utc_validated(int sec, int min, int hour , int mday , int month , int year, time_t * t); void util_fprintf_date_utc(time_t , FILE * ); time_t util_make_date_utc(int , int , int); time_t util_make_pure_date_utc(time_t t); diff --git a/ThirdParty/Ert/libert_util/include/ert/util/util_endian.h b/ThirdParty/Ert/lib/include/ert/util/util_endian.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/util_endian.h rename to ThirdParty/Ert/lib/include/ert/util/util_endian.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/util_env.h b/ThirdParty/Ert/lib/include/ert/util/util_env.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/util_env.h rename to ThirdParty/Ert/lib/include/ert/util/util_env.h diff --git a/ThirdParty/Ert/libert_util/include/ert/util/vector.h b/ThirdParty/Ert/lib/include/ert/util/vector.h similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/vector.h rename to ThirdParty/Ert/lib/include/ert/util/vector.h diff --git a/ThirdParty/Ert/libert_utilxx/src/TestArea.cpp b/ThirdParty/Ert/lib/util/TestArea.cpp similarity index 100% rename from ThirdParty/Ert/libert_utilxx/src/TestArea.cpp rename to ThirdParty/Ert/lib/util/TestArea.cpp diff --git a/ThirdParty/Ert/libert_util/src/arg_pack.c b/ThirdParty/Ert/lib/util/arg_pack.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/arg_pack.c rename to ThirdParty/Ert/lib/util/arg_pack.c diff --git a/ThirdParty/Ert/libert_util/src/block_fs.c b/ThirdParty/Ert/lib/util/block_fs.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/block_fs.c rename to ThirdParty/Ert/lib/util/block_fs.c diff --git a/ThirdParty/Ert/libert_util/src/buffer.c b/ThirdParty/Ert/lib/util/buffer.c similarity index 84% rename from ThirdParty/Ert/libert_util/src/buffer.c rename to ThirdParty/Ert/lib/util/buffer.c index a1da9cee7e..ef42a546b5 100644 --- a/ThirdParty/Ert/libert_util/src/buffer.c +++ b/ThirdParty/Ert/lib/util/buffer.c @@ -804,10 +804,131 @@ void buffer_store(const buffer_type * buffer , const char * filename) { fclose( stream ); } +/* + The functions buffer_fread_string() and buffer_fwrite_string() + should not be used; the embedded integer just creates chaos and + should the sole responsability of the calling scope. +*/ -#include "buffer_string.c" +/** + Storing strings: + ---------------- + + When storing a string (\0 terminated char pointer) what is actually + written to the buffer is + + 1. The length of the string - as returned from strlen(). + 2. The string content INCLUDING the terminating \0. + + +*/ + + +/** + This function will return a pointer to the current position in the + buffer, and advance the buffer position forward until a \0 + terminater is found. If \0 is not found the thing will abort(). + + Observe that the return value will point straight into the buffer, + this is highly volatile memory, and in general it will be safer to + use buffer_fread_alloc_string() to get a copy of the string. +*/ + +const char * buffer_fread_string(buffer_type * buffer) { + int string_length = buffer_fread_int( buffer ); + char * string_ptr = &buffer->data[buffer->pos]; + char c; + buffer_fskip( buffer , string_length ); + c = buffer_fread_char( buffer ); + if (c != '\0') + util_abort("%s: internal error - malformed string representation in buffer \n",__func__); + return string_ptr; +} + + + +char * buffer_fread_alloc_string(buffer_type * buffer) { + return util_alloc_string_copy( buffer_fread_string( buffer )); +} + +/** + Observe that this function writes a leading integer string length. +*/ +void buffer_fwrite_string(buffer_type * buffer , const char * string) { + buffer_fwrite_int( buffer , strlen( string )); /* Writing the length of the string */ + buffer_fwrite(buffer , string , 1 , strlen( string ) + 1); /* Writing the string content ** WITH ** the terminating \0 */ +} #ifdef ERT_HAVE_ZLIB -#include "buffer_zlib.c" -#endif +#include +/** + Unfortunately the old RedHat3 computers have a zlib version which + does not have the compressBound function. For that reason the + compressBound function from a 1.2xx version of zlib is pasted in + here verbatim: + */ + + +/* Snipped from zlib source code: */ +static size_t __compress_bound (size_t sourceLen) +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; +} + + +/** + Return value is the size (in bytes) of the compressed buffer. + */ +size_t buffer_fwrite_compressed(buffer_type * buffer, const void * ptr , size_t byte_size) { + size_t compressed_size = 0; + bool abort_on_error = true; + buffer->content_size = buffer->pos; /* Invalidating possible buffer content coming after the compressed content; that is uninterpretable anyway. */ + + if (byte_size > 0) { + size_t remaining_size = buffer->alloc_size - buffer->pos; + size_t compress_bound = __compress_bound( byte_size ); + if (compress_bound > remaining_size) + buffer_resize__(buffer , remaining_size + compress_bound , abort_on_error); + + compressed_size = buffer->alloc_size - buffer->pos; + util_compress_buffer( ptr , byte_size , &buffer->data[buffer->pos] , &compressed_size); + buffer->pos += compressed_size; + buffer->content_size += compressed_size; + } + + return compressed_size; +} + + +/** + Return value is the size of the uncompressed buffer. + */ +size_t buffer_fread_compressed(buffer_type * buffer , size_t compressed_size , void * target_ptr , size_t target_size) { + size_t remaining_size = buffer->content_size - buffer->pos; + size_t uncompressed_size = target_size; + if (remaining_size < compressed_size) + util_abort("%s: trying to read beyond end of buffer\n",__func__); + + + if (compressed_size > 0) { + int uncompress_result = uncompress(target_ptr , &uncompressed_size , (unsigned char *) &buffer->data[buffer->pos] , compressed_size); + if (uncompress_result != Z_OK) { + fprintf(stderr,"%s: ** Warning uncompress result:%d != Z_OK.\n" , __func__ , uncompress_result); + /** + According to the zlib documentation: + + 1. Values > 0 are not errors - just rare events? + 2. The value Z_BUF_ERROR is not fatal - we let that pass?! + */ + if (uncompress_result < 0 && uncompress_result != Z_BUF_ERROR) + util_abort("%s: fatal uncompress error: %d \n",__func__ , uncompress_result); + } + } else + uncompressed_size = 0; + + buffer->pos += compressed_size; + return uncompressed_size; +} + +#endif // ERT_HAVE_ZLIB diff --git a/ThirdParty/Ert/libert_util/src/config_test_input b/ThirdParty/Ert/lib/util/config_test_input similarity index 100% rename from ThirdParty/Ert/libert_util/src/config_test_input rename to ThirdParty/Ert/lib/util/config_test_input diff --git a/ThirdParty/Ert/libert_util/src/dependencies b/ThirdParty/Ert/lib/util/dependencies similarity index 100% rename from ThirdParty/Ert/libert_util/src/dependencies rename to ThirdParty/Ert/lib/util/dependencies diff --git a/ThirdParty/Ert/lib/util/ert/util/template_type.h b/ThirdParty/Ert/lib/util/ert/util/template_type.h new file mode 100644 index 0000000000..0c56145a5f --- /dev/null +++ b/ThirdParty/Ert/lib/util/ert/util/template_type.h @@ -0,0 +1,34 @@ +#ifndef ERT_TEMPLATE_TYPE_H +#define ERT_TEMPLATE_TYPE_H + +#include + +#include + +#ifdef ERT_HAVE_REGEXP +#include +#endif //ERT_HAVE_REGEXP + +#define TEMPLATE_TYPE_ID 7781045 + +struct template_struct { + UTIL_TYPE_ID_DECLARATION; + char * template_file; /* The template file - if internalize_template == false this filename can contain keys which will be replaced at instantiation time. */ + char * template_buffer; /* The content of the template buffer; only has valid content if internalize_template == true. */ + bool internalize_template; /* Should the template be loadad and internalized at template_alloc(). */ + subst_list_type * arg_list; /* Key-value mapping established at alloc time. */ + char * arg_string; /* A string representation of the arguments - ONLY used for a _get_ function. */ + #ifdef ERT_HAVE_REGEXP + regex_t start_regexp; + regex_t end_regexp; + #endif +}; + +#ifdef ERT_HAVE_REGEXP +typedef struct loop_struct loop_type; +void template_init_loop_regexp( struct template_struct* ); +int template_eval_loop( const struct template_struct* , buffer_type * buffer , int global_offset , struct loop_struct * ); +void template_eval_loops( const struct template_struct* template , buffer_type * buffer ); +#endif //ERT_HAVE_REGEXP + +#endif //ERT_TEMPLATE_TYPE_H diff --git a/ThirdParty/Ert/libert_util/src/ert_version.c b/ThirdParty/Ert/lib/util/ert_version.c similarity index 77% rename from ThirdParty/Ert/libert_util/src/ert_version.c rename to ThirdParty/Ert/lib/util/ert_version.c index a7452f9716..38733431be 100644 --- a/ThirdParty/Ert/libert_util/src/ert_version.c +++ b/ThirdParty/Ert/lib/util/ert_version.c @@ -1,9 +1,12 @@ #include #include +#define xstr(s) #s +#define str(s) xstr(s) + char* version_get_git_commit() { #ifdef GIT_COMMIT - return GIT_COMMIT; + return str(GIT_COMMIT); #else return "Unknown git commit hash"; #endif @@ -11,7 +14,7 @@ char* version_get_git_commit() { char* version_get_git_commit_short() { #ifdef GIT_COMMIT_SHORT - return GIT_COMMIT_SHORT; + return str(GIT_COMMIT_SHORT); #else return "Unknown git short commit hash"; #endif @@ -37,10 +40,10 @@ int version_get_minor_ert_version() { const char * version_get_micro_ert_version() { - return ERT_VERSION_MICRO; + return str(ERT_VERSION_MICRO); } bool version_is_ert_devel_version() { - return util_sscanf_int( ERT_VERSION_MICRO , NULL); + return util_sscanf_int(str(ERT_VERSION_MICRO), NULL); } diff --git a/ThirdParty/Ert/libert_util/src/hash.c b/ThirdParty/Ert/lib/util/hash.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/hash.c rename to ThirdParty/Ert/lib/util/hash.c diff --git a/ThirdParty/Ert/libert_util/src/hash_node.c b/ThirdParty/Ert/lib/util/hash_node.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/hash_node.c rename to ThirdParty/Ert/lib/util/hash_node.c diff --git a/ThirdParty/Ert/libert_util/src/hash_sll.c b/ThirdParty/Ert/lib/util/hash_sll.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/hash_sll.c rename to ThirdParty/Ert/lib/util/hash_sll.c diff --git a/ThirdParty/Ert/libert_util/src/lars.c b/ThirdParty/Ert/lib/util/lars.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/lars.c rename to ThirdParty/Ert/lib/util/lars.c diff --git a/ThirdParty/Ert/libert_util/src/log.c b/ThirdParty/Ert/lib/util/log.c similarity index 91% rename from ThirdParty/Ert/libert_util/src/log.c rename to ThirdParty/Ert/lib/util/log.c index f3ebba9816..497048f89f 100644 --- a/ThirdParty/Ert/libert_util/src/log.c +++ b/ThirdParty/Ert/lib/util/log.c @@ -128,6 +128,15 @@ bool log_include_message(const log_type *logh , int message_level) { return false; } +/** + * Adds a string to the log if message_level is below the threshold. It is the callers duty to either free the string + * or make sure that it is a string literal. + */ +void log_add_message_str(log_type *logh, message_level_type message_level , const char* message){ + //The conversion to (char*) is safe since free_message=false + log_add_message(logh,message_level, NULL, (char*) message,false); +} + /** If dup_stream != NULL the message (without the date/time header) is duplicated on this stream. @@ -171,7 +180,10 @@ void log_add_message(log_type *logh, int message_level , FILE * dup_stream , cha - +/** + * Adds a formated log message if message_level is below the threshold, fmt is expected to be the format string, + * and "..." contains any arguments to it. + */ void log_add_fmt_message(log_type * logh , int message_level , FILE * dup_stream , const char * fmt , ...) { if (log_include_message(logh,message_level)) { char * message; diff --git a/ThirdParty/Ert/libert_util/src/lookup_table.c b/ThirdParty/Ert/lib/util/lookup_table.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/lookup_table.c rename to ThirdParty/Ert/lib/util/lookup_table.c diff --git a/ThirdParty/Ert/libert_util/src/matrix.c b/ThirdParty/Ert/lib/util/matrix.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/matrix.c rename to ThirdParty/Ert/lib/util/matrix.c diff --git a/ThirdParty/Ert/libert_util/src/matrix_blas.c b/ThirdParty/Ert/lib/util/matrix_blas.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/matrix_blas.c rename to ThirdParty/Ert/lib/util/matrix_blas.c diff --git a/ThirdParty/Ert/libert_util/src/matrix_lapack.c b/ThirdParty/Ert/lib/util/matrix_lapack.c similarity index 99% rename from ThirdParty/Ert/libert_util/src/matrix_lapack.c rename to ThirdParty/Ert/lib/util/matrix_lapack.c index 7c3f3afb42..b9461d1318 100644 --- a/ThirdParty/Ert/libert_util/src/matrix_lapack.c +++ b/ThirdParty/Ert/lib/util/matrix_lapack.c @@ -203,11 +203,14 @@ void matrix_dgesvd(dgesvd_vector_enum jobu , dgesvd_vector_enum jobvt , matrix_ /* Try to allocate optimal worksize. */ worksize = (int) work[0]; - work = realloc( work , sizeof * work * worksize ); - if (work == NULL) { + double * tmp = realloc( work , sizeof * work * worksize ); + if (tmp == NULL) { /* Could not allocate optimal worksize - settle for the minimum. This can not fail. */ worksize = min_worksize; + free(work); work = util_calloc( worksize , sizeof * work ); + }else{ + work = tmp; /* The request for optimal worksize succeeded */ } dgesvd_(&_jobu , &_jobvt , &m , &n , matrix_get_data( A ) , &lda , S , U_data , &ldu , VT_data , &ldvt , work , &worksize , &info); diff --git a/ThirdParty/Ert/libert_util/src/matrix_stat.c b/ThirdParty/Ert/lib/util/matrix_stat.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/matrix_stat.c rename to ThirdParty/Ert/lib/util/matrix_stat.c diff --git a/ThirdParty/Ert/libert_util/src/menu.c b/ThirdParty/Ert/lib/util/menu.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/menu.c rename to ThirdParty/Ert/lib/util/menu.c diff --git a/ThirdParty/Ert/libert_util/src/msg.c b/ThirdParty/Ert/lib/util/msg.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/msg.c rename to ThirdParty/Ert/lib/util/msg.c diff --git a/ThirdParty/Ert/libert_util/src/mzran.c b/ThirdParty/Ert/lib/util/mzran.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/mzran.c rename to ThirdParty/Ert/lib/util/mzran.c diff --git a/ThirdParty/Ert/libert_util/src/node_ctype.c b/ThirdParty/Ert/lib/util/node_ctype.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/node_ctype.c rename to ThirdParty/Ert/lib/util/node_ctype.c diff --git a/ThirdParty/Ert/libert_util/src/node_data.c b/ThirdParty/Ert/lib/util/node_data.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/node_data.c rename to ThirdParty/Ert/lib/util/node_data.c diff --git a/ThirdParty/Ert/libert_util/src/parser.c b/ThirdParty/Ert/lib/util/parser.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/parser.c rename to ThirdParty/Ert/lib/util/parser.c diff --git a/ThirdParty/Ert/libert_util/src/path_fmt.c b/ThirdParty/Ert/lib/util/path_fmt.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/path_fmt.c rename to ThirdParty/Ert/lib/util/path_fmt.c diff --git a/ThirdParty/Ert/libert_util/src/path_stack.c b/ThirdParty/Ert/lib/util/path_stack.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/path_stack.c rename to ThirdParty/Ert/lib/util/path_stack.c diff --git a/ThirdParty/Ert/libert_util/src/perm_vector.c b/ThirdParty/Ert/lib/util/perm_vector.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/perm_vector.c rename to ThirdParty/Ert/lib/util/perm_vector.c diff --git a/ThirdParty/Ert/libert_util/src/readme.overview b/ThirdParty/Ert/lib/util/readme.overview similarity index 100% rename from ThirdParty/Ert/libert_util/src/readme.overview rename to ThirdParty/Ert/lib/util/readme.overview diff --git a/ThirdParty/Ert/libert_util/src/regression.c b/ThirdParty/Ert/lib/util/regression.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/regression.c rename to ThirdParty/Ert/lib/util/regression.c diff --git a/ThirdParty/Ert/libert_util/src/rng.c b/ThirdParty/Ert/lib/util/rng.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/rng.c rename to ThirdParty/Ert/lib/util/rng.c diff --git a/ThirdParty/Ert/libert_util/src/set.c b/ThirdParty/Ert/lib/util/set.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/set.c rename to ThirdParty/Ert/lib/util/set.c diff --git a/ThirdParty/Ert/libert_util/src/statistics.c b/ThirdParty/Ert/lib/util/statistics.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/statistics.c rename to ThirdParty/Ert/lib/util/statistics.c diff --git a/ThirdParty/Ert/libert_util/src/stepwise.c b/ThirdParty/Ert/lib/util/stepwise.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/stepwise.c rename to ThirdParty/Ert/lib/util/stepwise.c diff --git a/ThirdParty/Ert/libert_util/src/string_util.c b/ThirdParty/Ert/lib/util/string_util.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/string_util.c rename to ThirdParty/Ert/lib/util/string_util.c diff --git a/ThirdParty/Ert/libert_util/src/stringlist.c b/ThirdParty/Ert/lib/util/stringlist.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/stringlist.c rename to ThirdParty/Ert/lib/util/stringlist.c diff --git a/ThirdParty/Ert/libert_util/src/struct_vector.c b/ThirdParty/Ert/lib/util/struct_vector.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/struct_vector.c rename to ThirdParty/Ert/lib/util/struct_vector.c diff --git a/ThirdParty/Ert/libert_util/src/subst_func.c b/ThirdParty/Ert/lib/util/subst_func.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/subst_func.c rename to ThirdParty/Ert/lib/util/subst_func.c diff --git a/ThirdParty/Ert/libert_util/src/subst_list.c b/ThirdParty/Ert/lib/util/subst_list.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/subst_list.c rename to ThirdParty/Ert/lib/util/subst_list.c diff --git a/ThirdParty/Ert/libert_util/src/template.c b/ThirdParty/Ert/lib/util/template.c similarity index 84% rename from ThirdParty/Ert/libert_util/src/template.c rename to ThirdParty/Ert/lib/util/template.c index fa1959b119..e6b6880621 100644 --- a/ThirdParty/Ert/libert_util/src/template.c +++ b/ThirdParty/Ert/lib/util/template.c @@ -22,48 +22,13 @@ #include -#ifdef ERT_HAVE_REGEXP -#include -#include -#include - -#define END_REGEXP "[{]%[[:space:]]+endfor[[:space:]]+%[}]" -#define LOOP_REGEXP "[{]%[[:space:]]+for[[:space:]]+([$]?[[:alpha:]][[:alnum:]]*)[[:space:]]+in[[:space:]]+[[]([^]]*)[]][[:space:]]+%[}]" - -#define LOOP_OPTIONS REG_EXTENDED -#define END_OPTIONS REG_EXTENDED -#endif - #include #include #include #include +#include #include - - - -#define TEMPLATE_TYPE_ID 7781045 - -struct template_struct { - UTIL_TYPE_ID_DECLARATION; - char * template_file; /* The template file - if internalize_template == false this filename can contain keys which will be replaced at instantiation time. */ - char * template_buffer; /* The content of the template buffer; only has valid content if internalize_template == true. */ - bool internalize_template; /* Should the template be loadad and internalized at template_alloc(). */ - subst_list_type * arg_list; /* Key-value mapping established at alloc time. */ - char * arg_string; /* A string representation of the arguments - ONLY used for a _get_ function. */ - #ifdef ERT_HAVE_REGEXP - regex_t start_regexp; - regex_t end_regexp; - #endif -}; - -#ifdef ERT_HAVE_REGEXP -#include "template_loop.c" -#endif - - - /** Iff the template is set up with internaliz_template == false the template content is loaded at instantiation time, and in that case diff --git a/ThirdParty/Ert/libert_util/src/template_loop.c b/ThirdParty/Ert/lib/util/template_loop.c similarity index 91% rename from ThirdParty/Ert/libert_util/src/template_loop.c rename to ThirdParty/Ert/lib/util/template_loop.c index a56be8149d..df0f88f138 100644 --- a/ThirdParty/Ert/libert_util/src/template_loop.c +++ b/ThirdParty/Ert/lib/util/template_loop.c @@ -16,20 +16,31 @@ for more details. */ +#include + +#include +#include +#include + #include #include +#include +#include + +#define END_REGEXP "[{]%[[:space:]]+endfor[[:space:]]+%[}]" +#define LOOP_REGEXP "[{]%[[:space:]]+for[[:space:]]+([$]?[[:alpha:]][[:alnum:]]*)[[:space:]]+in[[:space:]]+[[]([^]]*)[]][[:space:]]+%[}]" + +#define LOOP_OPTIONS REG_EXTENDED +#define END_OPTIONS REG_EXTENDED #define DOLLAR '$' /* - This file implements a simple looping construct in the - templates. The support is strongly based on the POSIX regexp - functionality; and this file should not be included/compiled unless - that support is present. The file is included from template.c. + This file implements a simple looping construct in the templates. The support + is strongly based on the POSIX regexp functionality; and this file will not + be compiled unless that support is present. */ - - -typedef struct { +struct loop_struct { int opentag_offset; int opentag_length; @@ -43,8 +54,7 @@ typedef struct { int var_length; char * loop_var; stringlist_type * items; -} loop_type; - +}; static void regcompile(regex_t * reg , const char * reg_string , int flags) { int error = regcomp(reg , reg_string , flags); @@ -94,12 +104,6 @@ static loop_type * loop_alloc( const char * buffer , int global_offset , regmatc return loop; } -void loop_fprintf(const loop_type * loop ) { - printf("loop_var : %s \n",loop->loop_var ); - printf("loop_items: "); stringlist_fprintf( loop->items , "," , stdout ); printf("\n"); -} - - static void loop_set_endmatch( loop_type * loop , int global_offset , regmatch_t end_offset) { loop->endtag_offset = global_offset + end_offset.rm_so; loop->endtag_length = end_offset.rm_eo - end_offset.rm_so; @@ -183,7 +187,7 @@ static void loop_eval( const loop_type * loop , const char * body , buffer_type } -static int template_eval_loop( const template_type * template , buffer_type * buffer , int global_offset , loop_type * loop) { +int template_eval_loop( const template_type * template , buffer_type * buffer , int global_offset , loop_type * loop) { int flags = 0; int NMATCH = 3; regmatch_t match_list_loop[NMATCH]; @@ -260,13 +264,13 @@ static int template_eval_loop( const template_type * template , buffer_type * bu -static void template_init_loop_regexp( template_type * template ) { +void template_init_loop_regexp( template_type * template ) { regcompile( &template->start_regexp , LOOP_REGEXP , LOOP_OPTIONS ); regcompile( &template->end_regexp , END_REGEXP , END_OPTIONS ); } -static void template_eval_loops( const template_type * template , buffer_type * buffer ) { +void template_eval_loops( const template_type * template , buffer_type * buffer ) { int NMATCH = 10; regmatch_t match_list[NMATCH]; { diff --git a/ThirdParty/Ert/libert_util/src/test_util.c b/ThirdParty/Ert/lib/util/test_util.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/test_util.c rename to ThirdParty/Ert/lib/util/test_util.c diff --git a/ThirdParty/Ert/libert_util/src/test_work_area.c b/ThirdParty/Ert/lib/util/test_work_area.c similarity index 99% rename from ThirdParty/Ert/libert_util/src/test_work_area.c rename to ThirdParty/Ert/lib/util/test_work_area.c index 2ca36ac7c9..240361043d 100644 --- a/ThirdParty/Ert/libert_util/src/test_work_area.c +++ b/ThirdParty/Ert/lib/util/test_work_area.c @@ -211,7 +211,7 @@ static char * test_work_area_alloc_prefix( ) { if (!prefix_path) prefix_path = _PATH_TMP; - return util_alloc_string_copy( prefix_path ); + return util_alloc_realpath(prefix_path); #endif } diff --git a/ThirdParty/Ert/libert_util/tests/data/file1.txt b/ThirdParty/Ert/lib/util/tests/data/file1.txt similarity index 100% rename from ThirdParty/Ert/libert_util/tests/data/file1.txt rename to ThirdParty/Ert/lib/util/tests/data/file1.txt diff --git a/ThirdParty/Ert/libert_util/tests/data/file2.txt b/ThirdParty/Ert/lib/util/tests/data/file2.txt similarity index 100% rename from ThirdParty/Ert/libert_util/tests/data/file2.txt rename to ThirdParty/Ert/lib/util/tests/data/file2.txt diff --git a/ThirdParty/Ert/libert_util/tests/data2/dir2/file4 b/ThirdParty/Ert/lib/util/tests/data2/dir2/file4 similarity index 100% rename from ThirdParty/Ert/libert_util/tests/data2/dir2/file4 rename to ThirdParty/Ert/lib/util/tests/data2/dir2/file4 diff --git a/ThirdParty/Ert/libert_util/tests/data2/file1 b/ThirdParty/Ert/lib/util/tests/data2/file1 similarity index 100% rename from ThirdParty/Ert/libert_util/tests/data2/file1 rename to ThirdParty/Ert/lib/util/tests/data2/file1 diff --git a/ThirdParty/Ert/libert_util/tests/data2/file2 b/ThirdParty/Ert/lib/util/tests/data2/file2 similarity index 100% rename from ThirdParty/Ert/libert_util/tests/data2/file2 rename to ThirdParty/Ert/lib/util/tests/data2/file2 diff --git a/ThirdParty/Ert/libert_util/tests/data2/file3 b/ThirdParty/Ert/lib/util/tests/data2/file3 similarity index 100% rename from ThirdParty/Ert/libert_util/tests/data2/file3 rename to ThirdParty/Ert/lib/util/tests/data2/file3 diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_PATH_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_PATH_test.c similarity index 81% rename from ThirdParty/Ert/libert_util/tests/ert_util_PATH_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_PATH_test.c index 4eada494ec..8b84bb56b8 100644 --- a/ThirdParty/Ert/libert_util/tests/ert_util_PATH_test.c +++ b/ThirdParty/Ert/lib/util/tests/ert_util_PATH_test.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2012 Statoil ASA, Norway. - - The file 'ert_util_PATH_test.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. + Copyright (C) 2012 Statoil ASA, Norway. + + The file 'ert_util_PATH_test.c' is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. */ #include #include @@ -31,7 +31,7 @@ int main(int argc , char ** argv) { char ** path_list = util_alloc_PATH_list(); if (path_list[0] != NULL) test_error_exit("Failed on empty PATH\n"); - + util_free_NULL_terminated_stringlist( path_list ); } diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_abort_gnu_tests.c b/ThirdParty/Ert/lib/util/tests/ert_util_abort_gnu_tests.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_abort_gnu_tests.c rename to ThirdParty/Ert/lib/util/tests/ert_util_abort_gnu_tests.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_addr2line.c b/ThirdParty/Ert/lib/util/tests/ert_util_addr2line.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_addr2line.c rename to ThirdParty/Ert/lib/util/tests/ert_util_addr2line.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_alloc_file_components.c b/ThirdParty/Ert/lib/util/tests/ert_util_alloc_file_components.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_alloc_file_components.c rename to ThirdParty/Ert/lib/util/tests/ert_util_alloc_file_components.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_approx_equal.c b/ThirdParty/Ert/lib/util/tests/ert_util_approx_equal.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_approx_equal.c rename to ThirdParty/Ert/lib/util/tests/ert_util_approx_equal.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_arg_pack.c b/ThirdParty/Ert/lib/util/tests/ert_util_arg_pack.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_arg_pack.c rename to ThirdParty/Ert/lib/util/tests/ert_util_arg_pack.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_before_after.c b/ThirdParty/Ert/lib/util/tests/ert_util_before_after.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_before_after.c rename to ThirdParty/Ert/lib/util/tests/ert_util_before_after.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_binary_split.c b/ThirdParty/Ert/lib/util/tests/ert_util_binary_split.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_binary_split.c rename to ThirdParty/Ert/lib/util/tests/ert_util_binary_split.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_block_fs.c b/ThirdParty/Ert/lib/util/tests/ert_util_block_fs.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_block_fs.c rename to ThirdParty/Ert/lib/util/tests/ert_util_block_fs.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_buffer.c b/ThirdParty/Ert/lib/util/tests/ert_util_buffer.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_buffer.c rename to ThirdParty/Ert/lib/util/tests/ert_util_buffer.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_clamp.c b/ThirdParty/Ert/lib/util/tests/ert_util_clamp.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_clamp.c rename to ThirdParty/Ert/lib/util/tests/ert_util_clamp.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_copy_file.c b/ThirdParty/Ert/lib/util/tests/ert_util_copy_file.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_copy_file.c rename to ThirdParty/Ert/lib/util/tests/ert_util_copy_file.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_cwd_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_cwd_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_cwd_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_cwd_test.c diff --git a/ThirdParty/Ert/lib/util/tests/ert_util_datetime.c b/ThirdParty/Ert/lib/util/tests/ert_util_datetime.c new file mode 100644 index 0000000000..1958657190 --- /dev/null +++ b/ThirdParty/Ert/lib/util/tests/ert_util_datetime.c @@ -0,0 +1,52 @@ +/* + Copyright (C) 2017 Statoil ASA, Norway. + + This file is part of ERT - Ensemble based Reservoir Tool. + + ERT 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. + + ERT 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 at + for more details. +*/ +#include +#include +#include +#include + +#include +#include + + + +int main( int argc , char ** argv) { + + /* Invalid seconds */ + test_assert_false( util_make_datetime_utc_validated( 75, 0 , 0 , 1 , 1, 2010, NULL)); + + /* Invalid month */ + test_assert_false( util_make_datetime_utc_validated( 15, 0 , 0 , 1 , 16, 2010, NULL)); + + /* Invalid mday */ + test_assert_false( util_make_datetime_utc_validated( 15, 0 , 0 , -1 , 1, 2010, NULL)); + + { + time_t t; + int sec,min,hour,mday,month,year; + test_assert_true( util_make_datetime_utc_validated( 15, 3 , 6 , 5 , 7, 2010, &t)); + + util_set_datetime_values_utc( t , &sec, &min, &hour, &mday, &month, &year); + test_assert_int_equal( sec, 15 ); + test_assert_int_equal( min , 3 ); + test_assert_int_equal( hour , 6 ); + test_assert_int_equal( mday , 5 ); + test_assert_int_equal( month , 7 ); + test_assert_int_equal( year , 2010 ); + } +} diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_file_readable.c b/ThirdParty/Ert/lib/util/tests/ert_util_file_readable.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_file_readable.c rename to ThirdParty/Ert/lib/util/tests/ert_util_file_readable.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_filename.c b/ThirdParty/Ert/lib/util/tests/ert_util_filename.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_filename.c rename to ThirdParty/Ert/lib/util/tests/ert_util_filename.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_hash_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_hash_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_hash_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_hash_test.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_logh.c b/ThirdParty/Ert/lib/util/tests/ert_util_logh.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_logh.c rename to ThirdParty/Ert/lib/util/tests/ert_util_logh.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_matrix.c b/ThirdParty/Ert/lib/util/tests/ert_util_matrix.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_matrix.c rename to ThirdParty/Ert/lib/util/tests/ert_util_matrix.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_matrix_lapack.c b/ThirdParty/Ert/lib/util/tests/ert_util_matrix_lapack.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_matrix_lapack.c rename to ThirdParty/Ert/lib/util/tests/ert_util_matrix_lapack.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_matrix_stat.c b/ThirdParty/Ert/lib/util/tests/ert_util_matrix_stat.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_matrix_stat.c rename to ThirdParty/Ert/lib/util/tests/ert_util_matrix_stat.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_parent_path.c b/ThirdParty/Ert/lib/util/tests/ert_util_parent_path.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_parent_path.c rename to ThirdParty/Ert/lib/util/tests/ert_util_parent_path.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_path_stack_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_path_stack_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_path_stack_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_path_stack_test.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_ping.c b/ThirdParty/Ert/lib/util/tests/ert_util_ping.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_ping.c rename to ThirdParty/Ert/lib/util/tests/ert_util_ping.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_realpath.c b/ThirdParty/Ert/lib/util/tests/ert_util_realpath.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_realpath.c rename to ThirdParty/Ert/lib/util/tests/ert_util_realpath.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_relpath_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_relpath_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_relpath_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_relpath_test.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_rng.c b/ThirdParty/Ert/lib/util/tests/ert_util_rng.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_rng.c rename to ThirdParty/Ert/lib/util/tests/ert_util_rng.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_spawn.c b/ThirdParty/Ert/lib/util/tests/ert_util_spawn.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_spawn.c rename to ThirdParty/Ert/lib/util/tests/ert_util_spawn.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_sprintf_escape.c b/ThirdParty/Ert/lib/util/tests/ert_util_sprintf_escape.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_sprintf_escape.c rename to ThirdParty/Ert/lib/util/tests/ert_util_sprintf_escape.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_sscan_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_sscan_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_sscan_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_sscan_test.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_statistics.c b/ThirdParty/Ert/lib/util/tests/ert_util_statistics.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_statistics.c rename to ThirdParty/Ert/lib/util/tests/ert_util_statistics.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_strcat_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_strcat_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_strcat_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_strcat_test.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_string_util.c b/ThirdParty/Ert/lib/util/tests/ert_util_string_util.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_string_util.c rename to ThirdParty/Ert/lib/util/tests/ert_util_string_util.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_stringlist_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_stringlist_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_stringlist_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_stringlist_test.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_strstr_int_format.c b/ThirdParty/Ert/lib/util/tests/ert_util_strstr_int_format.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_strstr_int_format.c rename to ThirdParty/Ert/lib/util/tests/ert_util_strstr_int_format.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_struct_vector.c b/ThirdParty/Ert/lib/util/tests/ert_util_struct_vector.c similarity index 96% rename from ThirdParty/Ert/libert_util/tests/ert_util_struct_vector.c rename to ThirdParty/Ert/lib/util/tests/ert_util_struct_vector.c index 67a7347964..1ac9aa25a5 100644 --- a/ThirdParty/Ert/libert_util/tests/ert_util_struct_vector.c +++ b/ThirdParty/Ert/lib/util/tests/ert_util_struct_vector.c @@ -53,11 +53,10 @@ void test_create_invalid() { } void test_append_iget() { - struct test_struct d1,d2; + struct test_struct d1 = (struct test_struct) {.x = 100, .y = 99, .z = 234}; + struct test_struct d2 = (struct test_struct) {.x = 0, .y = 0, .z = 0}; + struct_vector_type * struct_vector = struct_vector_alloc( sizeof d1 ); - d1.x = 100; - d1.y = 99; - d1.z = 234; struct_vector_append( struct_vector , &d1 ); test_assert_int_equal( struct_vector_get_size( struct_vector ) , 1 ); diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_subst_list.c b/ThirdParty/Ert/lib/util/tests/ert_util_subst_list.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_subst_list.c rename to ThirdParty/Ert/lib/util/tests/ert_util_subst_list.c diff --git a/ThirdParty/Ert/libert_utilxx/tests/ert_util_test_area_xx.cpp b/ThirdParty/Ert/lib/util/tests/ert_util_test_area_xx.cpp similarity index 100% rename from ThirdParty/Ert/libert_utilxx/tests/ert_util_test_area_xx.cpp rename to ThirdParty/Ert/lib/util/tests/ert_util_test_area_xx.cpp diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_time_interval.c b/ThirdParty/Ert/lib/util/tests/ert_util_time_interval.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_time_interval.c rename to ThirdParty/Ert/lib/util/tests/ert_util_time_interval.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_type_vector_functions.c b/ThirdParty/Ert/lib/util/tests/ert_util_type_vector_functions.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_type_vector_functions.c rename to ThirdParty/Ert/lib/util/tests/ert_util_type_vector_functions.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_type_vector_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_type_vector_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_type_vector_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_type_vector_test.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_ui_return.c b/ThirdParty/Ert/lib/util/tests/ert_util_ui_return.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_ui_return.c rename to ThirdParty/Ert/lib/util/tests/ert_util_ui_return.c diff --git a/ThirdParty/Ert/libert_utilxx/tests/ert_util_unique_ptr.cpp b/ThirdParty/Ert/lib/util/tests/ert_util_unique_ptr.cpp similarity index 100% rename from ThirdParty/Ert/libert_utilxx/tests/ert_util_unique_ptr.cpp rename to ThirdParty/Ert/lib/util/tests/ert_util_unique_ptr.cpp diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_vector_test.c b/ThirdParty/Ert/lib/util/tests/ert_util_vector_test.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_vector_test.c rename to ThirdParty/Ert/lib/util/tests/ert_util_vector_test.c diff --git a/ThirdParty/Ert/libert_util/tests/ert_util_work_area.c b/ThirdParty/Ert/lib/util/tests/ert_util_work_area.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/ert_util_work_area.c rename to ThirdParty/Ert/lib/util/tests/ert_util_work_area.c diff --git a/ThirdParty/Ert/libert_util/tests/test_thread_pool.c b/ThirdParty/Ert/lib/util/tests/test_thread_pool.c similarity index 100% rename from ThirdParty/Ert/libert_util/tests/test_thread_pool.c rename to ThirdParty/Ert/lib/util/tests/test_thread_pool.c diff --git a/ThirdParty/Ert/libert_util/src/thread_pool.c b/ThirdParty/Ert/lib/util/thread_pool.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/thread_pool.c rename to ThirdParty/Ert/lib/util/thread_pool.c diff --git a/ThirdParty/Ert/libert_util/src/thread_pool1.c b/ThirdParty/Ert/lib/util/thread_pool1.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/thread_pool1.c rename to ThirdParty/Ert/lib/util/thread_pool1.c diff --git a/ThirdParty/Ert/libert_util/src/thread_pool_posix.c b/ThirdParty/Ert/lib/util/thread_pool_posix.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/thread_pool_posix.c rename to ThirdParty/Ert/lib/util/thread_pool_posix.c diff --git a/ThirdParty/Ert/libert_util/src/time_interval.c b/ThirdParty/Ert/lib/util/time_interval.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/time_interval.c rename to ThirdParty/Ert/lib/util/time_interval.c diff --git a/ThirdParty/Ert/libert_util/src/timer.c b/ThirdParty/Ert/lib/util/timer.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/timer.c rename to ThirdParty/Ert/lib/util/timer.c diff --git a/ThirdParty/Ert/libert_util/src/type_vector_functions.c b/ThirdParty/Ert/lib/util/type_vector_functions.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/type_vector_functions.c rename to ThirdParty/Ert/lib/util/type_vector_functions.c diff --git a/ThirdParty/Ert/libert_util/src/ui_return.c b/ThirdParty/Ert/lib/util/ui_return.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/ui_return.c rename to ThirdParty/Ert/lib/util/ui_return.c diff --git a/ThirdParty/Ert/libert_util/src/util.c b/ThirdParty/Ert/lib/util/util.c similarity index 94% rename from ThirdParty/Ert/libert_util/src/util.c rename to ThirdParty/Ert/lib/util/util.c index d0eaa9ce84..65d85bf5bc 100644 --- a/ThirdParty/Ert/libert_util/src/util.c +++ b/ThirdParty/Ert/lib/util/util.c @@ -38,27 +38,14 @@ #include #include "ert/util/build_config.h" - -#ifdef HAVE_BACKTRACE -#define __USE_GNU // Must be defined to get access to the dladdr() function; Man page says the symbol should be: _GNU_SOURCE but that does not seem to work? -#define _GNU_SOURCE // Must be defined _before_ #include to get the symbol 'program_invocation_name'. -#include -#endif - - #include #include #include #include -#include #include #include -#ifdef ERT_HAVE_OPENDIR -#include -#endif - #ifdef HAVE_FNMATCH #include #else @@ -79,10 +66,6 @@ #include #endif -#ifdef HAVE_EXECINFO -#include -#endif - #ifdef HAVE_FTRUNCATE #include #include @@ -2281,7 +2264,7 @@ bool util_copy_stream(FILE *src_stream , FILE *target_stream , size_t buffer_siz } -static bool util_copy_file__(const char * src_file , const char * target_file, size_t buffer_size , void * buffer , bool abort_on_error) { +bool util_copy_file__(const char * src_file , const char * target_file, size_t buffer_size , void * buffer , bool abort_on_error) { if (util_same_file(src_file , target_file)) { fprintf(stderr,"%s Warning: trying to copy %s onto itself - nothing done\n",__func__ , src_file); return false; @@ -3107,6 +3090,7 @@ static void __util_set_timevalues_utc(time_t t , int * sec , int * min , int * h } +static bool util_make_datetime_utc__(int sec, int min, int hour , int mday , int month , int year, bool force_set, time_t * t); /* This function takes a time_t instance as input, and @@ -3146,7 +3130,6 @@ bool util_is_first_day_in_month_utc( time_t t) { return false; } -static bool util_make_datetime_utc__(int sec, int min, int hour , int mday , int month , int year, time_t * t); /* Expects date in the order YYYY-MM-DD. @@ -3156,7 +3139,7 @@ bool util_sscanf_isodate(const char * date_token , time_t * t) { int day, month, year; if (sscanf(date_token , "%d-%d-%d" , &year , &month , &day) == 3) - return util_make_datetime_utc__(0,0,0,day , month , year , t); + return util_make_datetime_utc__(0,0,0,day , month , year , false, t); return false; } @@ -3331,7 +3314,7 @@ char * util_get_timezone() { */ -static bool util_make_datetime_utc__(int sec, int min, int hour , int mday , int month , int year, time_t * t) { +static bool util_make_datetime_utc__(int sec, int min, int hour , int mday , int month , int year, bool force_set, time_t * t) { bool valid = false; struct tm ts; ts.tm_sec = sec; @@ -3350,24 +3333,29 @@ static bool util_make_datetime_utc__(int sec, int min, int hour , int mday , int #endif if ((ts.tm_sec == sec) && - (ts.tm_sec == min) && + (ts.tm_min == min) && (ts.tm_hour == hour) && (ts.tm_mday == mday) && (ts.tm_mon == (month - 1)) && (ts.tm_year == (year - 1900))) valid = true; - if (t) - *t = work_t; + if (t) { + if (valid || force_set) + *t = work_t; + } } return valid; } +bool util_make_datetime_utc_validated(int sec, int min, int hour , int mday , int month , int year, time_t * t) { + return util_make_datetime_utc__( sec,min,hour,mday,month,year,false, t); +} time_t util_make_datetime_utc(int sec, int min, int hour , int mday , int month , int year) { time_t t; - util_make_datetime_utc__( sec,min,hour,mday,month,year,&t); + util_make_datetime_utc__( sec,min,hour,mday,month,year,true, &t); return t; } @@ -5078,9 +5066,9 @@ const char * util_enum_iget( int index , int size , const util_enum_element_type } -static char * __abort_program_message = NULL; /* Can use util_abort_append_version_info() to fill this with - version info+++ wich will be printed when util_abort() is called. */ -static char * __current_executable = NULL; +char * __abort_program_message = NULL; /* Can use util_abort_append_version_info() to fill this with + version info+++ wich will be printed when util_abort() is called. */ +char * __current_executable = NULL; void util_abort_append_version_info(const char * msg) { @@ -5196,55 +5184,6 @@ void util_time_utc( time_t * t , struct tm * ts ) { #endif } - - - - -#ifdef ERT_HAVE_SPAWN -#include "util_spawn.c" -#endif - -#ifdef ERT_HAVE_ZLIB -#include "util_zlib.c" -#endif - -#ifdef ERT_HAVE_GETUID -#include "util_getuid.c" -#endif - -#ifdef ERT_HAVE_LOCKF -#include "util_lockf.c" -#endif - - -#include "util_env.c" - -#ifdef ERT_HAVE_SYMLINK -#include "util_symlink.c" -#else -bool util_is_link(const char * path) { - return false; -} - -char * util_alloc_link_target(const char * link) { - return util_alloc_string_copy( link ); -} -#endif - - - -#ifdef HAVE_BACKTRACE -#include "util_abort_gnu.c" -#else -#include "util_abort_simple.c" -#endif - - -#ifdef ERT_HAVE_OPENDIR -#include "util_opendir.c" -#endif - - #ifdef HAVE_ROUND int util_roundf( float x ) { return roundf(x); } int util_round( double x ) { return round(x); } @@ -5253,13 +5192,295 @@ int util_roundf( float x ) { return (int) (x + 0.5); } int util_round( double x ) { return (int) (x + 0.5); } #endif -#include "util_path.c" -#include "util_lfs.c" +bool util_is_abs_path(const char * path) { +#ifdef ERT_WINDOWS + if ((path[0] == '/') || (path[0] == '\\')) + return true; + else + if ((isalpha(path[0]) && (path[1] == ':'))) + return true; + + return false; + +#else + + if (path[0] == UTIL_PATH_SEP_CHAR) + return true; + else + return false; + +#endif +} + +static int util_mkdir( const char * path ) { +#ifdef HAVE_POSIX_MKDIR + return mkdir( path , UTIL_DEFAULT_MKDIR_MODE ); +#endif + +#ifdef HAVE_WINDOWS_MKDIR + return _mkdir( path ); +#endif +} + + +void util_make_path(const char *_path) { + char *active_path; + char *path = (char *) _path; + int current_pos = 0; + + if (!util_is_directory(path)) { + int i = 0; + active_path = util_calloc(strlen(path) + 1 , sizeof * active_path ); + do { + int n = strcspn(path , UTIL_PATH_SEP_STRING); + if (n < strlen(path)) + n += 1; + path += n; + i++; + strncpy(active_path , _path , n + current_pos); + active_path[n+current_pos] = '\0'; + current_pos += n; + + if (!util_is_directory(active_path)) { + if (util_mkdir(active_path) != 0) { + bool fail = false; + switch (errno) { + case(EEXIST): + if (util_is_directory(active_path)) + fail = false; + break; + default: + fail = true; + break; + } + if (fail) + util_abort("%s: failed to make directory:%s - aborting\n: %s(%d) \n",__func__ , active_path , strerror(errno), errno); + } + } + + } while (strlen(active_path) < strlen(_path)); + free(active_path); + } +} + + +/** + This function will allocate a unique filename with a random part in + it. If the the path corresponding to the first argument does not + exist it is created. + + If the value include_pid is true, the pid of the calling process is + included in the filename, the resulting filename will be: + + path/prefix-pid-RANDOM + + if include_pid is false the resulting file will be: + + path/prefix-RANDOM + + Observe that IFF the prefix contains any path separator character + they are translated to "_". +*/ + + + +char * util_alloc_tmp_file(const char * path, const char * prefix , bool include_pid ) { + // Should be reimplemented to use mkstemp() + const int pid_digits = 6; + const int random_digits = 6; + const int random_max = 1000000; + +#ifdef HAVE_PID_T + const int pid_max = 1000000; + pid_t pid = getpid() % pid_max; +#else + int pid = 0; +#endif + + char * file = util_calloc(strlen(path) + 1 + strlen(prefix) + 1 + pid_digits + 1 + random_digits + 1 , sizeof * file ); + char * tmp_prefix = util_alloc_string_copy( prefix ); + + if (!util_is_directory(path)) + util_make_path(path); + util_string_tr( tmp_prefix , UTIL_PATH_SEP_CHAR , '_'); /* removing path seps. */ + + do { + long int rand_int = rand() % random_max; + if (include_pid) + sprintf(file , "%s%c%s-%d-%ld" , path , UTIL_PATH_SEP_CHAR , tmp_prefix , pid , rand_int); + else + sprintf(file , "%s%c%s-%ld" , path , UTIL_PATH_SEP_CHAR , tmp_prefix , rand_int); + } while (util_file_exists(file)); + + free( tmp_prefix ); + return file; +} + +/** + This file allocates a filename consisting of a leading path, a + basename and an extension. Both the path and the extension can be + NULL, but not the basename. + + Observe that this function does pure string manipulation; there is + no input check on whether path exists, if baseneme contains "." + (or even a '/') and so on. +*/ + +char * util_alloc_filename(const char * path , const char * basename , const char * extension) { + char * file; + int length = strlen(basename) + 1; + + if (path != NULL) + length += strlen(path) + 1; + + if (extension != NULL) + length += strlen(extension) + 1; + + file = util_calloc(length , sizeof * file ); + + if (path == NULL) { + if (extension == NULL) + memcpy(file , basename , strlen(basename) + 1); + else + sprintf(file , "%s.%s" , basename , extension); + } else { + if (extension == NULL) + sprintf(file , "%s%c%s" , path , UTIL_PATH_SEP_CHAR , basename); + else + sprintf(file , "%s%c%s.%s" , path , UTIL_PATH_SEP_CHAR , basename , extension); + } + + return file; +} + + +char * util_realloc_filename(char * filename , const char * path , const char * basename , const char * extension) { + util_safe_free(filename); + return util_alloc_filename( path , basename , extension ); +} + + + + +#ifdef HAVE_PROC +bool util_proc_alive(pid_t pid) { + char proc_path[16]; + sprintf(proc_path , "/proc/%d" , pid); + return util_is_directory(proc_path); +} +#endif + +int util_proc_mem_free(void) { + FILE *stream = util_fopen("/proc/meminfo" , "r"); + int mem; + util_fskip_lines(stream , 1); + util_fskip_token(stream); + util_fscanf_int(stream , &mem); + fclose(stream); + return mem; +} + + + + +char * util_split_alloc_dirname( const char * input_path ) { + char * path; + util_alloc_file_components( input_path , &path , NULL , NULL); + return path; +} + + +char * util_split_alloc_filename( const char * input_path ) { + char * filename = NULL; + { + char * basename; + char * extension; + + util_alloc_file_components( input_path , NULL , &basename , &extension); + + if (basename) + filename = util_alloc_filename( NULL , basename , extension ); + + util_safe_free( basename ); + util_safe_free( extension ); + } + + return filename; +} + + + +void util_path_split(const char *line , int *_tokens, char ***_token_list) { + util_split_string( line , UTIL_PATH_SEP_STRING , _tokens , _token_list); +} + +char * util_alloc_parent_path( const char * path) { + int path_ncomp; + char ** path_component_list; + char * parent_path = NULL; + + if (path) { + bool is_abs = util_is_abs_path( path ); + char * work_path; + + if (strstr(path , "..")) { + if (is_abs) + work_path = util_alloc_realpath__( path ); + else { + char * abs_path = util_alloc_realpath__( path ); + char * cwd = util_alloc_cwd(); + work_path = util_alloc_rel_path( cwd , abs_path ); + free( abs_path ); + free( cwd ); + } + } else + work_path = util_alloc_string_copy( path ); + + util_path_split( work_path , &path_ncomp , &path_component_list ); + if (path_ncomp > 0) { + int current_length = 4; + int ip; + + parent_path = util_realloc( parent_path , current_length * sizeof * parent_path); + parent_path[0] = '\0'; + + for (ip=0; ip < path_ncomp - 1; ip++) { + const char * ipath = path_component_list[ip]; + int min_length = strlen(parent_path) + strlen(ipath) + 1; + + if (min_length >= current_length) { + current_length = 2 * min_length; + parent_path = util_realloc( parent_path , current_length * sizeof * parent_path); + } + + if (is_abs || (ip > 0)) + strcat( parent_path , UTIL_PATH_SEP_STRING ); + strcat( parent_path , ipath ); + } + } + util_free_stringlist( path_component_list , path_ncomp ); + free( work_path ); + } + return parent_path; +} + +#ifdef ERT_HAVE_UNISTD int util_type_get_id( const void * data ) { int type_id = ((const int*) data)[0]; return type_id; } -#include "util_chdir.c" +int util_chdir(const char * path) { + return chdir( path ); +} +#endif +#ifdef HAVE_WINDOWS_CHDIR +#include + +int util_chdir(const char * path) { + return _chdir( path ); +} + +#endif diff --git a/ThirdParty/Ert/libert_util/src/util_abort_gnu.c b/ThirdParty/Ert/lib/util/util_abort_gnu.c similarity index 94% rename from ThirdParty/Ert/libert_util/src/util_abort_gnu.c rename to ThirdParty/Ert/lib/util/util_abort_gnu.c index c595f3fe46..416b355d8d 100644 --- a/ThirdParty/Ert/libert_util/src/util_abort_gnu.c +++ b/ThirdParty/Ert/lib/util/util_abort_gnu.c @@ -26,7 +26,23 @@ This function is purely a helper function for util_abort(). */ +#define __USE_GNU // Must be defined to get access to the dladdr() function; Man page says the symbol should be: _GNU_SOURCE but that does not seem to work? +#define _GNU_SOURCE // Must be defined _before_ #include to get the symbol 'program_invocation_name'. + +#include +#include +#include + +#include + +#include + +#include +#include +#include #include +#include +#include #if !defined(__GLIBC__) /* note: not same as __GNUC__ */ # if defined (__APPLE__) @@ -227,6 +243,8 @@ void util_abort_test_set_intercept_function(const char * function) { intercept_function = util_realloc_string_copy( intercept_function , function ); } +char* __abort_program_message; +char* __current_executable; void util_abort__(const char * file , const char * function , int line , const char * fmt , ...) { util_abort_test_intercept( function ); diff --git a/ThirdParty/Ert/libert_util/src/util_abort_simple.c b/ThirdParty/Ert/lib/util/util_abort_simple.c similarity index 89% rename from ThirdParty/Ert/libert_util/src/util_abort_simple.c rename to ThirdParty/Ert/lib/util/util_abort_simple.c index 889987eb7d..9f7363f414 100644 --- a/ThirdParty/Ert/libert_util/src/util_abort_simple.c +++ b/ThirdParty/Ert/lib/util/util_abort_simple.c @@ -2,10 +2,14 @@ This file implements a simpler version of the util_abort() function which does not present a backtrace. */ +#include +#include + #include +#include - - +char * __abort_program_message; +char * __current_executable; diff --git a/ThirdParty/Ert/libert_util/src/util_endian.c b/ThirdParty/Ert/lib/util/util_endian.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/util_endian.c rename to ThirdParty/Ert/lib/util/util_endian.c diff --git a/ThirdParty/Ert/libert_util/src/util_env.c b/ThirdParty/Ert/lib/util/util_env.c similarity index 99% rename from ThirdParty/Ert/libert_util/src/util_env.c rename to ThirdParty/Ert/lib/util/util_env.c index 7c5144b242..0395cb47c1 100644 --- a/ThirdParty/Ert/libert_util/src/util_env.c +++ b/ThirdParty/Ert/lib/util/util_env.c @@ -39,6 +39,8 @@ void util_setenv( const char * variable , const char * value) { #else +#include + #define PATHVAR_SPLIT ";" void util_setenv( const char * variable , const char * value) { SetEnvironmentVariable( variable , NULL ); diff --git a/ThirdParty/Ert/libert_util/src/util_getuid.c b/ThirdParty/Ert/lib/util/util_getuid.c similarity index 96% rename from ThirdParty/Ert/libert_util/src/util_getuid.c rename to ThirdParty/Ert/lib/util/util_getuid.c index 4e867d09b1..b95864b4c2 100644 --- a/ThirdParty/Ert/libert_util/src/util_getuid.c +++ b/ThirdParty/Ert/lib/util/util_getuid.c @@ -1,3 +1,12 @@ +#include +#include + +#include + +#include +#include +#include + uid_t util_get_entry_uid( const char * file ) { stat_type buffer; util_stat( file , &buffer); diff --git a/ThirdParty/Ert/libert_util/src/util_lfs.c b/ThirdParty/Ert/lib/util/util_lfs.c similarity index 99% rename from ThirdParty/Ert/libert_util/src/util_lfs.c rename to ThirdParty/Ert/lib/util/util_lfs.c index 17fca55ee4..d6d9c1f735 100644 --- a/ThirdParty/Ert/libert_util/src/util_lfs.c +++ b/ThirdParty/Ert/lib/util/util_lfs.c @@ -53,6 +53,8 @@ 'offset_type' in util.h, and all file operations should use that type. */ +#include + offset_type util_ftell(FILE * stream) { #ifdef ERT_WINDOWS_LFS return _ftelli64(stream); diff --git a/ThirdParty/Ert/libert_util/src/util_lockf.c b/ThirdParty/Ert/lib/util/util_lockf.c similarity index 95% rename from ThirdParty/Ert/libert_util/src/util_lockf.c rename to ThirdParty/Ert/lib/util/util_lockf.c index ed67a7436d..fe3636b85c 100644 --- a/ThirdParty/Ert/libert_util/src/util_lockf.c +++ b/ThirdParty/Ert/lib/util/util_lockf.c @@ -1,3 +1,12 @@ +#include +#include +#include + +#include + +#include +#include + /** This function will TRY to aquire an exclusive lock to the file filename. If the file does not exist it will be created. The mode diff --git a/ThirdParty/Ert/libert_util/src/util_opendir.c b/ThirdParty/Ert/lib/util/util_opendir.c similarity index 97% rename from ThirdParty/Ert/libert_util/src/util_opendir.c rename to ThirdParty/Ert/lib/util/util_opendir.c index 61c71b9735..3205364699 100644 --- a/ThirdParty/Ert/libert_util/src/util_opendir.c +++ b/ThirdParty/Ert/lib/util/util_opendir.c @@ -1,3 +1,13 @@ +#include +#include +#include + +#include + +#include +#include + +bool util_copy_file__(const char * src_file , const char * target_file, size_t buffer_size , void * buffer , bool abort_on_error); static void util_copy_directory__(const char * src_path , const char * target_path , int buffer_size , void * buffer ) { if (!util_is_directory(src_path)) diff --git a/ThirdParty/Ert/libert_util/src/util_spawn.c b/ThirdParty/Ert/lib/util/util_spawn.c similarity index 91% rename from ThirdParty/Ert/libert_util/src/util_spawn.c rename to ThirdParty/Ert/lib/util/util_spawn.c index 2e9c11109c..d1865ccca4 100644 --- a/ThirdParty/Ert/libert_util/src/util_spawn.c +++ b/ThirdParty/Ert/lib/util/util_spawn.c @@ -1,5 +1,17 @@ -#include +#include +#include "ert/util/build_config.h" + +#include +#include + +#include #include +#include +#include +#include + +#include + extern char **environ; @@ -107,9 +119,11 @@ int util_spawn_blocking(const char *executable, int argc, const char **argv, con */ #ifdef ERT_HAVE_PING +#define xstr(s) #s +#define str(s) xstr(s) bool util_ping(const char *hostname) { int wait_status; - wait_status = util_spawn_blocking(PING_CMD, 4, (const char *[4]) {"-c" , "3" , "-q", hostname}, "/dev/null" , "/dev/null"); + wait_status = util_spawn_blocking(str(PING_CMD), 4, (const char *[4]) {"-c" , "3" , "-q", hostname}, "/dev/null" , "/dev/null"); if (WIFEXITED( wait_status )) { int ping_status = WEXITSTATUS( wait_status ); diff --git a/ThirdParty/Ert/libert_util/src/util_symlink.c b/ThirdParty/Ert/lib/util/util_symlink.c similarity index 89% rename from ThirdParty/Ert/libert_util/src/util_symlink.c rename to ThirdParty/Ert/lib/util/util_symlink.c index 0f35f79f04..722a65186f 100644 --- a/ThirdParty/Ert/libert_util/src/util_symlink.c +++ b/ThirdParty/Ert/lib/util/util_symlink.c @@ -1,9 +1,25 @@ -/* - This file contains utility functions all related to symbolic links; - this file is not compiled at all on platforms which do not have the - symlink() call. -*/ +#include +#include +#include +#include "ert/util/build_config.h" +#include +#include + +#ifndef ERT_HAVE_SYMLINK + +bool util_is_link(const char * path) { + return false; +} + +char * util_alloc_link_target(const char * link) { + return util_alloc_string_copy( link ); +} + +#else + +#include +#include void util_make_slink(const char *target , const char * link) { if (util_file_exists(link)) { @@ -124,3 +140,4 @@ char * util_alloc_atlink_target(const char * path , const char * link) { } #endif +#endif // ERT_HAVE_SYMLINK diff --git a/ThirdParty/Ert/libert_util/src/util_zlib.c b/ThirdParty/Ert/lib/util/util_zlib.c similarity index 98% rename from ThirdParty/Ert/libert_util/src/util_zlib.c rename to ThirdParty/Ert/lib/util/util_zlib.c index d8f098de04..bbba27b487 100644 --- a/ThirdParty/Ert/libert_util/src/util_zlib.c +++ b/ThirdParty/Ert/lib/util/util_zlib.c @@ -1,5 +1,12 @@ +#include +#include +#include +#include + #include +#include + /** This function reads data from the input pointer data, and writes a compressed copy into the target buffer zbuffer. On input data_size diff --git a/ThirdParty/Ert/libert_util/src/vector.c b/ThirdParty/Ert/lib/util/vector.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/vector.c rename to ThirdParty/Ert/lib/util/vector.c diff --git a/ThirdParty/Ert/libert_util/src/vector_template.c b/ThirdParty/Ert/lib/util/vector_template.c similarity index 100% rename from ThirdParty/Ert/libert_util/src/vector_template.c rename to ThirdParty/Ert/lib/util/vector_template.c diff --git a/ThirdParty/Ert/libert_util/include/ert/util/vector_template.h b/ThirdParty/Ert/lib/vector_template.h.in similarity index 100% rename from ThirdParty/Ert/libert_util/include/ert/util/vector_template.h rename to ThirdParty/Ert/lib/vector_template.h.in diff --git a/ThirdParty/Ert/libecl/CMakeLists.txt b/ThirdParty/Ert/libecl/CMakeLists.txt deleted file mode 100644 index faca95eb2b..0000000000 --- a/ThirdParty/Ert/libecl/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_subdirectory( src ) - -add_subdirectory( applications ) -add_subdirectory( tests ) - diff --git a/ThirdParty/Ert/libecl/applications/CMakeLists.txt b/ThirdParty/Ert/libecl/applications/CMakeLists.txt deleted file mode 100644 index 1ebcfb0918..0000000000 --- a/ThirdParty/Ert/libecl/applications/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -if (BUILD_APPLICATIONS) - add_executable( sum_write sum_write.c ) - add_executable( make_grid make_grid.c ) - add_executable( grdecl_grid grdecl_grid.c ) - if (ERT_LINUX) - add_executable( ecl_pack.x ecl_pack.c ) - add_executable( ecl_unpack.x ecl_unpack.c ) - add_executable( esummary.x esummary.c ) - add_executable( convert.x convert.c ) - add_executable( grdecl_test.x grdecl_test.c ) - add_executable( kw_list.x kw_list.c ) - add_executable( kw_extract.x kw_extract.c ) - add_executable( grid_info.x grid_info.c ) - add_executable( grid_dump.x grid_dump.c ) - add_executable( grid_dump_ascii.x grid_dump_ascii.c ) - add_executable( summary.x view_summary.c ) - add_executable( select_test.x select_test.c ) - add_executable( load_test.x load_test.c ) - set(program_list ecl_pack.x ecl_unpack.x esummary.x kw_extract.x grdecl_grid make_grid sum_write load_test.x grdecl_test.x grid_dump_ascii.x select_test.x grid_dump.x convert.x kw_list.x grid_info.x summary.x) - else() - # The stupid .x extension creates problems on windows - add_executable( ecl_pack ecl_pack.c ) - add_executable( ecl_unpack ecl_unpack.c ) - add_executable( kw_extract kw_extract.c ) - add_executable( grid_info grid_info.c ) - add_executable( grid_dump grid_dump.c ) - add_executable( grid_dump_ascii grid_dump_ascii.c ) - add_executable( summary view_summary.c ) - add_executable( select_test select_test.c ) - add_executable( load_test load_test.c ) - set(program_list ecl_pack ecl_unpack kw_extract grdecl_grid make_grid sum_write load_test grid_dump_ascii select_test grid_dump grid_info summary) - endif() - - if (BUILD_ERT) - add_executable( ecl_quantile ecl_quantile.c ) - include_directories( ../../libconfig/include ) - target_link_libraries( ecl_quantile config ) - list( APPEND program_list ecl_quantile ) - endif() - - - foreach(prog ${program_list}) - target_link_libraries( ${prog} ecl ert_util ) - if (USE_RUNPATH) - add_runpath( ${prog} ) - endif() - - #----------------------------------------------------------------- - set (destination ${CMAKE_INSTALL_PREFIX}/bin) - if (INSTALL_ERT) - install(TARGETS ${prog} DESTINATION ${destination}) - if (INSTALL_GROUP) - install(CODE "EXECUTE_PROCESS(COMMAND chgrp ${INSTALL_GROUP} ${destination}/${prog})") - install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/${prog})") - endif() - endif() - endforeach() -endif() - -if (BUILD_ECL_SUMMARY) - add_executable( ecl_summary view_summary.c ) - target_link_libraries( ecl_summary ecl) - if (USE_RUNPATH) - add_runpath( ecl_summary ) - endif() - - set (destination ${CMAKE_INSTALL_PREFIX}/bin) - if (INSTALL_ERT) - install(TARGETS ecl_summary DESTINATION ${destination}) - if (INSTALL_GROUP) - install(CODE "EXECUTE_PROCESS(COMMAND chgrp ${INSTALL_GROUP} ${destination}/ecl_summary)") - install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/ecl_summary)") - endif() - endif() - - include(GNUInstallDirs) - install(FILES ${PROJECT_SOURCE_DIR}/docs/man/man1/ecl_summary.1 - DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) - -endif() - diff --git a/ThirdParty/Ert/libecl/applications/link_static.sh b/ThirdParty/Ert/libecl/applications/link_static.sh deleted file mode 100644 index ac68ae2574..0000000000 --- a/ThirdParty/Ert/libecl/applications/link_static.sh +++ /dev/null @@ -1,2 +0,0 @@ -gcc -o summary.x_static view_summary.o -L../lib -L../../libutil/lib -lecl -lutil -lm -lpt -gcc -static -o summary.x_full_static view_summary.o -L../lib -L../../libutil/lib -lecl -lutil -lm -lpthread -lz diff --git a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_file_view.h b/ThirdParty/Ert/libecl/include/ert/ecl/ecl_file_view.h deleted file mode 100644 index 8e363158da..0000000000 --- a/ThirdParty/Ert/libecl/include/ert/ecl/ecl_file_view.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright (C) 2016 Statoil ASA, Norway. - - This file is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - - -#ifndef ERT_ECL_FILE_VIEW_H -#define ERT_ECL_FILE_VIEW_H - -#include -#include - -#include -#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - ECL_FILE_CLOSE_STREAM = 1 , /* - This flag will close the underlying FILE object between each access; this is - mainly to save filedescriptors in cases where many ecl_file instances are open at - the same time. */ - // - ECL_FILE_WRITABLE = 2 /* - This flag opens the file in a mode where it can be updated and modified, but it - must still exist and be readable. I.e. this should not compared with the normal: - fopen(filename , "w") where an existing file is truncated to zero upon successfull - open. - */ -} ecl_file_flag_type; - - -typedef struct ecl_file_view_struct ecl_file_view_type; - - bool ecl_file_view_flags_set( const ecl_file_view_type * file_view, int query_flags); - bool ecl_file_view_check_flags( int state_flags , int query_flags); - - ecl_file_view_type * ecl_file_view_alloc( fortio_type * fortio , int * flags , inv_map_type * inv_map , bool owner ); - int ecl_file_view_get_global_index( const ecl_file_view_type * ecl_file_view , const char * kw , int ith); - void ecl_file_view_make_index( ecl_file_view_type * ecl_file_view ); - bool ecl_file_view_has_kw( const ecl_file_view_type * ecl_file_view, const char * kw); - ecl_file_kw_type * ecl_file_view_iget_file_kw( const ecl_file_view_type * ecl_file_view , int global_index); - ecl_file_kw_type * ecl_file_view_iget_named_file_kw( const ecl_file_view_type * ecl_file_view , const char * kw, int ith); - ecl_kw_type * ecl_file_view_iget_kw( const ecl_file_view_type * ecl_file_view , int index); - void ecl_file_view_index_fload_kw(const ecl_file_view_type * ecl_file_view, const char* kw, int index, const int_vector_type * index_map, char* buffer); - int ecl_file_view_find_kw_value( const ecl_file_view_type * ecl_file_view , const char * kw , const void * value); - const char * ecl_file_view_iget_distinct_kw( const ecl_file_view_type * ecl_file_view , int index); - int ecl_file_view_get_num_distinct_kw( const ecl_file_view_type * ecl_file_view ); - int ecl_file_view_get_size( const ecl_file_view_type * ecl_file_view ); - ecl_data_type ecl_file_view_iget_data_type( const ecl_file_view_type * ecl_file_view , int index); - int ecl_file_view_iget_size( const ecl_file_view_type * ecl_file_view , int index); - const char * ecl_file_view_iget_header( const ecl_file_view_type * ecl_file_view , int index); - ecl_kw_type * ecl_file_view_iget_named_kw( const ecl_file_view_type * ecl_file_view , const char * kw, int ith); - ecl_data_type ecl_file_view_iget_named_data_type( const ecl_file_view_type * ecl_file_view , const char * kw , int ith); - int ecl_file_view_iget_named_size( const ecl_file_view_type * ecl_file_view , const char * kw , int ith); - void ecl_file_view_replace_kw( ecl_file_view_type * ecl_file_view , ecl_kw_type * old_kw , ecl_kw_type * new_kw , bool insert_copy); - bool ecl_file_view_load_all( ecl_file_view_type * ecl_file_view ); - void ecl_file_view_add_kw( ecl_file_view_type * ecl_file_view , ecl_file_kw_type * file_kw); - void ecl_file_view_free( ecl_file_view_type * ecl_file_view ); - void ecl_file_view_free__( void * arg ); - int ecl_file_view_get_num_named_kw(const ecl_file_view_type * ecl_file_view , const char * kw); - void ecl_file_view_fwrite( const ecl_file_view_type * ecl_file_view , fortio_type * target , int offset); - int ecl_file_view_iget_occurence( const ecl_file_view_type * ecl_file_view , int global_index); - void ecl_file_view_fprintf_kw_list(const ecl_file_view_type * ecl_file_view , FILE * stream); - ecl_file_view_type * ecl_file_view_add_blockview(const ecl_file_view_type * ecl_file_view , const char * header, int occurence); - ecl_file_view_type * ecl_file_view_add_blockview2(const ecl_file_view_type * ecl_file_view , const char * start_kw, const char * end_kw, int occurence); - ecl_file_view_type * ecl_file_view_add_restart_view(ecl_file_view_type * file_view , int seqnum_index, int report_step , time_t sim_time, double sim_days); - ecl_file_view_type * ecl_file_view_alloc_blockview(const ecl_file_view_type * ecl_file_view , const char * header, int occurence); - ecl_file_view_type * ecl_file_view_alloc_blockview2(const ecl_file_view_type * ecl_file_view , const char * start_kw, const char * end_kw, int occurence); - - void ecl_file_view_add_child( ecl_file_view_type * parent , ecl_file_view_type * child); - bool ecl_file_view_drop_flag( ecl_file_view_type * file_view , int flag); - void ecl_file_view_add_flag( ecl_file_view_type * file_view , int flag); - - int ecl_file_view_seqnum_index_from_sim_time( ecl_file_view_type * parent_map , time_t sim_time); - bool ecl_file_view_has_sim_time( const ecl_file_view_type * ecl_file_view , time_t sim_time); - int ecl_file_view_find_sim_time(const ecl_file_view_type * ecl_file_view , time_t sim_time); - double ecl_file_view_iget_restart_sim_days(const ecl_file_view_type * ecl_file_view , int seqnum_index); - time_t ecl_file_view_iget_restart_sim_date(const ecl_file_view_type * ecl_file_view , int seqnum_index); - bool ecl_file_view_has_report_step( const ecl_file_view_type * ecl_file_view , int report_step); - - ecl_file_view_type * ecl_file_view_add_summary_view( ecl_file_view_type * file_view , int report_step ); - const char * ecl_file_view_get_src_file( const ecl_file_view_type * file_view ); - void ecl_file_view_fclose_stream( ecl_file_view_type * file_view ); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ThirdParty/Ert/libecl/src/CMakeLists.txt b/ThirdParty/Ert/libecl/src/CMakeLists.txt deleted file mode 100644 index dcbf36677a..0000000000 --- a/ThirdParty/Ert/libecl/src/CMakeLists.txt +++ /dev/null @@ -1,116 +0,0 @@ -include_directories( ext ) -file(GLOB ext_source "ext/*.c" ) -file(GLOB ext_header "ext/*.h" ) - -set( source_files - ecl_rsthead.c - ecl_sum_tstep.c - ecl_rst_file.c - ecl_init_file.c - ecl_grid_cache.c - smspec_node.c - ecl_kw_grdecl.c - ecl_file_kw.c - ecl_file_view.c - ecl_grav.c - ecl_grav_calc.c - ecl_smspec.c - ecl_sum_data.c - ecl_util.c - ecl_kw.c - ecl_sum.c - ecl_sum_vector.c - fortio.c - ecl_rft_file.c - ecl_rft_node.c - ecl_rft_cell.c - ecl_grid.c - ecl_coarse_cell.c - ecl_box.c - ecl_io_config.c - ecl_file.c - ecl_region.c - ecl_subsidence.c - ecl_grid_dims.c - grid_dims.c - nnc_info.c - ecl_grav_common.c - nnc_vector.c - ecl_nnc_export.c - ecl_nnc_geometry.c - layer.c - fault_block_layer.c - ecl_type.c - ecl_type_python.c - ${ext_source}) - -set( header_files - ecl_units.h - ecl_rsthead.h - ecl_sum_tstep.h - ecl_rst_file.h - ecl_init_file.h - smspec_node.h - ecl_grid_cache.h - ecl_kw_grdecl.h - ecl_file_kw.h - ecl_grav.h - ecl_grav_calc.h - ecl_endian_flip.h - ecl_smspec.h - ecl_sum_data.h - ecl_util.h - ecl_kw.h - ecl_sum.h - ecl_sum_vector.h - fortio.h - ecl_rft_file.h - ecl_rft_node.h - ecl_rft_cell.h - ecl_box.h - ecl_coarse_cell.h - ecl_grid.h - ecl_io_config.h - ecl_file.h - ecl_file_view.h - ecl_region.h - ecl_kw_magic.h - ecl_subsidence.h - ecl_grid_dims.h - grid_dims.h - nnc_info.h - nnc_vector.h - ecl_grav_common.h - ecl_nnc_export.h - ecl_nnc_geometry.h - layer.h - fault_block.h - fault_block_layer.h - ecl_type.h - ${ext_header}) - -if (ERT_USE_OPENMP) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}") -endif() - -add_library( ecl ${source_files} ) -set_target_properties( ecl PROPERTIES VERSION ${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR} SOVERSION ${ERT_VERSION_MAJOR}) -if (USE_RUNPATH) - add_runpath( ecl ) -endif() -target_link_libraries( ecl ert_geometry ert_util ) - -#----------------------------------------------------------------- -if (INSTALL_ERT) - install(TARGETS ecl DESTINATION ${CMAKE_INSTALL_LIBDIR}) - foreach(header ${header_files}) - install(FILES ../include/ert/ecl/${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ert/ecl) - endforeach() -endif() - - - - diff --git a/ThirdParty/Ert/libecl/src/ecl_file_deprecated.c b/ThirdParty/Ert/libecl/src/ecl_file_deprecated.c deleted file mode 100644 index 08442214d4..0000000000 --- a/ThirdParty/Ert/libecl/src/ecl_file_deprecated.c +++ /dev/null @@ -1,117 +0,0 @@ -void ecl_file_push_block( ecl_file_type * ecl_file ) { - vector_append_ref( ecl_file->map_stack , ecl_file->active_view ); -} - -void ecl_file_pop_block( ecl_file_type * ecl_file ) { - ecl_file->active_view = vector_pop_back( ecl_file->map_stack ); -} - - -static ecl_file_view_type * ecl_file_get_relative_blockview( ecl_file_type * ecl_file , const char * kw , int occurence) { - ecl_file_view_type * view = ecl_file_view_add_blockview( ecl_file->active_view , kw , occurence ); - return view; -} - - - -bool ecl_file_subselect_block( ecl_file_type * ecl_file , const char * kw , int occurence) { - ecl_file_view_type * blockmap = ecl_file_get_relative_blockview( ecl_file , kw , occurence); - if (blockmap != NULL) { - ecl_file->active_view = blockmap; - return true; - } else - return false; -} - - -bool ecl_file_select_block( ecl_file_type * ecl_file , const char * kw , int occurence ) { - ecl_file_view_type * blockmap = ecl_file_get_global_blockview( ecl_file , kw , occurence); - if (blockmap != NULL) { - ecl_file->active_view = blockmap; - return true; - } else - return false; -} - - -/* - Will select restart block nr @seqnum_index - without considering - report_steps or simulation time. -*/ -bool ecl_file_iselect_rstblock( ecl_file_type * ecl_file , int seqnum_index ) { - return ecl_file_select_block( ecl_file , SEQNUM_KW , seqnum_index ); -} - - -bool ecl_file_select_rstblock_sim_time( ecl_file_type * ecl_file , time_t sim_time) { - int seqnum_index = ecl_file_view_seqnum_index_from_sim_time( ecl_file->global_view , sim_time ); - - if (seqnum_index >= 0) - return ecl_file_iselect_rstblock( ecl_file , seqnum_index); - else - return false; -} - - -bool ecl_file_select_rstblock_report_step( ecl_file_type * ecl_file , int report_step) { - int global_index = ecl_file_view_find_kw_value( ecl_file->global_view , SEQNUM_KW , &report_step); - if ( global_index >= 0) { - int seqnum_index = ecl_file_view_iget_occurence( ecl_file->global_view , global_index ); - return ecl_file_iselect_rstblock( ecl_file , seqnum_index); - } else - return false; -} - - -/******************************************************************/ - -static ecl_file_type * ecl_file_open_rstblock_report_step__( const char * filename , int report_step , int flags) { - ecl_file_type * ecl_file = ecl_file_open( filename , flags ); - if (ecl_file) { - if (!ecl_file_select_rstblock_report_step( ecl_file , report_step )) { - ecl_file_close( ecl_file ); - ecl_file = NULL; - } - } - return ecl_file; -} - -ecl_file_type * ecl_file_open_rstblock_report_step( const char * filename , int report_step , int flags) { - return ecl_file_open_rstblock_report_step__(filename , report_step , flags ); -} - - -/******************************************************************/ - -static ecl_file_type * ecl_file_open_rstblock_sim_time__( const char * filename , time_t sim_time, int flags ) { - ecl_file_type * ecl_file = ecl_file_open( filename , flags ); - if (ecl_file) { - if (!ecl_file_select_rstblock_sim_time( ecl_file , sim_time)) { - ecl_file_close( ecl_file ); - ecl_file = NULL; - } - } - return ecl_file; -} - -ecl_file_type * ecl_file_open_rstblock_sim_time( const char * filename , time_t sim_time, int flags) { - return ecl_file_open_rstblock_sim_time__( filename , sim_time , flags ); -} - -/******************************************************************/ - -static ecl_file_type * ecl_file_iopen_rstblock__( const char * filename , int seqnum_index, int flags ) { - ecl_file_type * ecl_file = ecl_file_open( filename , flags ); - if (ecl_file) { - if (!ecl_file_iselect_rstblock( ecl_file , seqnum_index )) { - ecl_file_close( ecl_file ); - ecl_file = NULL; - } - } - return ecl_file; -} - - -ecl_file_type * ecl_file_iopen_rstblock( const char * filename , int seqnum_index , int flags) { - return ecl_file_iopen_rstblock__(filename , seqnum_index , flags ); -} diff --git a/ThirdParty/Ert/libecl/src/ecl_rstfile.c b/ThirdParty/Ert/libecl/src/ecl_rstfile.c deleted file mode 100644 index 63fe141b0d..0000000000 --- a/ThirdParty/Ert/libecl/src/ecl_rstfile.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (C) 2011 Statoil ASA, Norway. - - The file 'ecl_rstfile.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - - - -/******************************************************************/ -/* Query functions. */ - - -/** - Will look through all the INTEHEAD kw instances of the current - ecl_file and look for @sim_time. If the value is found true is - returned, otherwise false. -*/ - - - -bool ecl_file_has_sim_time( const ecl_file_type * ecl_file , time_t sim_time) { - return ecl_file_view_has_sim_time( ecl_file->active_view , sim_time ); -} - - -/* - This function will determine the restart block corresponding to the - world time @sim_time; if @sim_time can not be found the function - will return 0. - - The returned index is the 'occurence number' in the restart file, - i.e. in the (quite typical case) that not all report steps are - present the return value will not agree with report step. - - The return value from this function can then be used to get a - corresponding solution field directly, or the file map can - restricted to this block. - - Direct access: - - int index = ecl_file_get_restart_index( ecl_file , sim_time ); - if (index >= 0) { - ecl_kw_type * pressure_kw = ecl_file_iget_named_kw( ecl_file , "PRESSURE" , index ); - .... - } - - - Using block restriction: - - int index = ecl_file_get_restart_index( ecl_file , sim_time ); - if (index >= 0) { - ecl_file_iselect_rstblock( ecl_file , index ); - { - ecl_kw_type * pressure_kw = ecl_file_iget_named_kw( ecl_file , "PRESSURE" , 0 ); - .... - } - } - - Specially in the case of LGRs the block restriction should be used. - */ - -int ecl_file_get_restart_index( const ecl_file_type * ecl_file , time_t sim_time) { - int active_index = ecl_file_view_find_sim_time( ecl_file->active_view , sim_time ); - return active_index; -} - - -/** - Will look through all the SEQNUM kw instances of the current - ecl_file and look for @report_step. If the value is found true is - returned, otherwise false. -*/ - -bool ecl_file_has_report_step( const ecl_file_type * ecl_file , int report_step) { - return ecl_file_view_has_report_step( ecl_file->active_view , report_step ); -} - - -/** - This function will look up the INTEHEAD keyword in a ecl_file_type - instance, and calculate simulation date from this instance. - - Will return -1 if the requested INTEHEAD keyword can not be found. -*/ - -time_t ecl_file_iget_restart_sim_date( const ecl_file_type * restart_file , int index ) { - return ecl_file_view_iget_restart_sim_date( restart_file->active_view , index ); -} - -double ecl_file_iget_restart_sim_days( const ecl_file_type * restart_file , int index ) { - return ecl_file_view_iget_restart_sim_days( restart_file->active_view , index ); -} - - -/*****************************************************************/ -/* Select and open functions, observe that these functions should - only consider the global map. -*/ - - - - - - diff --git a/ThirdParty/Ert/libecl/tests/CMakeLists.txt b/ThirdParty/Ert/libecl/tests/CMakeLists.txt deleted file mode 100644 index 62aa9a50c2..0000000000 --- a/ThirdParty/Ert/libecl/tests/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -if (BUILD_TESTS) - - # Common test binary used in both the Statoil internal tests and the open tests. - add_executable( ecl_grid_cell_contains ecl_grid_cell_contains.c ) - target_link_libraries( ecl_grid_cell_contains ecl ) - - include( tests.cmake ) - if (STATOIL_TESTDATA_ROOT) - include (statoil_tests.cmake) - endif() -endif() - -# The ecl_win64 application is not built as a proper test integrated -# into the CTEST system. Should be invoked manually on Windows. -if (ERT_WINDOWS) - add_executable( ecl_lfs ecl_lfs.c ) - target_link_libraries( ecl_lfs ecl ert_util ) -endif() - diff --git a/ThirdParty/Ert/libecl/tests/statoil_tests.cmake b/ThirdParty/Ert/libecl/tests/statoil_tests.cmake deleted file mode 100644 index 8962b49fa2..0000000000 --- a/ThirdParty/Ert/libecl/tests/statoil_tests.cmake +++ /dev/null @@ -1,295 +0,0 @@ -add_executable( ecl_coarse_test ecl_coarse_test.c ) -target_link_libraries( ecl_coarse_test ecl ) -add_test( ecl_coarse_test ${EXECUTABLE_OUTPUT_PATH}/ecl_coarse_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2 ) - - -add_executable( ecl_grid_layer_contains ecl_grid_layer_contains.c ) -target_link_libraries( ecl_grid_layer_contains ecl ) -add_test( ecl_grid_layer_contains1 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_layer_contains ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) -add_test( ecl_grid_layer_contains2 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_layer_contains ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Mariner/MARINER.EGRID ) - - -add_executable( ecl_restart_test ecl_restart_test.c ) -target_link_libraries( ecl_restart_test ecl ) -add_test( ecl_restart_test ${EXECUTABLE_OUTPUT_PATH}/ecl_restart_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST ) - - -add_executable( ecl_nnc_export ecl_nnc_export.c ) -target_link_libraries( ecl_nnc_export ecl ) -add_test (ecl_nnc_export1 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_export ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE TRUE) -add_test (ecl_nnc_export2 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_export ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC TRUE) -add_test (ecl_nnc_export3 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_export ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3 TRUE) -add_test (ecl_nnc_export4 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_export ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/DualPoro/DUAL_DIFF TRUE) -add_test (ecl_nnc_export5 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_export ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/DualPoro/DUALPORO TRUE) -add_test (ecl_nnc_export6 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_export ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/nestedLGRcase/TESTCASE_NESTEDLGR TRUE) -add_test (ecl_nnc_export7 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_export ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/TYRIHANS/BASE20150218_MULTFLT FALSE) - -add_executable( ecl_nnc_export_get_tran ecl_nnc_export_get_tran.c ) -target_link_libraries( ecl_nnc_export_get_tran ecl ) -add_test (ecl_nnc_export_get_tran ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_export_get_tran ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3) - - -add_executable( ecl_util_make_date_shift ecl_util_make_date_shift.c ) -target_link_libraries( ecl_util_make_date_shift ecl ) -add_test( ecl_util_make_date_shift ${EXECUTABLE_OUTPUT_PATH}/ecl_util_make_date_shift ) - - -add_executable( ecl_sum_case_exists ecl_sum_case_exists.c ) -target_link_libraries( ecl_sum_case_exists ecl ) -add_test( ecl_sum_case_exists ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_case_exists - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/GurbatSummary/missingHeader/ECLIPSE - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/GurbatSummary/missingData/ECLIPSE ) - - -add_executable( ecl_grid_lgr_name ecl_grid_lgr_name.c ) -target_link_libraries( ecl_grid_lgr_name ecl ) -set_target_properties( ecl_grid_lgr_name PROPERTIES COMPILE_FLAGS "-Werror") -add_test( ecl_grid_lgr_name ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_lgr_name ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID) - - -add_executable( ecl_region ecl_region.c ) -target_link_libraries( ecl_region ecl ) -add_test( ecl_region ${EXECUTABLE_OUTPUT_PATH}/ecl_region ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) - -add_executable( ecl_grid_fwrite ecl_grid_fwrite.c ) -target_link_libraries( ecl_grid_fwrite ecl ) -add_test( ecl_grid_fwrite ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_fwrite ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) - -add_test( ecl_grid_cell_contains2 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_cell_contains ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) -add_test( ecl_grid_cell_contains3 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_cell_contains ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/FF12/FF12_2013B2.EGRID ) -add_test( ecl_grid_cell_contains4 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_cell_contains ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Brazil/R3_ICD.EGRID ) - -add_executable( ecl_grid_cell_contains_wellpath ecl_grid_cell_contains_wellpath.c ) -target_link_libraries( ecl_grid_cell_contains_wellpath ecl ) -add_test( ecl_grid_cell_contains_wellpath1 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_cell_contains_wellpath ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/CellContains/model/SMS-0.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/CellContains/R_PB-4H.jira ) - -add_executable( ecl_grid_cell_volume ecl_grid_cell_volume.c ) -target_link_libraries( ecl_grid_cell_volume ecl ) -add_test( ecl_grid_cell_volume1 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_cell_volume) -add_test( ecl_grid_cell_volume2 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_cell_volume ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) -add_test( ecl_grid_cell_volume3 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_cell_volume ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Heidrun/Summary/FF12_2013B3_CLEAN_RS.EGRID ) - -add_executable( ecl_region2region ecl_region2region_test.c ) -target_link_libraries( ecl_region2region ecl ) -add_test( ecl_region2region ${EXECUTABLE_OUTPUT_PATH}/ecl_region2region ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/R2R/R2R.SMSPEC ) - -add_executable( ecl_grid_case ecl_grid_case.c ) -target_link_libraries( ecl_grid_case ecl ) -add_test( ecl_grid_case ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_case ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ) - - -add_executable( ecl_lgr_test ecl_lgr_test.c ) -target_link_libraries( ecl_lgr_test ecl ) -add_test( ecl_lgr_test1 ${EXECUTABLE_OUTPUT_PATH}/ecl_lgr_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID) -add_test( ecl_lgr_test2 ${EXECUTABLE_OUTPUT_PATH}/ecl_lgr_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.GRID) -add_test( ecl_lgr_test3 ${EXECUTABLE_OUTPUT_PATH}/ecl_lgr_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID ) - - -add_executable( ecl_grid_simple ecl_grid_simple.c ) -target_link_libraries( ecl_grid_simple ecl ) -add_test( ecl_grid_simple ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_simple ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) - -add_test( ecl_grid_ecl2015_2 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_simple ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Eclipse2015_NNC_BUG/FF15_2015B2_LGRM_RDI15_HIST_RDIREAL1_20142.EGRID ) - -add_executable( ecl_grid_export_statoil ecl_grid_export.c ) -target_link_libraries( ecl_grid_export_statoil ecl ) -add_test( ecl_grid_export_statoil ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_export_statoil ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) - -add_executable( ecl_grid_volume ecl_grid_volume.c ) -target_link_libraries( ecl_grid_volume ecl ) -add_test( ecl_grid_volume1 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_volume ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ) -add_test( ecl_grid_volume2 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_volume ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/VolumeTest/TEST1 ) -add_test( ecl_grid_volume3 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_volume ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/OsebergSyd/Omega/OMEGA-0) -add_test( ecl_grid_volume4 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_volume ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Norne/reservoir_models/Norne_ATW2013/NORNE_ATW2013) - -# The grid volume test fails miserably on the test case given as example five; looking at -# the failures one could actually suspect that the ECLIPSE algorithm for PORV calculations -# has been different in this file - i.e. that the absolute value of the individual -# tetrahedron parts have been taken during the sum, and not at the end. At least the ert -# algorithm gets volumes ~ 0 whereas ECLIPSE reports ~10^9 for the same cell. -# add_test( ecl_grid_volume5 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_volume ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Heidrun/Summary/FF12_2013B3_CLEAN_RS) - -add_executable( ecl_grid_dims ecl_grid_dims.c ) -target_link_libraries( ecl_grid_dims ecl ) - -add_test( ecl_grid_dims0 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_dims ) -add_test( ecl_grid_dims1 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_dims ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.INIT ) -add_test( ecl_grid_dims2 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_dims ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.GRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.INIT) -add_test( ecl_grid_dims3 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_dims ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) -add_test( ecl_grid_dims4 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_dims ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.GRID ) -add_test( ecl_grid_dims5 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_dims ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.EGRID ) - - - -add_executable( ecl_nnc_test ecl_nnc_test.c ) -target_link_libraries( ecl_nnc_test ecl ) -add_test (ecl_nnc_test1 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) -add_test (ecl_nnc_test2 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID ) -add_test (ecl_nnc_test3 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID) -add_test (ecl_nnc_test4 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/DualPoro/DUAL_DIFF.EGRID ) -add_test (ecl_nnc_test5 ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/nestedLGRcase/TESTCASE_NESTEDLGR.EGRID) - - -add_executable( ecl_layer_statoil ecl_layer_statoil.c ) -target_link_libraries( ecl_layer_statoil ecl ) -add_test(ecl_layer_statoil ${EXECUTABLE_OUTPUT_PATH}/ecl_layer_statoil ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Mariner/MARINER.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Mariner/faultblock.grdecl) - - - -add_executable( ecl_dualp ecl_dualp.c ) -target_link_libraries( ecl_dualp ecl ) -add_test( ecl_dualp ${EXECUTABLE_OUTPUT_PATH}/ecl_dualp ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2 ) - -add_executable( ecl_sum_test ecl_sum_test.c ) -target_link_libraries( ecl_sum_test ecl ) -add_test( ecl_sum_test ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ) - -add_executable( ecl_sum_report_step_equal ecl_sum_report_step_equal.c ) -target_link_libraries( ecl_sum_report_step_equal ecl ) -add_test( ecl_sum_report_step_equal1 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_equal ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Snorre/SNORRE FALSE) -add_test( ecl_sum_report_step_equal2 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_equal ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE TRUE) -add_test( ecl_sum_report_step_equal3 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_equal ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/modGurbat/extraMinistep/ECLIPSE TRUE) -add_test( ecl_sum_report_step_equal4 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_equal ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/modGurbat/short/ECLIPSE FALSE) -add_test( ecl_sum_report_step_equal5 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_equal ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/modGurbat/enkf/ECLIPSE FALSE) -add_test( ecl_sum_report_step_equal6 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_equal ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Snorre/SNORRE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Snorre2/SNORRE2 FALSE) - -add_executable( ecl_sum_report_step_compatible ecl_sum_report_step_compatible.c ) -target_link_libraries( ecl_sum_report_step_compatible ecl ) -add_test( ecl_sum_report_step_compatible1 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_compatible ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Snorre/SNORRE FALSE) -add_test( ecl_sum_report_step_compatible2 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_compatible ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE TRUE) -add_test( ecl_sum_report_step_compatible3 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_compatible ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/modGurbat/extraMinistep/ECLIPSE TRUE) -add_test( ecl_sum_report_step_compatible4 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_compatible ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/modGurbat/short/ECLIPSE TRUE) -add_test( ecl_sum_report_step_compatible5 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_compatible ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/modGurbat/enkf/ECLIPSE TRUE) -add_test( ecl_sum_report_step_compatible6 ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_report_step_equal ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Snorre/SNORRE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Snorre2/SNORRE2 FALSE) - -if (HAVE_UTIL_ABORT_INTERCEPT) - add_executable( ecl_fortio ecl_fortio.c ) - target_link_libraries( ecl_fortio ecl ) - add_test( ecl_fortio ${EXECUTABLE_OUTPUT_PATH}/ecl_fortio ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST ) - set_property( TEST ecl_fortio PROPERTY LABELS StatoilData) -endif() - -add_executable( ecl_file ecl_file.c ) -target_link_libraries( ecl_file ecl ) -add_test( ecl_file ${EXECUTABLE_OUTPUT_PATH}/ecl_file ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST ECLIPSE.UNRST) - -add_executable( ecl_fmt ecl_fmt.c ) -target_link_libraries( ecl_fmt ecl ) -add_test( ecl_fmt ${EXECUTABLE_OUTPUT_PATH}/ecl_fmt ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.DATA) - - -add_executable( ecl_rsthead ecl_rsthead.c ) -target_link_libraries( ecl_rsthead ecl ) -add_test( ecl_rsthead ${EXECUTABLE_OUTPUT_PATH}/ecl_rsthead ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/DualPoro/DUALPORO.X0005 ) - -add_executable( ecl_smspec ecl_smspec.c ) -target_link_libraries( ecl_smspec ecl ) -add_test( ecl_smspec ${EXECUTABLE_OUTPUT_PATH}/ecl_smspec ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.SMSPEC - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Heidrun/Summary/FF12_2013B3_CLEAN_RS.SMSPEC ) - - -add_executable( ecl_rft ecl_rft.c ) -target_link_libraries( ecl_rft ecl ) -add_test( ecl_rft_rft ${EXECUTABLE_OUTPUT_PATH}/ecl_rft ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.RFT RFT) -add_test( ecl_rft_rft_rw ${EXECUTABLE_OUTPUT_PATH}/ecl_rft ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.RFT RFT_RW) -add_test( ecl_rft_plt ${EXECUTABLE_OUTPUT_PATH}/ecl_rft ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/RFT/TEST1_1A.RFT PLT) -add_test( ecl_rft_plt ${EXECUTABLE_OUTPUT_PATH}/ecl_rft ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/RFT/RFT2.RFT MSW-PLT) - -add_executable( ecl_grid_copy_statoil ecl_grid_copy_statoil.c ) -target_link_libraries( ecl_grid_copy_statoil ecl ) - -add_test( ecl_grid_copy_statoil1 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_copy_statoil ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) - -add_test( ecl_grid_copy_statoil2 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_copy_statoil ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Mariner/MARINER.EGRID ) - -add_test( ecl_grid_copy_statoil3 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_copy_statoil ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2.EGRID ) - -add_test( ecl_grid_copy_statoil4 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_copy_statoil ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID ) - - - - -add_executable( ecl_fault_block_layer_statoil ecl_fault_block_layer_statoil.c ) -target_link_libraries( ecl_fault_block_layer_statoil ecl ) -add_test( ecl_fault_block_layer_statoil ${EXECUTABLE_OUTPUT_PATH}/ecl_fault_block_layer_statoil - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Mariner/MARINER.EGRID - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Mariner/faultblock.grdecl) - - -set_property( TEST ecl_fault_block_layer_statoil PROPERTY LABELS StatoilData ) -set_property( TEST ecl_fmt PROPERTY LABELS StatoilData ) -set_property( TEST ecl_coarse_test PROPERTY LABELS StatoilData ) -set_property( TEST ecl_restart_test PROPERTY LABELS StatoilData ) -set_property( TEST ecl_lgr_test1 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_lgr_test2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_lgr_test3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_lgr_name PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_simple PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_export PROPERTY LABELS StatoilData ) -set_property( TEST ecl_dualp PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_test PROPERTY LABELS StatoilData ) - -set_property( TEST ecl_sum_report_step_equal1 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_equal2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_equal3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_equal4 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_equal5 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_equal6 PROPERTY LABELS StatoilData ) - -set_property( TEST ecl_sum_report_step_compatible1 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_compatible2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_compatible3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_compatible4 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_compatible5 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_sum_report_step_compatible6 PROPERTY LABELS StatoilData ) - - - -set_property( TEST ecl_grid_dims1 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_dims2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_dims3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_dims4 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_dims5 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_test1 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_test2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_test3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_test4 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_test5 PROPERTY LABELS StatoilData ) - -set_property( TEST ecl_grid_fwrite PROPERTY LABELS StatoilData) -set_property( TEST ecl_file PROPERTY LABELS StatoilData) -set_property( TEST ecl_rsthead PROPERTY LABELS StatoilData) -set_property( TEST ecl_region PROPERTY LABELS StatoilData) -set_property( TEST ecl_region2region PROPERTY LABELS StatoilData) -set_property( TEST ecl_grid_case PROPERTY LABELS StatoilData) -set_property( TEST ecl_rft_rft PROPERTY LABELS StatoilData) -set_property( TEST ecl_rft_plt PROPERTY LABELS StatoilData) -set_property( TEST ecl_rft_rft_rw PROPERTY LABELS StatoilData) -set_property( TEST ecl_sum_case_exists PROPERTY LABELS StatoilData) -set_property( TEST ecl_grid_volume1 PROPERTY LABELS StatoilData) -set_property( TEST ecl_grid_volume2 PROPERTY LABELS StatoilData) -#set_property( TEST ecl_grid_volume3 PROPERTY LABELS StatoilData) -set_property( TEST ecl_grid_cell_contains2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_cell_contains3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_cell_contains4 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_cell_volume2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_cell_volume3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_export1 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_export2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_export3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_export4 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_export5 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_export6 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_export7 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_nnc_export_get_tran PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_cell_contains2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_copy_statoil1 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_copy_statoil2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_copy_statoil3 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_copy_statoil4 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_layer_statoil PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_layer_contains1 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_layer_contains2 PROPERTY LABELS StatoilData ) -set_property( TEST ecl_grid_ecl2015_2 PROPERTY LABELS StatoilData ) diff --git a/ThirdParty/Ert/libecl/tests/tests.cmake b/ThirdParty/Ert/libecl/tests/tests.cmake deleted file mode 100644 index 9da02ab0f8..0000000000 --- a/ThirdParty/Ert/libecl/tests/tests.cmake +++ /dev/null @@ -1,119 +0,0 @@ -add_executable( ecl_nnc_geometry ecl_nnc_geometry.c ) -target_link_libraries( ecl_nnc_geometry ecl ) -add_test( ecl_nnc_geometry ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_geometry ) - -add_executable( ecl_alloc_grid_dxv_dyv_dzv ecl_alloc_grid_dxv_dyv_dzv.c ) -target_link_libraries( ecl_alloc_grid_dxv_dyv_dzv ecl ) -add_test( ecl_alloc_grid_dxv_dyv_dzv ${EXECUTABLE_OUTPUT_PATH}/ecl_alloc_grid_dxv_dyv_dzv ) - -add_executable( ecl_alloc_cpgrid ecl_alloc_cpgrid.c ) -target_link_libraries( ecl_alloc_cpgrid ecl ) -add_test( ecl_alloc_cpgrid ${EXECUTABLE_OUTPUT_PATH}/ecl_alloc_cpgrid ) - -add_executable( ecl_kw_init ecl_kw_init.c ) -target_link_libraries( ecl_kw_init ecl ) -add_test( ecl_kw_init ${EXECUTABLE_OUTPUT_PATH}/ecl_kw_init ) - -add_executable( ecl_grid_init_fwrite ecl_grid_init_fwrite.c ) -target_link_libraries( ecl_grid_init_fwrite ecl ) -add_test( ecl_grid_init_fwrite ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_init_fwrite ) - -add_executable( ecl_init_file ecl_init_file.c ) -target_link_libraries( ecl_init_file ecl ) -add_test( ecl_init_file ${EXECUTABLE_OUTPUT_PATH}/ecl_kw_init ) - -add_executable( ecl_kw_fread ecl_kw_fread.c ) -target_link_libraries( ecl_kw_fread ecl ) -add_test( ecl_kw_fread ${EXECUTABLE_OUTPUT_PATH}/ecl_kw_fread ) - -add_executable( ecl_valid_basename ecl_valid_basename.c ) -target_link_libraries( ecl_valid_basename ecl ) -add_test( ecl_valid_basename ${EXECUTABLE_OUTPUT_PATH}/ecl_valid_basename) - -add_executable( ecl_util_make_date_no_shift ecl_util_make_date_no_shift.c ) -target_link_libraries( ecl_util_make_date_no_shift ecl ) -add_test( ecl_util_make_date_no_shift ${EXECUTABLE_OUTPUT_PATH}/ecl_util_make_date_no_shift ) - -add_executable( ecl_sum_writer ecl_sum_writer.c ) -target_link_libraries( ecl_sum_writer ecl ) -add_test( ecl_sum_writer ${EXECUTABLE_OUTPUT_PATH}/ecl_sum_writer ) - -add_executable( ecl_grid_add_nnc ecl_grid_add_nnc.c ) -target_link_libraries( ecl_grid_add_nnc ecl ) -add_test( ecl_grid_add_nnc ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_add_nnc ) - -add_executable( ecl_grid_create ecl_grid_create.c ) -target_link_libraries( ecl_grid_create ecl ) -add_test( ecl_grid_create ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_create ) - -add_executable( ecl_grid_DEPTHZ ecl_grid_DEPTHZ.c ) -target_link_libraries( ecl_grid_DEPTHZ ecl ) -add_test( ecl_grid_DEPTHZ ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_DEPTHZ ) - -add_executable( ecl_grid_reset_actnum ecl_grid_reset_actnum.c ) -target_link_libraries( ecl_grid_reset_actnum ecl ) -add_test( ecl_grid_reset_actnum ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_reset_actnum ) - -add_executable( ecl_nnc_info_test ecl_nnc_info_test.c ) -target_link_libraries( ecl_nnc_info_test ecl ) -add_test (ecl_nnc_info_test ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_info_test ) - -add_executable( ecl_nnc_vector ecl_nnc_vector.c ) -target_link_libraries( ecl_nnc_vector ecl ) -add_test(ecl_nnc_vector ${EXECUTABLE_OUTPUT_PATH}/ecl_nnc_vector ) - -add_executable( ecl_kw_grdecl ecl_kw_grdecl.c ) -target_link_libraries( ecl_kw_grdecl ecl ) -add_test( ecl_kw_grdecl ${EXECUTABLE_OUTPUT_PATH}/ecl_kw_grdecl ) - -add_executable( ecl_kw_equal ecl_kw_equal.c ) -target_link_libraries( ecl_kw_equal ecl ) -add_test( ecl_kw_equal ${EXECUTABLE_OUTPUT_PATH}/ecl_kw_equal ) - -add_executable( ecl_kw_cmp_string ecl_kw_cmp_string.c ) -target_link_libraries( ecl_kw_cmp_string ecl ) -add_test( ecl_kw_cmp_string ${EXECUTABLE_OUTPUT_PATH}/ecl_kw_cmp_string ) - -add_executable( ecl_util_month_range ecl_util_month_range.c ) -target_link_libraries( ecl_util_month_range ecl ) -add_test( ecl_util_month_range ${EXECUTABLE_OUTPUT_PATH}/ecl_util_month_range ) - -if (HAVE_UTIL_ABORT_INTERCEPT) - add_executable( ecl_grid_corner ecl_grid_corner.c ) - target_link_libraries( ecl_grid_corner ecl ) - add_test( ecl_grid_corner ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_corner ) - - add_executable( ecl_layer ecl_layer.c ) - target_link_libraries( ecl_layer ecl ) - add_test(ecl_layer ${EXECUTABLE_OUTPUT_PATH}/ecl_layer ) -endif() - -add_executable( ecl_rft_cell ecl_rft_cell.c ) -target_link_libraries( ecl_rft_cell ecl ) -add_test( ecl_rft_cell ${EXECUTABLE_OUTPUT_PATH}/ecl_rft_cell ) - -add_executable( ecl_grid_copy ecl_grid_copy.c ) -target_link_libraries( ecl_grid_copy ecl ) -add_test( ecl_grid_copy ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_copy ) - -add_executable( ecl_get_num_cpu ecl_get_num_cpu_test.c ) -target_link_libraries( ecl_get_num_cpu ecl ) -add_test( ecl_get_num_cpu ${EXECUTABLE_OUTPUT_PATH}/ecl_get_num_cpu - ${PROJECT_SOURCE_DIR}/libecl/tests/data/num_cpu1 - ${PROJECT_SOURCE_DIR}/libecl/tests/data/num_cpu2 - ${PROJECT_SOURCE_DIR}/libecl/tests/data/num_cpu3 - ${PROJECT_SOURCE_DIR}/libecl/tests/data/num_cpu4 ) - -add_executable( ecl_fault_block_layer ecl_fault_block_layer.c ) -target_link_libraries( ecl_fault_block_layer ecl ) -add_test( ecl_fault_block_layer ${EXECUTABLE_OUTPUT_PATH}/ecl_fault_block_layer ) - -add_executable( ecl_grid_export ecl_grid_export.c ) -target_link_libraries( ecl_grid_export ecl ) -add_test( ecl_grid_export ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_export ) - -add_executable( ecl_rst_file ecl_rst_file.c ) -target_link_libraries( ecl_rst_file ecl ert_util ) -add_test( ecl_rst_file ${EXECUTABLE_OUTPUT_PATH}/ecl_rst_file ) - -add_test( ecl_grid_cell_contains1 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_cell_contains ) diff --git a/ThirdParty/Ert/libecl_well/CMakeLists.txt b/ThirdParty/Ert/libecl_well/CMakeLists.txt deleted file mode 100644 index c59e944fce..0000000000 --- a/ThirdParty/Ert/libecl_well/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_subdirectory( src ) -if (BUILD_APPLICATIONS) - add_subdirectory( applications ) -endif() - -if (BUILD_TESTS) - add_subdirectory( tests ) -endif() diff --git a/ThirdParty/Ert/libecl_well/applications/CMakeLists.txt b/ThirdParty/Ert/libecl_well/applications/CMakeLists.txt deleted file mode 100644 index e5a5e0d173..0000000000 --- a/ThirdParty/Ert/libecl_well/applications/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -add_executable( segment_info segment_info.c ) -add_executable( CF_dump well_CF_dump.c ) -add_executable( ri_well_test ri_well_test.c ) - -set(program_list segment_info CF_dump ri_well_test) -foreach(prog ${program_list}) - target_link_libraries( ${prog} ecl_well ecl) - if (USE_RUNPATH) - add_runpath( ${prog} ) - endif() - - - #----------------------------------------------------------------- - - if (WELL_INSTALL_PREFIX) - set (destination ${CMAKE_INSTALL_PREFIX}/${WELL_INSTALL_PREFIX}/bin) - else() - set (destination ${CMAKE_INSTALL_PREFIX}/bin) - endif() - - if (INSTALL_ERT) - install(TARGETS ${prog} DESTINATION ${destination}) - if (INSTALL_GROUP) - install(CODE "EXECUTE_PROCESS(COMMAND chgrp ${INSTALL_GROUP} ${destination}/${prog})") - install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/${prog})") - endif() - endif() -endforeach() diff --git a/ThirdParty/Ert/libecl_well/src/CMakeLists.txt b/ThirdParty/Ert/libecl_well/src/CMakeLists.txt deleted file mode 100644 index 84eacde50a..0000000000 --- a/ThirdParty/Ert/libecl_well/src/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -set( source_files - well_state.c - well_conn.c - well_info.c - well_ts.c - well_conn_collection.c - well_segment.c - well_segment_collection.c - well_branch_collection.c - well_rseg_loader.c -) - -set( header_files - well_state.h - well_const.h - well_conn.h - well_info.h - well_ts.h - well_conn_collection.h - well_segment.h - well_segment_collection.h - well_branch_collection.h - well_rseg_loader.h -) - -if (NOT ERT_WINDOWS) - set_property( SOURCE well_branch_collection.c well_segment.c well_segment_collection.c well_conn_collection.c well_conn.c PROPERTY COMPILE_FLAGS "-Werror") -endif() - - -include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) -include_directories( ${libgeometry_src_path} ) - - -add_library( ecl_well ${source_files} ) -set_target_properties( ecl_well PROPERTIES VERSION ${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR} SOVERSION ${ERT_VERSION_MAJOR} ) -target_link_libraries( ecl_well ecl ) -if (USE_RUNPATH) - add_runpath( ecl_well ) -endif() - - -#----------------------------------------------------------------- -if (INSTALL_ERT) - install(TARGETS ecl_well DESTINATION ${CMAKE_INSTALL_LIBDIR}) - foreach(header ${header_files}) - install(FILES ../include/ert/ecl_well/${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ert/ecl_well) - endforeach() -endif() - - diff --git a/ThirdParty/Ert/libecl_well/tests/CMakeLists.txt b/ThirdParty/Ert/libecl_well/tests/CMakeLists.txt deleted file mode 100644 index 4e6569740a..0000000000 --- a/ThirdParty/Ert/libecl_well/tests/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -include( tests.cmake ) -if (STATOIL_TESTDATA_ROOT) - include( statoil_tests.cmake ) -endif() - - - - - - - - diff --git a/ThirdParty/Ert/libecl_well/tests/statoil_tests.cmake b/ThirdParty/Ert/libecl_well/tests/statoil_tests.cmake deleted file mode 100644 index 85be1f7494..0000000000 --- a/ThirdParty/Ert/libecl_well/tests/statoil_tests.cmake +++ /dev/null @@ -1,100 +0,0 @@ -add_executable( well_state_load well_state_load.c ) -target_link_libraries( well_state_load ecl_well ) -set_target_properties( well_state_load PROPERTIES COMPILE_FLAGS "-Werror") - -add_executable( well_state_load_missing_RSEG well_state_load_missing_RSEG.c ) -target_link_libraries( well_state_load_missing_RSEG ecl_well ) -set_target_properties( well_state_load_missing_RSEG PROPERTIES COMPILE_FLAGS "-Werror") - -add_test( well_state_load1 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.X0030) - -add_test( well_state_load2 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.EGRID - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.X0021) - -add_test( well_state_load3 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW/MSW.EGRID - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW/MSW.X0123) - -add_test( well_state_load4 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/LGR.EGRID - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/LGR.X0095) - -add_test( well_state_load5 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.X0061) - -add_test( well_state_load_missing_RSEG1 ${EXECUTABLE_OUTPUT_PATH}/well_state_load_missing_RSEG ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.X0061) - -add_test( well_state_load_missing_RSEG2 ${EXECUTABLE_OUTPUT_PATH}/well_state_load_missing_RSEG ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW/MSW.EGRID - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW/MSW.X0123) - - -add_executable( well_segment_load well_segment_load.c ) -target_link_libraries( well_segment_load ecl_well ) -set_target_properties( well_segment_load PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_segment_load ${EXECUTABLE_OUTPUT_PATH}/well_segment_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.X0021) - - -add_executable( well_segment_branch_conn_load well_segment_branch_conn_load.c ) -target_link_libraries( well_segment_branch_conn_load ecl_well ) -set_target_properties( well_segment_branch_conn_load PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_segment_branch_conn_load ${EXECUTABLE_OUTPUT_PATH}/well_segment_branch_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.X0021) - -add_executable( well_info well_info.c ) -target_link_libraries( well_info ecl_well ) -set_target_properties( well_info PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_info ${EXECUTABLE_OUTPUT_PATH}/well_info ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) - - -add_executable( well_conn_CF well_conn_CF.c ) -target_link_libraries( well_conn_CF ecl_well ) -add_test( well_conn_CF ${EXECUTABLE_OUTPUT_PATH}/well_conn_CF ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.X0060) - -add_executable( well_conn_load well_conn_load.c ) -target_link_libraries( well_conn_load ecl_well ) -set_target_properties( well_conn_load PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_conn_load1 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.X0030 F) -add_test( well_conn_load2 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.X0021 F) -add_test( well_conn_load3 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.X0021 T) -add_test( well_conn_load4 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.X0021 F) -add_test( well_conn_load5 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/DualPoro/DUALPORO.X0009 F) -add_test( well_conn_load6 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003 F) - -add_executable( well_ts well_ts.c ) -target_link_libraries( well_ts ecl_well ) -add_test( well_ts ${EXECUTABLE_OUTPUT_PATH}/well_ts ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/CO2case/BASE_CASE ) - - -add_executable( well_dualp well_dualp.c ) -target_link_libraries( well_dualp ecl_well ) -add_test( well_dualp ${EXECUTABLE_OUTPUT_PATH}/well_dualp ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST - ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/DualPoro/DUALPORO.X0005 ) - -add_executable( well_lgr_load well_lgr_load.c ) -target_link_libraries( well_lgr_load ecl_well ) - -add_test( well_lgr_load1 ${EXECUTABLE_OUTPUT_PATH}/well_lgr_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003) -add_test( well_lgr_load2 ${EXECUTABLE_OUTPUT_PATH}/well_lgr_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.X0016) - -set_property( TEST well_lgr_load1 PROPERTY LABELS StatoilData ) -set_property( TEST well_lgr_load2 PROPERTY LABELS StatoilData ) -set_property( TEST well_dualp PROPERTY LABELS StatoilData ) -set_property( TEST well_state_load1 PROPERTY LABELS StatoilData ) -set_property( TEST well_state_load2 PROPERTY LABELS StatoilData ) -set_property( TEST well_state_load3 PROPERTY LABELS StatoilData ) -set_property( TEST well_state_load4 PROPERTY LABELS StatoilData ) -set_property( TEST well_state_load5 PROPERTY LABELS StatoilData ) -set_property( TEST well_state_load_missing_RSEG1 PROPERTY LABELS StatoilData ) -set_property( TEST well_state_load_missing_RSEG2 PROPERTY LABELS StatoilData ) -set_property( TEST well_dualp PROPERTY LABELS StatoilData ) -set_property( TEST well_conn_load1 PROPERTY LABELS StatoilData ) -set_property( TEST well_conn_load2 PROPERTY LABELS StatoilData ) -set_property( TEST well_conn_load3 PROPERTY LABELS StatoilData ) -set_property( TEST well_conn_load4 PROPERTY LABELS StatoilData ) -set_property( TEST well_conn_load5 PROPERTY LABELS StatoilData ) -set_property( TEST well_conn_load6 PROPERTY LABELS StatoilData ) -set_property( TEST well_conn_CF PROPERTY LABELS StatoilData ) -set_property( TEST well_info PROPERTY LABELS StatoilData ) -set_property( TEST well_segment_load PROPERTY LABELS StatoilData ) -set_property( TEST well_segment_branch_conn_load PROPERTY LABELS StatoilData ) -set_property( TEST well_ts PROPERTY LABELS StatoilData ) - diff --git a/ThirdParty/Ert/libecl_well/tests/tests.cmake b/ThirdParty/Ert/libecl_well/tests/tests.cmake deleted file mode 100644 index 20dc5381ba..0000000000 --- a/ThirdParty/Ert/libecl_well/tests/tests.cmake +++ /dev/null @@ -1,35 +0,0 @@ -add_executable( well_conn_collection well_conn_collection.c ) -target_link_libraries( well_conn_collection ecl_well ) -set_target_properties( well_conn_collection PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_conn_collection ${EXECUTABLE_OUTPUT_PATH}/well_conn_collection ) - -add_executable( well_branch_collection well_branch_collection.c ) -target_link_libraries( well_branch_collection ecl_well ) -set_target_properties( well_branch_collection PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_branch_collection ${EXECUTABLE_OUTPUT_PATH}/well_branch_collection ) - -add_executable( well_conn well_conn.c ) -target_link_libraries( well_conn ecl_well ) -set_target_properties( well_conn PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_conn ${EXECUTABLE_OUTPUT_PATH}/well_conn ) - -add_executable( well_state well_state.c ) -target_link_libraries( well_state ecl_well ) -set_target_properties( well_state PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_state ${EXECUTABLE_OUTPUT_PATH}/well_state ) - -add_executable( well_segment well_segment.c ) -target_link_libraries( well_segment ecl_well ) -set_target_properties( well_segment PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_segment ${EXECUTABLE_OUTPUT_PATH}/well_segment ) - -add_executable( well_segment_conn well_segment_conn.c ) -target_link_libraries( well_segment_conn ecl_well ) -set_target_properties( well_segment_conn PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_segment_conn ${EXECUTABLE_OUTPUT_PATH}/well_segment_conn ) - -add_executable( well_segment_collection well_segment_collection.c ) -target_link_libraries( well_segment_collection ecl_well ) -set_target_properties( well_segment_collection PROPERTIES COMPILE_FLAGS "-Werror") -add_test( well_segment_collection ${EXECUTABLE_OUTPUT_PATH}/well_segment_collection ) - diff --git a/ThirdParty/Ert/libeclxx/CMakeLists.txt b/ThirdParty/Ert/libeclxx/CMakeLists.txt deleted file mode 100644 index df9670eb2d..0000000000 --- a/ThirdParty/Ert/libeclxx/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_subdirectory( src ) - -if (BUILD_TESTS) - add_subdirectory( tests ) -endif() diff --git a/ThirdParty/Ert/libeclxx/src/CMakeLists.txt b/ThirdParty/Ert/libeclxx/src/CMakeLists.txt deleted file mode 100644 index 4a108238a8..0000000000 --- a/ThirdParty/Ert/libeclxx/src/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -set( source_files - FortIO.cpp - Smspec.cpp - EclFilename.cpp - ) - -set( header_files - EclKW.hpp - FortIO.hpp - Smspec.hpp - EclFilename.hpp - ) - - -add_library( eclxx ${source_files} ) -set_target_properties( eclxx PROPERTIES VERSION ${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR} SOVERSION ${ERT_VERSION_MAJOR}) -if (USE_RUNPATH) - add_runpath( eclxx ) -endif() -target_link_libraries( eclxx ecl ) - - -if (INSTALL_ERT) - install(TARGETS eclxx DESTINATION ${CMAKE_INSTALL_LIBDIR}) - foreach(header ${header_files}) - install(FILES ../include/ert/ecl/${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ert/ecl) - endforeach() -endif() diff --git a/ThirdParty/Ert/libeclxx/tests/CMakeLists.txt b/ThirdParty/Ert/libeclxx/tests/CMakeLists.txt deleted file mode 100644 index be233b2ae3..0000000000 --- a/ThirdParty/Ert/libeclxx/tests/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -add_executable(eclxx_kw eclxx_kw.cpp) -target_link_libraries(eclxx_kw eclxx ert_utilxx) -add_test(eclxx_kw ${EXECUTABLE_OUTPUT_PATH}/eclxx_kw) - -add_executable(eclxx_fortio eclxx_fortio.cpp) -target_link_libraries(eclxx_fortio eclxx ert_utilxx) -add_test(eclxx_fortio ${EXECUTABLE_OUTPUT_PATH}/eclxx_fortio) - -add_executable(eclxx_smspec eclxx_smspec.cpp) -target_link_libraries(eclxx_smspec eclxx ert_utilxx) -add_test(eclxx_smspec ${EXECUTABLE_OUTPUT_PATH}/eclxx_smspec) - -add_executable(eclxx_filename eclxx_filename.cpp) -target_link_libraries(eclxx_filename eclxx ert_utilxx) -add_test(eclxx_filename ${EXECUTABLE_OUTPUT_PATH}/eclxx_filename) - -add_executable(eclxx_types eclxx_types.cpp) -target_link_libraries(eclxx_types eclxx ert_utilxx) -add_test(eclxx_types ${EXECUTABLE_OUTPUT_PATH}/eclxx_types) diff --git a/ThirdParty/Ert/libert_util/CMakeLists.txt b/ThirdParty/Ert/libert_util/CMakeLists.txt deleted file mode 100644 index d7eabe992a..0000000000 --- a/ThirdParty/Ert/libert_util/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_subdirectory( include/ert/util ) - -add_subdirectory( src ) -if (BUILD_TESTS) - add_subdirectory( tests ) -endif() - -if (BUILD_APPLICATIONS) - add_subdirectory( applications ) -endif() diff --git a/ThirdParty/Ert/libert_util/applications/CMakeLists.txt b/ThirdParty/Ert/libert_util/applications/CMakeLists.txt deleted file mode 100644 index 9bd1440c95..0000000000 --- a/ThirdParty/Ert/libert_util/applications/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -if (HAVE_PTHREAD) - add_subdirectory( block_fs ) -endif() diff --git a/ThirdParty/Ert/libert_util/applications/block_fs/CMakeLists.txt b/ThirdParty/Ert/libert_util/applications/block_fs/CMakeLists.txt deleted file mode 100644 index 39b891f041..0000000000 --- a/ThirdParty/Ert/libert_util/applications/block_fs/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -add_executable( bls bls.c ) - -target_link_libraries( bls ert_util ) - -if (USE_RUNPATH) - add_runpath( bls ) -endif() - - -set (destination ${CMAKE_INSTALL_PREFIX}/bin) -if (INSTALL_ERT) - install(TARGETS bls DESTINATION ${destination}) - if (INSTALL_GROUP) - install(CODE "EXECUTE_PROCESS(COMMAND chgrp ${INSTALL_GROUP} ${destination}/bls)") - install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/bls)") - endif() -endif() - diff --git a/ThirdParty/Ert/libert_util/include/ert/util/CMakeLists.txt b/ThirdParty/Ert/libert_util/include/ert/util/CMakeLists.txt deleted file mode 100644 index ddfa513b65..0000000000 --- a/ThirdParty/Ert/libert_util/include/ert/util/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -set(header_files) - -foreach (type int double bool long time_t size_t float) - set(TYPE ${type} ) - set(header_target ${type}_vector.h) - - configure_file( vector_template.h ${header_target}) - - list( APPEND header_files ${CMAKE_CURRENT_BINARY_DIR}/${header_target} ) -endforeach( type ) - -if (MSVC) - configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/msvc_stdbool.h ${CMAKE_CURRENT_BINARY_DIR}/stdbool.h) - list( APPEND header_files ${CMAKE_CURRENT_BINARY_DIR}/stdbool.h) -endif() - -configure_file(build_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/build_config.h) -configure_file(ert_api_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/ert_api_config.h) -list( APPEND header_files ${CMAKE_CURRENT_BINARY_DIR}/ert_api_config.h) - -if (INSTALL_ERT) - foreach(header ${header_files}) - install(FILES ${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ert/util) - endforeach() -endif() - - - - diff --git a/ThirdParty/Ert/libert_util/src/CMakeLists.txt b/ThirdParty/Ert/libert_util/src/CMakeLists.txt deleted file mode 100644 index e2a9d9c228..0000000000 --- a/ThirdParty/Ert/libert_util/src/CMakeLists.txt +++ /dev/null @@ -1,183 +0,0 @@ -include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) - -set(source_files - rng.c - lookup_table.c - statistics.c - mzran.c - set.c - hash_node.c - hash_sll.c - hash.c - node_data.c - node_ctype.c - util.c - msg.c - arg_pack.c - path_fmt.c - menu.c - subst_list.c - subst_func.c - vector.c - parser.c - stringlist.c - matrix.c - buffer.c - log.c - template.c - timer.c - time_interval.c - string_util.c - type_vector_functions.c - ui_return.c - ert_version.c - struct_vector.c - perm_vector.c - test_util.c -) - -set(header_files - ssize_t.h - type_macros.h - rng.h - lookup_table.h - statistics.h - mzran.h - set.h - hash.h - hash_node.h - hash_sll.h - node_data.h - node_ctype.h - util.h - msg.h - arg_pack.h - path_fmt.h - stringlist.h - menu.h - subst_list.h - subst_func.h - vector.h - parser.h - matrix.h - buffer.h - log.h - template.h - timer.h - time_interval.h - string_util.h - type_vector_functions.h - ui_return.h - struct_vector.h - buffer_string.h - perm_vector.h - ert_version.h - test_util.h -) - - - -# Add compile time variable values to ert_version.c -if (ERT_WINDOWS) - execute_process(COMMAND cmd.exe /c "echo %date% %time%" OUTPUT_VARIABLE BUILD_TIME ) -else() # Linux or Darwin - execute_process(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE BUILD_TIME ) -endif() -string(STRIP ${BUILD_TIME} BUILD_TIME) - -find_package(Git) -if(GIT_FOUND) - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT_SHORT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) -else() - set( GIT_COMMIT "unknown (git not found!)") - set( GIT_COMMIT_SHORT "unknown (git not found!)") - message( WARNING "Git not found. Build will not contain git revision info." ) -endif() - -set_source_files_properties( ert_version.c PROPERTIES COMPILE_DEFINITIONS "COMPILE_TIME_STAMP=\"${BUILD_TIME}\";GIT_COMMIT=\"${GIT_COMMIT}\";GIT_COMMIT_SHORT=\"${GIT_COMMIT_SHORT}\";ERT_VERSION_MAJOR=${ERT_VERSION_MAJOR};ERT_VERSION_MINOR=${ERT_VERSION_MINOR};ERT_VERSION_MICRO=\"${ERT_VERSION_MICRO}\"") - - -if (CMAKE_COMPILER_IS_GNUCC) - set_property(SOURCE hash.c PROPERTY COMPILE_FLAGS "-Wno-error") -endif() - -if (ERT_HAVE_LAPACK) - list( APPEND source_files matrix_lapack.c matrix_blas.c matrix_stat.c regression.c lars.c stepwise.c) - list( APPEND header_files matrix_lapack.h matrix_blas.h matrix_stat.h regression.h lars.h stepwise.h) -endif() - -if (ERT_HAVE_UNISTD) - list( APPEND source_files path_stack.c ) - list( APPEND header_files path_stack.h ) -endif() - -foreach (type int double bool long time_t size_t float) - set(TYPE ${type} ) - set(src_target ${CMAKE_CURRENT_BINARY_DIR}/${type}_vector.c) - - configure_file( vector_template.c ${src_target}) - - list( APPEND source_files ${src_target} ) -endforeach( type ) - -find_program (PING_PATH ping) -if (PING_PATH) - add_definitions( -DPING_CMD=\"${PING_PATH}\") -endif() - -if (ERT_HAVE_THREAD_POOL) - list( APPEND header_files thread_pool.h ) - list( APPEND source_files thread_pool.c ) -endif() - - -# The block_fs filesystem is so heavily dependant on pthreads that it is not -# built if de not have pthreads. - -if (HAVE_PTHREAD) - list( APPEND source_files block_fs.c ) - list( APPEND header_files block_fs.h ) -endif() - -# The test_work_area depends on that opendir() is available. -if (ERT_HAVE_GETUID AND ERT_HAVE_OPENDIR) - list( APPEND source_files test_work_area.c) - list( APPEND header_files test_work_area.h) -endif() - -if (ERT_BUILD_CXX) - list( APPEND header_files test_util.hpp ) -endif() - -add_library( ert_util ${source_files} ) - -message(STATUS "Linking with: ${ERT_EXTERNAL_UTIL_LIBS}") -set_target_properties( ert_util PROPERTIES VERSION ${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR} SOVERSION ${ERT_VERSION_MAJOR} ) -if (USE_RUNPATH) - add_runpath( ert_util ) -endif() -target_link_libraries( ert_util ${ERT_EXTERNAL_UTIL_LIBS} ) - -#----------------------------------------------------------------- -if (INSTALL_ERT) - install(TARGETS ert_util DESTINATION ${CMAKE_INSTALL_LIBDIR}) - - foreach(header ${header_files}) - install(FILES ../include/ert/util/${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ert/util) - endforeach() -endif() - - - diff --git a/ThirdParty/Ert/libert_util/src/buffer_string.c b/ThirdParty/Ert/libert_util/src/buffer_string.c deleted file mode 100644 index ab8ed74dc1..0000000000 --- a/ThirdParty/Ert/libert_util/src/buffer_string.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - The functions buffer_fread_string() and buffer_fwrite_string() - should not be used; the embedded integer just creates chaos and - should the sole responsability of the calling scope. -*/ - -/** - Storing strings: - ---------------- - - When storing a string (\0 terminated char pointer) what is actually - written to the buffer is - - 1. The length of the string - as returned from strlen(). - 2. The string content INCLUDING the terminating \0. - - -*/ - - -/** - This function will return a pointer to the current position in the - buffer, and advance the buffer position forward until a \0 - terminater is found. If \0 is not found the thing will abort(). - - Observe that the return value will point straight into the buffer, - this is highly volatile memory, and in general it will be safer to - use buffer_fread_alloc_string() to get a copy of the string. -*/ - -const char * buffer_fread_string(buffer_type * buffer) { - int string_length = buffer_fread_int( buffer ); - char * string_ptr = &buffer->data[buffer->pos]; - char c; - buffer_fskip( buffer , string_length ); - c = buffer_fread_char( buffer ); - if (c != '\0') - util_abort("%s: internal error - malformed string representation in buffer \n",__func__); - return string_ptr; -} - - - -char * buffer_fread_alloc_string(buffer_type * buffer) { - return util_alloc_string_copy( buffer_fread_string( buffer )); -} - - - -/** - Observe that this function writes a leading integer string length. -*/ -void buffer_fwrite_string(buffer_type * buffer , const char * string) { - buffer_fwrite_int( buffer , strlen( string )); /* Writing the length of the string */ - buffer_fwrite(buffer , string , 1 , strlen( string ) + 1); /* Writing the string content ** WITH ** the terminating \0 */ -} - diff --git a/ThirdParty/Ert/libert_util/src/buffer_zlib.c b/ThirdParty/Ert/libert_util/src/buffer_zlib.c deleted file mode 100644 index 00db36faac..0000000000 --- a/ThirdParty/Ert/libert_util/src/buffer_zlib.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - This file is compiled as part of the buffer.c file; if the symbol - ERT_HAVE_ZLIB is defined. -*/ -#include -/** - Unfortunately the old RedHat3 computers have a zlib version which - does not have the compressBound function. For that reason the - compressBound function from a 1.2xx version of zlib is pasted in - here verbatim: -*/ - - -/* Snipped from zlib source code: */ -static size_t __compress_bound (size_t sourceLen) -{ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; -} - - -/** - Return value is the size (in bytes) of the compressed buffer. -*/ -size_t buffer_fwrite_compressed(buffer_type * buffer, const void * ptr , size_t byte_size) { - size_t compressed_size = 0; - bool abort_on_error = true; - buffer->content_size = buffer->pos; /* Invalidating possible buffer content coming after the compressed content; that is uninterpretable anyway. */ - - if (byte_size > 0) { - size_t remaining_size = buffer->alloc_size - buffer->pos; - size_t compress_bound = __compress_bound( byte_size ); - if (compress_bound > remaining_size) - buffer_resize__(buffer , remaining_size + compress_bound , abort_on_error); - - compressed_size = buffer->alloc_size - buffer->pos; - util_compress_buffer( ptr , byte_size , &buffer->data[buffer->pos] , &compressed_size); - buffer->pos += compressed_size; - buffer->content_size += compressed_size; - } - - return compressed_size; -} - - -/** - Return value is the size of the uncompressed buffer. -*/ -size_t buffer_fread_compressed(buffer_type * buffer , size_t compressed_size , void * target_ptr , size_t target_size) { - size_t remaining_size = buffer->content_size - buffer->pos; - size_t uncompressed_size = target_size; - if (remaining_size < compressed_size) - util_abort("%s: trying to read beyond end of buffer\n",__func__); - - - if (compressed_size > 0) { - int uncompress_result = uncompress(target_ptr , &uncompressed_size , (unsigned char *) &buffer->data[buffer->pos] , compressed_size); - if (uncompress_result != Z_OK) { - fprintf(stderr,"%s: ** Warning uncompress result:%d != Z_OK.\n" , __func__ , uncompress_result); - /** - According to the zlib documentation: - - 1. Values > 0 are not errors - just rare events? - 2. The value Z_BUF_ERROR is not fatal - we let that pass?! - */ - if (uncompress_result < 0 && uncompress_result != Z_BUF_ERROR) - util_abort("%s: fatal uncompress error: %d \n",__func__ , uncompress_result); - } - } else - uncompressed_size = 0; - - buffer->pos += compressed_size; - return uncompressed_size; -} - diff --git a/ThirdParty/Ert/libert_util/src/util_chdir.c b/ThirdParty/Ert/libert_util/src/util_chdir.c deleted file mode 100644 index 00fc5453d7..0000000000 --- a/ThirdParty/Ert/libert_util/src/util_chdir.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2013 Statoil ASA, Norway. - - The file 'util_chdir.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#ifdef HAVE_POSIX_CHDIR -#include - -int util_chdir(const char * path) { - return chdir( path ); -} - -#endif - - -#ifdef HAVE_WINDOWS_CHDIR -#include - -int util_chdir(const char * path) { - return _chdir( path ); -} - -#endif - - diff --git a/ThirdParty/Ert/libert_util/src/util_path.c b/ThirdParty/Ert/libert_util/src/util_path.c deleted file mode 100644 index 40f76c98ab..0000000000 --- a/ThirdParty/Ert/libert_util/src/util_path.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - Copyright (C) 2011 Statoil ASA, Norway. - - The file 'util_path.c' is part of ERT - Ensemble based Reservoir Tool. - - ERT 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. - - ERT 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 at - for more details. -*/ - -#ifdef HAVE_WINDOWS_MKDIR -#include -#endif - -#include - -/** - This little function checks if the supplied path is an abolute path, - or a relative path. On posix the check is extremely simple - if the - first character equals "/" it is interpreted as an abolute path, - otherwise not. -*/ - - -bool util_is_abs_path(const char * path) { -#ifdef ERT_WINDOWS - if ((path[0] == '/') || (path[0] == '\\')) - return true; - else - if ((isalpha(path[0]) && (path[1] == ':'))) - return true; - - return false; - -#else - - if (path[0] == UTIL_PATH_SEP_CHAR) - return true; - else - return false; - -#endif -} - -static int util_mkdir( const char * path ) { -#ifdef HAVE_POSIX_MKDIR - return mkdir( path , UTIL_DEFAULT_MKDIR_MODE ); -#endif - -#ifdef HAVE_WINDOWS_MKDIR - return _mkdir( path ); -#endif -} - - -void util_make_path(const char *_path) { - char *active_path; - char *path = (char *) _path; - int current_pos = 0; - - if (!util_is_directory(path)) { - int i = 0; - active_path = util_calloc(strlen(path) + 1 , sizeof * active_path ); - do { - int n = strcspn(path , UTIL_PATH_SEP_STRING); - if (n < strlen(path)) - n += 1; - path += n; - i++; - strncpy(active_path , _path , n + current_pos); - active_path[n+current_pos] = '\0'; - current_pos += n; - - if (!util_is_directory(active_path)) { - if (util_mkdir(active_path) != 0) { - bool fail = false; - switch (errno) { - case(EEXIST): - if (util_is_directory(active_path)) - fail = false; - break; - default: - fail = true; - break; - } - if (fail) - util_abort("%s: failed to make directory:%s - aborting\n: %s(%d) \n",__func__ , active_path , strerror(errno), errno); - } - } - - } while (strlen(active_path) < strlen(_path)); - free(active_path); - } -} - - -/** - This function will allocate a unique filename with a random part in - it. If the the path corresponding to the first argument does not - exist it is created. - - If the value include_pid is true, the pid of the calling process is - included in the filename, the resulting filename will be: - - path/prefix-pid-RANDOM - - if include_pid is false the resulting file will be: - - path/prefix-RANDOM - - Observe that IFF the prefix contains any path separator character - they are translated to "_". -*/ - - - -char * util_alloc_tmp_file(const char * path, const char * prefix , bool include_pid ) { - // Should be reimplemented to use mkstemp() - const int pid_digits = 6; - const int random_digits = 6; - const int random_max = 1000000; - -#ifdef HAVE_PID_T - const int pid_max = 1000000; - pid_t pid = getpid() % pid_max; -#else - int pid = 0; -#endif - - char * file = util_calloc(strlen(path) + 1 + strlen(prefix) + 1 + pid_digits + 1 + random_digits + 1 , sizeof * file ); - char * tmp_prefix = util_alloc_string_copy( prefix ); - - if (!util_is_directory(path)) - util_make_path(path); - util_string_tr( tmp_prefix , UTIL_PATH_SEP_CHAR , '_'); /* removing path seps. */ - - do { - long int rand_int = rand() % random_max; - if (include_pid) - sprintf(file , "%s%c%s-%d-%ld" , path , UTIL_PATH_SEP_CHAR , tmp_prefix , pid , rand_int); - else - sprintf(file , "%s%c%s-%ld" , path , UTIL_PATH_SEP_CHAR , tmp_prefix , rand_int); - } while (util_file_exists(file)); - - free( tmp_prefix ); - return file; -} - -/** - This file allocates a filename consisting of a leading path, a - basename and an extension. Both the path and the extension can be - NULL, but not the basename. - - Observe that this function does pure string manipulation; there is - no input check on whether path exists, if baseneme contains "." - (or even a '/') and so on. -*/ - -char * util_alloc_filename(const char * path , const char * basename , const char * extension) { - char * file; - int length = strlen(basename) + 1; - - if (path != NULL) - length += strlen(path) + 1; - - if (extension != NULL) - length += strlen(extension) + 1; - - file = util_calloc(length , sizeof * file ); - - if (path == NULL) { - if (extension == NULL) - memcpy(file , basename , strlen(basename) + 1); - else - sprintf(file , "%s.%s" , basename , extension); - } else { - if (extension == NULL) - sprintf(file , "%s%c%s" , path , UTIL_PATH_SEP_CHAR , basename); - else - sprintf(file , "%s%c%s.%s" , path , UTIL_PATH_SEP_CHAR , basename , extension); - } - - return file; -} - - -char * util_realloc_filename(char * filename , const char * path , const char * basename , const char * extension) { - util_safe_free(filename); - return util_alloc_filename( path , basename , extension ); -} - - - - -#ifdef HAVE_PROC -bool util_proc_alive(pid_t pid) { - char proc_path[16]; - sprintf(proc_path , "/proc/%d" , pid); - return util_is_directory(proc_path); -} -#endif - -int util_proc_mem_free(void) { - FILE *stream = util_fopen("/proc/meminfo" , "r"); - int mem; - util_fskip_lines(stream , 1); - util_fskip_token(stream); - util_fscanf_int(stream , &mem); - fclose(stream); - return mem; -} - - - - -char * util_split_alloc_dirname( const char * input_path ) { - char * path; - util_alloc_file_components( input_path , &path , NULL , NULL); - return path; -} - - -char * util_split_alloc_filename( const char * input_path ) { - char * filename = NULL; - { - char * basename; - char * extension; - - util_alloc_file_components( input_path , NULL , &basename , &extension); - - if (basename) - filename = util_alloc_filename( NULL , basename , extension ); - - util_safe_free( basename ); - util_safe_free( extension ); - } - - return filename; -} - - - -void util_path_split(const char *line , int *_tokens, char ***_token_list) { - util_split_string( line , UTIL_PATH_SEP_STRING , _tokens , _token_list); -} - -/** - Observe that -*/ - -char * util_alloc_parent_path( const char * path) { - int path_ncomp; - char ** path_component_list; - char * parent_path = NULL; - - if (path) { - bool is_abs = util_is_abs_path( path ); - char * work_path; - - if (strstr(path , "..")) { - if (is_abs) - work_path = util_alloc_realpath__( path ); - else { - char * abs_path = util_alloc_realpath__( path ); - char * cwd = util_alloc_cwd(); - work_path = util_alloc_rel_path( cwd , abs_path ); - free( abs_path ); - free( cwd ); - } - } else - work_path = util_alloc_string_copy( path ); - - util_path_split( work_path , &path_ncomp , &path_component_list ); - if (path_ncomp > 0) { - int current_length = 4; - int ip; - - parent_path = util_realloc( parent_path , current_length * sizeof * parent_path); - parent_path[0] = '\0'; - - for (ip=0; ip < path_ncomp - 1; ip++) { - const char * ipath = path_component_list[ip]; - int min_length = strlen(parent_path) + strlen(ipath) + 1; - - if (min_length >= current_length) { - current_length = 2 * min_length; - parent_path = util_realloc( parent_path , current_length * sizeof * parent_path); - } - - if (is_abs || (ip > 0)) - strcat( parent_path , UTIL_PATH_SEP_STRING ); - strcat( parent_path , ipath ); - } - } - util_free_stringlist( path_component_list , path_ncomp ); - free( work_path ); - } - return parent_path; -} diff --git a/ThirdParty/Ert/libert_util/tests/CMakeLists.txt b/ThirdParty/Ert/libert_util/tests/CMakeLists.txt deleted file mode 100644 index 2142cab296..0000000000 --- a/ThirdParty/Ert/libert_util/tests/CMakeLists.txt +++ /dev/null @@ -1,196 +0,0 @@ -link_directories( ${ERT_BINARY_DIR}/libert_util/src ) - -add_executable( test_thread_pool test_thread_pool.c ) -target_link_libraries( test_thread_pool ert_util ) - -find_library( VALGRIND NAMES valgr ) -if (VALGRIND) - add_test( test_thread_pool valgrind --error-exitcode=1 --tool=memcheck ${EXECUTABLE_OUTPUT_PATH}/test_thread_pool ) -else() - add_test( test_thread_pool ${EXECUTABLE_OUTPUT_PATH}/test_thread_pool ) -endif() - -add_executable( ert_util_matrix ert_util_matrix.c ) -target_link_libraries( ert_util_matrix ert_util ) -add_test( ert_util_matrix ${EXECUTABLE_OUTPUT_PATH}/ert_util_matrix ) - -if (ERT_HAVE_LAPACK) - add_executable( ert_util_matrix_lapack ert_util_matrix_lapack.c ) - target_link_libraries( ert_util_matrix_lapack ert_util ) - add_test( ert_util_matrix_lapack ${EXECUTABLE_OUTPUT_PATH}/ert_util_matrix_lapack ) - - add_executable( ert_util_matrix_stat ert_util_matrix_stat.c ) - target_link_libraries( ert_util_matrix_stat ert_util ) - add_test( ert_util_matrix_stat ${EXECUTABLE_OUTPUT_PATH}/ert_util_matrix_stat ) -endif() - -add_executable( ert_util_subst_list ert_util_subst_list.c ) -target_link_libraries( ert_util_subst_list ert_util ) -add_test( ert_util_subst_list ${EXECUTABLE_OUTPUT_PATH}/ert_util_subst_list ) - - -add_executable( ert_util_buffer ert_util_buffer.c ) -target_link_libraries( ert_util_buffer ert_util ) -add_test( ert_util_buffer ${EXECUTABLE_OUTPUT_PATH}/ert_util_buffer ) - -add_executable( ert_util_statistics ert_util_statistics.c ) -target_link_libraries( ert_util_statistics ert_util ) -add_test( ert_util_statistics ${EXECUTABLE_OUTPUT_PATH}/ert_util_statistics ) - -add_executable( ert_util_copy_file ert_util_copy_file.c ) -target_link_libraries( ert_util_copy_file ert_util ) -add_test( ert_util_copy_file ${EXECUTABLE_OUTPUT_PATH}/ert_util_copy_file ${EXECUTABLE_OUTPUT_PATH}/ert_util_copy_file ) - -add_executable( ert_util_filename ert_util_filename.c ) -target_link_libraries( ert_util_filename ert_util ) -add_test( ert_util_filename ${EXECUTABLE_OUTPUT_PATH}/ert_util_filename ) - -add_executable( ert_util_sscan_test ert_util_sscan_test.c ) -target_link_libraries( ert_util_sscan_test ert_util ) -add_test( ert_util_sscan_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_sscan_test ) - -add_executable( ert_util_string_util ert_util_string_util.c ) -target_link_libraries( ert_util_string_util ert_util ) -add_test( ert_util_string_util ${EXECUTABLE_OUTPUT_PATH}/ert_util_string_util ) - -add_executable( ert_util_vector_test ert_util_vector_test.c ) -target_link_libraries( ert_util_vector_test ert_util ) -add_test( ert_util_vector_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_vector_test ) - -add_executable( ert_util_cwd_test ert_util_cwd_test.c ) -target_link_libraries( ert_util_cwd_test ert_util ) -add_test( ert_util_cwd_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_cwd_test ${CMAKE_CURRENT_BINARY_DIR}) - -add_executable( ert_util_relpath_test ert_util_relpath_test.c ) -target_link_libraries( ert_util_relpath_test ert_util ) -add_test( ert_util_relpath_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_relpath_test ) - -add_executable( ert_util_path_stack_test ert_util_path_stack_test.c ) -target_link_libraries( ert_util_path_stack_test ert_util ) -add_test( ert_util_path_stack_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_path_stack_test ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - -add_executable( ert_util_PATH_test ert_util_PATH_test.c ) -target_link_libraries( ert_util_PATH_test ert_util ) -add_test( ert_util_PATH_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_PATH_test ) - -add_executable( ert_util_strcat_test ert_util_strcat_test.c ) -target_link_libraries( ert_util_strcat_test ert_util ) -add_test( ert_util_strcat_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_strcat_test ) - -add_executable( ert_util_sprintf_escape ert_util_sprintf_escape.c ) -target_link_libraries( ert_util_sprintf_escape ert_util ) -add_test( ert_util_sprintf_escape ${EXECUTABLE_OUTPUT_PATH}/ert_util_sprintf_escape ) - - -add_executable( ert_util_stringlist_test ert_util_stringlist_test.c ) -target_link_libraries( ert_util_stringlist_test ert_util ) -add_test( ert_util_stringlist_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_stringlist_test ) - -add_executable( ert_util_realpath ert_util_realpath.c ) -target_link_libraries( ert_util_realpath ert_util ) -add_test( ert_util_realpath ${EXECUTABLE_OUTPUT_PATH}/ert_util_realpath ) - -add_executable( ert_util_hash_test ert_util_hash_test.c ) -target_link_libraries( ert_util_hash_test ert_util ) -add_test( ert_util_hash_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_hash_test ) - -add_executable( ert_util_binary_split ert_util_binary_split.c ) -target_link_libraries( ert_util_binary_split ert_util ) -add_test( ert_util_binary_split ${EXECUTABLE_OUTPUT_PATH}/ert_util_binary_split ) - -add_executable( ert_util_logh ert_util_logh.c ) -target_link_libraries( ert_util_logh ert_util ) -add_test( ert_util_logh ${EXECUTABLE_OUTPUT_PATH}/ert_util_logh ) - -add_executable( ert_util_rng ert_util_rng.c ) -target_link_libraries( ert_util_rng ert_util ) -add_test( ert_util_rng ${EXECUTABLE_OUTPUT_PATH}/ert_util_rng ) - -add_executable( ert_util_time_interval ert_util_time_interval.c ) -target_link_libraries( ert_util_time_interval ert_util ) -add_test( ert_util_time_interval ${EXECUTABLE_OUTPUT_PATH}/ert_util_time_interval ) - -add_executable( ert_util_before_after ert_util_before_after.c ) -target_link_libraries( ert_util_before_after ert_util ) -add_test( ert_util_before_after ${EXECUTABLE_OUTPUT_PATH}/ert_util_before_after ) - -add_executable( ert_util_approx_equal ert_util_approx_equal.c ) -target_link_libraries( ert_util_approx_equal ert_util ) -add_test( ert_util_approx_equal ${EXECUTABLE_OUTPUT_PATH}/ert_util_approx_equal ) - -if (ERT_HAVE_PING) - add_executable( ert_util_ping ert_util_ping.c ) - target_link_libraries( ert_util_ping ert_util ) - add_test( ert_util_ping ${EXECUTABLE_OUTPUT_PATH}/ert_util_ping) -endif() - -add_executable( ert_util_file_readable ert_util_file_readable.c ) -target_link_libraries( ert_util_file_readable ert_util ) -add_test( ert_util_file_readable ${EXECUTABLE_OUTPUT_PATH}/ert_util_file_readable ${FILE_READABLE_SERVERS}) - -add_executable( ert_util_type_vector_functions ert_util_type_vector_functions.c ) -target_link_libraries( ert_util_type_vector_functions ert_util ) -add_test( ert_util_type_vector_functions ${EXECUTABLE_OUTPUT_PATH}/ert_util_type_vector_functions) - - -add_executable( ert_util_ui_return ert_util_ui_return.c ) -target_link_libraries( ert_util_ui_return ert_util ) -add_test( ert_util_ui_return ${EXECUTABLE_OUTPUT_PATH}/ert_util_ui_return ) - -add_executable( ert_util_clamp ert_util_clamp.c ) -target_link_libraries( ert_util_clamp ert_util ) -add_test( ert_util_clamp ${EXECUTABLE_OUTPUT_PATH}/ert_util_clamp ) - -add_executable( ert_util_strstr_int_format ert_util_strstr_int_format.c ) -target_link_libraries( ert_util_strstr_int_format ert_util ) -add_test( ert_util_strstr_int_format ${EXECUTABLE_OUTPUT_PATH}/ert_util_strstr_int_format ) - -add_executable( ert_util_parent_path ert_util_parent_path.c ) -target_link_libraries( ert_util_parent_path ert_util ) -add_test( ert_util_parent_path ${EXECUTABLE_OUTPUT_PATH}/ert_util_parent_path) - -add_executable( ert_util_alloc_file_components ert_util_alloc_file_components.c ) -target_link_libraries( ert_util_alloc_file_components ert_util ) -add_test( ert_util_alloc_file_components ${EXECUTABLE_OUTPUT_PATH}/ert_util_alloc_file_components) - -add_executable( ert_util_work_area ert_util_work_area.c ) -target_link_libraries( ert_util_work_area ert_util ) -add_test( NAME ert_util_work_area - COMMAND ${EXECUTABLE_OUTPUT_PATH}/ert_util_work_area data2/file1 ${CMAKE_CURRENT_SOURCE_DIR}/data2/file2 data2 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - -add_executable( ert_util_arg_pack ert_util_arg_pack.c) -set_target_properties( ert_util_arg_pack PROPERTIES COMPILE_FLAGS "-Werror") -target_link_libraries( ert_util_arg_pack ert_util ) -add_test( ert_util_arg_pack ${EXECUTABLE_OUTPUT_PATH}/ert_util_arg_pack) - -if (HAVE_BACKTRACE) - add_executable( ert_util_abort_gnu_tests ert_util_abort_gnu_tests.c) - target_link_libraries( ert_util_abort_gnu_tests ert_util ) - add_test( ert_util_abort_gnu_tests ${EXECUTABLE_OUTPUT_PATH}/ert_util_abort_gnu_tests) - - add_executable( ert_util_addr2line ert_util_addr2line.c ) - target_link_libraries( ert_util_addr2line ert_util ) - add_test( ert_util_addr2line ${EXECUTABLE_OUTPUT_PATH}/ert_util_addr2line) -endif() - -if (HAVE_UTIL_ABORT_INTERCEPT) - add_executable( ert_util_block_fs ert_util_block_fs.c) - target_link_libraries( ert_util_block_fs ert_util ) - add_test( ert_util_block_fs ${EXECUTABLE_OUTPUT_PATH}/ert_util_block_fs) - - add_executable( ert_util_struct_vector ert_util_struct_vector.c ) - target_link_libraries( ert_util_struct_vector ert_util ) - add_test( ert_util_struct_vector ${EXECUTABLE_OUTPUT_PATH}/ert_util_struct_vector ) - - add_executable( ert_util_type_vector_test ert_util_type_vector_test.c ) - target_link_libraries( ert_util_type_vector_test ert_util ) - add_test( ert_util_type_vector_test ${EXECUTABLE_OUTPUT_PATH}/ert_util_type_vector_test ) -endif() - -if (ERT_HAVE_SPAWN) - add_executable( ert_util_spawn ert_util_spawn.c ) - target_link_libraries( ert_util_spawn ert_util ) - add_test( ert_util_spawn ${EXECUTABLE_OUTPUT_PATH}/ert_util_spawn) -endif() - diff --git a/ThirdParty/Ert/libert_utilxx/CMakeLists.txt b/ThirdParty/Ert/libert_utilxx/CMakeLists.txt deleted file mode 100644 index c6dd2b2070..0000000000 --- a/ThirdParty/Ert/libert_utilxx/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_subdirectory( src ) - -if (BUILD_TESTS) - add_subdirectory( tests ) -endif() - diff --git a/ThirdParty/Ert/libert_utilxx/src/CMakeLists.txt b/ThirdParty/Ert/libert_utilxx/src/CMakeLists.txt deleted file mode 100644 index 9ff4095fa7..0000000000 --- a/ThirdParty/Ert/libert_utilxx/src/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -set( source_files - TestArea.cpp - ) - -set( header_files - TestArea.hpp - ert_unique_ptr.hpp -) - - -add_library( ert_utilxx ${source_files} ) -set_target_properties( ert_utilxx PROPERTIES VERSION ${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR} SOVERSION ${ERT_VERSION_MAJOR}) -if (USE_RUNPATH) - add_runpath( ert_utilxx ) -endif() -target_link_libraries( ert_utilxx ert_util ) - - -if (INSTALL_ERT) - install(TARGETS ert_utilxx DESTINATION ${CMAKE_INSTALL_LIBDIR}) - foreach(header ${header_files}) - install(FILES ../include/ert/util/${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ert/util) - endforeach() -endif() diff --git a/ThirdParty/Ert/libert_utilxx/tests/CMakeLists.txt b/ThirdParty/Ert/libert_utilxx/tests/CMakeLists.txt deleted file mode 100644 index e9cd19572e..0000000000 --- a/ThirdParty/Ert/libert_utilxx/tests/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_executable(ert_util_unique_ptr ert_util_unique_ptr.cpp ) -target_link_libraries(ert_util_unique_ptr ert_util) -add_test(ert_util_unique_ptr ${EXECUTABLE_OUTPUT_PATH}/ert_util_unique_ptr) - -add_executable(ert_util_test_area_xx ert_util_test_area_xx.cpp ) -target_link_libraries(ert_util_test_area_xx ert_utilxx) -add_test(ert_util_test_area_xx ${EXECUTABLE_OUTPUT_PATH}/ert_util_test_area_xx) diff --git a/ThirdParty/Ert/libgeometry/CMakeLists.txt b/ThirdParty/Ert/libgeometry/CMakeLists.txt deleted file mode 100644 index 4a47f8a3de..0000000000 --- a/ThirdParty/Ert/libgeometry/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_subdirectory( src ) - -#if (BUILD_APPLICATONS) -# add_subdirectory( applications ) -#endif() - -if (BUILD_TESTS) - add_subdirectory( tests ) -endif() - diff --git a/ThirdParty/Ert/libgeometry/src/CMakeLists.txt b/ThirdParty/Ert/libgeometry/src/CMakeLists.txt deleted file mode 100644 index c33a248603..0000000000 --- a/ThirdParty/Ert/libgeometry/src/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -set( source_files geo_surface.c geo_util.c geo_pointset.c geo_region.c geo_polygon.c geo_polygon_collection.c) -set( header_files geo_surface.h geo_util.h geo_pointset.h geo_region.h geo_polygon.h geo_polygon_collection.h) - -add_library( ert_geometry ${source_files} ) -set_target_properties( ert_geometry PROPERTIES VERSION ${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR} SOVERSION ${ERT_VERSION_MAJOR}) -target_link_libraries( ert_geometry ert_util ) -if (USE_RUNPATH) - add_runpath( ert_geometry ) -endif() - - -#----------------------------------------------------------------- -if (INSTALL_ERT) - install(TARGETS ert_geometry DESTINATION ${CMAKE_INSTALL_LIBDIR}) - foreach(header ${header_files}) - install(FILES ../include/ert/geometry/${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ert/geometry) - endforeach() -endif() - - diff --git a/ThirdParty/Ert/libgeometry/tests/CMakeLists.txt b/ThirdParty/Ert/libgeometry/tests/CMakeLists.txt deleted file mode 100644 index 3547148055..0000000000 --- a/ThirdParty/Ert/libgeometry/tests/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -add_executable( geo_util_xlines geo_util_xlines.c ) -target_link_libraries( geo_util_xlines ert_geometry ) -add_test( geo_util_xlines ${EXECUTABLE_OUTPUT_PATH}/geo_util_xlines ) - -add_executable( geo_polygon geo_polygon.c ) -target_link_libraries( geo_polygon ert_geometry ) -add_test( geo_polygon ${EXECUTABLE_OUTPUT_PATH}/geo_polygon ) - -add_executable( geo_polygon_collection geo_polygon_collection.c ) -target_link_libraries( geo_polygon_collection ert_geometry ) -add_test( geo_polygon_collection ${EXECUTABLE_OUTPUT_PATH}/geo_polygon_collection ) - -if (STATOIL_TESTDATA_ROOT) - add_executable( geo_surface geo_surface.c ) - target_link_libraries( geo_surface ert_geometry ) - - add_test( geo_surface ${EXECUTABLE_OUTPUT_PATH}/geo_surface - ${PROJECT_SOURCE_DIR}/test-data/Statoil/Geometry/Surface.irap - ${PROJECT_SOURCE_DIR}/test-data/Statoil/Geometry/Surface_incompatible.irap ) - set_property( TEST geo_surface PROPERTY LABELS StatoilData ) -endif() - - - - diff --git a/ThirdParty/Ert/python/cmake/Modules/add_python_package.cmake b/ThirdParty/Ert/python/cmake/Modules/add_python_package.cmake index 9d1527d309..bb0c1a6e2d 100644 --- a/ThirdParty/Ert/python/cmake/Modules/add_python_package.cmake +++ b/ThirdParty/Ert/python/cmake/Modules/add_python_package.cmake @@ -30,7 +30,9 @@ function(add_python_package target package_path source_files install_package) list(APPEND build_files ${build_file} ) if (install_package) - install(FILES ${build_file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${package_path}) + # For cmake versions >= 2.8.12 the preferred keyword is DIRECTORY. + get_filename_component( src_path ${file} PATH ) + install(FILES ${build_file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${package_path}/${src_path}) install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/bin/cmake_pyc_file ${install_file})") endif() diff --git a/ThirdParty/Ert/python/cmake/Modules/add_python_test.cmake b/ThirdParty/Ert/python/cmake/Modules/add_python_test.cmake index 26583c5090..cb9130e1c6 100644 --- a/ThirdParty/Ert/python/cmake/Modules/add_python_test.cmake +++ b/ThirdParty/Ert/python/cmake/Modules/add_python_test.cmake @@ -34,5 +34,5 @@ macro( addPythonTest TEST_CLASS ) set_property(TEST ${TEST_NAME} PROPERTY LABELS "Python") endif() - set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "CTEST_PYTHONPATH=${CTEST_PYTHONPATH}") + set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "CTEST_PYTHONPATH=${CTEST_PYTHONPATH};ERT_ROOT=${ERT_ROOT}") endmacro( ) diff --git a/ThirdParty/Ert/python/cmake/Modules/find_python_package.cmake b/ThirdParty/Ert/python/cmake/Modules/find_python_package.cmake index 9cfd68f6aa..3e62b604e5 100644 --- a/ThirdParty/Ert/python/cmake/Modules/find_python_package.cmake +++ b/ThirdParty/Ert/python/cmake/Modules/find_python_package.cmake @@ -27,6 +27,7 @@ function(find_python_package_version package) endfunction() + # If we find the correct module and new enough version, set PY_package, where # "package" is the given argument to the version we found else, display warning # and do not set any variables. @@ -34,17 +35,22 @@ function(find_python_package package version python_prefix) if (CMAKE_PREFIX_PATH) set( ORG_PYTHONPATH $ENV{PYTHONPATH} ) + set( CMAKE_PYTHONATH "") + set( sep "") foreach ( PREFIX_PATH ${CMAKE_PREFIX_PATH} ) - set(THIS_PYTHONPATH "${PREFIX_PATH}/${python_prefix}") - set(ENV{PYTHONPATH} "${THIS_PYTHONPATH}:${ORG_PYTHONPATH}") - find_python_package_version(${package}) - if (DEFINED PY_${package}) - if (${PY_${package}_PATH} STREQUAL ${THIS_PYTHONPATH}) - set(CTEST_PYTHONPATH "${PY_${package}_PATH}:${CTEST_PYTHONPATH}" PARENT_SCOPE) - endif() - break( ) - endif() + set( CMAKE_PYTHONPATH "${CMAKE_PYTHONPATH}${sep}${PREFIX_PATH}/${python_prefix}") + set( sep ":") endforeach() + + set(ENV{PYTHONPATH} "${CMAKE_PYTHONPATH}:${ORG_PYTHONPATH}") + + find_python_package_version(${package}) + if (DEFINED PY_${package}) + STRING(FIND ${CMAKE_PYTHONPATH} ${PY_${package}_PATH} pos) + if (${pos} GREATER -1) + set(CTEST_PYTHONPATH "${PY_${package}_PATH}:${CMAKE_PYTHONPATH}" PARENT_SCOPE) + endif() + endif() set(ENV{PYTHONPATH} ${ORG_PYTHONPATH}) else() find_python_package_version(${package}) diff --git a/ThirdParty/Ert/python/cmake/Modules/init_python.cmake b/ThirdParty/Ert/python/cmake/Modules/init_python.cmake index 414879259c..6af40838c3 100644 --- a/ThirdParty/Ert/python/cmake/Modules/init_python.cmake +++ b/ThirdParty/Ert/python/cmake/Modules/init_python.cmake @@ -105,15 +105,34 @@ def runTestCase(tests, verbosity=0): sys.exit(1) +# This will update both the internal sys.path load order and the +# environment variable PYTHONPATH with the following list: +# +# cwd:CTEST_PYTHONPATH:PYTHONPATH + def update_path(): - for path in os.environ['CTEST_PYTHONPATH'].split(':'): - sys.path.insert(0 , path) - + path_list = [os.getcwd()] + + if 'CTEST_PYTHONPATH' in os.environ: + ctest_pythonpath = os.environ['CTEST_PYTHONPATH'] + for path in ctest_pythonpath.split(':'): + path_list.append( path ) + + for path in reversed(path_list): + sys.path.insert(0 , path) + + if 'PYTHONPATH' in os.environ: + pythonpath = os.environ['PYTHONPATH'] + for path in pythonpath.split(':'): + path_list.append( path ) + + os.environ['PYTHONPATH'] = ':'.join( path_list ) + + if __name__ == '__main__': update_path( ) from ecl.test import ErtTestRunner - for test_class in sys.argv[1:]: tests = ErtTestRunner.getTestsFromTestClass(test_class) @@ -172,4 +191,4 @@ for file in sys.argv[1:]: -endfunction() \ No newline at end of file +endfunction() diff --git a/ThirdParty/Ert/python/doc/install.txt b/ThirdParty/Ert/python/doc/install.txt index 7a1e06dbde..a762c7f01a 100644 --- a/ThirdParty/Ert/python/doc/install.txt +++ b/ThirdParty/Ert/python/doc/install.txt @@ -29,12 +29,11 @@ the py_compile module. Installing the shared libraries ------------------------------- -The ctypes module is based on the dlopen() system call to open shared -libraries libecl.so, libert_util.so and so on. The final dlopen() call is -not passed any path information, i.e. the runtime linker must be able -to locate the shared libraries based solely on the normal runtime -linking conventions. This means that you have two alternatives when -installing the shared libraries: +The ctypes module is based on the dlopen() system call to open the shared +libecl.so. The final dlopen() call is not passed any path information, i.e. the +runtime linker must be able to locate the shared libraries based solely on the +normal runtime linking conventions. This means that you have two alternatives +when installing the shared libraries: 1. Install all the libraries in one of the standard library locations like /usr/local/lib. @@ -43,8 +42,7 @@ installing the shared libraries: subsequently update the LD_LIBRARY_PATH variable to point to this directory. -The shared libraries you will need are: libert_util.so, libecl.so, -librms.so, libsched.so, libenkf.so, libjob_queue.so, libconfig.so and libgeometry.so +The shared libraries you will need is 'libecl.so' The test environment -------------------- diff --git a/ThirdParty/Ert/python/python/CMakeLists.txt b/ThirdParty/Ert/python/python/CMakeLists.txt index c6d592545b..59be104ca7 100644 --- a/ThirdParty/Ert/python/python/CMakeLists.txt +++ b/ThirdParty/Ert/python/python/CMakeLists.txt @@ -2,4 +2,7 @@ configure_file(test_env.py.in ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX}/t add_subdirectory(cwrap) add_subdirectory( ecl ) -add_subdirectory( bin ) + +if (INSTALL_ERT_LEGACY) + add_subdirectory( legacy/ert ) +endif() diff --git a/ThirdParty/Ert/python/python/bin/CMakeLists.txt b/ThirdParty/Ert/python/python/bin/CMakeLists.txt deleted file mode 100644 index 0410f2a073..0000000000 --- a/ThirdParty/Ert/python/python/bin/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -if (BUILD_ERT) - set(application_list - ert_tcp_server - ertshell - ert_upgrade_fs107 - ) - foreach(prog ${application_list} ) - file(COPY ${prog} DESTINATION ${EXECUTABLE_OUTPUT_PATH}) - endforeach() -endif() - - - -if (INSTALL_ERT) - set (destination ${CMAKE_INSTALL_PREFIX}/bin) - foreach(prog ${application_list} ) - install(PROGRAMS ${prog} DESTINATION ${destination}) - if (INSTALL_GROUP) - install(CODE "EXECUTE_PROCESS(COMMAND chgrp ${INSTALL_GROUP} ${destination}/${prog})") - install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/${prog})") - endif() - endforeach() -endif() - diff --git a/ThirdParty/Ert/python/python/bin/ert_tcp_server b/ThirdParty/Ert/python/python/bin/ert_tcp_server deleted file mode 100644 index caa75d9da7..0000000000 --- a/ThirdParty/Ert/python/python/bin/ert_tcp_server +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -import argparse -import socket -import sys - -from ert.server.ertrpcserver import ErtRPCServer - -default_port = 0 - -parser = argparse.ArgumentParser() - -parser.add_argument("--port", type=int, default=default_port, dest="port") -parser.add_argument("--host", default=socket.gethostname(), dest="host") -parser.add_argument("--localhost", default=False, action="store_true", dest="localhost") -parser.add_argument("--log-file", default="ert-server.log", dest="log_file") -parser.add_argument("--log-level", type=int, default=1, dest="log_level") -parser.add_argument("config_file") - -args = parser.parse_args() - -config_file = args.config_file -port = args.port -log_level = args.log_level - - -# By default the server will bind with the publicly available hostname -# socket.gethostname() - meaning that clients can connect from -# anywhere, but by using the --localhost switch the server can be -# instructed to only accept connections from localhost. -# -# On some computers the socket.gethostname() will not include the -# domain name; that will not work and we exit the server and ask the -# user to supply the full hostname using --host. - -if args.localhost: - host = "localhost" -else: - host = args.host - if host.count(".") == 0: - sys.exit("Sorry - could not determine FQDN for server - use the --host option to supply.") - -server = ErtRPCServer(config_file, host, port, log_requests=log_level > 1, verbose_queue=True) - -try: - print("ERT Server running on port: %d at host: %s" % (server.port, host)) - server.start() -except KeyboardInterrupt: - try: - server.stop() - print("ERT Server 'smoothly' killed the running jobs") - except Exception as e: - print("Unable to stop server 'gracefully'!") - raise e diff --git a/ThirdParty/Ert/python/python/bin/ert_upgrade_fs107 b/ThirdParty/Ert/python/python/bin/ert_upgrade_fs107 deleted file mode 100644 index 4374b5dcfc..0000000000 --- a/ThirdParty/Ert/python/python/bin/ert_upgrade_fs107 +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -import sys -import os -import os.path - -from ert.config import ConfigParser, ContentTypeEnum, UnrecognizedEnum -from ert.enkf import TimeMap,EnkfFs -from ert.ecl import EclSum - -#TimeMap._upgrade107 = - - -def parse(config_file): - parser = ConfigParser( ) - item = parser.add("REFCASE", False ) - item.iset_type(0 , ContentTypeEnum.CONFIG_PATH ) - - item = parser.add("ENSPATH" , False ) - item.iset_type(0 , ContentTypeEnum.CONFIG_EXISTING_PATH ) - - content = parser.parse( config_file , unrecognized = UnrecognizedEnum.CONFIG_UNRECOGNIZED_IGNORE ) - if "REFCASE" in content: - refcase = EclSum( content.getValue( "REFCASE" )) - else: - refcase = None - - if "ENSPATH" in content: - path = content["ENSPATH"] - enspath = path[0].getPath( ) - else: - enspath = "storage" - - - return enspath , refcase - - -def upgrade(ens_path, refcase): - for case in os.listdir( ens_path ): - full_case = os.path.join( ens_path , case ) - if os.path.isdir( full_case ): - version = EnkfFs.diskVersion( full_case ) - try: - version = EnkfFs.diskVersion( full_case ) - except IOError: - print "The case:%s was ignored" % full_case - continue - - if version < 105: - print "Very old case: %s ignored - you should probably delete this" % full_case - continue - - if version < 107: - print "Upgrading %s to version 107" % full_case - - time_map_file = os.path.join( full_case , "files/time-map") - if os.path.isfile( time_map_file ): - time_map = TimeMap( time_map_file) - assert( isinstance( refcase , EclSum )) - time_map.upgrade107( refcase ) - time_map.fwrite( time_map_file ) - else: - print "No time-map file found" - - EnkfFs.updateVersion( full_case, version , 107 ) - fs = EnkfFs( full_case ) - - -if len(sys.argv) != 2: - sys.exit("Script must have exactly one argument: config_file") - -config_file = sys.argv[1] -ens_path , refcase = parse( config_file ) -if refcase: - print "Upgrading storage:%s with refcase:%s" % (ens_path , refcase.case ) -upgrade( ens_path , refcase ) - diff --git a/ThirdParty/Ert/python/python/bin/ertshell b/ThirdParty/Ert/python/python/bin/ertshell deleted file mode 100644 index e8d53e0a63..0000000000 --- a/ThirdParty/Ert/python/python/bin/ertshell +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python -import os -from PyQt4.QtGui import QApplication -import sys - -import ert_gui -from ert_gui.ertwidgets import resourceIcon -from ert_gui.shell import ErtShell -from ert_gui.tools import HelpCenter - - -if __name__ == '__main__': - if os.getenv("ERT_SHARE_PATH"): - ert_share_path = os.getenv("ERT_SHARE_PATH") - else: - ert_share_path = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../share")) - - ert_gui.ertwidgets.img_prefix = ert_share_path + "/gui/img/" - - help_center = HelpCenter("ERT") - help_center.setHelpLinkPrefix(os.getenv("ERT_SHARE_PATH") + "/gui/help/") - - - app = QApplication(sys.argv) - app.setWindowIcon(resourceIcon("application/window_icon_cutout")) - - ert_shell = ErtShell() - if len(sys.argv) > 1: - ert_shell.onecmd('load_config %s' % sys.argv[1]) - - if len(sys.argv) > 2: - for workflow in sys.argv[2:]: - ert_shell.onecmd('workflows run %s' % workflow) - - ert_shell.cmdloop() \ No newline at end of file diff --git a/ThirdParty/Ert/python/python/cwrap/clib.py b/ThirdParty/Ert/python/python/cwrap/clib.py index 2c24cb43fb..8fb87a6518 100644 --- a/ThirdParty/Ert/python/python/cwrap/clib.py +++ b/ThirdParty/Ert/python/python/cwrap/clib.py @@ -14,20 +14,6 @@ # See the GNU General Public License at # for more details. """Convenience module for loading shared library. - -Observe that to ensure that all libraries are loaded through the same -code path, all required libraries should be loaded explicitly through -the use of import statements; i.e. the ecl.geo package requires the -libert_util librarary, to ensure that the correct version of the -libert_util.so library file is loaded we should manually load that -first as: - - import ecl.util - GEO_LIB = ecl.load("libert_geometry") - -Otherwise the standard operating system dependency resolve code will -be invoked when loading libert_geometry, and that could in principle -lead to loading a different version of libert_util.so """ import platform diff --git a/ThirdParty/Ert/python/python/cwrap/prototype.py b/ThirdParty/Ert/python/python/cwrap/prototype.py index 082fe7184a..3bbe636b3e 100644 --- a/ThirdParty/Ert/python/python/cwrap/prototype.py +++ b/ThirdParty/Ert/python/python/cwrap/prototype.py @@ -160,6 +160,9 @@ class Prototype(object): @classmethod def registerType(cls, type_name, type_class_or_function, is_return_type=True, storage_type=None): + if storage_type is None and (inspect.isfunction(type_class_or_function)): + storage_type = ctypes.c_void_p + _registerType(type_name, type_class_or_function, is_return_type = is_return_type, diff --git a/ThirdParty/Ert/python/python/ecl/ecl/ecl_grid.py b/ThirdParty/Ert/python/python/ecl/ecl/ecl_grid.py index 7d9bdb6a65..270c37f5bb 100644 --- a/ThirdParty/Ert/python/python/ecl/ecl/ecl_grid.py +++ b/ThirdParty/Ert/python/python/ecl/ecl/ecl_grid.py @@ -47,7 +47,8 @@ class EclGrid(BaseCClass): _alloc_rectangular = EclPrototype("ecl_grid_obj ecl_grid_alloc_rectangular( int , int , int , double , double , double , int*)" , bind = False) _exists = EclPrototype("bool ecl_grid_exists( char* )" , bind = False) - _get_lgr = EclPrototype("ecl_grid_ref ecl_grid_get_lgr( ecl_grid , char* )") + _get_numbered_lgr = EclPrototype("ecl_grid_ref ecl_grid_get_lgr_from_lgr_nr( ecl_grid , int)") + _get_named_lgr = EclPrototype("ecl_grid_ref ecl_grid_get_lgr( ecl_grid , char* )") _get_cell_lgr = EclPrototype("ecl_grid_ref ecl_grid_get_cell_lgr1( ecl_grid , int )") _num_coarse_groups = EclPrototype("int ecl_grid_get_num_coarse_groups( ecl_grid )") _in_coarse_group1 = EclPrototype("bool ecl_grid_cell_in_coarse_group1( ecl_grid , int)") @@ -78,7 +79,8 @@ class EclGrid(BaseCClass): _cell_contains = EclPrototype("bool ecl_grid_cell_contains_xyz1( ecl_grid , int , double , double , double )") _cell_regular = EclPrototype("bool ecl_grid_cell_regular1( ecl_grid , int)") _num_lgr = EclPrototype("int ecl_grid_get_num_lgr( ecl_grid )") - _has_lgr = EclPrototype("bool ecl_grid_has_lgr( ecl_grid , char* )") + _has_numbered_lgr = EclPrototype("bool ecl_grid_has_lgr_nr( ecl_grid , int)") + _has_named_lgr = EclPrototype("bool ecl_grid_has_lgr( ecl_grid , char* )") _grid_value = EclPrototype("double ecl_grid_get_property( ecl_grid , ecl_kw , int , int , int)") _get_cell_volume = EclPrototype("double ecl_grid_get_cell_volume1( ecl_grid , int )") _get_cell_thickness = EclPrototype("double ecl_grid_get_cell_thickness1( ecl_grid , int )") @@ -103,6 +105,11 @@ class EclGrid(BaseCClass): _compressed_kw_copy = EclPrototype("void ecl_grid_compressed_kw_copy( ecl_grid , ecl_kw , ecl_kw)") _global_kw_copy = EclPrototype("void ecl_grid_global_kw_copy( ecl_grid , ecl_kw , ecl_kw)") _create_volume_keyword = EclPrototype("ecl_kw_obj ecl_grid_alloc_volume_kw( ecl_grid , bool)") + _use_mapaxes = EclPrototype("bool ecl_grid_use_mapaxes(ecl_grid)") + _export_coord = EclPrototype("ecl_kw_obj ecl_grid_alloc_coord_kw( ecl_grid )") + _export_zcorn = EclPrototype("ecl_kw_obj ecl_grid_alloc_zcorn_kw( ecl_grid )") + _export_actnum = EclPrototype("ecl_kw_obj ecl_grid_alloc_actnum_kw( ecl_grid )") + _export_mapaxes = EclPrototype("ecl_kw_obj ecl_grid_alloc_mapaxes_kw( ecl_grid )") @@ -896,31 +903,40 @@ class EclGrid(BaseCClass): """ Query if the grid has an LGR with name @lgr_name. """ - if self._has_lgr( lgr_name ): + if self._has_named_lgr( lgr_name ): return True else: return False - def get_lgr( self , lgr_name ): - """ - Get EclGrid instance with LGR content. + def get_lgr(self, lgr_key): + """Get EclGrid instance with LGR content. - Return an EclGrid instance based on the LGR named - @lgr_name. The LGR grid instance is in most questions like an - ordinary grid instance; the only difference is that it can not - be used for further queries about LGRs. + Return an EclGrid instance based on the LGR @lgr, the input + argument can either be the name of an LGR or the grid number + of the LGR. The LGR grid instance is mostly like an ordinary + grid instance; the only difference is that it can not be used + for further queries about LGRs. + + If the grid does not contain an LGR with this name/nr + exception KeyError will be raised. - If the grid does not contain an LGR with this name the method - will return None. """ - if self._has_lgr( lgr_name ): - lgr = self._get_lgr( name ) - lgr.setParent( self ) - return lgr + lgr = None + if isinstance(lgr_key, int): + if self._has_numbered_lgr(lgr_key): + lgr = self._get_numbered_lgr(lgr_key) else: - raise KeyError("No such LGR:%s" % lgr_name) + if self._has_named_lgr(lgr_key): + lgr = self._get_named_lgr(lgr_key) + if lgr is None: + raise KeyError("No such LGR: %s" % lgr_key) + + lgr.setParent(self) + return lgr + + def get_cell_lgr( self, active_index = None , global_index = None , ijk = None): """ @@ -1199,3 +1215,18 @@ class EclGrid(BaseCClass): """ return self._create_volume_keyword( active_size ) + + def export_coord(self): + return self._export_coord() + + def export_zcorn(self): + return self._export_zcorn() + + def export_actnum(self): + return self._export_actnum() + + def export_mapaxes(self): + if not self._use_mapaxes(): + return None + + return self._export_mapaxes() diff --git a/ThirdParty/Ert/python/python/ecl/ecl/ecl_grid_generator.py b/ThirdParty/Ert/python/python/ecl/ecl/ecl_grid_generator.py index b40e6ca335..16b5016e15 100644 --- a/ThirdParty/Ert/python/python/ecl/ecl/ecl_grid_generator.py +++ b/ThirdParty/Ert/python/python/ecl/ecl/ecl_grid_generator.py @@ -14,45 +14,92 @@ # See the GNU General Public License at # for more details. -import itertools -import numpy +import itertools, numpy +from math import sqrt from ecl.util import IntVector from ecl.ecl import EclGrid, EclKW, EclDataType, EclPrototype +def flatten(l): + return [elem for sublist in l for elem in sublist] + +def divide(l, size): + return [l[i:i+size:] for i in range(0, len(l), size)] + +def duplicate_inner(l): + return [elem for elem in l for i in range(2)][1:-1:] + +def construct_floatKW(name, values): + kw = EclKW(name, len(values), EclDataType.ECL_FLOAT) + for i, value in enumerate(values): + kw[i] = value + return kw + +def pre_mapaxes_translation(translation, mapaxes): + if mapaxes is None: + return translation + + x, y, z = translation + + unit_y = numpy.array((mapaxes[0]-mapaxes[2], mapaxes[1]-mapaxes[3])); + unit_y /= sqrt(numpy.sum(unit_y*unit_y)) + + unit_x = numpy.array((mapaxes[4]-mapaxes[2], mapaxes[5]-mapaxes[3])); + unit_x /= sqrt(numpy.sum(unit_x*unit_x)) + + det = 1.0 / (unit_x[0]*unit_y[1] - unit_x[1] * unit_y[0]); + + return ( + ( x*unit_y[1] - y*unit_y[0]) * det, + (-x*unit_x[1] + y*unit_x[0]) * det, + z + ) + class EclGridGenerator: - _alloc_rectangular = EclPrototype("ecl_grid_obj ecl_grid_alloc_rectangular( int , int , int , double , double , double , int*)" , bind = False) + _alloc_rectangular = EclPrototype("ecl_grid_obj ecl_grid_alloc_rectangular(int, int, int, double, double, double, int*)", bind=False) @classmethod - def createRectangular(cls, dims , dV , actnum = None): + def createRectangular(cls, dims, dV, actnum=None): """ Will create a new rectangular grid. @dims = (nx,ny,nz) @dVg = (dx,dy,dz) With the default value @actnum == None all cells will be active, """ if actnum is None: - ecl_grid = cls._alloc_rectangular( dims[0] , dims[1] , dims[2] , dV[0] , dV[1] , dV[2] , None ) + ecl_grid = cls._alloc_rectangular( + dims[0], dims[1], dims[2], + dV[0], dV[1], dV[2], + None + ) else: - if not isinstance(actnum , IntVector): - tmp = IntVector(initial_size = len(actnum)) - for (index , value) in enumerate(actnum): + if not isinstance(actnum, IntVector): + tmp = IntVector(initial_size=len(actnum)) + for (index, value) in enumerate(actnum): tmp[index] = value actnum = tmp - if not len(actnum) == dims[0] * dims[1] * dims[2]: - raise ValueError("ACTNUM size mismatch: len(ACTNUM):%d Expected:%d" % (len(actnum) , dims[0] * dims[1] * dims[2])) - ecl_grid = cls._alloc_rectangular( dims[0] , dims[1] , dims[2] , dV[0] , dV[1] , dV[2] , actnum.getDataPtr() ) + if not len(actnum) == dims[0]*dims[1]*dims[2]: + raise ValueError( + "ACTNUM size mismatch: len(ACTNUM):%d Expected:%d" + % (len(actnum), dims[0]*dims[1]*dims[2]) + ) + + ecl_grid = cls._alloc_rectangular( + dims[0], dims[1], dims[2], + dV[0], dV[1], dV[2], + actnum.getDataPtr() + ) # If we have not succeeded in creatin the grid we *assume* the # error is due to a failed malloc. if ecl_grid is None: raise MemoryError("Failed to allocated regualar grid") - + return ecl_grid @classmethod - def createSingleCellGrid(cls, corners): + def create_single_cell_grid(cls, corners): """ Provided with the corners of the grid in a similar manner as the eight corners are output for a single cell, this method will create a grid @@ -61,17 +108,21 @@ class EclGridGenerator: zcorn = [corners[i][2] for i in range(8)] - flatten = lambda l : [elem for sublist in l for elem in sublist] coord = [(corners[i], corners[i+4]) for i in range(4)] coord = flatten(flatten(coord)) - def constructFloatKW(name, values): + def construct_floatKW(name, values): kw = EclKW(name, len(values), EclDataType.ECL_FLOAT) for i in range(len(values)): kw[i] = values[i] return kw - grid = EclGrid.create((1,1,1), constructFloatKW("ZCORN", zcorn), constructFloatKW("COORD", coord), None) + grid = EclGrid.create( + (1, 1, 1), + construct_floatKW("ZCORN", zcorn), + construct_floatKW("COORD", coord), + None + ) if not corners == [grid.getCellCorner(i, 0) for i in range(8)]: raise AssertionError("Failed to generate single cell grid. " + @@ -80,7 +131,101 @@ class EclGridGenerator: return grid @classmethod - def createGrid(cls, dims, dV, offset=1, + def create_zcorn(cls, dims, dV, offset=1, escape_origo_shift=(1,1,0), + irregular_offset=False, irregular=False, concave=False, + faults=False): + + cls.__assert_zcorn_parameters(dims, dV, offset, escape_origo_shift, + irregular_offset, irregular, concave, faults) + + nx, ny, nz = dims + dx, dy, dz = dV + + # Compute zcorn + z = escape_origo_shift[2] + zcorn = [z]*(4*nx*ny) + for k in range(nz-1): + z = z+dz + local_offset = offset + (dz/2. if irregular_offset and k%2 == 0 else 0) + + layer = [] + for i in range(ny+1): + shift = ((i if concave else 0) + (k/2 if irregular else 0)) % 2 + path = [z if i%2 == shift else z+local_offset for i in range(nx+1)] + layer.append(duplicate_inner(path)) + + zcorn = zcorn + (2*flatten(duplicate_inner(layer))) + + z = z+dz + zcorn = zcorn + ([z]*(4*nx*ny)) + + if faults: + # Ensure that drop does not align with grid structure + drop = (offset+dz)/2. if abs(offset-dz/2.) > 0.2 else offset + 0.4 + zcorn = cls.__create_faults(nx, ny, nz, zcorn, drop) + + + if z != escape_origo_shift[2] + nz*dz: + raise ValueError("%f != %f" % (z, escape_origo_shift[2] + nz*dz)) + + cls.assert_zcorn(nx, ny, nz, zcorn) + return construct_floatKW("ZCORN", zcorn) + + @classmethod + def create_coord(cls, dims, dV, escape_origo_shift=(1,1,0), + scale=1, translation=(0,0,0), rotate=False, misalign=False): + + nx, ny, nz = dims + dx, dy, dz = dV + + # Compute coord + z = escape_origo_shift[2] + nz*dz + coord = [] + for j, i in itertools.product(range(ny+1), range(nx+1)): + x, y = i*dx+escape_origo_shift[0], j*dy+escape_origo_shift[1] + coord = coord + [x, y, escape_origo_shift[2], x, y, z] + + # Apply transformations + lower_center = ( + nx*dx/2. + escape_origo_shift[0], + ny*dy/2. + escape_origo_shift[1] + ) + + if misalign: + coord = cls.__misalign_coord(coord, dims, dV) + + coord = cls.__scale_coord(coord, scale, lower_center) + + if rotate: + coord = cls.__rotate_coord(coord, lower_center) + + coord = cls.__translate_lower_coord(coord, translation) + + cls.assert_coord(nx, ny, nz, coord) + return construct_floatKW("COORD", coord) + + @classmethod + def __assert_zcorn_parameters(cls, dims, dV, offset, escape_origo_shift, + irregular_offset, irregular, concave, faults): + + nx, ny, nz = dims + dx, dy, dz = dV + + # Validate arguments + if min(dims + dV) <= 0: + raise ValueError("Expected positive grid and cell dimentions") + + if offset < 0: + raise ValueError("Expected non-negative offset") + + if irregular and offset + (dz/2. if irregular_offset else 0) > dz: + raise AssertionError("Arguments can result in self-" + + "intersecting cells. Increase dz, deactivate eiter " + + "irregular or irregular_offset, or decrease offset to avoid " + + "any problems") + + @classmethod + def create_grid(cls, dims, dV, offset=1, escape_origo_shift=(1,1,0), irregular_offset=False, irregular=False, concave=False, faults=False, scale=1, translation=(0,0,0), rotate=False, @@ -132,85 +277,16 @@ class EclGridGenerator: @irregular_offset. """ - nx, ny, nz = dims - dx, dy, dz = dV + zcorn = cls.create_zcorn(dims, dV, offset, escape_origo_shift, + irregular_offset, irregular, concave, faults) - # Validate arguments - if min(dims + dV) <= 0: - raise ValueError("Expected positive grid and cell dimentions") + coord = cls.create_coord(dims, dV, escape_origo_shift, scale, + translation, rotate, misalign) - if offset < 0: - raise ValueError("Expected non-negative offset") - - if irregular and offset + (dz/2. if irregular_offset else 0) > dz: - raise AssertionError("Arguments can result in self-" + - "intersecting cells. Increase dz, deactivate eiter " + - "irregular or irregular_offset, or decrease offset to avoid " + - "any problems") - - verbose = lambda l : [elem for elem in l for i in range(2)][1:-1:] - flatten = lambda l : [elem for sublist in l for elem in sublist] - - # Compute zcorn - z = escape_origo_shift[2] - zcorn = [z]*(4*nx*ny) - for k in range(nz-1): - z = z+dz - local_offset = offset + (dz/2. if irregular_offset and k%2 == 0 else 0) - - layer = [] - for i in range(ny+1): - shift = ((i if concave else 0) + (k/2 if irregular else 0)) % 2 - path = [z if i%2 == shift else z+local_offset for i in range(nx+1)] - layer.append(verbose(path)) - - zcorn = zcorn + (2*flatten(verbose(layer))) - - z = z+dz - zcorn = zcorn + ([z]*(4*nx*ny)) - - if faults: - # Ensure that drop does not align with grid structure - drop = (offset+dz)/2. if abs(offset-dz/2.) > 0.2 else offset + 0.4 - zcorn = cls.__createFaults(nx, ny, nz, zcorn, drop) - - cls.assertZcorn(nx, ny, nz, zcorn) - - # Compute coord - coord = [] - for j, i in itertools.product(range(ny+1), range(nx+1)): - x, y = i*dx+escape_origo_shift[0], j*dy+escape_origo_shift[1] - coord = coord + [x, y, escape_origo_shift[2], x, y, z] - - # Apply transformations - lower_center = ( - nx*dx/2. + escape_origo_shift[0], - ny*dy/2. + escape_origo_shift[1] - ) - - if misalign: - coord = cls.__misalignCoord(coord, dims, dV) - - coord = cls.__scaleCoord(coord, scale, lower_center) - - if rotate: - coord = cls.__rotateCoord(coord, lower_center) - - coord = cls.__translateCoord(coord, translation) - - cls.assertCoord(nx, ny, nz, coord) - - # Construct grid - def constructFloatKW(name, values): - kw = EclKW(name, len(values), EclDataType.ECL_FLOAT) - for i in range(len(values)): - kw[i] = values[i] - return kw - - return EclGrid.create(dims, constructFloatKW("ZCORN", zcorn), constructFloatKW("COORD", coord), None) + return EclGrid.create(dims, zcorn, coord, None) @classmethod - def __createFaults(cls, nx, ny, nz, zcorn, drop): + def __create_faults(cls, nx, ny, nz, zcorn, drop): """ Will create several faults consisting of all cells such that either its i or j index is 1 modulo 3. @@ -236,7 +312,7 @@ class EclGridGenerator: return zcorn @classmethod - def assertZcorn(cls, nx, ny, nz, zcorn): + def assert_zcorn(cls, nx, ny, nz, zcorn, twisted_check=True): """ Raises an AssertionError if the zcorn is not as expected. In @@ -255,14 +331,14 @@ class EclGridGenerator: plane_size = 4*nx*ny for p in range(8*nx*ny*nz - plane_size): - if zcorn[p] > zcorn[p + plane_size]: + if zcorn[p] > zcorn[p + plane_size] and twisted_check: raise AssertionError( "Twisted cell was created. " + "Decrease offset or increase dz to avoid this!" ) @classmethod - def __scaleCoord(cls, coord, scale, lower_center): + def __scale_coord(cls, coord, scale, lower_center): coord = numpy.array([ map(float, coord[i:i+6:]) for i in range(0, len(coord), 6) @@ -274,7 +350,7 @@ class EclGridGenerator: return coord.flatten().tolist() @classmethod - def __misalignCoord(cls, coord, dims, dV): + def __misalign_coord(cls, coord, dims, dV): nx, ny, nz = dims coord = numpy.array([ @@ -282,8 +358,9 @@ class EclGridGenerator: for i in range(0, len(coord), 6) ]) + tf = lambda i, j: 1./2 if abs(i)+abs(j) <= 1 else 0.25 adjustment = numpy.array([ - (0, 0, 0, i*dV[0]/2., j*dV[1]/2., 0) for i, j in itertools.product([-1, 0, 1], repeat=2) + (0, 0, 0, i*tf(i,j)*dV[0], j*tf(i,j)*dV[1], 0) for i, j in itertools.product([-1, 0, 1], repeat=2) ]) for i, c in enumerate(coord): @@ -298,7 +375,7 @@ class EclGridGenerator: return coord.flatten().tolist() @classmethod - def __rotateCoord(cls, coord, lower_center): + def __rotate_coord(cls, coord, lower_center): coord = numpy.array([ map(float, coord[i:i+6:]) for i in range(0, len(coord), 6) @@ -314,7 +391,7 @@ class EclGridGenerator: return coord.flatten().tolist() @classmethod - def __translateCoord(cls, coord, translation): + def __translate_lower_coord(cls, coord, translation): coord = numpy.array([ map(float, coord[i:i+6:]) for i in range(0, len(coord), 6) @@ -325,14 +402,15 @@ class EclGridGenerator: return coord.flatten().tolist() @classmethod - def assertCoord(cls, nx, ny, nz, coord): + def assert_coord(cls, nx, ny, nz, coord, negative_values=False): """ Raises an AssertionError if the coord is not as expected. In - particular, it is verfied that: + particular, it is verified that: - coord has the approperiate length (6*(nx+1)*(ny+1)) and - - that all values are positive. + - that all values are positive unless negative_values are + explicitly allowed. """ @@ -342,10 +420,286 @@ class EclGridGenerator: (6*(nx+1)*(ny+1), len(coord)) ) - if min(coord) < 0: + if not negative_values and min(coord) < 0: raise AssertionError("Negative COORD values was generated. " + "This is likely due to a tranformation. " + "Increasing the escape_origio_shift will most likely " + "fix the problem") + @classmethod + def assert_actnum(cls, nx, ny, nz, actnum): + """ + Raises an AssertionError if the actnum is not as expected. In + particular, it is verified that: + + - actnum has the approperiate length nx*ny*nz and + - that all values are either 0 or 1. + + """ + + if actnum is None: + return + + if len(actnum) != nx*ny*nz: + raise AssertionError( + "Expected the length of ACTNUM to be %d, was %s." + %(nx*ny*nz, len(actnum)) + ) + + if set(actnum)-set([0,1]): + raise AssertionError( + "Expected ACTNUM to consist of 0's and 1's, was %s." + % ", ".join(map(str, set(actnum))) + ) + + @classmethod + def extract_coord(cls, dims, coord, ijk_bounds): + nx, ny, nz = dims + (lx, ux), (ly, uy), (lz, uz) = ijk_bounds + new_nx, new_ny, new_nz = ux-lx+1, uy-ly+1, uz-lz+1 + + cls.assert_coord(nx, ny, nz, coord, negative_values=True) + + # Format COORD + coord = divide(divide(coord, 6), nx+1) + + # Extract new COORD + new_coord = [coord_slice[lx:ux+2:] + for coord_slice in coord[ly:uy+2]] + + # Flatten and verify + new_coord = flatten(flatten(new_coord)) + cls.assert_coord(new_nx, new_ny, new_nz, new_coord, + negative_values=True) + + return construct_floatKW("COORD", new_coord) + + @classmethod + def extract_zcorn(cls, dims, zcorn, ijk_bounds): + nx, ny, nz = dims + (lx, ux), (ly, uy), (lz, uz) = ijk_bounds + new_nx, new_ny, new_nz = ux-lx+1, uy-ly+1, uz-lz+1 + + cls.assert_zcorn(nx, ny, nz, zcorn, twisted_check=False) + + # Format ZCORN + zcorn = divide(divide(zcorn, 2*nx), 2*ny) + + # Extract new ZCORN + new_zcorn = [ + y_slice[2*lx:2*ux+2:] + for z_slice in zcorn[2*lz:2*uz+2:] + for y_slice in z_slice[2*ly:2*uy+2:] + ] + + # Flatten and verify + new_zcorn = flatten(new_zcorn) + cls.assert_zcorn(new_nx, new_ny, new_nz, new_zcorn) + + return construct_floatKW("ZCORN", new_zcorn) + + @classmethod + def extract_actnum(cls, dims, actnum, ijk_bounds): + if actnum is None: + return None + + nx, ny, nz = dims + (lx, ux), (ly, uy), (lz, uz) = ijk_bounds + new_nx, new_ny, new_nz = ux-lx+1, uy-ly+1, uz-lz+1 + + cls.assert_actnum(nx, ny, nz, actnum) + + actnum = divide(divide(actnum, nx), ny) + + new_actnum = [ + y_slice[lx:ux+1:] + for z_slice in actnum[lz:uz+1:] + for y_slice in z_slice[ly:uy+1:] + ] + + new_actnum = flatten(new_actnum) + cls.assert_actnum(new_nx, new_ny, new_nz, new_actnum) + + actnumkw = EclKW("ACTNUM", len(new_actnum), EclDataType.ECL_INT) + for i, value in enumerate(new_actnum): + actnumkw[i] = value + + return actnumkw + + @classmethod + def __translate_coord(cls, coord, translation): + coord = numpy.array([ + map(float, coord[i:i+6:]) + for i in range(0, len(coord), 6) + ]) + translation = numpy.array(list(translation) + list(translation)) + + coord = coord + translation + return construct_floatKW("COORD", coord.flatten().tolist()) + + + @classmethod + def extract_subgrid(cls, grid, ijk_bounds, + decomposition_change=False, translation=None): + + """ + Extracts a subgrid from the given grid according to the specified + bounds. + + @ijk_bounds: The bounds describing the subgrid. Should be a tuple of + length 3, where each element gives the bound for the i, j, k + coordinates of the subgrid to be described, respectively. Each bound + should either be an interval of the form (a, b) where 0 <= a <= b < nx + or a single integer a which is equivialent to the bound (a, a). + + NOTE: The given bounds are including endpoints. + + @decomposition_change: Depending on the given ijk_bounds, libecl might + decompose the cells of the subgrid differently when extracted from + grid. This is somewhat unexpected behaviour and if this event occur we + give an exception together with an description for how to avoid this, + unless decompostion_change is set to True. + + @translation: Gives the possibility of translating the subgrid. Should + be given as a tuple (dx, dy, dz), where each coordinate of the grid + will be moved by di in direction i. + + """ + + gdims = grid.getDims()[:-1:] + nx, ny, nz = gdims + ijk_bounds = cls.assert_ijk_bounds(gdims, ijk_bounds) + + coord = grid.export_coord() + cls.assert_coord(nx, ny, nz, coord, negative_values=True) + + zcorn = grid.export_zcorn() + cls.assert_zcorn(nx, ny, nz, zcorn) + + actnum = grid.export_actnum() + cls.assert_actnum(nx, ny, nz, actnum) + + mapaxes = grid.export_mapaxes() + + sub_data = cls.extract_subgrid_data( + gdims, + coord, zcorn, + ijk_bounds=ijk_bounds, + actnum=actnum, + mapaxes=mapaxes, + decomposition_change=decomposition_change, + translation=translation + ) + + sdim = tuple([b-a+1 for a,b in ijk_bounds]) + sub_coord, sub_zcorn, sub_actnum = sub_data + + return EclGrid.create(sdim, sub_zcorn, sub_coord, sub_actnum, mapaxes=mapaxes) + + @classmethod + def extract_subgrid_data(cls, dims, coord, zcorn, ijk_bounds, actnum=None, + mapaxes=None, decomposition_change=False, translation=None): + """ + + Extracts subgrid data from COORD, ZCORN and potentially ACTNUM. It + returns similar formatted data for the subgrid described by the bounds. + + @dims: The dimentions (nx, ny, nz) of the grid + + @coord: The COORD data of the grid. + + @zcorn: The ZCORN data of the grid. + + @ijk_bounds: The bounds describing the subgrid. Should be a tuple of + length 3, where each element gives the bound for the i, j, k + coordinates of the subgrid to be described, respectively. Each bound + should either be an interval of the form (a, b) where 0 <= a <= b < nx + or a single integer a which is equivialent to the bound (a, a). + + NOTE: The given bounds are including endpoints. + + @actnum: The ACTNUM data of the grid. + + @mapaxes The MAPAXES data of the grid. + + @decomposition_change: Depending on the given ijk_bounds, libecl might + decompose the cells of the subgrid differently when extracted from + grid. This is somewhat unexpected behaviour and if this event occur we + give an exception together with an description for how to avoid this, + unless decompostion_change is set to True. + + @translation: Gives the possibility of translating the subgrid. Should + be given as a tuple (dx, dy, dz), where each coordinate of the grid + will be moved by di in direction i. + + """ + coord, zcorn = list(coord), list(zcorn) + actnum = None if actnum is None else list(actnum) + + ijk_bounds = cls.assert_ijk_bounds(dims, ijk_bounds) + cls.assert_decomposition_change(ijk_bounds, decomposition_change) + + nx, ny, nz = dims + (lx, ux), (ly, uy), (lz, uz) = ijk_bounds + new_nx, new_ny, new_nz = ux-lx+1, uy-ly+1, uz-lz+1 + + new_coord = cls.extract_coord(dims, coord, ijk_bounds) + new_zcorn = cls.extract_zcorn(dims, zcorn, ijk_bounds) + new_actnum = cls.extract_actnum(dims, actnum, ijk_bounds) + + if translation is not None: + mtranslation = pre_mapaxes_translation(translation, mapaxes) + new_coord = cls.__translate_coord(new_coord, mtranslation) + + for i in range(len(new_zcorn)): + new_zcorn[i] += translation[2] + + return new_coord, new_zcorn, new_actnum + + @classmethod + def assert_ijk_bounds(cls, dims, ijk_bounds): + ijk_bounds = list(ijk_bounds) + + for i in range(len(ijk_bounds)): + if isinstance(ijk_bounds[i], int): + ijk_bounds[i] = [ijk_bounds[i]] + if len(ijk_bounds[i]) == 1: + ijk_bounds[i] += ijk_bounds[i] + + if len(ijk_bounds) != 3: + raise ValueError( + "Expected ijk_bounds to contain three intervals, " + + "contained only %d" % len(ijk_bounds)) + + for n, bound in zip(dims, ijk_bounds): + if len(bound) != 2: + raise ValueError( + "Expected bound to consist of two elements, was %s", + str(bound)) + + if not (isinstance(bound[0], int) and isinstance(bound[1], int)): + raise TypeError( + "Expected bound to consist of two integers, ", + "was %s (%s)" + %(str(bound), str((map(type,bound)))) + ) + + if not (0 <= bound[0] <= bound[1] < n): + raise ValueError( + "Expected bounds to have the following format: " + + "0 <= lower bound <= upper_bound < ni, "+ + "was %d <=? %d <=? %d +# for more details. + +from os.path import isfile from cwrap import BaseCClass from ecl.ecl import EclGrid from ecl.ecl.ecl_file import EclFile @@ -82,9 +99,14 @@ class WellInfo(BaseCClass): """ return self._has_well( item ) + def _assert_file_exists(self, rst_file): + if not isfile(rst_file): + raise IOError('No such file %s' % rst_file) + def addWellFile(self, rst_file, load_segment_information): """ @type rstfile: str or EclFile """ if isinstance(rst_file, str): + self._assert_file_exists(rst_file) self._load_rstfile(rst_file, load_segment_information) elif isinstance(rst_file, EclFile): self._load_rst_eclfile(rst_file, load_segment_information) diff --git a/ThirdParty/Ert/python/python/legacy/ert/CMakeLists.txt b/ThirdParty/Ert/python/python/legacy/ert/CMakeLists.txt new file mode 100644 index 0000000000..dc308b5229 --- /dev/null +++ b/ThirdParty/Ert/python/python/legacy/ert/CMakeLists.txt @@ -0,0 +1,11 @@ +set(PYTHON_SOURCES + __init__.py + ecl/__init__.py + ecl/faults/__init__.py + geo/__init__.py + well/__init__.py + util/__init__.py + test/__init__.py +) +add_python_package("python.ert" ${PYTHON_INSTALL_PREFIX}/ert "${PYTHON_SOURCES}" True) + diff --git a/ThirdParty/Ert/python/python/legacy/ert/__init__.py b/ThirdParty/Ert/python/python/legacy/ert/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ThirdParty/Ert/python/python/legacy/ert/ecl/__init__.py b/ThirdParty/Ert/python/python/legacy/ert/ecl/__init__.py new file mode 100644 index 0000000000..bdc9ad8458 --- /dev/null +++ b/ThirdParty/Ert/python/python/legacy/ert/ecl/__init__.py @@ -0,0 +1,26 @@ +from ecl.ecl import EclFileEnum, EclFileFlagEnum, EclPhaseEnum, EclUnitTypeEnum , EclUtil +from ecl.ecl import EclTypeEnum, EclDataType +from ecl.ecl import EclSumVarType +from ecl.ecl import EclSumTStep +from ecl.ecl import EclSum #, EclSumVector, EclSumNode, EclSMSPECNode +from ecl.ecl import EclSumKeyWordVector +from ecl.ecl import EclPLTCell, EclRFTCell +from ecl.ecl import EclRFT, EclRFTFile +from ecl.ecl import FortIO, openFortIO +from ecl.ecl import EclKW +from ecl.ecl import Ecl3DKW +from ecl.ecl import EclFileView +from ecl.ecl import EclFile , openEclFile +from ecl.ecl import Ecl3DFile +from ecl.ecl import EclInitFile +from ecl.ecl import EclRestartFile +from ecl.ecl import EclGrid +from ecl.ecl import EclRegion +from ecl.ecl import EclSubsidence +from ecl.ecl import phase_deltag, deltag +from ecl.ecl import EclGrav +from ecl.ecl import EclSumNode +from ecl.ecl import EclSumVector +from ecl.ecl import EclNPV , NPVPriceVector +from ecl.ecl import EclCmp +from ecl.ecl import EclGridGenerator diff --git a/ThirdParty/Ert/python/python/legacy/ert/ecl/faults/__init__.py b/ThirdParty/Ert/python/python/legacy/ert/ecl/faults/__init__.py new file mode 100644 index 0000000000..2d336c1fd6 --- /dev/null +++ b/ThirdParty/Ert/python/python/legacy/ert/ecl/faults/__init__.py @@ -0,0 +1,7 @@ +from ecl.ecl.faults import Layer +from ecl.ecl.faults import FaultCollection +from ecl.ecl.faults import Fault +from ecl.ecl.faults import FaultLine +from ecl.ecl.faults import FaultSegment , SegmentMap +from ecl.ecl.faults import FaultBlock , FaultBlockCell +from ecl.ecl.faults import FaultBlockLayer diff --git a/ThirdParty/Ert/python/python/legacy/ert/geo/__init__.py b/ThirdParty/Ert/python/python/legacy/ert/geo/__init__.py new file mode 100644 index 0000000000..67f4193aa3 --- /dev/null +++ b/ThirdParty/Ert/python/python/legacy/ert/geo/__init__.py @@ -0,0 +1,8 @@ +from ecl.geo import GeoPointset +from ecl.geo import GeoRegion +from ecl.geo import CPolyline +from ecl.geo import CPolylineCollection +from ecl.geo import Polyline +from ecl.geo import XYZIo +from ecl.geo import GeometryTools +from ecl.geo import Surface diff --git a/ThirdParty/Ert/python/python/legacy/ert/test/__init__.py b/ThirdParty/Ert/python/python/legacy/ert/test/__init__.py new file mode 100644 index 0000000000..912a43a595 --- /dev/null +++ b/ThirdParty/Ert/python/python/legacy/ert/test/__init__.py @@ -0,0 +1,10 @@ +from ecl.test import TestRun +from ecl.test import path_exists +from ecl.test import ExtendedTestCase +from ecl.test import SourceEnumerator +from ecl.test import TestArea , TestAreaContext +from ecl.test import TempArea , TempAreaContext +from ecl.test import ErtTestRunner +from ecl.test import PathContext +from ecl.test import LintTestCase +from ecl.test import ImportTestCase diff --git a/ThirdParty/Ert/python/python/legacy/ert/util/__init__.py b/ThirdParty/Ert/python/python/legacy/ert/util/__init__.py new file mode 100644 index 0000000000..eeb36b19f3 --- /dev/null +++ b/ThirdParty/Ert/python/python/legacy/ert/util/__init__.py @@ -0,0 +1,25 @@ +from ecl.util import Version +from ecl.util import RngAlgTypeEnum, RngInitModeEnum, LLSQResultEnum +from ecl.util import CTime +from ecl.util import PermutationVector +from ecl.util import VectorTemplate +from ecl.util import DoubleVector +from ecl.util import IntVector +from ecl.util import BoolVector +from ecl.util import TimeVector +from ecl.util import StringList +from ecl.util import RandomNumberGenerator +from ecl.util import Matrix +from ecl.util import quantile, quantile_sorted, polyfit +from ecl.util import Log +from ecl.util import LookupTable +from ecl.util import Buffer +from ecl.util import Hash, StringHash, DoubleHash, IntegerHash +from ecl.util import SubstitutionList +from ecl.util import UIReturn +from ecl.util import ThreadPool +from ecl.util import CThreadPool, startCThreadPool +from ecl.util import installAbortSignals, updateAbortSignals +from ecl.util import Profiler +from ecl.util import ArgPack +from ecl.util import PathFormat diff --git a/ThirdParty/Ert/python/python/legacy/ert/well/__init__.py b/ThirdParty/Ert/python/python/legacy/ert/well/__init__.py new file mode 100644 index 0000000000..5a699e5689 --- /dev/null +++ b/ThirdParty/Ert/python/python/legacy/ert/well/__init__.py @@ -0,0 +1,7 @@ +from ecl.well import WellTypeEnum +from ecl.well import WellConnectionDirectionEnum +from ecl.well import WellConnection +from ecl.well import WellSegment +from ecl.well import WellState +from ecl.well import WellTimeLine +from ecl.well import WellInfo diff --git a/ThirdParty/Ert/python/tests/CMakeLists.txt b/ThirdParty/Ert/python/tests/CMakeLists.txt index 985fe07610..a343151dff 100644 --- a/ThirdParty/Ert/python/tests/CMakeLists.txt +++ b/ThirdParty/Ert/python/tests/CMakeLists.txt @@ -12,5 +12,9 @@ add_subdirectory(well) add_subdirectory(cwrap) add_subdirectory(global) +if (INSTALL_ERT_LEGACY) + add_subdirectory(legacy) +endif() +configure_file( test_install.in ${EXECUTABLE_OUTPUT_PATH}/test_install @ONLY ) diff --git a/ThirdParty/Ert/python/tests/cwrap/test_basecvalue.py b/ThirdParty/Ert/python/tests/cwrap/test_basecvalue.py index 6f2bb647d6..4066333221 100644 --- a/ThirdParty/Ert/python/tests/cwrap/test_basecvalue.py +++ b/ThirdParty/Ert/python/tests/cwrap/test_basecvalue.py @@ -4,7 +4,7 @@ from cwrap import BaseCValue, Prototype from ecl.test import ExtendedTestCase class TestPrototype(Prototype): - lib = ecl.load("libert_util") + lib = ecl.load("libecl") def __init__(self, prototype): super(TestPrototype, self).__init__(self.lib, prototype) diff --git a/ThirdParty/Ert/python/tests/cwrap/test_cfile.py b/ThirdParty/Ert/python/tests/cwrap/test_cfile.py index 3fb5093a55..1df29bfe8c 100644 --- a/ThirdParty/Ert/python/tests/cwrap/test_cfile.py +++ b/ThirdParty/Ert/python/tests/cwrap/test_cfile.py @@ -6,7 +6,7 @@ from ecl.test.test_area import TestAreaContext # Local copies so that the real ones don't get changed class TestUtilPrototype(Prototype): - lib = ecl.load("libert_util") + lib = ecl.load("libecl") def __init__(self, prototype, bind=False): super(TestUtilPrototype, self).__init__(TestUtilPrototype.lib, prototype, bind=bind) diff --git a/ThirdParty/Ert/python/tests/cwrap/test_metawrap.py b/ThirdParty/Ert/python/tests/cwrap/test_metawrap.py index 2f9c5c2b90..e82db53d6d 100644 --- a/ThirdParty/Ert/python/tests/cwrap/test_metawrap.py +++ b/ThirdParty/Ert/python/tests/cwrap/test_metawrap.py @@ -9,7 +9,7 @@ from ecl.test import ExtendedTestCase # Local copies so that the real ones don't get changed class TestUtilPrototype(Prototype): - lib = ecl.load("libert_util") + lib = ecl.load("libecl") def __init__(self, prototype, bind=False): super(TestUtilPrototype, self).__init__(TestUtilPrototype.lib, prototype, bind=bind) @@ -113,7 +113,6 @@ class MetaWrapTest(ExtendedTestCase): def stringObj(c_ptr): char_ptr = ctypes.c_char_p(c_ptr) python_string = char_ptr.value - TestUtilPrototype.lib.free(c_ptr) return python_string.decode('ascii') Prototype.registerType("string_obj", stringObj) diff --git a/ThirdParty/Ert/python/tests/ecl/CMakeLists.txt b/ThirdParty/Ert/python/tests/ecl/CMakeLists.txt index 85a308d90e..07099c738f 100644 --- a/ThirdParty/Ert/python/tests/ecl/CMakeLists.txt +++ b/ThirdParty/Ert/python/tests/ecl/CMakeLists.txt @@ -19,6 +19,7 @@ set(TEST_SOURCES test_grdecl.py test_grid.py test_grid_statoil.py + test_grid_generator.py test_indexed_read.py test_ecl_kw_statoil.py test_ecl_kw.py @@ -40,11 +41,14 @@ set(TEST_SOURCES test_geertsma.py test_ecl_type.py test_restart_head.py + test_fk_user_data.py ) add_python_package("python.tests.ecl" ${PYTHON_INSTALL_PREFIX}/tests/ecl "${TEST_SOURCES}" False) +addPythonTest(tests.ecl.test_fk_user_data.FKTest) addPythonTest(tests.ecl.test_grid.GridTest ) +addPythonTest(tests.ecl.test_grid_generator.GridGeneratorTest ) addPythonTest(tests.ecl.test_ecl_kw.KWTest) addPythonTest(tests.ecl.test_kw_function.KWFunctionTest) addPythonTest(tests.ecl.test_ecl_3dkw.Ecl3DKWTest ) diff --git a/ThirdParty/Ert/python/tests/ecl/test_ecl_file.py b/ThirdParty/Ert/python/tests/ecl/test_ecl_file.py index 66a70196eb..5a56e14520 100644 --- a/ThirdParty/Ert/python/tests/ecl/test_ecl_file.py +++ b/ThirdParty/Ert/python/tests/ecl/test_ecl_file.py @@ -79,7 +79,37 @@ class EclFileTest(ExtendedTestCase): self.assertTrue( ecl_file.has_kw("KW2")) self.assertEqual(ecl_file[1], ecl_file[-1]) + def test_save_kw(self): + with TestAreaContext("python/ecl_file/save_kw"): + data = range(1000) + kw = EclKW("MY_KEY", len(data), EclDataType.ECL_INT) + for index, val in enumerate(data): + kw[index] = val + clean_dump = "my_clean_file" + fortio = FortIO(clean_dump, FortIO.WRITE_MODE) + kw.fwrite(fortio) + fortio.close() + + test_file = "my_dump_file" + fortio = FortIO(test_file, FortIO.WRITE_MODE) + kw.fwrite(fortio) + fortio.close() + + self.assertFilesAreEqual(clean_dump, test_file) + + ecl_file = EclFile(test_file, flags=EclFileFlagEnum.ECL_FILE_WRITABLE) + loaded_kw = ecl_file["MY_KEY"][0] + self.assertTrue(kw.equal(loaded_kw)) + + ecl_file.save_kw(loaded_kw) + ecl_file.close() + + self.assertFilesAreEqual(clean_dump, test_file) + + ecl_file = EclFile(test_file) + loaded_kw = ecl_file["MY_KEY"][0] + self.assertTrue(kw.equal(loaded_kw)) def test_gc(self): kw1 = EclKW("KW1" , 100 , EclDataType.ECL_INT) diff --git a/ThirdParty/Ert/python/tests/ecl/test_ecl_util.py b/ThirdParty/Ert/python/tests/ecl/test_ecl_util.py index 0704b17cf1..497f52769c 100644 --- a/ThirdParty/Ert/python/tests/ecl/test_ecl_util.py +++ b/ThirdParty/Ert/python/tests/ecl/test_ecl_util.py @@ -21,12 +21,12 @@ from ecl.test import ExtendedTestCase class EclUtilTest(ExtendedTestCase): def test_enums(self): - source_file_path = "libecl/include/ert/ecl/ecl_util.h" + source_file_path = "lib/include/ert/ecl/ecl_util.h" self.assertEnumIsFullyDefined(EclFileEnum, "ecl_file_enum", source_file_path) self.assertEnumIsFullyDefined(EclPhaseEnum, "ecl_phase_enum", source_file_path) self.assertEnumIsFullyDefined(EclUnitTypeEnum, "ert_ecl_unit_enum", source_file_path) - source_file_path = "libecl/include/ert/ecl/ecl_type.h" + source_file_path = "lib/include/ert/ecl/ecl_type.h" self.assertEnumIsFullyDefined(EclTypeEnum, "ecl_type_enum", source_file_path) def test_file_type(self): diff --git a/ThirdParty/Ert/python/tests/ecl/test_fk_user_data.py b/ThirdParty/Ert/python/tests/ecl/test_fk_user_data.py new file mode 100644 index 0000000000..b3d48befea --- /dev/null +++ b/ThirdParty/Ert/python/tests/ecl/test_fk_user_data.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# Copyright (C) 2017 Statoil ASA, Norway. +# +# The file 'test_ecl_cell_containment.py' is part of ERT - Ensemble based Reservoir Tool. +# +# ERT 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. +# +# ERT 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 at +# for more details. + +from ecl.ecl import EclGrid +from ecl.test import ExtendedTestCase, TestAreaContext + +class FKTest(ExtendedTestCase): + + def test_cell_containment(self): + + grid_location = "local/ECLIPSE/faarikaal/faarikaal%d.EGRID" + well_location = "local/ECLIPSE/faarikaal/faarikaal%d.txt" + + for i in range(1, 8): + grid_file = self.createTestPath(grid_location % i) + well_file = self.createTestPath(well_location % i) + + grid = EclGrid(grid_file) + + # Load well data + with open(well_file, "r") as f: + lines = [line.split() for line in f.readlines()] + + points = [map(float, line[:3:]) for line in lines] + exp_cells = [tuple(map(int, line[3::])) for line in lines] + + msg = "Expected point %s to be in cell %s, was in %s." + for point, exp_cell in zip(points, exp_cells): + reported_cell = grid.find_cell(*point) + self.assertEqual( + exp_cell, + reported_cell, + msg % (str(point), str(exp_cell), str(reported_cell)) + ) diff --git a/ThirdParty/Ert/python/tests/ecl/test_grid.py b/ThirdParty/Ert/python/tests/ecl/test_grid.py index 08dded9868..624f0ac890 100644 --- a/ThirdParty/Ert/python/tests/ecl/test_grid.py +++ b/ThirdParty/Ert/python/tests/ecl/test_grid.py @@ -49,21 +49,21 @@ CORNER_HOME = { def createVolumeTestGridBase(dim, dV, offset=1): return [ - GridGen.createGrid(dim, dV, offset=0), - GridGen.createGrid(dim, dV, offset=offset), - GridGen.createGrid(dim, dV, offset=offset, irregular_offset=True), - GridGen.createGrid(dim, dV, offset=offset, concave=True), - GridGen.createGrid(dim, dV, offset=offset, irregular=True), - GridGen.createGrid(dim, dV, offset=offset, concave=True, irregular=True), - GridGen.createGrid(dim, dV, offset=offset, irregular_offset=True, concave=True), - GridGen.createGrid(dim, dV, offset=0, faults=True), - GridGen.createGrid(dim, dV, offset=offset, faults=True), - GridGen.createGrid(dim, dV, escape_origo_shift=(100, 100, 0), scale=2), - GridGen.createGrid(dim, dV, escape_origo_shift=(100, 100, 0), scale=0.5), - GridGen.createGrid(dim, dV, escape_origo_shift=(100, 100, 0), translation=(50,50,0)), - GridGen.createGrid(dim, dV, escape_origo_shift=(100, 100, 0), rotate=True), - GridGen.createGrid(dim, dV, escape_origo_shift=(100, 100, 0), misalign=True), - GridGen.createGrid(dim, dV, offset=offset, escape_origo_shift=(100, 100, 0), + GridGen.create_grid(dim, dV, offset=0), + GridGen.create_grid(dim, dV, offset=offset), + GridGen.create_grid(dim, dV, offset=offset, irregular_offset=True), + GridGen.create_grid(dim, dV, offset=offset, concave=True), + GridGen.create_grid(dim, dV, offset=offset, irregular=True), + GridGen.create_grid(dim, dV, offset=offset, concave=True, irregular=True), + GridGen.create_grid(dim, dV, offset=offset, irregular_offset=True, concave=True), + GridGen.create_grid(dim, dV, offset=0, faults=True), + GridGen.create_grid(dim, dV, offset=offset, faults=True), + GridGen.create_grid(dim, dV, escape_origo_shift=(100, 100, 0), scale=2), + GridGen.create_grid(dim, dV, escape_origo_shift=(100, 100, 0), scale=0.5), + GridGen.create_grid(dim, dV, escape_origo_shift=(100, 100, 0), translation=(50,50,0)), + GridGen.create_grid(dim, dV, escape_origo_shift=(100, 100, 0), rotate=True), + GridGen.create_grid(dim, dV, escape_origo_shift=(100, 100, 0), misalign=True), + GridGen.create_grid(dim, dV, offset=offset, escape_origo_shift=(100, 100, 0), irregular_offset=True, concave=True, irregular=True, scale=1.5, translation=(5,5,0), rotate=True, misalign=True) @@ -71,11 +71,11 @@ def createVolumeTestGridBase(dim, dV, offset=1): def createContainmentTestBase(): return [ - (3, GridGen.createGrid((6,6,6), (1,1,1), offset=1)), - (10, GridGen.createGrid((3,3,3), (1,1,1), offset=1, concave=True)), - (4, GridGen.createGrid((10,10,1), (1,1,1), offset=0., misalign=True)), + (3, GridGen.create_grid((6,6,6), (1,1,1), offset=1)), + (10, GridGen.create_grid((3,3,3), (1,1,1), offset=1, concave=True)), + (4, GridGen.create_grid((10,10,1), (1,1,1), offset=0., misalign=True)), (3, - GridGen.createGrid((6,6,6), (1,1,1), offset=0., + GridGen.create_grid((6,6,6), (1,1,1), offset=0., escape_origo_shift=(100, 100, 0), irregular_offset=True, concave=True, irregular=True, scale=1.5, translation=(5,5,0), @@ -110,7 +110,7 @@ def createWrapperGrid(grid): for i, pos in enumerate(corner_pos) ] - return GridGen.createSingleCellGrid(corners) + return GridGen.create_single_cell_grid(corners) def average(points): p = reduce(lambda a,b: (a[0]+b[0], a[1]+b[1], a[2]+b[2]), points) @@ -334,6 +334,15 @@ class GridTest(ExtendedTestCase): self.assertEqual( len(grid) , nx*ny*nz ) self.assertEqual( grid.getNumActive( ) , 4 ) + def test_export(self): + dims = (3, 3, 3) + coord = GridGen.create_coord(dims, (1,1,1)) + zcorn = GridGen.create_zcorn(dims, (1,1,1), offset=0) + + grid = EclGrid.create(dims, zcorn, coord, None) + + self.assertEqual(zcorn, grid.export_zcorn()) + self.assertEqual(coord, grid.export_coord()) def test_output_units(self): n = 10 @@ -389,11 +398,13 @@ class GridTest(ExtendedTestCase): for i in range(grid.getGlobalSize()) ].count(True) - self.assertTrue(hits in [0, 1]) + self.assertIn(hits, [0, 1]) + expected = 1 if wgrid.cell_contains(x, y, z, 0) else 0 self.assertEqual( - 1 if wgrid.cell_contains(x, y, z, 0) else 0, - hits + expected, + hits, + 'Expected %d for (%g,%g,%g), got %d' % (expected, x, y, z, hits) ) def test_cell_corner_containment(self): @@ -445,7 +456,7 @@ class GridTest(ExtendedTestCase): (20, 20, 20) ] - grid = GridGen.createSingleCellGrid(points) + grid = GridGen.create_single_cell_grid(points) assertPoint = lambda p : self.assertTrue( grid.cell_contains(p[0], p[1], p[2], 0) @@ -505,7 +516,7 @@ class GridTest(ExtendedTestCase): (25, 25, 25) ] - grid = GridGen.createSingleCellGrid(points) + grid = GridGen.create_single_cell_grid(points) assertPoint = lambda p : self.assertTrue( grid.cell_contains(p[0], p[1], p[2], 0) diff --git a/ThirdParty/Ert/python/tests/ecl/test_grid_generator.py b/ThirdParty/Ert/python/tests/ecl/test_grid_generator.py new file mode 100644 index 0000000000..ff2d8f087d --- /dev/null +++ b/ThirdParty/Ert/python/tests/ecl/test_grid_generator.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +# Copyright (C) 2017 Statoil ASA, Norway. +# +# The file 'test_grid_generator.py' is part of ERT - Ensemble based Reservoir Tool. +# +# ERT 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. +# +# ERT 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 at +# for more details. + +from itertools import product as prod +import operator, random, numpy + +from ecl.ecl import EclGrid, EclKW, EclDataType +from ecl.ecl import EclGridGenerator as GridGen +from ecl.test import ExtendedTestCase, TestAreaContext + + +def generate_ijk_bounds(dims): + ibounds = [(l, u) for l in range(dims[0]) for u in range(l, dims[0])] + jbounds = [(l, u) for l in range(dims[1]) for u in range(l, dims[1])] + kbounds = [(l, u) for l in range(dims[2]) for u in range(l, dims[2])] + return prod(ibounds, jbounds, kbounds) + +def decomposition_preserving(ijk_bound): + return sum(zip(*ijk_bound)[0])%2 is 0 + +class GridGeneratorTest(ExtendedTestCase): + + def setUp(self): + self.test_base = [ + ( + list(GridGen.create_coord((4,4,4), (1,1,1))), + list(GridGen.create_zcorn((4,4,4), (1,1,1), offset=0)), + GridGen.create_grid((4,4,4), (1,1,1), offset=0) + ), + ( + list( + GridGen.create_coord((5,5,5), (1,1,1), + translation=(10,10,0)) + ), + list( + GridGen.create_zcorn((5,5,5), (1,1,1), offset=0.5, + irregular_offset=True, concave=True, irregular=True) + ), + GridGen.create_grid( + (5,5,5), (1,1,1), offset=0.5, + irregular=True, irregular_offset=True, concave=True, + translation=(10,10,0) + ) + ) + ] + + def test_extract_grid_decomposition_change(self): + dims = (4,4,4) + zcorn = list(GridGen.create_zcorn(dims, (1,1,1), offset=0)) + coord = list(GridGen.create_coord(dims, (1,1,1))) + + ijk_bounds = generate_ijk_bounds(dims) + for ijk_bounds in ijk_bounds: + if decomposition_preserving(ijk_bounds): + GridGen.extract_subgrid_data(dims, coord, zcorn, ijk_bounds) + else: + with self.assertRaises(ValueError): + GridGen.extract_subgrid_data(dims, coord, zcorn, ijk_bounds) + + GridGen.extract_subgrid_data(dims, + coord, zcorn, + ijk_bounds, + decomposition_change=True) + + def test_extract_grid_invalid_bounds(self): + dims = (3,3,3) + zcorn = list(GridGen.create_zcorn(dims, (1,1,1), offset=0)) + coord = list(GridGen.create_coord(dims, (1,1,1))) + + with self.assertRaises(ValueError): + GridGen.extract_subgrid_data(dims, coord, zcorn, ((-1,0), (2,2), (2,2))) + + with self.assertRaises(ValueError): + GridGen.extract_subgrid_data(dims, coord, zcorn, ((1,6), (2,2), (2,2))) + + with self.assertRaises(ValueError): + GridGen.extract_subgrid_data(dims, coord, zcorn, ((1,2), (2,0), (2,2))) + + def test_extract_grid_slice_spec(self): + dims = (4,4,4) + zcorn = list(GridGen.create_zcorn(dims, (1,1,1), offset=0)) + coord = list(GridGen.create_coord(dims, (1,1,1))) + + ijk_bounds = generate_ijk_bounds(dims) + for ijk in ijk_bounds: + ijk = list(ijk) + for i in range(3): + if len(set(ijk[i])) == 1: + ijk[i] = ijk[i][0] + + GridGen.extract_subgrid_data(dims, + coord, zcorn, + ijk, + decomposition_change=True) + + def assertSubgrid(self, grid, subgrid, ijk_bound): + sijk_space = prod(*[range(d) for d in subgrid.getDims()[:-1:]]) + for sijk in sijk_space: + gijk = tuple([a+b for a, b in zip(sijk, zip(*ijk_bound)[0])]) + + self.assertEqual( + [subgrid.getCellCorner(i, ijk=sijk) for i in range(8)], + [grid.getCellCorner(i, ijk=gijk) for i in range(8)] + ) + + self.assertEqual(grid.active(ijk=gijk), subgrid.active(ijk=sijk)) + + def test_validate_cells(self): + for coord, zcorn, grid in self.test_base: + grid_dims = grid.getDims()[:-1:] + ijk_bounds = generate_ijk_bounds(grid_dims) + for ijk_bound in ijk_bounds: + if not decomposition_preserving(ijk_bound): + continue + + sub_dims = tuple([u-l+1 for l, u in ijk_bound]) + sub_coord, sub_zcorn, _ = GridGen.extract_subgrid_data( + grid_dims, + coord, + zcorn, + ijk_bound + ) + + subgrid = EclGrid.create(sub_dims, sub_zcorn, sub_coord, None) + self.assertEqual(sub_dims, subgrid.getDims()[:-1:]) + self.assertSubgrid(grid, subgrid, ijk_bound) + + def test_actnum_extraction(self): + dims = (4,4,4) + + coord = GridGen.create_coord(dims, (1,1,1)) + zcorn = GridGen.create_zcorn(dims, (1,1,1), offset=0) + + actnum = EclKW("ACTNUM", reduce(operator.mul, dims), EclDataType.ECL_INT) + random.seed(1337) + for i in range(len(actnum)): + actnum[i] = random.randint(0, 1) + + grid = EclGrid.create(dims, zcorn, coord, actnum) + + ijk_bounds = generate_ijk_bounds(dims) + for ijk_bound in ijk_bounds: + if not decomposition_preserving(ijk_bound): + continue + + sub = GridGen.extract_subgrid_data( + dims, + coord, + zcorn, + ijk_bound, + actnum=actnum + ) + + sub_coord, sub_zcorn, sub_actnum = sub + sub_dims = tuple([u-l+1 for l, u in ijk_bound]) + subgrid = EclGrid.create(sub_dims, sub_zcorn, sub_coord, sub_actnum) + self.assertEqual(sub_dims, subgrid.getDims()[:-1:]) + self.assertSubgrid(grid, subgrid, ijk_bound) + + def test_translation(self): + dims = (3,3,3) + + coord = GridGen.create_coord(dims, (1,1,1)) + zcorn = GridGen.create_zcorn(dims, (1,1,1), offset=0) + grid = EclGrid.create(dims, zcorn, coord, None) + + ijk_bound = [(0, d-1) for d in dims] + translation = (1, 2, 3) + sub_coord, sub_zcorn, _ = GridGen.extract_subgrid_data( + dims, + coord, + zcorn, + ijk_bound, + translation=translation + ) + + tgrid = EclGrid.create(dims, sub_zcorn, sub_coord, None) + self.assertEqual(grid.getGlobalSize(), tgrid.getGlobalSize()) + + for gi in range(grid.getGlobalSize()): + translation = numpy.array(translation) + corners = [grid.getCellCorner(i, gi) for i in range(8)] + corners = [tuple(numpy.array(c)+translation) for c in corners] + + tcorners = [tgrid.getCellCorner(i, gi) for i in range(8)] + + self.assertEqual(corners, tcorners) + + def test_subgrid_extration(self): + for _, _, grid in self.test_base[:-1:]: + grid_dims = grid.getDims()[:-1:] + ijk_bounds = generate_ijk_bounds(grid_dims) + for ijk_bound in ijk_bounds: + if not decomposition_preserving(ijk_bound): + continue + + sub_dims = tuple([u-l+1 for l, u in ijk_bound]) + subgrid = GridGen.extract_subgrid(grid, ijk_bound) + + self.assertEqual(sub_dims, subgrid.getDims()[:-1:]) + self.assertSubgrid(grid, subgrid, ijk_bound) + + def test_subgrid_translation(self): + grid = GridGen.create_grid((4,4,4), (1,1,1), offset=0.5, + irregular=True, irregular_offset=True, concave=True, + translation=(10,10,0)) + + # Create grid with MAPAXES + mapaxes = EclKW("MAPAXES", 6, EclDataType.ECL_FLOAT) + for i, val in enumerate([1200, 1400, 2500, 2500, 3700, 4000]): + mapaxes[i] = val + + grid = EclGrid.create( + grid.getDims(), + grid.export_zcorn(), + grid.export_coord(), + None, + mapaxes=mapaxes + ) + + for translation in [ + (0,0,0), + (10, 10, 100), + (-1, -1, -1) + ]: + subgrid = GridGen.extract_subgrid( + grid, + ((0,3), (0,3), (0,3)), + translation=translation + ) + + self.assertEqual(grid.getDims(), subgrid.getDims()) + + translation = numpy.array(translation) + for gindex in range(grid.getGlobalSize()): + grid_corners = [ + grid.getCellCorner(i, global_index=gindex) + for i in range(8) + ] + + subgrid_corners = [ + subgrid.getCellCorner(i, global_index=gindex) + for i in range(8) + ] + + subgrid_corners = [ + list(numpy.array(corner) - translation) + for corner in subgrid_corners + ] + + for gc, sc in zip(grid_corners, subgrid_corners): + self.assertAlmostEqualList( + gc, + sc, + msg="Failed to translate corners correctly." + + "Expected %s, was %s." % (gc, sc), + tolerance=10e-10 + ) diff --git a/ThirdParty/Ert/python/tests/ecl/test_grid_statoil.py b/ThirdParty/Ert/python/tests/ecl/test_grid_statoil.py index db64e14680..89129deadc 100644 --- a/ThirdParty/Ert/python/tests/ecl/test_grid_statoil.py +++ b/ThirdParty/Ert/python/tests/ecl/test_grid_statoil.py @@ -387,3 +387,22 @@ class GridTest(ExtendedTestCase): grdecl_file = self.createTestPath("Statoil/ECLIPSE/1.6.0_issueGrdecl/test_aug2016_gridOnly.grdecl") grid = EclGrid.loadFromGrdecl( grdecl_file ) + + def test_lgr_get(self): + grid = EclGrid(self.createTestPath("Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID")) + for (nr,name) in [ ( 104 , "LG003017"), + (2 , "LG006024"), + ( 4 , "LG005025"), + ( 82 , "LG011029"), + (100 , "LG007021"), + (110 , "LG003014")]: + lgr_name = grid.get_lgr( name ) + lgr_nr = grid.get_lgr( nr ) + + self.assertEqual( lgr_name , lgr_nr ) + + with self.assertRaises(KeyError): + grid.get_lgr("NO/SUCHLGR") + + with self.assertRaises(KeyError): + grid.get_lgr(1024) diff --git a/ThirdParty/Ert/python/tests/ecl/test_sum.py b/ThirdParty/Ert/python/tests/ecl/test_sum.py index c41d1da0a9..2d23c2425c 100644 --- a/ThirdParty/Ert/python/tests/ecl/test_sum.py +++ b/ThirdParty/Ert/python/tests/ecl/test_sum.py @@ -59,7 +59,7 @@ class SumTest(ExtendedTestCase): def test_identify_var_type(self): - self.assertEnumIsFullyDefined( EclSumVarType , "ecl_smspec_var_type" , "libecl/include/ert/ecl/smspec_node.h") + self.assertEnumIsFullyDefined( EclSumVarType , "ecl_smspec_var_type" , "lib/include/ert/ecl/smspec_node.h") self.assertEqual( EclSum.varType( "WWCT:OP_X") , EclSumVarType.ECL_SMSPEC_WELL_VAR ) self.assertEqual( EclSum.varType( "RPR") , EclSumVarType.ECL_SMSPEC_REGION_VAR ) self.assertEqual( EclSum.varType( "WNEWTON") , EclSumVarType.ECL_SMSPEC_MISC_VAR ) diff --git a/ThirdParty/Ert/python/tests/install/test_install.py b/ThirdParty/Ert/python/tests/install/test_install.py new file mode 100644 index 0000000000..b43ab9b903 --- /dev/null +++ b/ThirdParty/Ert/python/tests/install/test_install.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +import sys + +# This is a small executable which is used to verify the install, +# Prior to calling this the environment must have been prepared to +# ensure that the newly installed versions are picked up - this can +# typically be achieved with the bash script bin/test_install which is +# generated during the configure process. + +from ecl.ecl import EclSum, EclGrid + + + diff --git a/ThirdParty/Ert/python/tests/legacy/CMakeLists.txt b/ThirdParty/Ert/python/tests/legacy/CMakeLists.txt new file mode 100644 index 0000000000..1ccd83497b --- /dev/null +++ b/ThirdParty/Ert/python/tests/legacy/CMakeLists.txt @@ -0,0 +1,16 @@ +set(TEST_SOURCES + __init__.py + test_ecl.py + test_geo.py + test_well.py + test_util.py + test_test.py +) + +add_python_package("python.tests.legacy.ert" ${PYTHON_INSTALL_PREFIX}/tests/legacy "${TEST_SOURCES}" False) + +addPythonTest(tests.legacy.test_ecl.ErtLegacyEclTest) +addPythonTest(tests.legacy.test_geo.ErtLegacyGeoTest) +addPythonTest(tests.legacy.test_well.ErtLegacyWellTest) +addPythonTest(tests.legacy.test_util.ErtLegacyUtilTest) +addPythonTest(tests.legacy.test_test.ErtLegacyTestTest) diff --git a/ThirdParty/Ert/python/tests/legacy/__init__.py b/ThirdParty/Ert/python/tests/legacy/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ThirdParty/Ert/python/tests/legacy/test_ecl.py b/ThirdParty/Ert/python/tests/legacy/test_ecl.py new file mode 100644 index 0000000000..f90d3fd628 --- /dev/null +++ b/ThirdParty/Ert/python/tests/legacy/test_ecl.py @@ -0,0 +1,41 @@ +from ert.ecl import EclFileEnum, EclFileFlagEnum, EclPhaseEnum, EclUnitTypeEnum , EclUtil +from ert.ecl import EclTypeEnum, EclDataType +from ert.ecl import EclSumVarType +from ert.ecl import EclSumTStep +from ert.ecl import EclSum #, EclSumVector, EclSumNode, EclSMSPECNode +from ert.ecl import EclSumKeyWordVector +from ert.ecl import EclPLTCell, EclRFTCell +from ert.ecl import EclRFT, EclRFTFile +from ert.ecl import FortIO, openFortIO +from ert.ecl import EclKW +from ert.ecl import Ecl3DKW +from ert.ecl import EclFileView +from ert.ecl import EclFile , openEclFile +from ert.ecl import Ecl3DFile +from ert.ecl import EclInitFile +from ert.ecl import EclRestartFile +from ert.ecl import EclGrid +from ert.ecl import EclRegion +from ert.ecl import EclSubsidence +from ert.ecl import phase_deltag, deltag +from ert.ecl import EclGrav +from ert.ecl import EclSumNode +from ert.ecl import EclSumVector +from ert.ecl import EclNPV , NPVPriceVector +from ert.ecl import EclCmp +from ert.ecl import EclGridGenerator + +from ert.ecl.faults import Layer +from ert.ecl.faults import FaultCollection +from ert.ecl.faults import Fault +from ert.ecl.faults import FaultLine +from ert.ecl.faults import FaultSegment , SegmentMap +from ert.ecl.faults import FaultBlock , FaultBlockCell +from ert.ecl.faults import FaultBlockLayer + + +from ecl.test import ExtendedTestCase + + +class ErtLegacyEclTest(ExtendedTestCase): + pass diff --git a/ThirdParty/Ert/python/tests/legacy/test_geo.py b/ThirdParty/Ert/python/tests/legacy/test_geo.py new file mode 100644 index 0000000000..669b5ab9d6 --- /dev/null +++ b/ThirdParty/Ert/python/tests/legacy/test_geo.py @@ -0,0 +1,14 @@ +from ert.geo import GeoPointset +from ert.geo import GeoRegion +from ert.geo import CPolyline +from ert.geo import CPolylineCollection +from ert.geo import Polyline +from ert.geo import XYZIo +from ert.geo import GeometryTools +from ert.geo import Surface + +from ecl.test import ExtendedTestCase + + +class ErtLegacyGeoTest(ExtendedTestCase): + pass diff --git a/ThirdParty/Ert/python/tests/legacy/test_test.py b/ThirdParty/Ert/python/tests/legacy/test_test.py new file mode 100644 index 0000000000..40d0ef2b73 --- /dev/null +++ b/ThirdParty/Ert/python/tests/legacy/test_test.py @@ -0,0 +1,16 @@ +from ert.test import TestRun +from ert.test import path_exists +from ert.test import ExtendedTestCase +from ert.test import SourceEnumerator +from ert.test import TestArea , TestAreaContext +from ert.test import TempArea , TempAreaContext +from ert.test import ErtTestRunner +from ert.test import PathContext +from ert.test import LintTestCase +from ert.test import ImportTestCase + +from ecl.test import ExtendedTestCase + + +class ErtLegacyTestTest(ExtendedTestCase): + pass diff --git a/ThirdParty/Ert/python/tests/legacy/test_util.py b/ThirdParty/Ert/python/tests/legacy/test_util.py new file mode 100644 index 0000000000..4fa75a85b5 --- /dev/null +++ b/ThirdParty/Ert/python/tests/legacy/test_util.py @@ -0,0 +1,31 @@ +from ert.util import Version +from ert.util import RngAlgTypeEnum, RngInitModeEnum, LLSQResultEnum +from ert.util import CTime +from ert.util import PermutationVector +from ert.util import VectorTemplate +from ert.util import DoubleVector +from ert.util import IntVector +from ert.util import BoolVector +from ert.util import TimeVector +from ert.util import StringList +from ert.util import RandomNumberGenerator +from ert.util import Matrix +from ert.util import quantile, quantile_sorted, polyfit +from ert.util import Log +from ert.util import LookupTable +from ert.util import Buffer +from ert.util import Hash, StringHash, DoubleHash, IntegerHash +from ert.util import SubstitutionList +from ert.util import UIReturn +from ert.util import ThreadPool +from ert.util import CThreadPool, startCThreadPool +from ert.util import installAbortSignals, updateAbortSignals +from ert.util import Profiler +from ert.util import ArgPack +from ert.util import PathFormat + +from ecl.test import ExtendedTestCase + + +class ErtLegacyUtilTest(ExtendedTestCase): + pass diff --git a/ThirdParty/Ert/python/tests/legacy/test_well.py b/ThirdParty/Ert/python/tests/legacy/test_well.py new file mode 100644 index 0000000000..102b049739 --- /dev/null +++ b/ThirdParty/Ert/python/tests/legacy/test_well.py @@ -0,0 +1,13 @@ +from ert.well import WellTypeEnum +from ert.well import WellConnectionDirectionEnum +from ert.well import WellConnection +from ert.well import WellSegment +from ert.well import WellState +from ert.well import WellTimeLine +from ert.well import WellInfo + +from ecl.test import ExtendedTestCase + + +class ErtLegacyWellTest(ExtendedTestCase): + pass diff --git a/ThirdParty/Ert/python/tests/test_install.in b/ThirdParty/Ert/python/tests/test_install.in new file mode 100644 index 0000000000..0831127069 --- /dev/null +++ b/ThirdParty/Ert/python/tests/test_install.in @@ -0,0 +1,6 @@ +#!/bin/bash + +export PYTHONPATH=@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_PREFIX@:@CTEST_PYTHONPATH@:$PYTHONPATH + +@PROJECT_SOURCE_DIR@/python/tests/install/test_install.py $@ + diff --git a/ThirdParty/Ert/python/tests/util/test_arg_pack.py b/ThirdParty/Ert/python/tests/util/test_arg_pack.py index 0ecbe23c05..2a73c39112 100644 --- a/ThirdParty/Ert/python/tests/util/test_arg_pack.py +++ b/ThirdParty/Ert/python/tests/util/test_arg_pack.py @@ -2,7 +2,7 @@ import ecl from ecl.test import ExtendedTestCase from ecl.util import ArgPack, StringList -TEST_LIB = ecl.load("libert_util") +TEST_LIB = ecl.load("libecl") class ArgPackTest(ExtendedTestCase): diff --git a/ThirdParty/Ert/python/tests/util/test_cstring.py b/ThirdParty/Ert/python/tests/util/test_cstring.py index fe82c5a6fe..12f8a58c50 100644 --- a/ThirdParty/Ert/python/tests/util/test_cstring.py +++ b/ThirdParty/Ert/python/tests/util/test_cstring.py @@ -4,7 +4,7 @@ from ecl.test.extended_testcase import ExtendedTestCase # Local copies so that the real ones don't get changed class TestUtilPrototype(Prototype): - lib = ecl.load("libert_util") + lib = ecl.load("libecl") def __init__(self, prototype, bind=False): super(TestUtilPrototype, self).__init__(TestUtilPrototype.lib, prototype, bind=bind) diff --git a/ThirdParty/Ert/python/tests/util/test_cthread_pool.py b/ThirdParty/Ert/python/tests/util/test_cthread_pool.py index ee55aa9ce6..dd6b32b952 100644 --- a/ThirdParty/Ert/python/tests/util/test_cthread_pool.py +++ b/ThirdParty/Ert/python/tests/util/test_cthread_pool.py @@ -3,7 +3,7 @@ import ecl from ecl.test import ExtendedTestCase from ecl.util import CThreadPool, startCThreadPool -TEST_LIB = ecl.load("libert_util") +TEST_LIB = ecl.load("libecl") class CThreadPoolTest(ExtendedTestCase): diff --git a/ThirdParty/Ert/python/tests/util/test_path_context.py b/ThirdParty/Ert/python/tests/util/test_path_context.py index 51587a5827..a47fad6724 100644 --- a/ThirdParty/Ert/python/tests/util/test_path_context.py +++ b/ThirdParty/Ert/python/tests/util/test_path_context.py @@ -18,8 +18,10 @@ class PathContextTest(ExtendedTestCase): def test_chdir(self): with PathContext("/tmp/pc"): - self.assertEqual( os.getcwd() , "/tmp/pc") - + self.assertEqual( + os.path.realpath(os.getcwd()), + os.path.realpath("/tmp/pc") + ) def test_cleanup(self): with TestAreaContext("pathcontext"): diff --git a/ThirdParty/Ert/python/tests/util/test_rng.py b/ThirdParty/Ert/python/tests/util/test_rng.py index dc4b03f7ca..fdf0c2d60c 100644 --- a/ThirdParty/Ert/python/tests/util/test_rng.py +++ b/ThirdParty/Ert/python/tests/util/test_rng.py @@ -6,8 +6,8 @@ from ecl.test import ExtendedTestCase,TestAreaContext class RngTest(ExtendedTestCase): def test_enums(self): - self.assertEnumIsFullyDefined(RngAlgTypeEnum, "rng_alg_type", "libert_util/include/ert/util/rng.h") - self.assertEnumIsFullyDefined(RngInitModeEnum, "rng_init_mode", "libert_util/include/ert/util/rng.h") + self.assertEnumIsFullyDefined(RngAlgTypeEnum, "rng_alg_type", "lib/include/ert/util/rng.h") + self.assertEnumIsFullyDefined(RngInitModeEnum, "rng_init_mode", "lib/include/ert/util/rng.h") def test_rng_default(self): rng = RandomNumberGenerator() diff --git a/ThirdParty/Ert/python/tests/util/test_spawn.py b/ThirdParty/Ert/python/tests/util/test_spawn.py index a867da3336..c624ea3d6a 100644 --- a/ThirdParty/Ert/python/tests/util/test_spawn.py +++ b/ThirdParty/Ert/python/tests/util/test_spawn.py @@ -9,7 +9,7 @@ from ecl.test.test_area import TestAreaContext from cwrap import Prototype class _TestSpawnPrototype(Prototype): - lib = ecl.load('libert_util') + lib = ecl.load('libecl') def __init__(self, prototype, bind=True): super(_TestSpawnPrototype, self).__init__(_TestSpawnPrototype.lib, prototype, bind=bind) diff --git a/ThirdParty/Ert/python/tests/util/test_ui_return.py b/ThirdParty/Ert/python/tests/util/test_ui_return.py index 2e7dfe9e75..8b8da46025 100644 --- a/ThirdParty/Ert/python/tests/util/test_ui_return.py +++ b/ThirdParty/Ert/python/tests/util/test_ui_return.py @@ -65,5 +65,5 @@ class UIReturnTest(ExtendedTestCase): self.assertEqual(errorList, []) def test_status_enum(self): - source_file_path = "libert_util/include/ert/util/ui_return.h" + source_file_path = "lib/include/ert/util/ui_return.h" self.assertEnumIsFullyDefined(UIReturnStatusEnum, "ui_return_status_enum", source_file_path) diff --git a/ThirdParty/Ert/python/tests/well/CMakeLists.txt b/ThirdParty/Ert/python/tests/well/CMakeLists.txt index e5853b33f6..b9efe79dca 100644 --- a/ThirdParty/Ert/python/tests/well/CMakeLists.txt +++ b/ThirdParty/Ert/python/tests/well/CMakeLists.txt @@ -8,7 +8,7 @@ set(TEST_SOURCES add_python_package("python.tests.well" ${PYTHON_INSTALL_PREFIX}/tests/well "${TEST_SOURCES}" False) if (STATOIL_TESTDATA_ROOT) - addPythonTest(well.test_ecl_well.EclWellTest LABELS StatoilData) - addPythonTest(well.test_ecl_well2.EclWellTest2 LABELS StatoilData) - addPythonTest(well.test_ecl_well3.EclWellTest3 LABELS StatoilData) + addPythonTest(tests.well.test_ecl_well.EclWellTest LABELS StatoilData) + addPythonTest(tests.well.test_ecl_well2.EclWellTest2 LABELS StatoilData) + addPythonTest(tests.well.test_ecl_well3.EclWellTest3 LABELS StatoilData) endif() diff --git a/ThirdParty/Ert/python/tests/well/test_ecl_well.py b/ThirdParty/Ert/python/tests/well/test_ecl_well.py index bcbf872d17..ed3aad2c47 100644 --- a/ThirdParty/Ert/python/tests/well/test_ecl_well.py +++ b/ThirdParty/Ert/python/tests/well/test_ecl_well.py @@ -65,6 +65,16 @@ class EclWellTest(ExtendedTestCase): return EclWellTest.__well_info + def test_no_such_well(self): + grid_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID") + rst_path1 = self.createTestPath("nosuch/path/ECLIPSE.X001") + rst_path2 = self.createTestPath("nosuch/path/ECLIPSE.X002") + grid = EclGrid(grid_path) + with self.assertRaises(IOError): + _ = WellInfo(grid, rst_path1) + with self.assertRaises(IOError): + _ = WellInfo(grid, [rst_path1, rst_path2]) + def test_construction(self): grid_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID") rst_path_1 = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.X0011") @@ -110,13 +120,13 @@ class EclWellTest(ExtendedTestCase): def test_well_type_enum(self): - source_file_path = "libecl_well/include/ert/ecl_well/well_const.h" + source_file_path = "lib/include/ert/ecl_well/well_conn.h" # The header file has duplicated symbols, so the simple test fails. # self.assertEnumIsFullyDefined(WellTypeEnum, "well_type_enum", source_file_path) def test_well_connection_direction_enum(self): - source_file_path = "libecl_well/include/ert/ecl_well/well_conn.h" + source_file_path = "lib/include/ert/ecl_well/well_conn.h" self.assertEnumIsFullyDefined(WellConnectionDirectionEnum, "well_conn_dir_enum", source_file_path) diff --git a/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal1.EGRID b/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal1.EGRID new file mode 100644 index 0000000000000000000000000000000000000000..4496b36d5ef0921e2c6e35b1743e69be1f0325ea GIT binary patch literal 258624 zcmeF43A|NP|Nn2LK_#Uq$yLTCib$bb(bg>uq#jAgQ<6;AJVb~L5w}bg=j`F!ZZec1 zWJ<0~(PYX{hHDBbipmiG_h+56kEi3_=iak^&)?I}Z+pGoueNi~cdxbg`L56Ue%D%i z?VOyP`bYNa7m)|MGj~)avUD9N-+=yt$6`8Q<$Zm=8FvF~I5GN1s8H{L&s> zdVlooKFNQ7*qC4XJpcd0M*U6S={cZR4;8?1)qgpE{qX$FQ~&9^;rGk&ANfg5r~xw} z`tQGb2a^7CMF0K+dhi?KK1cuI7uCDv*KKok@2VsEJFzd9=hv;Xv3J$spE|{_7vK{q1}{%ZVR7Air+I6FKhW6xZiF9a{IUI`SkZ ze)Z7&x{V*<^KYE#kLKpr?O4Be)zca{@%!fH*KO8=?ioKgt?ylR)Rm6A1K-)Z7RS3dMQ?JR?hSiaJ^fI}9YR^HOZfa9r)V+t zX>lEO^PJc~j&r`|xUDmzPJVvfy>_M!$2zeAe81WhK40V%FW{W}a6GcA6T5JHe%%@y z_|C;n@fg0}>N!52?Zlp>KDB3Z+|ns-#c|tw>Nd=YeZzIto6YARIn&?aocmos9k{N3 zt+)?&^PPK~=|ef*U-f_0iQlj&ziyK;93SsYuS?wy`i=Tu>%NdrR-L^cx&QH5?yrWb6+Xigo)S<5v>%ix~p3CRY zIK_{b=GSe`_fMW=o=QnLxm%8ob#NOq&Hoxhp+nwpxaI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u3Sw@uQ|pE^6hb7obm<;dh2vjWc4D zb|Dh&-zOy)kM4=s{~yaH-xmeHFY^EWOoDUrQZ&S`G(OD5lzhF>Xpmo9SWlgzujIJD Uyf~J9*6=G4ubJY*dhT@n4<^THEC2ui literal 0 HcmV?d00001 diff --git a/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal4.txt b/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal4.txt new file mode 100644 index 0000000000..3a2bf9dfa5 --- /dev/null +++ b/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal4.txt @@ -0,0 +1,2 @@ +122616.59 5406847.62 6621.33 1 1 1 +122620.94 5406856.7 6628.22 1 1 2 diff --git a/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal5.EGRID b/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal5.EGRID new file mode 100644 index 0000000000000000000000000000000000000000..0cd21891fb69f5e75256f47a0d6945cbc7f1fa67 GIT binary patch literal 78968 zcmeI53%piS{{K%(l3R%3e>if#jB8VMVKZGnu&}PAtjn5 z>2fqWQsh!{p1t>za~jv=R=E`Z@6Udo)p=&uepWi=l-cL?dY^syuD$lmCpZDs2gC!{~$ zJ2PGUZQIJJEHD06Hl=CPp`^8T!2Cuz`8TrpH_84ftxX?OepF8C!6u;nCx5ki1v2HQ z)yXG!XpIj!lrO8xMcpaorK8)I6n@gqcz)aR(w7QL3O|}_D&J!MncGVW7w&1iPezrO zj(?}5@YCl^<=|Q6rBB~iQusv!<9%0LUOH}UN#W;zHI>&?mX|*HYDwW&pBVp`hUKMW z$@9y8rm|DB^3oB%_Gl_#yeqrdFkXyC54|2HB|*Y%1g)mkv#V@-W@~AOJ8nXQn+ZKsT{tLJbRGm zmd1OIG!s0I;aXGKhkTwnqoi=jGUNR)h~vM3W4O>%_G(;S`eFfjzF|^ll27?vockzK z^&0apOeD|2CN+@bdG!v?eW0njifzX|PM)1iYSF&srPH?M+;23M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F(&$QDEx|uY;AD3o~Ysg*XCAt&S#G&ZQVV}P{+b%)7BF!<0SJ_TH zP*zY-&+_|WHa{qGk z)%x7!Rn6yayE^l=vA^7X=AOg4I=}U0f4S!xH@`YQ%S~hRvFq&e>Q3!;t2@ojSKH(+ zug<({KguKbFE>xE&s|=f`P{r#HUGc1KYI$%miY&+dm zmTLPvqx=80m+kej`;9JZeXf?QJ#K3AS(9n*e)4T^)7fcm+UPnhTa?buN2gJnmi1@T zWtLX{AGOMwVBP3AMXRR6bm z*fn-pQ~l*GugQESm+JpE54*-LudS)g*G_G|(PgdIpS8P|GpScjZ`a$Y%`dua*VlAv z^Ua;wW4G&a_YqxZmo;70cKPhNwq$r@LH9N|+w^i=BDc9U{`lZXc z+vd*a9&L1e?y_s%bv$9&5n(8lid3EPATW0>}ZnLKO<>s-f`DB09eu`dW zdu{A>v&%N!s;0SV*7dxOEBDVHr(K`Bytd|l>-)3UPUo3>&7#Y>wwlh{Ynq$Sy4auH z&$^oG_*du8rnBd(ZJ1X(eWUEWCTo2C!;OE%f4S#TljFAetnSpFVs85A{&Q_>I&b&$ zD^0^P(8#oJ-KIlH>n7T1^>~YdM(x|TYHM1C>l@~*-{%(`oYE?vLz?iX?Q-(b`liwK F{~x)(yt4oR literal 0 HcmV?d00001 diff --git a/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal5.txt b/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal5.txt new file mode 100644 index 0000000000..55575a7e45 --- /dev/null +++ b/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal5.txt @@ -0,0 +1,7 @@ +125914.01 6699854.27 7024.64 1 5 2 +125935.07 6699860.05 7038.64 1 4 6 +125947.26 6699863.36 7046.67 1 4 9 +125979.08 6699871.83 7067.58 1 3 31 +125999.91 6699877.26 7081.25 1 2 46 +126015.43 6699881.3 7091.44 1 2 55 +126042.07 6699888.35 7108.87 2 1 74 diff --git a/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal6.EGRID b/ThirdParty/Ert/test-data/local/ECLIPSE/faarikaal/faarikaal6.EGRID new file mode 100644 index 0000000000000000000000000000000000000000..7a28fd3aad7049d1c29f7286475c711c0d9c1902 GIT binary patch literal 8192 zcmeI1e{7ZI6~`|X1X~y#!@!KADCI{1e?T|PV6Vi2n=lH8vp4R zKXK*$zfpl0C&{_N`Gt9*f`vrvmz5LD=L%neLAg?pFAGPH*0Ij9E?C3_J(On;1>#graKdO`dT}a}3 zjdM&Vm4N|PRiAx$oM5vKP1t0=3HRBM$B_NTxaO+P-McpQXgdf z^wLlyZK~LmCf7;0ITV?=RO$8|tOO2!Rh_O`iB zG4tbAOWni_*IAy(c!rqy%-^|&SeK;kF`g|M!T6$>pR~Kq_ueN~xzxSA)^&1sFn&SI z3HEc#LE@g5y319rQ_XlxrI^A7*9m8m%L0kM$v!ug;J?3^UHI=B*A_8e_ayUs#Z1Xz zZ%4?hTx$0dYehfC_!0bk|5;+4mD@;HT9)L}Mt z*wqk0$@5Colh(iSq$|fz2cCY5blerkDSE<{oDb*ulj1>|Xxy_7>J0?~(uFOYDO^ zDO!l*XFtHRN2$4&|Ls-eOMFFy+E&6{5iz{{9%|P$JA$>H%*rmj3%7pu zQ}Fc>>pcD!!gnq@Ry42|gXYUwcnoeFqQjE&a20-zT-NmH?T|L-_JgBEqwxxJpT0^_$(X(`z^HPXCDSf*Y$Y+ z={s->94bBpZ{T}7`}6ukynQ$QVp9hCKx+>XSFsfhDq7HRU(bIXNzi4EBN?CEGI6P}K7hW|kA6@R4n0y~3ve)dUdaVmYj znRnEa_)t8>*#~wYXZs!af0eV`o4tu=w-a*@8i~^96i@S<;tam~dj6Z>`PZC-YvF$u z??c5#I99X=#4h9fKfw9v;Jac1_ljw(QS5|&KYK2I7Q@en)W4OQE6&0Juy^qt($6mR zh&kxxBM73 zRfy%?7{e~kJqQn>KEHscYHUf2ujkAv7NHl#8`%8p%lQ8IQ~3K59?ro#u!EUXJjiz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- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b8272fd67..d687fae8d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,33 +118,25 @@ else() set(ERT_INCLUDE_ROOT "${RESINSIGHT_ERT_EXTERNAL_SOURCE_ROOT}") add_subdirectory(${ERT_SOURCE_PATH} ${CMAKE_BINARY_DIR}/ThirdParty/Ert) else() - set(ERT_INCLUDE_ROOT ${CMAKE_SOURCE_DIR}/ThirdParty/Ert) + set(ERT_INCLUDE_ROOT ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/lib/include/ert) add_subdirectory(ThirdParty/Ert) endif () list(APPEND ERT_INCLUDE_DIRS - ${ERT_INCLUDE_ROOT}/libecl/include/ - ${ERT_INCLUDE_ROOT}/libert_util/include/ - ${ERT_INCLUDE_ROOT}/libgeometry/include/ - ${ERT_INCLUDE_ROOT}/libecl_well/include/ - ${ERT_INCLUDE_ROOT}/libeclxx/include - ${ERT_INCLUDE_ROOT}/libert_utilxx/include - - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/libert_util/include + ${ERT_INCLUDE_ROOT}/ecl/ + ${ERT_INCLUDE_ROOT}/util/ + ${ERT_INCLUDE_ROOT}/geometry/ + ${ERT_INCLUDE_ROOT}/ecl_well/ ) list(APPEND ERT_LIBRARIES ecl - eclxx - ecl_well - ert_geometry - ert_util ) if (MSVC) set_property(TARGET ${ERT_LIBRARIES} - ecl_lfs +# ecl_lfs PROPERTY FOLDER "Thirdparty/ERT" ) endif() From 0e8d76d05c52308459a5f978770a35eb40bd05ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 22 Jun 2017 13:46:46 +0200 Subject: [PATCH 23/61] Fix proper include paths for new libecl version. --- CMakeLists.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d687fae8d6..bfa41854ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,15 +118,13 @@ else() set(ERT_INCLUDE_ROOT "${RESINSIGHT_ERT_EXTERNAL_SOURCE_ROOT}") add_subdirectory(${ERT_SOURCE_PATH} ${CMAKE_BINARY_DIR}/ThirdParty/Ert) else() - set(ERT_INCLUDE_ROOT ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/lib/include/ert) + set(ERT_INCLUDE_ROOT ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/lib/include) add_subdirectory(ThirdParty/Ert) endif () list(APPEND ERT_INCLUDE_DIRS - ${ERT_INCLUDE_ROOT}/ecl/ - ${ERT_INCLUDE_ROOT}/util/ - ${ERT_INCLUDE_ROOT}/geometry/ - ${ERT_INCLUDE_ROOT}/ecl_well/ + ${CMAKE_BINARY_DIR}/ThirdParty/Ert/lib/include + ${ERT_INCLUDE_ROOT}/ ) list(APPEND ERT_LIBRARIES @@ -136,7 +134,6 @@ else() if (MSVC) set_property(TARGET ${ERT_LIBRARIES} -# ecl_lfs PROPERTY FOLDER "Thirdparty/ERT" ) endif() From 527151ba236425dbe56549a3c5a1a30808195b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 22 Jun 2017 14:20:16 +0200 Subject: [PATCH 24/61] Do not add OpenMP C-flags as linker arguments for libecl --- ThirdParty/Ert/lib/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/ThirdParty/Ert/lib/CMakeLists.txt b/ThirdParty/Ert/lib/CMakeLists.txt index 450bc95758..d5f95a7ff4 100644 --- a/ThirdParty/Ert/lib/CMakeLists.txt +++ b/ThirdParty/Ert/lib/CMakeLists.txt @@ -204,7 +204,6 @@ endif() if (ERT_USE_OPENMP) target_compile_options(ecl PUBLIC ${OpenMP_C_FLAGS}) - target_link_libraries( ecl PUBLIC ${OpenMP_C_FLAGS}) target_link_libraries( ecl PUBLIC ${OpenMP_EXE_LINKER_FLAGS}) endif () From 7b7af2b1974efe422ac44598b8b8ca003edf1b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 22 Jun 2017 16:03:55 +0200 Subject: [PATCH 25/61] #1641 Use new interface for reading trans values from libecl --- .../FileInterface/RifReaderEclipseOutput.cpp | 38 +++++++++++-------- .../FileInterface/RifReaderEclipseOutput.h | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 615a637d34..e0603bba6b 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -44,6 +44,8 @@ #include "ert/ecl/ecl_kw_magic.h" #include "ert/ecl/ecl_nnc_export.h" +#include "ert/ecl/ecl_nnc_geometry.h" +#include "ert/ecl/ecl_nnc_data.h" #include // Needed for HUGE_VAL on Linux #include @@ -572,38 +574,42 @@ void RifReaderEclipseOutput::importFaults(const QStringList& fileSet, cvf::Colle //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifReaderEclipseOutput::transferNNCData( const ecl_grid_type * mainEclGrid , const ecl_file_type * init_file, RigMainGrid * mainGrid) +void RifReaderEclipseOutput::transferNNCData( const ecl_grid_type * mainEclGrid , ecl_file_type * init_file, RigMainGrid * mainGrid) { if (!m_ecl_init_file ) return; CVF_ASSERT(mainEclGrid && mainGrid); // Get the data from ERT + ecl_nnc_geometry_type* nnc_geo = ecl_nnc_geometry_alloc(mainEclGrid); + ecl_nnc_data_type* tran_data = ecl_nnc_data_alloc_tran(mainEclGrid, nnc_geo, ecl_file_get_global_view(init_file)); + + int numNNC = ecl_nnc_data_get_size(tran_data); + int geometrySize = ecl_nnc_geometry_size(nnc_geo); + CVF_ASSERT(numNNC == geometrySize); - int numNNC = ecl_nnc_export_get_size( mainEclGrid ); if (numNNC > 0) { - ecl_nnc_type * eclNNCData= new ecl_nnc_type[numNNC]; - - ecl_nnc_export(mainEclGrid, init_file, eclNNCData); - - // Transform to our own datastructures - //cvf::Trace::show("Reading NNC. Count: " + cvf::String(numNNC)); + // Transform to our own data structures mainGrid->nncData()->connections().resize(numNNC); std::vector& transmissibilityValues = mainGrid->nncData()->makeConnectionScalarResult(cvf::UNDEFINED_SIZE_T); + const double* transValues = ecl_nnc_data_get_values(tran_data); + for (int nIdx = 0; nIdx < numNNC; ++nIdx) { - RigGridBase* grid1 = mainGrid->gridByIndex(eclNNCData[nIdx].grid_nr1); - mainGrid->nncData()->connections()[nIdx].m_c1GlobIdx = grid1->reservoirCellIndex(eclNNCData[nIdx].global_index1); - RigGridBase* grid2 = mainGrid->gridByIndex(eclNNCData[nIdx].grid_nr2); - mainGrid->nncData()->connections()[nIdx].m_c2GlobIdx = grid2->reservoirCellIndex(eclNNCData[nIdx].global_index2); - transmissibilityValues[nIdx] = eclNNCData[nIdx].trans; + const ecl_nnc_pair_type* geometry_pair = ecl_nnc_geometry_iget(nnc_geo, nIdx); + RigGridBase* grid1 = mainGrid->gridByIndex(geometry_pair->grid_nr1); + mainGrid->nncData()->connections()[nIdx].m_c1GlobIdx = grid1->reservoirCellIndex(geometry_pair->global_index1); + RigGridBase* grid2 = mainGrid->gridByIndex(geometry_pair->grid_nr2); + mainGrid->nncData()->connections()[nIdx].m_c2GlobIdx = grid2->reservoirCellIndex(geometry_pair->global_index2); + + transmissibilityValues[nIdx] = transValues[nIdx]; } - - - delete[] eclNNCData; } + + ecl_nnc_geometry_free(nnc_geo); + ecl_nnc_data_free(tran_data); } diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h index 9b5b49c976..231ec1f8f4 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h @@ -82,7 +82,7 @@ private: bool openDynamicAccess(); void extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector* values, const std::vector& fileValues); - void transferNNCData( const ecl_grid_type * mainEclGrid , const ecl_file_type * init_file, + void transferNNCData( const ecl_grid_type * mainEclGrid , ecl_file_type * init_file, RigMainGrid * mainGrid); RifEclipseRestartDataAccess* createDynamicResultsAccess(); From de414c4277b82672e57e2d92f0bc3b54aa238071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Mon, 26 Jun 2017 10:25:08 +0200 Subject: [PATCH 26/61] #1645 Load dynamic NNC results from restart file --- .../RifEclipseRestartDataAccess.h | 4 +- .../RifEclipseRestartFilesetAccess.cpp | 47 +++++++++ .../RifEclipseRestartFilesetAccess.h | 2 + .../RifEclipseUnifiedRestartFileAccess.cpp | 44 +++++++++ .../RifEclipseUnifiedRestartFileAccess.h | 2 + .../FileInterface/RifReaderEclipseOutput.cpp | 28 +++++- .../FileInterface/RifReaderEclipseOutput.h | 4 +- .../ModelVisualization/RivFaultPartMgr.cpp | 11 ++- .../ModelVisualization/RivFaultPartMgr.h | 2 +- .../RivNNCGeometryGenerator.cpp | 18 +++- .../RivNNCGeometryGenerator.h | 8 +- .../ProjectDataModel/RimDefines.cpp | 12 +++ ApplicationCode/ProjectDataModel/RimDefines.h | 3 + .../ProjectDataModel/RimEclipseCase.cpp | 17 +++- .../RimReservoirCellResultsStorage.cpp | 44 +++++++-- .../RigCaseCellResultsData.cpp | 52 ++++++++++ .../ReservoirDataModel/RigNNCData.cpp | 96 ++++++++++++++++--- .../ReservoirDataModel/RigNNCData.h | 27 ++++-- .../RigReservoirBuilderMock.cpp | 2 +- .../RigResultAccessorFactory.cpp | 36 +++++++ .../UserInterface/RiuResultTextBuilder.cpp | 11 ++- 21 files changed, 423 insertions(+), 47 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseRestartDataAccess.h b/ApplicationCode/FileInterface/RifEclipseRestartDataAccess.h index 6884afe0bf..abb8a02b7a 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartDataAccess.h +++ b/ApplicationCode/FileInterface/RifEclipseRestartDataAccess.h @@ -99,11 +99,13 @@ public: virtual void setTimeSteps(const std::vector& timeSteps) {}; virtual size_t timeStepCount() = 0; virtual void timeSteps(std::vector* timeSteps, std::vector* daysSinceSimulationStart) = 0; - virtual std::vector reportNumbers() = 0; + virtual std::vector reportNumbers() = 0; virtual void resultNames(QStringList* resultNames, std::vector* resultDataItemCounts) = 0; virtual bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector* values) = 0; + virtual bool dynamicNNCResults(const ecl_grid_type* grid, size_t timeStep, std::vector* waterFlux, std::vector* oilFlux, std::vector* gasFlux) = 0; + virtual void readWellData(well_info_type * well_info, bool importCompleteMswData) = 0; virtual int readUnitsType() = 0; }; diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index cc4b1fceb8..c80b204129 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -22,6 +22,9 @@ #include "RifEclipseOutputFileTools.h" #include "cafProgressInfo.h" +#include "ert/ecl/ecl_file.h" +#include "ert/ecl/ecl_nnc_geometry.h" +#include "ert/ecl/ecl_nnc_data.h" //-------------------------------------------------------------------------------------------------- /// Constructor @@ -211,6 +214,50 @@ bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t t return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifEclipseRestartFilesetAccess::dynamicNNCResults(const ecl_grid_type* grid, size_t timeStep, std::vector* waterFlux, std::vector* oilFlux, std::vector* gasFlux) +{ + if (timeStep > timeStepCount()) + { + return false; + } + + openTimeStep(timeStep); + + if (!m_ecl_files[timeStep]) + { + return false; + } + + ecl_file_view_type* summaryView = ecl_file_get_global_view(m_ecl_files[timeStep]); + ecl_nnc_geometry_type* nnc_geo = ecl_nnc_geometry_alloc(grid); + + { + ecl_nnc_data_type* waterFluxData = ecl_nnc_data_alloc_wat_flux(grid, nnc_geo, summaryView); + const double* waterFluxValues = ecl_nnc_data_get_values(waterFluxData); + waterFlux->insert(waterFlux->end(), &waterFluxValues[0], &waterFluxValues[ecl_nnc_data_get_size(waterFluxData)]); + ecl_nnc_data_free(waterFluxData); + } + { + ecl_nnc_data_type* oilFluxData = ecl_nnc_data_alloc_oil_flux(grid, nnc_geo, summaryView); + const double* oilFluxValues = ecl_nnc_data_get_values(oilFluxData); + oilFlux->insert(oilFlux->end(), &oilFluxValues[0], &oilFluxValues[ecl_nnc_data_get_size(oilFluxData)]); + ecl_nnc_data_free(oilFluxData); + } + { + ecl_nnc_data_type* gasFluxData = ecl_nnc_data_alloc_gas_flux(grid, nnc_geo, summaryView); + const double* gasFluxValues = ecl_nnc_data_get_values(gasFluxData); + gasFlux->insert(gasFlux->end(), &gasFluxValues[0], &gasFluxValues[ecl_nnc_data_get_size(gasFluxData)]); + ecl_nnc_data_free(gasFluxData); + } + + ecl_nnc_geometry_free(nnc_geo); + + return true; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h index 9bb4ac7749..e57544a78b 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.h @@ -49,6 +49,8 @@ public: void resultNames(QStringList* resultNames, std::vector* resultDataItemCounts); bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector* values); + bool dynamicNNCResults(const ecl_grid_type* grid, size_t timeStep, std::vector* waterFlux, std::vector* oilFlux, std::vector* gasFlux) override; + virtual void readWellData(well_info_type* well_info, bool importCompleteMswData); virtual int readUnitsType(); diff --git a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp index f5006c4b0f..f2c248b049 100644 --- a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.cpp @@ -23,6 +23,8 @@ #include "ert/ecl/ecl_file.h" #include "ert/ecl/ecl_kw_magic.h" +#include "ert/ecl/ecl_nnc_geometry.h" +#include "ert/ecl/ecl_nnc_data.h" #include @@ -150,6 +152,48 @@ bool RifEclipseUnifiedRestartFileAccess::results(const QString& resultName, size return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifEclipseUnifiedRestartFileAccess::dynamicNNCResults(const ecl_grid_type* grid, size_t timeStep, std::vector* waterFlux, std::vector* oilFlux, std::vector* gasFlux) +{ + if (timeStep > timeStepCount()) + { + return false; + } + + if (!openFile()) + { + return false; + } + + ecl_file_view_type* summaryView = ecl_file_get_restart_view(m_ecl_file, timeStep, 0, 0, 0); + ecl_nnc_geometry_type* nnc_geo = ecl_nnc_geometry_alloc(grid); + + { + ecl_nnc_data_type* waterFluxData = ecl_nnc_data_alloc_wat_flux(grid, nnc_geo, summaryView); + const double* waterFluxValues = ecl_nnc_data_get_values(waterFluxData); + waterFlux->insert(waterFlux->end(), &waterFluxValues[0], &waterFluxValues[ecl_nnc_data_get_size(waterFluxData)]); + ecl_nnc_data_free(waterFluxData); + } + { + ecl_nnc_data_type* oilFluxData = ecl_nnc_data_alloc_oil_flux(grid, nnc_geo, summaryView); + const double* oilFluxValues = ecl_nnc_data_get_values(oilFluxData); + oilFlux->insert(oilFlux->end(), &oilFluxValues[0], &oilFluxValues[ecl_nnc_data_get_size(oilFluxData)]); + ecl_nnc_data_free(oilFluxData); + } + { + ecl_nnc_data_type* gasFluxData = ecl_nnc_data_alloc_gas_flux(grid, nnc_geo, summaryView); + const double* gasFluxValues = ecl_nnc_data_get_values(gasFluxData); + gasFlux->insert(gasFlux->end(), &gasFluxValues[0], &gasFluxValues[ecl_nnc_data_get_size(gasFluxData)]); + ecl_nnc_data_free(gasFluxData); + } + + ecl_nnc_geometry_free(nnc_geo); + + return true; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.h b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.h index 2344ed3266..02b3c2a690 100644 --- a/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.h +++ b/ApplicationCode/FileInterface/RifEclipseUnifiedRestartFileAccess.h @@ -52,6 +52,8 @@ public: void resultNames(QStringList* resultNames, std::vector* resultDataItemCounts); bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector* values); + bool dynamicNNCResults(const ecl_grid_type* grid, size_t timeStep, std::vector* waterFlux, std::vector* oilFlux, std::vector* gasFlux) override; + virtual void readWellData(well_info_type * well_info, bool importCompleteMswData); virtual int readUnitsType(); diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index e0603bba6b..0d133d06bc 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -419,7 +419,10 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e { progInfo.setProgressDescription("Reading NNC data"); progInfo.setNextProgressIncrement(5); - transferNNCData(mainEclGrid, m_ecl_init_file, eclipseCase->mainGrid()); + transferStaticNNCData(mainEclGrid, m_ecl_init_file, eclipseCase->mainGrid()); + progInfo.incrementProgress(); + + transferDynamicNNCData(mainEclGrid, eclipseCase->mainGrid()); progInfo.incrementProgress(); progInfo.setProgressDescription("Processing NNC data"); @@ -574,7 +577,7 @@ void RifReaderEclipseOutput::importFaults(const QStringList& fileSet, cvf::Colle //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifReaderEclipseOutput::transferNNCData( const ecl_grid_type * mainEclGrid , ecl_file_type * init_file, RigMainGrid * mainGrid) +void RifReaderEclipseOutput::transferStaticNNCData(const ecl_grid_type* mainEclGrid , ecl_file_type* init_file, RigMainGrid* mainGrid) { if (!m_ecl_init_file ) return; @@ -593,7 +596,7 @@ void RifReaderEclipseOutput::transferNNCData( const ecl_grid_type * mainEclGrid // Transform to our own data structures mainGrid->nncData()->connections().resize(numNNC); - std::vector& transmissibilityValues = mainGrid->nncData()->makeConnectionScalarResult(cvf::UNDEFINED_SIZE_T); + std::vector& transmissibilityValues = mainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::COMB_TRANS); const double* transValues = ecl_nnc_data_get_values(tran_data); for (int nIdx = 0; nIdx < numNNC; ++nIdx) @@ -612,6 +615,25 @@ void RifReaderEclipseOutput::transferNNCData( const ecl_grid_type * mainEclGrid ecl_nnc_data_free(tran_data); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderEclipseOutput::transferDynamicNNCData(const ecl_grid_type* mainEclGrid, RigMainGrid* mainGrid) +{ + CVF_ASSERT(mainEclGrid && mainGrid); + + size_t timeStepCount = m_dynamicResultsAccess->timeStepCount(); + + std::vector< std::vector >& waterFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::FLUX_WAT, timeStepCount); + std::vector< std::vector >& oilFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::FLUX_OIL, timeStepCount); + std::vector< std::vector >& gasFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::FLUX_GAS, timeStepCount); + + for (size_t timeStep = 0; timeStep < timeStepCount; ++timeStep) + { + m_dynamicResultsAccess->dynamicNNCResults(mainEclGrid, timeStep, &waterFluxData[timeStep], &oilFluxData[timeStep], &gasFluxData[timeStep]); + } +} + //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h index 231ec1f8f4..10f667aaef 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h @@ -82,8 +82,8 @@ private: bool openDynamicAccess(); void extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector* values, const std::vector& fileValues); - void transferNNCData( const ecl_grid_type * mainEclGrid , ecl_file_type * init_file, - RigMainGrid * mainGrid); + void transferStaticNNCData(const ecl_grid_type* mainEclGrid , ecl_file_type* init_file, RigMainGrid* mainGrid); + void transferDynamicNNCData(const ecl_grid_type* mainEclGrid, RigMainGrid* mainGrid); RifEclipseRestartDataAccess* createDynamicResultsAccess(); diff --git a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp index 4efb3f420d..79724f3e15 100644 --- a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp @@ -103,7 +103,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell { CVF_ASSERT(cellResultColors); - updateNNCColors(cellResultColors); + updateNNCColors(timeStepIndex, cellResultColors); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); RimEclipseView* eclipseView = cellResultColors->reservoirView(); @@ -182,7 +182,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors) { - updateNNCColors(cellResultColors); + updateNNCColors(timeStepIndex, cellResultColors); if (m_nativeFaultFaces.notNull()) { @@ -375,7 +375,7 @@ void RivFaultPartMgr::updatePartEffect() m_oppositeFaultFaces->setEffect(geometryOnlyEffect.p()); } - updateNNCColors(NULL); + updateNNCColors(0, NULL); // Update mesh colors as well, in case of change RiaPreferences* prefs = RiaApplication::instance()->preferences(); @@ -642,7 +642,7 @@ caf::FaceCulling RivFaultPartMgr::faceCullingMode() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivFaultPartMgr::updateNNCColors(RimEclipseCellColors* cellResultColors) +void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors* cellResultColors) { if (m_NNCFaces.isNull()) return; @@ -661,10 +661,11 @@ void RivFaultPartMgr::updateNNCColors(RimEclipseCellColors* cellResultColors) if (showNncsWithScalarMappedColor) { size_t scalarSetIndex = cellResultColors->scalarResultIndex(); + RimDefines::ResultCatType resultType = cellResultColors->resultType(); const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); - m_NNCGenerator->textureCoordinates(m_NNCTextureCoords.p(), mapper, scalarSetIndex); + m_NNCGenerator->textureCoordinates(m_NNCTextureCoords.p(), mapper, resultType, scalarSetIndex, timeStepIndex); cvf::ref nncEffect; diff --git a/ApplicationCode/ModelVisualization/RivFaultPartMgr.h b/ApplicationCode/ModelVisualization/RivFaultPartMgr.h index 96fbf16c44..1253deddd7 100644 --- a/ApplicationCode/ModelVisualization/RivFaultPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivFaultPartMgr.h @@ -70,7 +70,7 @@ private: void generatePartGeometry(); void updatePartEffect(); - void updateNNCColors(RimEclipseCellColors* cellResultColors); + void updateNNCColors(size_t timeStepIndex, RimEclipseCellColors* cellResultColors); caf::FaceCulling faceCullingMode() const; diff --git a/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.cpp b/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.cpp index c3cce69e43..7db42e23db 100644 --- a/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.cpp +++ b/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.cpp @@ -145,14 +145,26 @@ void RivNNCGeometryGenerator::computeArrays() /// Calculates the texture coordinates in a "nearly" one dimensional texture. /// Undefined values are coded with a y-texture coordinate value of 1.0 instead of the normal 0.5 //-------------------------------------------------------------------------------------------------- -void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, size_t scalarResultIndex) const +void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords, + const cvf::ScalarMapper* mapper, + RimDefines::ResultCatType resultType, + size_t scalarResultIndex, + size_t timeStepIndex) const { size_t numVertices = m_vertices->size(); textureCoords->resize(numVertices); cvf::Vec2f* rawPtr = textureCoords->ptr(); - - const std::vector* nncResultVals = m_nncData->connectionScalarResult(scalarResultIndex); + const std::vector* nncResultVals; + if (resultType == RimDefines::STATIC_NATIVE) + { + nncResultVals = m_nncData->staticConnectionScalarResult(scalarResultIndex); + } + else if (resultType == RimDefines::DYNAMIC_NATIVE) + { + nncResultVals = m_nncData->dynamicConnectionScalarResult(scalarResultIndex, timeStepIndex); + } + if (!nncResultVals) { textureCoords->setAll(cvf::Vec2f(0.0f, 1.0f)); diff --git a/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.h b/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.h index 60affaf6b5..a98c9c5647 100644 --- a/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.h +++ b/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.h @@ -18,6 +18,9 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once + +#include "RimDefines.h" + #include "cvfBase.h" #include "cvfObject.h" #include "cvfArray.h" @@ -45,7 +48,10 @@ public: void setCellVisibility( const cvf::UByteArray* cellVisibilities, const RigGridBase * grid); void textureCoordinates(cvf::Vec2fArray* textureCoords, - const cvf::ScalarMapper* mapper, size_t scalarResultIndex) const; + const cvf::ScalarMapper* mapper, + RimDefines::ResultCatType resultType, + size_t scalarResultIndex, + size_t timeStepIndex) const; // Mapping between cells and geometry cvf::ref > triangleToNNCIndex() const; diff --git a/ApplicationCode/ProjectDataModel/RimDefines.cpp b/ApplicationCode/ProjectDataModel/RimDefines.cpp index ec64948c4a..c7d2dc21d1 100644 --- a/ApplicationCode/ProjectDataModel/RimDefines.cpp +++ b/ApplicationCode/ProjectDataModel/RimDefines.cpp @@ -97,6 +97,18 @@ bool RimDefines::isPerCellFaceResult(const QString& resultName) { return true; } + else if (resultName.compare(RimDefines::combinedWaterFluxResultName(), Qt::CaseInsensitive) == 0) + { + return true; + } + else if (resultName.compare(RimDefines::combinedOilFluxResultName(), Qt::CaseInsensitive) == 0) + { + return true; + } + else if (resultName.compare(RimDefines::combinedGasFluxResultName(), Qt::CaseInsensitive) == 0) + { + return true; + } return false; } diff --git a/ApplicationCode/ProjectDataModel/RimDefines.h b/ApplicationCode/ProjectDataModel/RimDefines.h index 779f763d27..401f508a3b 100644 --- a/ApplicationCode/ProjectDataModel/RimDefines.h +++ b/ApplicationCode/ProjectDataModel/RimDefines.h @@ -49,6 +49,9 @@ public: static QString undefinedGridFaultName() { return "Undefined Grid Faults"; } static QString undefinedGridFaultWithInactiveName() { return "Undefined Grid Faults With Inactive"; } static QString combinedTransmissibilityResultName() { return "TRANXYZ"; } + static QString combinedWaterFluxResultName() { return "FLRWATIJK"; } + static QString combinedOilFluxResultName() { return "FLROILIJK"; } + static QString combinedGasFluxResultName() { return "FLRGASIJK"; } static QString ternarySaturationResultName() { return "TERNARY"; } static QString combinedMultResultName() { return "MULTXYZ"; } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index ce2c15ee2b..b227f872e9 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -582,7 +582,22 @@ bool RimEclipseCase::openReserviorCase() size_t combinedTransResIdx = results->cellResults()->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedTransmissibilityResultName()); if (combinedTransResIdx != cvf::UNDEFINED_SIZE_T) { - eclipseCaseData()->mainGrid()->nncData()->setCombTransmisibilityScalarResultIndex(combinedTransResIdx); + eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::COMB_TRANS, combinedTransResIdx); + } + size_t combinedWatFluxResIdx = results->cellResults()->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedWaterFluxResultName()); + if (combinedWatFluxResIdx != cvf::UNDEFINED_SIZE_T) + { + eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::FLUX_WAT, combinedWatFluxResIdx); + } + size_t combinedOilFluxResIdx = results->cellResults()->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedOilFluxResultName()); + if (combinedOilFluxResIdx != cvf::UNDEFINED_SIZE_T) + { + eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::FLUX_OIL, combinedOilFluxResIdx); + } + size_t combinedGasFluxResIdx = results->cellResults()->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedGasFluxResultName()); + if (combinedGasFluxResIdx != cvf::UNDEFINED_SIZE_T) + { + eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::FLUX_GAS, combinedGasFluxResIdx); } } diff --git a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index 0beded7277..9a0dbba6da 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -324,6 +324,27 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RimDefines::Result computeRiTRANSbyAreaComponent(resultName); } } + else if (type == RimDefines::DYNAMIC_NATIVE) + { + if (resultName == RimDefines::combinedWaterFluxResultName()) + { + this->findOrLoadScalarResult(type, "FLRWATI+"); + this->findOrLoadScalarResult(type, "FLRWATJ+"); + this->findOrLoadScalarResult(type, "FLRWATK+"); + } + else if (resultName == RimDefines::combinedOilFluxResultName()) + { + this->findOrLoadScalarResult(type, "FLROILI+"); + this->findOrLoadScalarResult(type, "FLROILJ+"); + this->findOrLoadScalarResult(type, "FLROILK+"); + } + else if (resultName == RimDefines::combinedGasFluxResultName()) + { + this->findOrLoadScalarResult(type, "FLRGASI+"); + this->findOrLoadScalarResult(type, "FLRGASJ+"); + this->findOrLoadScalarResult(type, "FLRGASK+"); + } + } if (isDataPresent(scalarResultIndex)) @@ -966,7 +987,7 @@ void RimReservoirCellResultsStorage::computeNncCombRiTrans() if (!m_cellResults) return; size_t riCombTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedRiTranResultName()); - if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransScalarResultIndex)) return; + if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex)) return; double cdarchy = darchysValue(); @@ -985,7 +1006,8 @@ void RimReservoirCellResultsStorage::computeNncCombRiTrans() std::vector & permXResults = m_cellResults->cellScalarResults(permXResultIdx)[0]; std::vector & permYResults = m_cellResults->cellScalarResults(permYResultIdx)[0]; std::vector & permZResults = m_cellResults->cellScalarResults(permZResultIdx)[0]; - std::vector & riCombTransResults = m_ownerMainGrid->nncData()->makeConnectionScalarResult(riCombTransScalarResultIndex); + std::vector & riCombTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::RI_COMB_TRANS); + m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::RI_COMB_TRANS, riCombTransScalarResultIndex); std::vector * ntgResults = NULL; if (hasNTGResults) @@ -1226,11 +1248,14 @@ void RimReservoirCellResultsStorage::computeNncCombRiMULT() size_t riCombTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedRiTranResultName()); size_t combTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedTransmissibilityResultName()); - if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombMultScalarResultIndex)) return; + if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombMultScalarResultIndex)) return; - std::vector & riMultResults = m_ownerMainGrid->nncData()->makeConnectionScalarResult(riCombMultScalarResultIndex); - const std::vector * riTransResults = m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransScalarResultIndex); - const std::vector * transResults = m_ownerMainGrid->nncData()->connectionScalarResult(combTransScalarResultIndex); + std::vector & riMultResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::RI_COMB_MULT); + const std::vector * riTransResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(RigNNCData::RI_COMB_TRANS); + const std::vector * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(RigNNCData::COMB_TRANS); + m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::RI_COMB_MULT, riCombMultScalarResultIndex); + m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::RI_COMB_TRANS, riCombTransScalarResultIndex); + m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::COMB_TRANS, combTransScalarResultIndex); for (size_t nncConIdx = 0; nncConIdx < riMultResults.size(); ++nncConIdx) { @@ -1359,10 +1384,11 @@ void RimReservoirCellResultsStorage::computeNncCombRiTRANSbyArea() size_t riCombTransByAreaScResIdx = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedRiAreaNormTranResultName()); size_t combTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedTransmissibilityResultName()); - if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransByAreaScResIdx)) return; + if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransByAreaScResIdx)) return; - std::vector & riAreaNormTransResults = m_ownerMainGrid->nncData()->makeConnectionScalarResult(riCombTransByAreaScResIdx); - const std::vector * transResults = m_ownerMainGrid->nncData()->connectionScalarResult(combTransScalarResultIndex); + std::vector & riAreaNormTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::RI_COMB_TRANS_BY_AREA); + m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::RI_COMB_TRANS_BY_AREA, riCombTransByAreaScResIdx); + const std::vector * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex); const std::vector& connections = m_ownerMainGrid->nncData()->connections(); diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index d24f66f573..39881e5470 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -321,6 +321,30 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTranZResultName())); statisticsCalculator = calc; } + else if (resultName == RimDefines::combinedWaterFluxResultName()) + { + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRWATI+")); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRWATJ+")); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRWATK+")); + statisticsCalculator = calc; + } + else if (resultName == RimDefines::combinedOilFluxResultName()) + { + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLROILI+")); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLROILJ+")); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLROILK+")); + statisticsCalculator = calc; + } + else if (resultName == RimDefines::combinedGasFluxResultName()) + { + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRGASI+")); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRGASJ+")); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRGASK+")); + statisticsCalculator = calc; + } else { statisticsCalculator = new RigEclipseNativeStatCalc(this, scalarResultIndex); @@ -694,6 +718,34 @@ void RigCaseCellResultsData::createPlaceholderResultEntries() } } + // FLUX + { + size_t waterIndex = findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedWaterFluxResultName()); + if (waterIndex == cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRWATI+") != cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRWATJ+") != cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRWATK+") != cvf::UNDEFINED_SIZE_T) + { + addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedWaterFluxResultName(), false); + } + size_t oilIndex = findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedOilFluxResultName()); + if (oilIndex == cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLROILI+") != cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLROILJ+") != cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLROILK+") != cvf::UNDEFINED_SIZE_T) + { + addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedOilFluxResultName(), false); + } + size_t gasIndex = findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedGasFluxResultName()); + if (gasIndex == cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRGASI+") != cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRGASJ+") != cvf::UNDEFINED_SIZE_T && + findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRGASK+") != cvf::UNDEFINED_SIZE_T) + { + addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedGasFluxResultName(), false); + } + } + // TRANSXYZ { size_t tranX, tranY, tranZ; diff --git a/ApplicationCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationCode/ReservoirDataModel/RigNNCData.cpp index 72a4f023a4..e26c741608 100644 --- a/ApplicationCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigNNCData.cpp @@ -166,38 +166,92 @@ void RigNNCData::processConnections(const RigMainGrid& mainGrid) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector& RigNNCData::makeConnectionScalarResult(size_t scalarResultIndex) +std::vector& RigNNCData::makeStaticConnectionScalarResult(NNCDataType nncDataType) { - std::vector& results = m_connectionResults[scalarResultIndex]; - results.resize(m_connections.size(), HUGE_VAL); + std::vector< std::vector >& results = m_connectionResults[nncDataType]; + results.resize(1); + results[0].resize(m_connections.size(), HUGE_VAL); + return results[0]; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector* RigNNCData::staticConnectionScalarResult(size_t scalarResultIndex) const +{ + const NNCDataType* nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (!nncDataType) return nullptr; + + std::map > >::const_iterator it = m_connectionResults.find(*nncDataType); + + CVF_ASSERT(it->second.size() == 1); + + if (it != m_connectionResults.end()) + { + return &(it->second[0]); + } + else + { + return nullptr; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector< std::vector >& RigNNCData::makeDynamicConnectionScalarResult(NNCDataType nncDataType, size_t timeStepCount) +{ + auto& results = m_connectionResults[nncDataType]; + results.resize(timeStepCount); return results; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector* RigNNCData::connectionScalarResult(size_t scalarResultIndex) const +const std::vector< std::vector >* RigNNCData::dynamicConnectionScalarResult(size_t scalarResultIndex) const { - std::map >::const_iterator it = m_connectionResults.find(scalarResultIndex); + const NNCDataType* nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (!nncDataType) return nullptr; + + auto it = m_connectionResults.find(*nncDataType); + if (it != m_connectionResults.end()) + { return &(it->second); + } else - return NULL; + { + return nullptr; + } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNNCData::setCombTransmisibilityScalarResultIndex(size_t scalarResultIndex) +const std::vector* RigNNCData::dynamicConnectionScalarResult(size_t scalarResultIndex, size_t timeStep) const { - std::map >::iterator it = m_connectionResults.find(cvf::UNDEFINED_SIZE_T); + const NNCDataType* nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (!nncDataType) return nullptr; + + auto it = m_connectionResults.find(*nncDataType); + if (it != m_connectionResults.end()) { - std::vector& emptyData = m_connectionResults[scalarResultIndex]; - std::vector& realData = m_connectionResults[cvf::UNDEFINED_SIZE_T]; - emptyData.swap(realData); - m_connectionResults.erase(cvf::UNDEFINED_SIZE_T); + if (it->second.size() > timeStep) + { + return &(it->second[timeStep]); + } } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigNNCData::setScalarResultIndex(NNCDataType nncDataType, size_t scalarResultIndex) +{ + m_resultIndexToNNCDataType[scalarResultIndex] = nncDataType; } //-------------------------------------------------------------------------------------------------- @@ -205,10 +259,26 @@ void RigNNCData::setCombTransmisibilityScalarResultIndex(size_t scalarResultInde //-------------------------------------------------------------------------------------------------- bool RigNNCData::hasScalarValues(size_t scalarResultIndex) { - std::map >::iterator it = m_connectionResults.find(scalarResultIndex); + const NNCDataType* nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (!nncDataType) return false; + + auto it = m_connectionResults.find(*nncDataType); return (it != m_connectionResults.end()); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigNNCData::NNCDataType* RigNNCData::getNNCDataTypeFromScalarResultIndex(size_t scalarResultIndex) const +{ + auto it = m_resultIndexToNNCDataType.find(scalarResultIndex); + if (it != m_resultIndexToNNCDataType.end()) + { + return &it->second; + } + return nullptr; +} + /* //-------------------------------------------------------------------------------------------------- /// TODO: Possibly not needed ! diff --git a/ApplicationCode/ReservoirDataModel/RigNNCData.h b/ApplicationCode/ReservoirDataModel/RigNNCData.h index d9d55439a8..50904e9e5b 100644 --- a/ApplicationCode/ReservoirDataModel/RigNNCData.h +++ b/ApplicationCode/ReservoirDataModel/RigNNCData.h @@ -57,8 +57,17 @@ public: class RigNNCData : public cvf::Object { - public: + enum NNCDataType { + FLUX_WAT, + FLUX_OIL, + FLUX_GAS, + COMB_TRANS, + RI_COMB_TRANS, + RI_COMB_MULT, + RI_COMB_TRANS_BY_AREA, + }; + RigNNCData(); void processConnections(const RigMainGrid& mainGrid); @@ -66,10 +75,13 @@ public: std::vector& connections() { return m_connections; } const std::vector& connections() const { return m_connections; }; - std::vector& makeConnectionScalarResult(size_t scalarResultIndex); - const std::vector* connectionScalarResult(size_t scalarResultIndex) const; + std::vector& makeStaticConnectionScalarResult(NNCDataType nncDataType); + const std::vector* staticConnectionScalarResult(size_t scalarResultIndex) const; + std::vector< std::vector >& makeDynamicConnectionScalarResult(NNCDataType nncDataType, size_t timeStepCount); + const std::vector< std::vector >* dynamicConnectionScalarResult(size_t scalarResultIndex) const; + const std::vector* dynamicConnectionScalarResult(size_t scalarResultIndex, size_t timeStep) const; - void setCombTransmisibilityScalarResultIndex(size_t scalarResultIndex); + void setScalarResultIndex(NNCDataType nncDataType, size_t scalarResultIndex); bool hasScalarValues(size_t scalarResultIndex); @@ -78,7 +90,10 @@ private: // This section is possibly not needed //typedef std::map, 7 > > ConnectionSearchMap; //ConnectionSearchMap m_cellIdxToFaceToConnectionIdxMap; + const NNCDataType* getNNCDataTypeFromScalarResultIndex(size_t scalarResultIndex) const; + private: - std::vector m_connections; - std::map > m_connectionResults; ///< scalarResultIndex to value array map + std::vector m_connections; + std::map > > m_connectionResults; + std::map m_resultIndexToNNCDataType; }; diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index e928da4c44..b726b20254 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -542,7 +542,7 @@ void RigReservoirBuilderMock::addFaults(RigEclipseCaseData* eclipseCase) addNnc(grid, i1, j1, k1, i2, j2, k2, nncConnections); } - std::vector& tranVals = grid->nncData()->makeConnectionScalarResult(cvf::UNDEFINED_SIZE_T); + std::vector& tranVals = grid->nncData()->makeStaticConnectionScalarResult(RigNNCData::COMB_TRANS); for (size_t cIdx = 0; cIdx < tranVals.size(); ++cIdx) { tranVals[cIdx] = 0.2; diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp index 5b1411e14e..464d9e56bb 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp @@ -125,6 +125,42 @@ cvf::ref RigResultAccessorFactory::createFromUiResultName(Rig return cellFaceAccessObject; } + else if (uiResultName == RimDefines::combinedWaterFluxResultName()) + { + cvf::ref cellFaceAccessObject = new RigCombTransResultAccessor(grid); + + cvf::ref xRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLRWATI+"); + cvf::ref yRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLRWATJ+"); + cvf::ref zRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLRWATK+"); + + cellFaceAccessObject->setTransResultAccessors(xRiAreaNormTransAccessor.p(), yRiAreaNormTransAccessor.p(), zRiAreaNormTransAccessor.p()); + + return cellFaceAccessObject; + } + else if (uiResultName == RimDefines::combinedOilFluxResultName()) + { + cvf::ref cellFaceAccessObject = new RigCombTransResultAccessor(grid); + + cvf::ref xRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLROILI+"); + cvf::ref yRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLROILJ+"); + cvf::ref zRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLROILK+"); + + cellFaceAccessObject->setTransResultAccessors(xRiAreaNormTransAccessor.p(), yRiAreaNormTransAccessor.p(), zRiAreaNormTransAccessor.p()); + + return cellFaceAccessObject; + } + else if (uiResultName == RimDefines::combinedGasFluxResultName()) + { + cvf::ref cellFaceAccessObject = new RigCombTransResultAccessor(grid); + + cvf::ref xRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLRGASI+"); + cvf::ref yRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLRGASJ+"); + cvf::ref zRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, "FLRGASK+"); + + cellFaceAccessObject->setTransResultAccessors(xRiAreaNormTransAccessor.p(), yRiAreaNormTransAccessor.p(), zRiAreaNormTransAccessor.p()); + + return cellFaceAccessObject; + } return RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName); } diff --git a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp index 383d50fd6e..287c0a95fd 100644 --- a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp @@ -348,7 +348,16 @@ QString RiuResultTextBuilder::nncResultText() if (m_reservoirView->currentFaultResultColors()) { size_t scalarResultIdx = m_reservoirView->currentFaultResultColors()->scalarResultIndex(); - const std::vector* nncValues = nncData->connectionScalarResult(scalarResultIdx); + RimDefines::ResultCatType resultType = m_reservoirView->currentFaultResultColors()->resultType(); + const std::vector* nncValues; + if (resultType == RimDefines::STATIC_NATIVE) + { + nncValues = nncData->staticConnectionScalarResult(scalarResultIdx); + } + else if (resultType == RimDefines::DYNAMIC_NATIVE) + { + nncValues = nncData->dynamicConnectionScalarResult(scalarResultIdx, m_timeStepIndex); + } if (nncValues) { QString resultVar = m_reservoirView->currentFaultResultColors()->resultVariableUiName(); From 9bea767cdfd31c027fad59d07404190be02cd670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 29 Jun 2017 09:07:21 +0200 Subject: [PATCH 27/61] #1663 Octave interface to get NNC-pair information --- ApplicationCode/CMakeLists.txt | 1 + .../SocketInterface/RiaNNCCommands.cpp | 97 +++++++++++ OctavePlugin/CMakeLists.txt | 2 + OctavePlugin/riGetNNCConnections.cpp | 153 ++++++++++++++++++ OctavePlugin/riSettings.h | 6 + 5 files changed, 259 insertions(+) create mode 100644 ApplicationCode/SocketInterface/RiaNNCCommands.cpp create mode 100644 OctavePlugin/riGetNNCConnections.cpp diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 836b7d38fd..7efd69c90a 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -87,6 +87,7 @@ set( SOCKET_INTERFACE_FILES SocketInterface/RiaProjectInfoCommands.cpp SocketInterface/RiaCaseInfoCommands.cpp SocketInterface/RiaGeometryCommands.cpp + SocketInterface/RiaNNCCommands.cpp SocketInterface/RiaPropertyDataCommands.cpp SocketInterface/RiaWellDataCommands.cpp SocketInterface/RiaSocketTools.cpp diff --git a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp new file mode 100644 index 0000000000..65d7094b0e --- /dev/null +++ b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaSocketCommand.h" + +#include "RiaSocketServer.h" +#include "RiaSocketTools.h" +#include "RiaApplication.h" +#include "RiaPreferences.h" + +#include "RigActiveCellInfo.h" +#include "RigCaseCellResultsData.h" +#include "RigEclipseCaseData.h" +#include "RigMainGrid.h" + +#include "Rim3dOverlayInfoConfig.h" +#include "RimCellEdgeColors.h" +#include "RimCellRangeFilterCollection.h" +#include "RimEclipseCase.h" +#include "RimEclipseCellColors.h" +#include "RimEclipsePropertyFilterCollection.h" +#include "RimEclipseView.h" +#include "RimEclipseWellCollection.h" +#include "RimReservoirCellResultsStorage.h" + +#include + + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaGetNNCConnections: public RiaSocketCommand +{ +public: + static QString commandName () { return QString("GetNNCConnections"); } + + virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) + { + RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); + if (!rimCase) return true; + + // Write data back to octave: columnCount, GridNr I J K GridNr I J K + if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid())) + { + // No data available + socketStream << (quint64)0; + return true; + } + + RigMainGrid* mainGrid = rimCase->eclipseCaseData()->mainGrid(); + + size_t connectionCount = mainGrid->nncData()->connections().size(); + + socketStream << (quint64)connectionCount; + + for (const RigConnection& connection : mainGrid->nncData()->connections()) + { + const RigCell& cell1 = mainGrid->globalCellArray()[connection.m_c1GlobIdx]; + const RigCell& cell2 = mainGrid->globalCellArray()[connection.m_c2GlobIdx]; + + sendCellInfo(socketStream, cell1); + sendCellInfo(socketStream, cell2); + } + + return true; + } + + static void sendCellInfo(QDataStream& socketStream, const RigCell& cell) + { + RigGridBase* hostGrid = cell.hostGrid(); + size_t gridLocalCellIndex = cell.gridLocalCellIndex(); + size_t i, j, k; + hostGrid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k); + + socketStream << (qint32)hostGrid->gridIndex(); + socketStream << (qint32)i << (qint32)j << (qint32)k; + } +}; + +static bool RiaGetNNCConnections_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetNNCConnections::commandName()); diff --git a/OctavePlugin/CMakeLists.txt b/OctavePlugin/CMakeLists.txt index 21ec239bad..954899eef8 100644 --- a/OctavePlugin/CMakeLists.txt +++ b/OctavePlugin/CMakeLists.txt @@ -8,6 +8,7 @@ set(CPP_SOURCES riSetActiveCellProperty.cpp riGetActiveCellInfo.cpp riGetMainGridDimensions.cpp + riGetNNCConnections.cpp riGetCurrentCase.cpp riGetCaseGroups.cpp riGetSelectedCases.cpp @@ -172,6 +173,7 @@ if (RESINSIGHT_OCTAVE_PLUGIN_QMAKE AND RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE) "${CMAKE_CURRENT_BINARY_DIR}/riSetActiveCellProperty.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetActiveCellInfo.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetMainGridDimensions.oct" + "${CMAKE_CURRENT_BINARY_DIR}/riGetNNCConnections.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetCurrentCase.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetCaseGroups.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetSelectedCases.oct" diff --git a/OctavePlugin/riGetNNCConnections.cpp b/OctavePlugin/riGetNNCConnections.cpp new file mode 100644 index 0000000000..05d8a3f524 --- /dev/null +++ b/OctavePlugin/riGetNNCConnections.cpp @@ -0,0 +1,153 @@ +#include +#include +#include + +#include "riSettings.h" +#include "RiaSocketDataTransfer.cpp" // NB! Include cpp-file to avoid linking of additional file in oct-compile configuration + +struct GridLocalCell +{ + int gridIndex; + int i; + int j; + int k; +}; + +struct Connection +{ + GridLocalCell fromCell; + GridLocalCell toCell; +}; + +void getNNCConnections(std::vector& connections, const QString& hostName, quint16 port, const qint64& caseId) +{ + QString serverName = hostName; + quint16 serverPort = port; + + QTcpSocket socket; + socket.connectToHost(serverName, serverPort); + + if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs)) + { + error((("Connection: ") + socket.errorString()).toLatin1().data()); + return; + } + + QString command = QString("GetNNCConnections %1").arg(caseId); + QByteArray cmdBytes = command.toLatin1(); + + QDataStream socketStream(&socket); + socketStream.setVersion(riOctavePlugin::qtDataStreamVersion); + + socketStream << (qint64)(cmdBytes.size()); + socket.write(cmdBytes); + + while (socket.bytesAvailable() < (int)sizeof(quint64)) + { + if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs)) + { + error((("Waiting for header: ") + socket.errorString()).toLatin1().data()); + return; + } + OCTAVE_QUIT; + } + + quint64 connectionCount; + quint64 byteCount; + quint64 rowByteSize = sizeof(qint32) * 4 * 2; + + socketStream >> connectionCount; + + byteCount = connectionCount * rowByteSize; + + while (socket.bytesAvailable() < (int)byteCount) + { + if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs)) + { + error((("Waiting for data: ") + socket.errorString()).toLatin1().data()); + return; + } + OCTAVE_QUIT; + } + + connections.resize(connectionCount); + + for (size_t i = 0; i < connectionCount; ++i) + { + socketStream >> connections[i].fromCell.gridIndex; + socketStream >> connections[i].fromCell.i >> connections[i].fromCell.j >> connections[i].fromCell.k; + socketStream >> connections[i].toCell.gridIndex; + socketStream >> connections[i].toCell.i >> connections[i].toCell.j >> connections[i].toCell.k; + } + + return; +} + +DEFUN_DLD(riGetNNCConnections, args, nargout, + "Usage:\n" + "\n" + " riGetNNCConnections([CaseId])\n" + "\n" + "This function returns a two dimensional matrix containing grid and IJK information\n" + "for each NNC in the requested case." +) +{ + int nargin = args.length(); + if (nargin > 1) + { + error("riGetNNCConnections: Too many arguments, CaseId are optional input arguments.\n"); + print_usage(); + } + else if (nargout < 1) + { + error("riGetNNCConnections: Missing output argument.\n"); + print_usage(); + } + else + { + std::vector connections; + qint64 caseId = -1; + + if (nargin > 0) + { + if (args(0).is_numeric_type()) + { + unsigned int argCaseId = args(0).uint_value(); + caseId = argCaseId; + } + } + + getNNCConnections(connections, "127.0.0.1", 40001, caseId); + + Cell cellValuesGridIndex(connections.size(), 2); + Cell cellValuesI(connections.size(), 2); + Cell cellValuesJ(connections.size(), 2); + Cell cellValuesK(connections.size(), 2); + + for (size_t i = 0; i < connections.size(); ++i) + { + cellValuesGridIndex(i, 0) = connections[i].fromCell.gridIndex; + cellValuesGridIndex(i, 1) = connections[i].toCell.gridIndex; + + cellValuesI(i, 0) = connections[i].fromCell.i; + cellValuesI(i, 1) = connections[i].toCell.i; + + cellValuesJ(i, 0) = connections[i].fromCell.j; + cellValuesJ(i, 1) = connections[i].toCell.j; + + cellValuesK(i, 0) = connections[i].fromCell.k; + cellValuesK(i, 1) = connections[i].toCell.k; + } + + octave_map m; + + m.assign(riOctavePlugin::cellIndex_gridIndex, cellValuesGridIndex); + m.assign(riOctavePlugin::cellIndex_I, cellValuesI); + m.assign(riOctavePlugin::cellIndex_J, cellValuesJ); + m.assign(riOctavePlugin::cellIndex_K, cellValuesK); + + return octave_value(m); + } + + return octave_value(); +} \ No newline at end of file diff --git a/OctavePlugin/riSettings.h b/OctavePlugin/riSettings.h index 63ad778b37..3e80a781d9 100644 --- a/OctavePlugin/riSettings.h +++ b/OctavePlugin/riSettings.h @@ -60,5 +60,11 @@ namespace riOctavePlugin char timeStepDate_Hour[] = "Hour"; char timeStepDate_Minute[] = "Minute"; char timeStepDate_Second[] = "Second"; + + // Octave data structure : CellIndex + char cellIndex_gridIndex[] = "GridIndex"; + char cellIndex_I[] = "I"; + char cellIndex_J[] = "J"; + char cellIndex_K[] = "K"; } From 44f02340966e535dd259dac19813dbfa08ab6eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 29 Jun 2017 11:19:07 +0200 Subject: [PATCH 28/61] #1661 Octave interface for getting static and dynamic NNC result values from ResInsight --- .../FileInterface/RifReaderEclipseOutput.cpp | 8 +- .../ProjectDataModel/RimEclipseCase.cpp | 8 +- .../RimReservoirCellResultsStorage.cpp | 18 +- .../ReservoirDataModel/RigNNCData.cpp | 87 +++++++--- .../ReservoirDataModel/RigNNCData.h | 33 ++-- .../RigReservoirBuilderMock.cpp | 2 +- .../SocketInterface/RiaNNCCommands.cpp | 129 ++++++++++++++- OctavePlugin/CMakeLists.txt | 4 + OctavePlugin/riGetDynamicNNCValues.cpp | 156 ++++++++++++++++++ OctavePlugin/riGetStaticNNCValues.cpp | 141 ++++++++++++++++ 10 files changed, 526 insertions(+), 60 deletions(-) create mode 100644 OctavePlugin/riGetDynamicNNCValues.cpp create mode 100644 OctavePlugin/riGetStaticNNCValues.cpp diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 0d133d06bc..ca4cb02940 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -596,7 +596,7 @@ void RifReaderEclipseOutput::transferStaticNNCData(const ecl_grid_type* mainEclG // Transform to our own data structures mainGrid->nncData()->connections().resize(numNNC); - std::vector& transmissibilityValues = mainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::COMB_TRANS); + std::vector& transmissibilityValues = mainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameCombTrans()); const double* transValues = ecl_nnc_data_get_values(tran_data); for (int nIdx = 0; nIdx < numNNC; ++nIdx) @@ -624,9 +624,9 @@ void RifReaderEclipseOutput::transferDynamicNNCData(const ecl_grid_type* mainEcl size_t timeStepCount = m_dynamicResultsAccess->timeStepCount(); - std::vector< std::vector >& waterFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::FLUX_WAT, timeStepCount); - std::vector< std::vector >& oilFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::FLUX_OIL, timeStepCount); - std::vector< std::vector >& gasFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::FLUX_GAS, timeStepCount); + std::vector< std::vector >& waterFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::propertyNameFluxWat(), timeStepCount); + std::vector< std::vector >& oilFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::propertyNameFluxOil(), timeStepCount); + std::vector< std::vector >& gasFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::propertyNameFluxGas(), timeStepCount); for (size_t timeStep = 0; timeStep < timeStepCount; ++timeStep) { diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index b227f872e9..a962518f43 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -582,22 +582,22 @@ bool RimEclipseCase::openReserviorCase() size_t combinedTransResIdx = results->cellResults()->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedTransmissibilityResultName()); if (combinedTransResIdx != cvf::UNDEFINED_SIZE_T) { - eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::COMB_TRANS, combinedTransResIdx); + eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameCombTrans(), combinedTransResIdx); } size_t combinedWatFluxResIdx = results->cellResults()->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedWaterFluxResultName()); if (combinedWatFluxResIdx != cvf::UNDEFINED_SIZE_T) { - eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::FLUX_WAT, combinedWatFluxResIdx); + eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxWat(), combinedWatFluxResIdx); } size_t combinedOilFluxResIdx = results->cellResults()->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedOilFluxResultName()); if (combinedOilFluxResIdx != cvf::UNDEFINED_SIZE_T) { - eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::FLUX_OIL, combinedOilFluxResIdx); + eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxOil(), combinedOilFluxResIdx); } size_t combinedGasFluxResIdx = results->cellResults()->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, RimDefines::combinedGasFluxResultName()); if (combinedGasFluxResIdx != cvf::UNDEFINED_SIZE_T) { - eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::FLUX_GAS, combinedGasFluxResIdx); + eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxGas(), combinedGasFluxResIdx); } } diff --git a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index 9a0dbba6da..71a15d7bbe 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -1006,8 +1006,8 @@ void RimReservoirCellResultsStorage::computeNncCombRiTrans() std::vector & permXResults = m_cellResults->cellScalarResults(permXResultIdx)[0]; std::vector & permYResults = m_cellResults->cellScalarResults(permYResultIdx)[0]; std::vector & permZResults = m_cellResults->cellScalarResults(permZResultIdx)[0]; - std::vector & riCombTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::RI_COMB_TRANS); - m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::RI_COMB_TRANS, riCombTransScalarResultIndex); + std::vector & riCombTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans()); + m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransScalarResultIndex); std::vector * ntgResults = NULL; if (hasNTGResults) @@ -1250,12 +1250,10 @@ void RimReservoirCellResultsStorage::computeNncCombRiMULT() if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombMultScalarResultIndex)) return; - std::vector & riMultResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::RI_COMB_MULT); - const std::vector * riTransResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(RigNNCData::RI_COMB_TRANS); - const std::vector * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(RigNNCData::COMB_TRANS); - m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::RI_COMB_MULT, riCombMultScalarResultIndex); - m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::RI_COMB_TRANS, riCombTransScalarResultIndex); - m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::COMB_TRANS, combTransScalarResultIndex); + std::vector & riMultResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombMult()); + const std::vector * riTransResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex); + const std::vector * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex); + m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombMult(), riCombMultScalarResultIndex); for (size_t nncConIdx = 0; nncConIdx < riMultResults.size(); ++nncConIdx) { @@ -1386,8 +1384,8 @@ void RimReservoirCellResultsStorage::computeNncCombRiTRANSbyArea() if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransByAreaScResIdx)) return; - std::vector & riAreaNormTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::RI_COMB_TRANS_BY_AREA); - m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::RI_COMB_TRANS_BY_AREA, riCombTransByAreaScResIdx); + std::vector & riAreaNormTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTransByArea()); + m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTransByArea(), riCombTransByAreaScResIdx); const std::vector * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex); const std::vector& connections = m_ownerMainGrid->nncData()->connections(); diff --git a/ApplicationCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationCode/ReservoirDataModel/RigNNCData.cpp index e26c741608..939a5ec967 100644 --- a/ApplicationCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigNNCData.cpp @@ -166,7 +166,7 @@ void RigNNCData::processConnections(const RigMainGrid& mainGrid) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector& RigNNCData::makeStaticConnectionScalarResult(NNCDataType nncDataType) +std::vector& RigNNCData::makeStaticConnectionScalarResult(QString nncDataType) { std::vector< std::vector >& results = m_connectionResults[nncDataType]; results.resize(1); @@ -179,15 +179,14 @@ std::vector& RigNNCData::makeStaticConnectionScalarResult(NNCDataType nn //-------------------------------------------------------------------------------------------------- const std::vector* RigNNCData::staticConnectionScalarResult(size_t scalarResultIndex) const { - const NNCDataType* nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); - if (!nncDataType) return nullptr; + QString nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (nncDataType.isNull()) return nullptr; - std::map > >::const_iterator it = m_connectionResults.find(*nncDataType); - - CVF_ASSERT(it->second.size() == 1); + std::map > >::const_iterator it = m_connectionResults.find(nncDataType); if (it != m_connectionResults.end()) { + CVF_ASSERT(it->second.size() == 1); return &(it->second[0]); } else @@ -199,7 +198,26 @@ const std::vector* RigNNCData::staticConnectionScalarResult(size_t scala //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector< std::vector >& RigNNCData::makeDynamicConnectionScalarResult(NNCDataType nncDataType, size_t timeStepCount) +const std::vector* RigNNCData::staticConnectionScalarResultByName(const QString& nncDataType) const +{ + std::map > >::const_iterator it = m_connectionResults.find(nncDataType); + + + if (it != m_connectionResults.end()) + { + CVF_ASSERT(it->second.size() == 1); + return &(it->second[0]); + } + else + { + return nullptr; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector< std::vector >& RigNNCData::makeDynamicConnectionScalarResult(QString nncDataType, size_t timeStepCount) { auto& results = m_connectionResults[nncDataType]; results.resize(timeStepCount); @@ -211,10 +229,10 @@ std::vector< std::vector >& RigNNCData::makeDynamicConnectionScalarResul //-------------------------------------------------------------------------------------------------- const std::vector< std::vector >* RigNNCData::dynamicConnectionScalarResult(size_t scalarResultIndex) const { - const NNCDataType* nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); - if (!nncDataType) return nullptr; + QString nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (nncDataType.isNull()) return nullptr; - auto it = m_connectionResults.find(*nncDataType); + auto it = m_connectionResults.find(nncDataType); if (it != m_connectionResults.end()) { @@ -231,10 +249,10 @@ const std::vector< std::vector >* RigNNCData::dynamicConnectionScalarRes //-------------------------------------------------------------------------------------------------- const std::vector* RigNNCData::dynamicConnectionScalarResult(size_t scalarResultIndex, size_t timeStep) const { - const NNCDataType* nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); - if (!nncDataType) return nullptr; + QString nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (nncDataType.isNull()) return nullptr; - auto it = m_connectionResults.find(*nncDataType); + auto it = m_connectionResults.find(nncDataType); if (it != m_connectionResults.end()) { @@ -249,7 +267,36 @@ const std::vector* RigNNCData::dynamicConnectionScalarResult(size_t scal //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNNCData::setScalarResultIndex(NNCDataType nncDataType, size_t scalarResultIndex) +const std::vector>* RigNNCData::dynamicConnectionScalarResultByName(const QString& nncDataType) const +{ + auto it = m_connectionResults.find(nncDataType); + if (it != m_connectionResults.end()) + { + return &(it->second); + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector* RigNNCData::dynamicConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) const +{ + auto it = m_connectionResults.find(nncDataType); + if (it != m_connectionResults.end()) + { + if (it->second.size() > timeStep) + { + return &(it->second[timeStep]); + } + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigNNCData::setScalarResultIndex(const QString& nncDataType, size_t scalarResultIndex) { m_resultIndexToNNCDataType[scalarResultIndex] = nncDataType; } @@ -259,24 +306,24 @@ void RigNNCData::setScalarResultIndex(NNCDataType nncDataType, size_t scalarResu //-------------------------------------------------------------------------------------------------- bool RigNNCData::hasScalarValues(size_t scalarResultIndex) { - const NNCDataType* nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); - if (!nncDataType) return false; + QString nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (nncDataType.isNull()) return false; - auto it = m_connectionResults.find(*nncDataType); + auto it = m_connectionResults.find(nncDataType); return (it != m_connectionResults.end()); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RigNNCData::NNCDataType* RigNNCData::getNNCDataTypeFromScalarResultIndex(size_t scalarResultIndex) const +const QString RigNNCData::getNNCDataTypeFromScalarResultIndex(size_t scalarResultIndex) const { auto it = m_resultIndexToNNCDataType.find(scalarResultIndex); if (it != m_resultIndexToNNCDataType.end()) { - return &it->second; + return it->second; } - return nullptr; + return QString(); } /* diff --git a/ApplicationCode/ReservoirDataModel/RigNNCData.h b/ApplicationCode/ReservoirDataModel/RigNNCData.h index 50904e9e5b..c7fe6f3dc3 100644 --- a/ApplicationCode/ReservoirDataModel/RigNNCData.h +++ b/ApplicationCode/ReservoirDataModel/RigNNCData.h @@ -58,30 +58,31 @@ public: class RigNNCData : public cvf::Object { public: - enum NNCDataType { - FLUX_WAT, - FLUX_OIL, - FLUX_GAS, - COMB_TRANS, - RI_COMB_TRANS, - RI_COMB_MULT, - RI_COMB_TRANS_BY_AREA, - }; + static QString propertyNameFluxWat() { return "FLRWAT"; } + static QString propertyNameFluxOil() { return "FLROIL"; } + static QString propertyNameFluxGas() { return "FLRGAS"; } + static QString propertyNameCombTrans() { return "TRAN"; } + static QString propertyNameRiCombTrans() { return "riTRAN"; } + static QString propertyNameRiCombTransByArea() { return "riTRANbyArea"; } + static QString propertyNameRiCombMult() { return "riMULT"; } RigNNCData(); void processConnections(const RigMainGrid& mainGrid); std::vector& connections() { return m_connections; } - const std::vector& connections() const { return m_connections; }; + const std::vector& connections() const { return m_connections; } - std::vector& makeStaticConnectionScalarResult(NNCDataType nncDataType); + std::vector& makeStaticConnectionScalarResult(QString nncDataType); const std::vector* staticConnectionScalarResult(size_t scalarResultIndex) const; - std::vector< std::vector >& makeDynamicConnectionScalarResult(NNCDataType nncDataType, size_t timeStepCount); + const std::vector* staticConnectionScalarResultByName(const QString& nncDataType) const; + std::vector< std::vector >& makeDynamicConnectionScalarResult(QString nncDataType, size_t timeStepCount); const std::vector< std::vector >* dynamicConnectionScalarResult(size_t scalarResultIndex) const; const std::vector* dynamicConnectionScalarResult(size_t scalarResultIndex, size_t timeStep) const; + const std::vector< std::vector >* dynamicConnectionScalarResultByName(const QString& nncDataType) const; + const std::vector* dynamicConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) const; - void setScalarResultIndex(NNCDataType nncDataType, size_t scalarResultIndex); + void setScalarResultIndex(const QString& nncDataType, size_t scalarResultIndex); bool hasScalarValues(size_t scalarResultIndex); @@ -90,10 +91,10 @@ private: // This section is possibly not needed //typedef std::map, 7 > > ConnectionSearchMap; //ConnectionSearchMap m_cellIdxToFaceToConnectionIdxMap; - const NNCDataType* getNNCDataTypeFromScalarResultIndex(size_t scalarResultIndex) const; + const QString getNNCDataTypeFromScalarResultIndex(size_t scalarResultIndex) const; private: std::vector m_connections; - std::map > > m_connectionResults; - std::map m_resultIndexToNNCDataType; + std::map > > m_connectionResults; + std::map m_resultIndexToNNCDataType; }; diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index b726b20254..ec240ab2ab 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -542,7 +542,7 @@ void RigReservoirBuilderMock::addFaults(RigEclipseCaseData* eclipseCase) addNnc(grid, i1, j1, k1, i2, j2, k2, nncConnections); } - std::vector& tranVals = grid->nncData()->makeStaticConnectionScalarResult(RigNNCData::COMB_TRANS); + std::vector& tranVals = grid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameCombTrans()); for (size_t cIdx = 0; cIdx < tranVals.size(); ++cIdx) { tranVals[cIdx] = 0.2; diff --git a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp index 65d7094b0e..2c461cc3ca 100644 --- a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp @@ -39,9 +39,7 @@ #include "RimReservoirCellResultsStorage.h" #include - - - +#include //-------------------------------------------------------------------------------------------------- /// @@ -54,8 +52,6 @@ public: virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) { RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); - if (!rimCase) return true; - // Write data back to octave: columnCount, GridNr I J K GridNr I J K if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid())) { @@ -95,3 +91,126 @@ public: }; static bool RiaGetNNCConnections_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetNNCConnections::commandName()); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaGetDynamicNNCValues: public RiaSocketCommand +{ +public: + static QString commandName () { return QString("GetDynamicNNCValues"); } + + virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) + { + RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); + // Write data back to octave: connectionCount, timeStepCount, property values + if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid())) + { + // No data available + socketStream << (quint64)0 << (quint64)0; + return true; + } + + QString propertyName = args[2]; + + RigMainGrid* mainGrid = rimCase->eclipseCaseData()->mainGrid(); + const std::vector< std::vector >* nncValues = mainGrid->nncData()->dynamicConnectionScalarResultByName(propertyName); + + if (nncValues == nullptr) + { + socketStream << (quint64)0 << (quint64)0; + return true; + } + + std::vector requestedTimeSteps; + if (args.size() > 3) + { + bool timeStepReadError = false; + for (int argIdx = 3; argIdx < args.size(); ++argIdx) + { + bool conversionOk = false; + int tsIdx = args[argIdx].toInt(&conversionOk); + + if (conversionOk) + { + requestedTimeSteps.push_back(tsIdx); + } + else + { + timeStepReadError = true; + } + } + + if (timeStepReadError) + { + server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetDynamicNNCValues : \n") + RiaSocketServer::tr("An error occurred while interpreting the requested time steps.")); + } + } + else + { + for (size_t timeStep = 0; timeStep < nncValues->size(); ++timeStep) + { + requestedTimeSteps.push_back(timeStep); + } + } + + // then the connection count and time step count. + size_t connectionCount = mainGrid->nncData()->connections().size(); + size_t timeStepCount = requestedTimeSteps.size(); + + socketStream << (quint64)connectionCount; + socketStream << (quint64)timeStepCount; + + for (size_t timeStep : requestedTimeSteps) + { + const std::vector& timeStepValues = nncValues->at(timeStep); + RiaSocketTools::writeBlockData(server, server->currentClient(), (const char *)timeStepValues.data(), sizeof(double) * timeStepValues.size()); + } + + return true; + } +}; + +static bool RiaGetDynamicNNCValues_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetDynamicNNCValues::commandName()); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaGetStaticNNCValues: public RiaSocketCommand +{ +public: + static QString commandName () { return QString("GetStaticNNCValues"); } + + virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) + { + RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); + QString propertyName = args[2]; + + // Write data back to octave: connectionCount, property values + if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid())) + { + // No data available + socketStream << (quint64)0; + return true; + } + + RigMainGrid* mainGrid = rimCase->eclipseCaseData()->mainGrid(); + const std::vector* nncValues = mainGrid->nncData()->staticConnectionScalarResultByName(propertyName); + + if (nncValues == nullptr) + { + socketStream << (quint64)0; + return true; + } + + // connection count + size_t connectionCount = mainGrid->nncData()->connections().size(); + socketStream << (quint64)connectionCount; + + RiaSocketTools::writeBlockData(server, server->currentClient(), (const char *)nncValues->data(), sizeof(double) * nncValues->size()); + + return true; + } +}; + +static bool RiaGetStaticNNCValues_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetStaticNNCValues::commandName()); diff --git a/OctavePlugin/CMakeLists.txt b/OctavePlugin/CMakeLists.txt index 954899eef8..3745004132 100644 --- a/OctavePlugin/CMakeLists.txt +++ b/OctavePlugin/CMakeLists.txt @@ -11,6 +11,8 @@ set(CPP_SOURCES riGetNNCConnections.cpp riGetCurrentCase.cpp riGetCaseGroups.cpp + riGetDynamicNNCValues.cpp + riGetStaticNNCValues.cpp riGetSelectedCases.cpp riGetCases.cpp riGetTimeStepDates.cpp @@ -174,6 +176,8 @@ if (RESINSIGHT_OCTAVE_PLUGIN_QMAKE AND RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE) "${CMAKE_CURRENT_BINARY_DIR}/riGetActiveCellInfo.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetMainGridDimensions.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetNNCConnections.oct" + "${CMAKE_CURRENT_BINARY_DIR}/riGetDynamicNNCValues.oct" + "${CMAKE_CURRENT_BINARY_DIR}/riGetStaticNNCValues.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetCurrentCase.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetCaseGroups.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetSelectedCases.oct" diff --git a/OctavePlugin/riGetDynamicNNCValues.cpp b/OctavePlugin/riGetDynamicNNCValues.cpp new file mode 100644 index 0000000000..a150dffc39 --- /dev/null +++ b/OctavePlugin/riGetDynamicNNCValues.cpp @@ -0,0 +1,156 @@ +#include +#include + +#include + +#include "riSettings.h" + +#include "RiaSocketDataTransfer.cpp" // NB! Include cpp-file to avoid linking of additional file in oct-compile configuration + +void getDynamicNNCValues(Matrix& propertyFrames, const QString &serverName, quint16 serverPort, + const qint64& caseId, QString propertyName, const int32NDArray& requestedTimeSteps) +{ + QTcpSocket socket; + socket.connectToHost(serverName, serverPort); + + if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs)) + { + error((("Connection: ") + socket.errorString()).toLatin1().data()); + return; + } + + QDataStream socketStream(&socket); + socketStream.setVersion(riOctavePlugin::qtDataStreamVersion); + + // Create command as a string with arguments , and send it: + QString command; + command += "GetDynamicNNCValues " + QString::number(caseId) + " " + propertyName; + + for (int i = 0; i < requestedTimeSteps.length(); ++i) + { + if (i == 0) command += " "; + command += QString::number(static_cast(requestedTimeSteps.elem(i)) - 1); // To make the index 0-based + if (i != requestedTimeSteps.length() -1) command += " "; + } + + QByteArray cmdBytes = command.toLatin1(); + + socketStream << (qint64)(cmdBytes.size()); + socket.write(cmdBytes); + + // Get response. First wait for the header + + while (socket.bytesAvailable() < (int)(2*sizeof(quint64))) + { + if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs)) + { + error((("Waiting for header: ") + socket.errorString()).toLatin1().data()); + return; + } + } + + // Read connection count and timestep count + quint64 connectionCount; + quint64 timestepCount; + + socketStream >> connectionCount; + socketStream >> timestepCount; + + propertyFrames.resize(connectionCount, timestepCount); + + if (!(connectionCount && timestepCount)) + { + error ("Could not find the requested data in ResInsight"); + return; + } + + quint64 totalByteCount = timestepCount * connectionCount * sizeof(double); + + double* internalMatrixData = propertyFrames.fortran_vec(); + QStringList errorMessages; + if (!RiaSocketDataTransfer::readBlockDataFromSocket(&socket, (char*)(internalMatrixData), totalByteCount, errorMessages)) + { + for (int i = 0; i < errorMessages.size(); i++) + { + error(errorMessages[i].toLatin1().data()); + } + + return; + } + + QString tmp = QString("riGetDynamicNNCValues : Read %1").arg(propertyName); + + if (caseId < 0) + { + tmp += QString(" from current case."); + } + else + { + tmp += QString(" from case with Id: %1.").arg(caseId); + } + octave_stdout << tmp.toStdString() << " Connections: " << connectionCount << ", Time steps : " << timestepCount << std::endl; + + return; +} + + +DEFUN_DLD (riGetDynamicNNCValues, args, nargout, + "Usage:\n" + "\n" + " riGetDynamicNNCValues([CaseId], PropertyName, [RequestedTimeSteps])\n" + "\n" + "This function retrieves the dynamic NNC values for each connection for the requested time steps." + ) +{ + int nargin = args.length (); + if (nargin < 1) + { + error("riGetDynamicNNCValues: Too few arguments. The name of the property requested is necessary.\n"); + print_usage(); + return octave_value_list(); + } + else if (nargin > 3) + { + error("riGetDynamicNNCValues: Too many arguments.\n"); + print_usage(); + return octave_value_list(); + } + else if (nargout < 1) + { + error("riGetDynamicNNCValues: Missing output argument.\n"); + print_usage(); + return octave_value_list(); + } + + std::vector argIndices; + argIndices.push_back(0); + argIndices.push_back(1); + argIndices.push_back(2); + + // Check if we have a CaseId: + if (!args(argIndices[0]).is_numeric_type()) + { + argIndices[0] = -1; + for (size_t aIdx = 1; aIdx < argIndices.size(); ++aIdx) + --argIndices[aIdx]; + } + + // Check if we have a Requested TimeSteps + if (!(nargin > argIndices[2] && args(argIndices[2]).is_matrix_type())) + { + argIndices[2] = -1; + } + + Matrix propertyFrames; + qint32 caseId = -1; + int32NDArray requestedTimeSteps; + std::string propertyName; + + if (argIndices[0] >= 0) caseId = args(argIndices[0]).int_value(); + if (argIndices[1] >= 0) propertyName = args(argIndices[1]).char_matrix_value().row_as_string(0); + if (argIndices[2] >= 0) requestedTimeSteps = args(argIndices[2]).int32_array_value(); + + getDynamicNNCValues(propertyFrames, "127.0.0.1", 40001, caseId, propertyName.c_str(), requestedTimeSteps); + + return octave_value(propertyFrames); +} diff --git a/OctavePlugin/riGetStaticNNCValues.cpp b/OctavePlugin/riGetStaticNNCValues.cpp new file mode 100644 index 0000000000..42d92e834e --- /dev/null +++ b/OctavePlugin/riGetStaticNNCValues.cpp @@ -0,0 +1,141 @@ +#include +#include + +#include + +#include "riSettings.h" + +#include "RiaSocketDataTransfer.cpp" // NB! Include cpp-file to avoid linking of additional file in oct-compile configuration + +void getStaticNNCValues(std::vector& propertyValues, const QString &serverName, quint16 serverPort, + const qint64& caseId, QString propertyName) +{ + QTcpSocket socket; + socket.connectToHost(serverName, serverPort); + + if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs)) + { + error((("Connection: ") + socket.errorString()).toLatin1().data()); + return; + } + + QDataStream socketStream(&socket); + socketStream.setVersion(riOctavePlugin::qtDataStreamVersion); + + // Create command as a string with arguments , and send it: + QString command; + command += "GetStaticNNCValues " + QString::number(caseId) + " " + propertyName; + + QByteArray cmdBytes = command.toLatin1(); + + socketStream << (qint64)(cmdBytes.size()); + socket.write(cmdBytes); + + // Get response. First wait for the header + + while (socket.bytesAvailable() < (int)sizeof(quint64)) + { + if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs)) + { + error((("Waiting for header: ") + socket.errorString()).toLatin1().data()); + return; + } + } + + // Read connection count and timestep count + quint64 connectionCount; + + socketStream >> connectionCount; + + if (!(connectionCount)) + { + error ("Could not find the requested data in ResInsight"); + return; + } + + propertyValues.reserve(connectionCount); + + for (size_t i = 0; i < connectionCount; ++i) + { + double val; + socketStream >> val; + propertyValues.push_back(val); + } + + QString tmp = QString("riGetStaticNNCValues : Read %1").arg(propertyName); + + if (caseId < 0) + { + tmp += QString(" from current case."); + } + else + { + tmp += QString(" from case with Id: %1.").arg(caseId); + } + octave_stdout << tmp.toStdString() << " Connections: " << connectionCount << std::endl; + + return; +} + + +DEFUN_DLD (riGetStaticNNCValues, args, nargout, + "Usage:\n" + "\n" + " riGetStaticNNCValues([CaseId], PropertyName)\n" + "\n" + "This function retrieves the static NNC values for each connection." + ) +{ + int nargin = args.length (); + if (nargin < 1) + { + error("riGetStaticNNCValues: Too few arguments. The name of the property requested is necessary.\n"); + print_usage(); + return octave_value(); + } + else if (nargin > 2) + { + error("riGetStaticNNCValues: Too many arguments.\n"); + print_usage(); + return octave_value(); + } + else if (nargout < 1) + { + error("riGetStaticNNCValues: Missing output argument.\n"); + print_usage(); + return octave_value(); + } + + std::vector argIndices; + argIndices.push_back(0); + argIndices.push_back(1); + + // Check if we have a CaseId: + if (!args(argIndices[0]).is_numeric_type()) + { + argIndices[0] = -1; + for (size_t aIdx = 1; aIdx < argIndices.size(); ++aIdx) + --argIndices[aIdx]; + } + + std::vector propertyValues; + qint32 caseId = -1; + std::string propertyName; + + if (argIndices[0] >= 0) caseId = args(argIndices[0]).int_value(); + if (argIndices[1] >= 0) propertyName = args(argIndices[1]).char_matrix_value().row_as_string(0); + + getStaticNNCValues(propertyValues, "127.0.0.1", 40001, caseId, propertyName.c_str()); + + dim_vector dv(2, 1); + dv(0) = propertyValues.size(); + dv(1) = 1; + NDArray oct_propertyValues(dv); + + for (size_t i = 0; i < propertyValues.size(); ++i) + { + oct_propertyValues(i) = propertyValues[i]; + } + + return octave_value(oct_propertyValues); +} From f96fdc27e7e090cfdd5dc99d0f34ffaff1eb7ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 4 Jul 2017 13:50:22 +0200 Subject: [PATCH 29/61] Guard dynamic nnc access against missing restart file(s) --- ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index ca4cb02940..2b43757325 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -622,6 +622,8 @@ void RifReaderEclipseOutput::transferDynamicNNCData(const ecl_grid_type* mainEcl { CVF_ASSERT(mainEclGrid && mainGrid); + if (m_dynamicResultsAccess.isNull()) return; + size_t timeStepCount = m_dynamicResultsAccess->timeStepCount(); std::vector< std::vector >& waterFluxData = mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::propertyNameFluxWat(), timeStepCount); From 8edac70013006e2c502c834eff7ad17c05018f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 4 Jul 2017 13:51:14 +0200 Subject: [PATCH 30/61] Adjusted argument alignment --- .../ReservoirDataModel/RigTimeHistoryResultAccessor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp index 7f2ffc6eee..f9ed7c11b0 100644 --- a/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigTimeHistoryResultAccessor.cpp @@ -29,7 +29,11 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigTimeHistoryResultAccessor::timeHistoryValues(RigEclipseCaseData* eclipseCaseData, RimEclipseResultDefinition* resultDefinition, size_t gridIndex, size_t cellIndex, size_t timeStepCount) +std::vector RigTimeHistoryResultAccessor::timeHistoryValues(RigEclipseCaseData* eclipseCaseData, + RimEclipseResultDefinition* resultDefinition, + size_t gridIndex, + size_t cellIndex, + size_t timeStepCount) { std::vector values; From 0a58a752ffe05ec80f2a3014fe799435e37c2c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 4 Jul 2017 13:53:24 +0200 Subject: [PATCH 31/61] Changed to 1-based IJK indices in Octave NNC interface --- ApplicationCode/SocketInterface/RiaNNCCommands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp index 2c461cc3ca..01d8bd3bd8 100644 --- a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp @@ -86,7 +86,7 @@ public: hostGrid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k); socketStream << (qint32)hostGrid->gridIndex(); - socketStream << (qint32)i << (qint32)j << (qint32)k; + socketStream << (qint32)(i+1) << (qint32)(j+1) << (qint32)(k+1); } }; From 4bc465e096ea38123feb4e5e516d953f78abc6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 4 Jul 2017 15:32:59 +0200 Subject: [PATCH 32/61] Guard time history curve creation (Result Plot) from combined results. --- .../UserInterface/RiuSelectionChangedHandler.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp index c15ae4d56c..d4cfa95900 100644 --- a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -109,9 +109,10 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec return; } - else if (eclipseView->cellResult()->hasDynamicResult() && - eclipseView->eclipseCase() && - eclipseView->eclipseCase()->eclipseCaseData()) + else if (eclipseView->cellResult()->hasDynamicResult() + && !RimDefines::isPerCellFaceResult(eclipseView->cellResult()->resultVariable()) + && eclipseView->eclipseCase() + && eclipseView->eclipseCase()->eclipseCaseData()) { RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(eclipseView->cellResult()->porosityModel()); From b81c332e604a64cf5cd91585a6e1aa5a961818c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 4 Jul 2017 15:44:23 +0200 Subject: [PATCH 33/61] Updated to version 2017.05.02-fdev.01 for Sprint 1 in Further Development. Also added the assumed SHA for the libecl code used. --- ResInsightVersion.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 6305eb054d..dd90572af4 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,14 +1,15 @@ set(RESINSIGHT_MAJOR_VERSION 2017) set(RESINSIGHT_MINOR_VERSION 05) -set(RESINSIGHT_INCREMENT_VERSION "2") +set(RESINSIGHT_INCREMENT_VERSION "2-fdev.01") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") # https://github.com/Statoil/libecl -set(ERT_GITHUB_SHA "06a39878636af0bc52582430ad0431450e51139c") +set(ERT_GITHUB_SHA "ecac8afb4342a321b4366fe1fb8a095e67f2d08a") +# Not completely shure this is the correct one. it might be db2b7317c instead or ... # https://github.com/OPM/opm-flowdiagnostics set(OPM_FLOWDIAGNOSTICS_SHA "b6e59ddcd2feba450c8612a7402c9239e442c0d4") From ec4362b247d560a97bfbaa6d52333c50e97be562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 7 Jul 2017 13:31:14 +0200 Subject: [PATCH 34/61] #1692 Put SourSimRL Results in a separate result type #1693 Started to separate code for SourSim and Eclipse results data. --- .../FileInterface/RifReaderEclipseOutput.cpp | 74 ++++++++++--------- .../FileInterface/RifReaderEclipseOutput.h | 1 + .../ProjectDataModel/RimDefines.cpp | 1 + ApplicationCode/ProjectDataModel/RimDefines.h | 1 + .../ProjectDataModel/RimEclipseResultCase.cpp | 8 ++ .../ProjectDataModel/RimEclipseResultCase.h | 1 + .../RimEclipseResultDefinition.cpp | 28 +++++-- .../RimReservoirCellResultsStorage.cpp | 46 ++++++++++++ .../RigCaseCellResultsData.cpp | 17 ++--- .../RigCaseCellResultsData.h | 1 - .../RiaPropertyDataCommands.cpp | 2 + 11 files changed, 125 insertions(+), 55 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 2b43757325..c426148ac2 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -533,9 +533,8 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) for (int i = 0; i < resultNames.size(); ++i) { - size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false); + size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::SOURSIMRL, resultNames[i], false); matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, m_daysSinceSimulationStart, reportNumbers); - matrixModelResults->setSourSimData(resIndex); } m_hdfReaderInterface = std::move(myReader); @@ -974,43 +973,48 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelRe return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderEclipseOutput::sourSimRlResult(const QString& result, size_t stepIndex, std::vector* values) +{ + values->clear(); + + if ( !m_hdfReaderInterface ) return; + + if ( m_eclipseCase->mainGrid()->gridCount() == 0 ) + { + RiaLogging::error("No grids available"); + + return ; + } + + size_t activeCellCount = cvf::UNDEFINED_SIZE_T; + { + RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); + fracActCellInfo->gridActiveCellCounts(0, activeCellCount); + } + + bool readCellResultOk = m_hdfReaderInterface->dynamicResult(result, stepIndex, values); + + if (activeCellCount != values->size()) + { + values->clear(); + + RiaLogging::error("SourSimRL results does not match the number of active cells in the grid"); + return; + } +} + //-------------------------------------------------------------------------------------------------- /// Get dynamic result at given step index. Will concatenate values for the main grid and all sub grids. //-------------------------------------------------------------------------------------------------- -bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values) +bool RifReaderEclipseOutput::dynamicResult(const QString& result, + PorosityModelResultType matrixOrFracture, + size_t stepIndex, + std::vector* values) { -#ifdef USE_HDF5 - if (m_hdfReaderInterface) - { - if (m_eclipseCase->mainGrid()->gridCount() == 0) - { - RiaLogging::error("No grids available"); - - return false; - } - - size_t activeCellCount = cvf::UNDEFINED_SIZE_T; - { - RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); - fracActCellInfo->gridActiveCellCounts(0, activeCellCount); - } - - bool readCellResultOk = m_hdfReaderInterface->dynamicResult(result, stepIndex, values); - - if (activeCellCount != values->size()) - { - for (size_t i=0; i < values->size(); i++) - { - values->at(i) = HUGE_VAL; - } - - RiaLogging::error("No grids available"); - return false; - } - - return readCellResultOk; - } -#endif + if (m_dynamicResultsAccess.isNull()) { diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h index 10f667aaef..37430677e0 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h @@ -62,6 +62,7 @@ public: bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector* values); bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values); + void sourSimRlResult(const QString& result, size_t stepIndex, std::vector* values); static bool transferGeometry(const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase); static void transferCoarseningInfo(const ecl_grid_type* eclGrid, RigGridBase* grid); diff --git a/ApplicationCode/ProjectDataModel/RimDefines.cpp b/ApplicationCode/ProjectDataModel/RimDefines.cpp index c7d2dc21d1..dd4c5d33ea 100644 --- a/ApplicationCode/ProjectDataModel/RimDefines.cpp +++ b/ApplicationCode/ProjectDataModel/RimDefines.cpp @@ -29,6 +29,7 @@ namespace caf { addItem(RimDefines::DYNAMIC_NATIVE, "DYNAMIC_NATIVE", "Dynamic"); addItem(RimDefines::STATIC_NATIVE, "STATIC_NATIVE", "Static"); + addItem(RimDefines::SOURSIMRL, "SOURSIMRL", "SourSimRL"); addItem(RimDefines::GENERATED, "GENERATED", "Generated"); addItem(RimDefines::INPUT_PROPERTY, "INPUT_PROPERTY", "Input Property"); addItem(RimDefines::FORMATION_NAMES, "FORMATION_NAMES", "Formation Names"); diff --git a/ApplicationCode/ProjectDataModel/RimDefines.h b/ApplicationCode/ProjectDataModel/RimDefines.h index 401f508a3b..928634ec98 100644 --- a/ApplicationCode/ProjectDataModel/RimDefines.h +++ b/ApplicationCode/ProjectDataModel/RimDefines.h @@ -30,6 +30,7 @@ public: { DYNAMIC_NATIVE, STATIC_NATIVE, + SOURSIMRL, GENERATED, INPUT_PROPERTY, FORMATION_NAMES, diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index b2f3bd97cc..d1cfb0a5f6 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -464,6 +464,14 @@ void RimEclipseResultCase::setSourSimFileName(const QString& fileName) loadAndUpdateSourSimData(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimEclipseResultCase::hasSourSimFile() +{ + return !m_sourSimFileName().isEmpty(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h index 6a87831e66..53d45c50b1 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h @@ -43,6 +43,7 @@ public: void setGridFileName(const QString& caseFileName); void setCaseInfo(const QString& userDescription, const QString& caseFileName); void setSourSimFileName(const QString& fileName); + bool hasSourSimFile(); virtual bool openEclipseGridFile(); virtual void reloadEclipseGridFile(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 8b6497ec70..f1a0278e58 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -422,33 +422,41 @@ QList RimEclipseResultDefinition::calculateValueOptions( if ( fieldNeedingOptions == &m_resultTypeUiField ) { bool hasFlowDiagFluxes = false; + bool hasSourSimRLFile = false; RimEclipseResultCase* eclResCase = dynamic_cast(m_eclipseCase.p()); if ( eclResCase && eclResCase->eclipseCaseData() ) { hasFlowDiagFluxes = eclResCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes(); + hasSourSimRLFile = eclResCase->hasSourSimFile(); } + RimGridTimeHistoryCurve* timeHistoryCurve; this->firstAncestorOrThisOfType(timeHistoryCurve); // Do not include flow diagnostics results if not available or is a time history curve - if ( !hasFlowDiagFluxes || timeHistoryCurve != nullptr ) + if ( !hasFlowDiagFluxes || timeHistoryCurve != nullptr || !hasSourSimRLFile) { using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >; for ( size_t i = 0; i < ResCatEnum::size(); ++i ) { RimDefines::ResultCatType resType = ResCatEnum::fromIndex(i); - if ( resType != RimDefines::FLOW_DIAGNOSTICS ) + if ( resType == RimDefines::FLOW_DIAGNOSTICS + && (!hasFlowDiagFluxes || timeHistoryCurve) ) { - QString uiString = ResCatEnum::uiTextFromIndex(i); - options.push_back(caf::PdmOptionItemInfo(uiString, resType)); + continue; } + + if ( resType == RimDefines::SOURSIMRL + && (!hasSourSimRLFile ) ) + { + continue; + } + + QString uiString = ResCatEnum::uiTextFromIndex(i); + options.push_back(caf::PdmOptionItemInfo(uiString, resType)); } } - else - { - // Do nothing, and thereby use the defaults of the AppEnum field - } } if ( m_resultTypeUiField() != RimDefines::FLOW_DIAGNOSTICS ) @@ -857,6 +865,10 @@ bool RimEclipseResultDefinition::hasDynamicResult() const { return true; } + else if (m_resultType() == RimDefines::SOURSIMRL) + { + return true; + } else if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS) { return true; diff --git a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index 71a15d7bbe..e54b1d7eb6 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -38,6 +38,7 @@ #include #include #include +#include "RifReaderEclipseOutput.h" CAF_PDM_SOURCE_INIT(RimReservoirCellResultsStorage, "ReservoirCellResultStorage"); @@ -240,6 +241,11 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(const QString& res scalarResultIndex = this->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, resultName); } + if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) + { + scalarResultIndex = this->findOrLoadScalarResult(RimDefines::SOURSIMRL, resultName); + } + if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) { scalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::GENERATED, resultName); @@ -418,6 +424,26 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RimDefines::Result } } + // Handle SourSimRL reading + + if (type == RimDefines::SOURSIMRL) + { + RifReaderEclipseOutput* eclReader = dynamic_cast(m_readerInterface.p()); + if (eclReader) + { + size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepDates.size(); + + m_cellResults->cellScalarResults(scalarResultIndex).resize(timeStepCount); + + size_t i; + for ( i = 0; i < timeStepCount; i++ ) + { + std::vector& values = m_cellResults->cellScalarResults(scalarResultIndex)[i]; + eclReader->sourSimRlResult(resultName, i, &values); + } + } + } + return scalarResultIndex; } @@ -493,6 +519,26 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResultForTimeStep(RimDefi } } + // Handle SourSimRL reading + + if (type == RimDefines::SOURSIMRL) + { + RifReaderEclipseOutput* eclReader = dynamic_cast(m_readerInterface.p()); + if (eclReader) + { + size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepDates.size(); + + m_cellResults->cellScalarResults(scalarResultIndex).resize(timeStepCount); + + std::vector& values = m_cellResults->cellScalarResults(scalarResultIndex)[timeStepIndex]; + + if ( values.size() == 0) + { + eclReader->sourSimRlResult(resultName, timeStepIndex, &values); + } + } + } + return scalarResultIndex; } diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 39881e5470..da8272a49f 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -229,6 +229,11 @@ size_t RigCaseCellResultsData::findScalarResultIndex(const QString& resultName) scalarResultIndex = this->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, resultName); } + if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) + { + scalarResultIndex = this->findScalarResultIndex(RimDefines::SOURSIMRL, resultName); + } + if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) { scalarResultIndex = this->findScalarResultIndex(RimDefines::GENERATED, resultName); @@ -670,16 +675,6 @@ void RigCaseCellResultsData::setMustBeCalculated(size_t scalarResultIndex) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RigCaseCellResultsData::setSourSimData(size_t scalarResultIndex) -{ - CVF_ASSERT(scalarResultIndex < m_resultInfos.size()); - - m_resultInfos[scalarResultIndex].m_isSourSimData = true; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -690,7 +685,7 @@ void RigCaseCellResultsData::eraseAllSourSimData() for (size_t i = 0; i < m_resultInfos.size(); i++) { ResultInfo& ri = m_resultInfos[i]; - if (ri.m_isSourSimData) + if (ri.m_resultType == RimDefines::SOURSIMRL) { ri.m_resultType = RimDefines::REMOVED; } diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h index d4e6d49a38..075ecb9cb3 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -135,7 +135,6 @@ public: bool mustBeCalculated(size_t scalarResultIndex) const; void setMustBeCalculated(size_t scalarResultIndex); - void setSourSimData(size_t scalarResultIndex); void eraseAllSourSimData(); diff --git a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp index 5b02f12f19..28ca79d2a7 100644 --- a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -1108,6 +1108,8 @@ public: std::vector resTypeNames; resTypes.push_back(RimDefines::DYNAMIC_NATIVE); resTypeNames.push_back("DynamicNative"); + resTypes.push_back(RimDefines::SOURSIMRL); + resTypeNames.push_back("SourSimRL"); resTypes.push_back(RimDefines::STATIC_NATIVE ); resTypeNames.push_back("StaticNative"); resTypes.push_back(RimDefines::GENERATED ); From 59543d170869d090058aca792e24dbbaa5f6af0d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 31 Jul 2017 14:07:59 +0200 Subject: [PATCH 35/61] #1712 Build System : Remove references to obsolete ERT libs --- CMakeLists.txt | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfa41854ba..dd44391693 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,10 +85,6 @@ if (RESINSIGHT_ERT_EXTERNAL_LIB_ROOT OR RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT) list(APPEND ERT_LIBRARIES ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libecl.so - ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libeclxx.so - ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libecl_well.so - ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libert_geometry.so - ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libert_util.so ) else() @@ -354,18 +350,6 @@ if (RESINSIGHT_PRIVATE_INSTALL) ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libecl.so ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libecl.so.2 ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libecl.so.2.2 - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libeclxx.so - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libeclxx.so.2 - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libeclxx.so.2.2 - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libecl_well.so - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libecl_well.so.2 - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libecl_well.so.2.2 - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libert_geometry.so - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libert_geometry.so.2 - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libert_geometry.so.2.2 - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libert_util.so - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libert_util.so.2 - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/${CMAKE_INSTALL_LIBDIR}/libert_util.so.2.2 ) install(FILES ${ERT_SHARED_LIB_FILES} DESTINATION ${RESINSIGHT_INSTALL_FOLDER} ) From 8c7bd87050b85b416ad2d9104bac644441807519 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 31 Jul 2017 14:08:43 +0200 Subject: [PATCH 36/61] #1712 Build System : Add ERT lib to list of third party libs --- ApplicationCode/CMakeLists.txt | 2 -- CMakeLists.txt | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 7efd69c90a..b153477085 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -316,8 +316,6 @@ set( LINK_LIBRARIES ${APP_FWK_LIBRARIES} ${VIZ_FWK_LIBRARIES} - ${ERT_LIBRARIES} - ${THIRD_PARTY_LIBRARIES} ${OPENGL_LIBRARIES} diff --git a/CMakeLists.txt b/CMakeLists.txt index dd44391693..94c5d9e7fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,10 @@ else() endif(RESINSIGHT_ERT_EXTERNAL_LIB_ROOT OR RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT) +list(APPEND THIRD_PARTY_LIBRARIES + ${ERT_LIBRARIES} +) + ################################################################################ # Subset of Boost, used by NRLib and flow diagnostics application From 3a97384dcdb5d680edebb41e35c0ddb75edeb0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Wed, 2 Aug 2017 14:39:53 +0200 Subject: [PATCH 37/61] #1689 Improve help texts of NNC commands for Octave interface --- OctavePlugin/riGetDynamicNNCValues.cpp | 7 ++++++- OctavePlugin/riGetNNCConnections.cpp | 9 +++++++-- OctavePlugin/riGetStaticNNCValues.cpp | 5 ++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/OctavePlugin/riGetDynamicNNCValues.cpp b/OctavePlugin/riGetDynamicNNCValues.cpp index a150dffc39..15e6e2893e 100644 --- a/OctavePlugin/riGetDynamicNNCValues.cpp +++ b/OctavePlugin/riGetDynamicNNCValues.cpp @@ -99,7 +99,12 @@ DEFUN_DLD (riGetDynamicNNCValues, args, nargout, "\n" " riGetDynamicNNCValues([CaseId], PropertyName, [RequestedTimeSteps])\n" "\n" - "This function retrieves the dynamic NNC values for each connection for the requested time steps." + "This function returns a matrix with the dynamic NNC values for each connection for the requested time steps.\n" + "The matrix has a number of rows equal to the number of NNC connections and a number of columns equal to the requested time steps.\n" + "\n" + "See riGetNNCConnections for information about each individual connection.\n" + "If the CaseId is not defined, ResInsight's Current Case is used.\n" + "If RequestedTimeSteps are left empty, values for all time steps will be returned.\n" ) { int nargin = args.length (); diff --git a/OctavePlugin/riGetNNCConnections.cpp b/OctavePlugin/riGetNNCConnections.cpp index 05d8a3f524..1610c68cea 100644 --- a/OctavePlugin/riGetNNCConnections.cpp +++ b/OctavePlugin/riGetNNCConnections.cpp @@ -88,8 +88,13 @@ DEFUN_DLD(riGetNNCConnections, args, nargout, "\n" " riGetNNCConnections([CaseId])\n" "\n" - "This function returns a two dimensional matrix containing grid and IJK information\n" - "for each NNC in the requested case." + "This function returns a two dimensional matrix containing grid and IJK information for each NNC in the requested case.\n" + "The columns contain the following information:\n" + "[GridIdx, I, J, K]:\n" + " GridIdx : The index of the grid the cell resides in. (Main grid has index 0)\n" + " I, J, K : 1-based index address of the cell in the grid.\n" + "\n" + "If the CaseId is not defined, ResInsight's Current Case is used.\n" ) { int nargin = args.length(); diff --git a/OctavePlugin/riGetStaticNNCValues.cpp b/OctavePlugin/riGetStaticNNCValues.cpp index 42d92e834e..85f4497a97 100644 --- a/OctavePlugin/riGetStaticNNCValues.cpp +++ b/OctavePlugin/riGetStaticNNCValues.cpp @@ -83,7 +83,10 @@ DEFUN_DLD (riGetStaticNNCValues, args, nargout, "\n" " riGetStaticNNCValues([CaseId], PropertyName)\n" "\n" - "This function retrieves the static NNC values for each connection." + "This function returns a vector with the static NNC values for each connection.\n" + "\n" + "See riGetNNCConnections for information about each individual connection.\n" + "If the CaseId is not defined, ResInsight's Current Case is used.\n" ) { int nargin = args.length (); From fc8eefb5fedd94e9b77d4a014d14e61d56bb8c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 3 Aug 2017 14:23:50 +0200 Subject: [PATCH 38/61] #1688 Make all commands using a [RequestedTimeSteps] handle a single timestep --- OctavePlugin/riGetActiveCellProperty.cpp | 2 +- OctavePlugin/riGetGridProperty.cpp | 2 +- OctavePlugin/riGetWellStatus.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OctavePlugin/riGetActiveCellProperty.cpp b/OctavePlugin/riGetActiveCellProperty.cpp index 573e324f12..7c2551aad4 100644 --- a/OctavePlugin/riGetActiveCellProperty.cpp +++ b/OctavePlugin/riGetActiveCellProperty.cpp @@ -148,7 +148,7 @@ DEFUN_DLD (riGetActiveCellProperty, args, nargout, // Check if we have a Requested TimeSteps - if (!(nargin > argIndices[2] && args(argIndices[2]).is_matrix_type() && !args(argIndices[2]).is_string())) + if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || args(argIndices[2]).is_numeric_type()) && !args(argIndices[2]).is_string())) { argIndices[2] = -1; for (size_t aIdx = 3; aIdx < argIndices.size(); ++aIdx) diff --git a/OctavePlugin/riGetGridProperty.cpp b/OctavePlugin/riGetGridProperty.cpp index 075c36ee48..7b5db5ed40 100644 --- a/OctavePlugin/riGetGridProperty.cpp +++ b/OctavePlugin/riGetGridProperty.cpp @@ -163,7 +163,7 @@ DEFUN_DLD (riGetGridProperty, args, nargout, // Check if we have a Requested TimeSteps - if (!(nargin > argIndices[3] && args(argIndices[3]).is_matrix_type() && !args(argIndices[3]).is_string())) + if (!(nargin > argIndices[3] && (args(argIndices[3]).is_matrix_type() || args(argIndices[3]).is_numeric_type()) && !args(argIndices[3]).is_string())) { argIndices[3] = -1; for (size_t aIdx = 3; aIdx < argIndices.size(); ++aIdx) diff --git a/OctavePlugin/riGetWellStatus.cpp b/OctavePlugin/riGetWellStatus.cpp index 0e779dd108..6c10b23a70 100644 --- a/OctavePlugin/riGetWellStatus.cpp +++ b/OctavePlugin/riGetWellStatus.cpp @@ -136,7 +136,7 @@ DEFUN_DLD (riGetWellStatus, args, nargout, // Check if we have a Requested TimeSteps int lastArgumentIndex = argIndices[2] ; - if (!(nargin > argIndices[2] && args(argIndices[2]).is_matrix_type())) + if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || args(argIndices[2]).is_numeric_type()))) { argIndices[2] = -1; } From cf2df771d4702638a8bbd12c82eb69042283f3a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 3 Aug 2017 14:35:46 +0200 Subject: [PATCH 39/61] #1675 Selected cell interface for Octave --- .../SocketInterface/RiaCaseInfoCommands.cpp | 100 +++++++++ .../RiaPropertyDataCommands.cpp | 163 ++++++++++++++ OctavePlugin/CMakeLists.txt | 4 + .../riGetGridPropertyForSelectedCells.cpp | 199 ++++++++++++++++++ OctavePlugin/riGetSelectedCells.cpp | 130 ++++++++++++ 5 files changed, 596 insertions(+) create mode 100644 OctavePlugin/riGetGridPropertyForSelectedCells.cpp create mode 100644 OctavePlugin/riGetSelectedCells.cpp diff --git a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp index 3d998de20c..77b7228d81 100644 --- a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp @@ -29,6 +29,10 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" +#include "RigGeoMechCaseData.h" +#include "RigFemPartCollection.h" +#include "RigFemPart.h" +#include "RigFemPartGrid.h" #include "Rim3dOverlayInfoConfig.h" #include "RimCellEdgeColors.h" @@ -39,6 +43,10 @@ #include "RimEclipseView.h" #include "RimEclipseWellCollection.h" #include "RimReservoirCellResultsStorage.h" +#include "RimGeoMechCase.h" +#include "RimGeoMechView.h" + +#include "RiuSelectionManager.h" #include @@ -538,3 +546,95 @@ public: static bool RiaGetTimeStepDays_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetTimeStepDays::commandName()); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaGetSelectedCells: public RiaSocketCommand +{ +public: + static QString commandName () { return QString("GetSelectedCells"); } + + virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) + { + // findCaseFromArgs only returns RimEclipseCase, so geomech cases are not supported because of this. + // The rest of the function supports geomech cases, so using a findCaseFromArgs that supports geomech + // cases is the only change needed to add geomech support. + RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); + if (!rimCase) return true; + + // Write data back to octave: column count, bytes per column, caseId, gridNumber, cellI, cellJ, cellK + + std::array, 5> selectedCellInfo; + getSelectedCells(rimCase, + selectedCellInfo[0], + selectedCellInfo[1], + selectedCellInfo[2], + selectedCellInfo[3], + selectedCellInfo[4]); + + // First write column count + quint64 columnCount = 5; + socketStream << columnCount; + + // then the byte-size of the size of one column + quint64 columnByteCount = (quint64)(selectedCellInfo[0].size()*sizeof(qint32)); + socketStream << columnByteCount; + + // Write back table data + for (size_t tIdx = 0; tIdx < columnCount; ++tIdx) + { + RiaSocketTools::writeBlockData(server, server->currentClient(), (const char *)selectedCellInfo[tIdx].data(), columnByteCount); + } + + return true; + } + + static void getSelectedCells(const RimCase* reservoirCase, + std::vector& caseNumber, + std::vector& gridNumber, + std::vector& cellI, + std::vector& cellJ, + std::vector& cellK) + { + std::vector items; + RiuSelectionManager::instance()->selectedItems(items); + + for (const RiuSelectionItem* item : items) + { + size_t i, j, k; + size_t gridIndex; + size_t caseId; + if (item->type() == RiuSelectionItem::ECLIPSE_SELECTION_OBJECT) + { + const RiuEclipseSelectionItem* eclipseItem = static_cast(item); + + eclipseItem->m_view->eclipseCase()->eclipseCaseData()->grid(eclipseItem->m_gridIndex)->ijkFromCellIndex(eclipseItem->m_cellIndex, &i, &j, &k); + gridIndex = eclipseItem->m_gridIndex; + caseId = eclipseItem->m_view->eclipseCase()->caseId; + } + else if (item->type() == RiuSelectionItem::GEOMECH_SELECTION_OBJECT) + { + const RiuGeoMechSelectionItem* geomechItem = static_cast(item); + + geomechItem->m_view->geoMechCase()->geoMechData()->femParts()->part(geomechItem->m_gridIndex)->structGrid()->ijkFromCellIndex(geomechItem->m_cellIndex, &i, &j, &k); + gridIndex = geomechItem->m_gridIndex; + caseId = geomechItem->m_view->geoMechCase()->caseId; + } + else + { + continue; + } + + if (caseId == reservoirCase->caseId) + { + caseNumber.push_back(caseId); + gridNumber.push_back(gridIndex); + cellI.push_back(i + 1); + cellJ.push_back(j + 1); + cellK.push_back(k + 1); + } + } + } +}; + +static bool RiaGetSelectedCells_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetSelectedCells::commandName()); diff --git a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp index 28ca79d2a7..40a61f0eca 100644 --- a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -38,9 +38,12 @@ #include "RimEclipseInputPropertyCollection.h" #include "RimEclipseView.h" #include "RimReservoirCellResultsStorage.h" +#include "RimGeoMechView.h" +#include "RimGeoMechCase.h" #include "RiuMainWindow.h" #include "RiuProcessMonitor.h" +#include "RiuSelectionManager.h" #include @@ -1152,3 +1155,163 @@ public: }; static bool RiaGetPropertyNames_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetPropertyNames::commandName()); + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaGetGridPropertyForSelectedCells: public RiaSocketCommand +{ +public: + static QString commandName() { return QString("GetGridPropertyForSelectedCells"); } + + virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) + { + RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); + if (!rimCase) return true; + + QString propertyName = args[2]; + + RifReaderInterface::PorosityModelResultType porosityModel = RifReaderInterface::MATRIX_RESULTS; + + if (args.size() > 1) + { + QString prorosityModelString = args[3]; + if (prorosityModelString.toUpper() == "FRACTURE") + { + porosityModel = RifReaderInterface::FRACTURE_RESULTS; + } + } + + size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T; + if (rimCase && rimCase->results(porosityModel)) + { + scalarResultIndex = rimCase->results(porosityModel)->findOrLoadScalarResult(propertyName); + } + + std::vector requestedTimesteps; + if (args.size() < 5) + { + // Select all + for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModel)->cellResults()->timeStepCount(scalarResultIndex); ++tsIdx) + { + requestedTimesteps.push_back(tsIdx); + } + } + else + { + bool timeStepReadError = false; + for (int argIdx = 4; argIdx < args.size(); ++argIdx) + { + bool conversionOk = false; + int tsIdx = args[argIdx].toInt(&conversionOk); + + if (conversionOk) + { + requestedTimesteps.push_back(tsIdx); + } + else + { + timeStepReadError = true; + } + } + + if (timeStepReadError) + { + server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riGetGridProperty : \n") + + RiaSocketServer::tr("An error occurred while interpreting the requested time steps.")); + } + + } + if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid()) ) + { + // No data available + socketStream << (quint64)0 << (quint64)0 ; + return true; + } + + std::vector< std::pair > selectedCells = getSelectedCellsForCase(rimCase); + + // First write column count + quint64 timestepCount = (quint64)requestedTimesteps.size(); + socketStream << timestepCount; + + // then the byte-size of the size of one column + quint64 timestepByteCount = (quint64)(selectedCells.size()*sizeof(double)); + socketStream << timestepByteCount; + + size_t valueCount = RiaSocketDataTransfer::maximumValueCountInBlock(); + std::vector values(valueCount); + size_t valueIndex = 0; + + for (size_t timeStep : requestedTimesteps) + { + const std::vector& scalarResults = rimCase->results(porosityModel)->cellResults()->cellScalarResults(scalarResultIndex, timeStep); + + + for (const std::pair selectedCell : selectedCells) + { + cvf::ref resultAccessor = RigResultAccessorFactory::createFromUiResultName(rimCase->eclipseCaseData(), selectedCell.first, porosityModel, timeStep, propertyName); + if (resultAccessor.isNull()) + { + return false; + } + + values[valueIndex] = resultAccessor->cellScalar(selectedCell.second); + + valueIndex++; + if (valueIndex >= valueCount) + { + if (!RiaSocketTools::writeBlockData(server, server->currentClient(), (const char *)values.data(), valueIndex * sizeof(double))) + { + return false; + } + + valueIndex = 0; + } + } + } + + // Write remaining data + if (!RiaSocketTools::writeBlockData(server, server->currentClient(), (const char *)values.data(), valueIndex * sizeof(double))) + { + return false; + } + + return true; + } + + static std::vector< std::pair > getSelectedCellsForCase(const RimCase* reservoirCase) + { + std::vector items; + RiuSelectionManager::instance()->selectedItems(items); + + std::vector< std::pair > selectedCells; + + for (const RiuSelectionItem* item : items) + { + if (item->type() == RiuSelectionItem::ECLIPSE_SELECTION_OBJECT) + { + const RiuEclipseSelectionItem* eclipseItem = static_cast(item); + + if (eclipseItem->m_view->eclipseCase()->caseId == reservoirCase->caseId) + { + selectedCells.push_back(std::make_pair(eclipseItem->m_gridIndex, eclipseItem->m_cellIndex)); + } + } + else if (item->type() == RiuSelectionItem::GEOMECH_SELECTION_OBJECT) + { + const RiuGeoMechSelectionItem* geomechItem = static_cast(item); + + if (geomechItem->m_view->geoMechCase()->caseId == reservoirCase->caseId) + { + selectedCells.push_back(std::make_pair(geomechItem->m_gridIndex, geomechItem->m_cellIndex)); + } + } + } + + return selectedCells; + } +}; + +static bool RiaGetGridPropertyForSelectedCells_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetGridPropertyForSelectedCells::commandName()); diff --git a/OctavePlugin/CMakeLists.txt b/OctavePlugin/CMakeLists.txt index 3745004132..c0a3436b28 100644 --- a/OctavePlugin/CMakeLists.txt +++ b/OctavePlugin/CMakeLists.txt @@ -14,6 +14,7 @@ set(CPP_SOURCES riGetDynamicNNCValues.cpp riGetStaticNNCValues.cpp riGetSelectedCases.cpp + riGetSelectedCells.cpp riGetCases.cpp riGetTimeStepDates.cpp riGetTimeStepDays.cpp @@ -25,6 +26,7 @@ set(CPP_SOURCES riGetActiveCellCorners.cpp riGetGridProperty.cpp riSetGridProperty.cpp + riGetGridPropertyForSelectedCells.cpp riGetPropertyNames.cpp riGetWellNames.cpp riGetWellStatus.cpp @@ -181,6 +183,7 @@ if (RESINSIGHT_OCTAVE_PLUGIN_QMAKE AND RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE) "${CMAKE_CURRENT_BINARY_DIR}/riGetCurrentCase.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetCaseGroups.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetSelectedCases.oct" + "${CMAKE_CURRENT_BINARY_DIR}/riGetSelectedCells.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetCases.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetTimeStepDates.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetTimeStepDays.oct" @@ -192,6 +195,7 @@ if (RESINSIGHT_OCTAVE_PLUGIN_QMAKE AND RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE) "${CMAKE_CURRENT_BINARY_DIR}/riGetActiveCellCorners.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetGridProperty.oct" "${CMAKE_CURRENT_BINARY_DIR}/riSetGridProperty.oct" + "${CMAKE_CURRENT_BINARY_DIR}/riGetGridPropertyForSelectedCells.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetPropertyNames.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetWellNames.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetWellStatus.oct" diff --git a/OctavePlugin/riGetGridPropertyForSelectedCells.cpp b/OctavePlugin/riGetGridPropertyForSelectedCells.cpp new file mode 100644 index 0000000000..7d23ea399c --- /dev/null +++ b/OctavePlugin/riGetGridPropertyForSelectedCells.cpp @@ -0,0 +1,199 @@ +#include +#include + +#include + +#include "riSettings.h" + +#include "RiaSocketDataTransfer.cpp" // NB! Include cpp-file to avoid linking of additional file in oct-compile configuration + +void getGridPropertyForSelectedCells(Matrix& propertyFrames, const QString &serverName, quint16 serverPort, + const qint64& caseId, QString propertyName, const int32NDArray& requestedTimeSteps, QString porosityModel) +{ + QTcpSocket socket; + socket.connectToHost(serverName, serverPort); + + if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs)) + { + error((("Connection: ") + socket.errorString()).toLatin1().data()); + return; + } + + QDataStream socketStream(&socket); + socketStream.setVersion(riOctavePlugin::qtDataStreamVersion); + + // Create command as a string with arguments , and send it: + + QString command; + command += "GetGridPropertyForSelectedCells " + QString::number(caseId) + " " + propertyName + " " + porosityModel; + + for (int i = 0; i < requestedTimeSteps.length(); ++i) + { + if (i == 0) command += " "; + command += QString::number(static_cast(requestedTimeSteps.elem(i)) - 1); // To make the index 0-based + if (i != requestedTimeSteps.length() - 1) command += " "; + } + + QByteArray cmdBytes = command.toLatin1(); + + socketStream << (qint64)(cmdBytes.size()); + socket.write(cmdBytes); + + // Get response. First wait for the header + + while (socket.bytesAvailable() < (int)(2*sizeof(quint64))) + { + if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs)) + { + error((("Waiting for header: ") + socket.errorString()).toLatin1().data()); + return; + } + } + + // Read timestep count and blocksize + + quint64 timestepCount; + quint64 byteCount; + size_t selectedCellCount; + + socketStream >> timestepCount; + socketStream >> byteCount; + + selectedCellCount = byteCount / sizeof(double); + propertyFrames.resize(selectedCellCount, timestepCount); + + if (!(byteCount && timestepCount)) + { + error ("Could not find the requested data in ResInsight"); + return; + } + + quint64 totalByteCount = byteCount * timestepCount; + + double* internalMatrixData = propertyFrames.fortran_vec(); + QStringList errorMessages; + if (!RiaSocketDataTransfer::readBlockDataFromSocket(&socket, (char*)(internalMatrixData), totalByteCount, errorMessages)) + { + for (int i = 0; i < errorMessages.size(); i++) + { + error(errorMessages[i].toLatin1().data()); + } + + return; + } + + QString tmp = QString("riGetGridPropertyForSelectedCells : Read %1").arg(propertyName); + + if (caseId < 0) + { + tmp += QString(" from current case."); + } + else + { + tmp += QString(" from case with Id: %1.").arg(caseId); + } + octave_stdout << tmp.toStdString() << " Selected cells cells : " << selectedCellCount << ", Time steps : " << timestepCount << std::endl; + + return; +} + + + +DEFUN_DLD (riGetGridPropertyForSelectedCells, args, nargout, + "Usage:\n" + "\n" + "Matrix[numSelectedCells][numTimestepsRequested]\n" + " riGetGridPropertyForSelectedCells([CaseId], PropertyName, [RequestedTimeSteps], [PorosityModel = \"Matrix\"|\"Fracture\"] )\n" + "\n" + "This function returns a two dimensional matrix: [numSelectedCells][numTimestepsRequested] containing the requested property data from the case with CaseId.\n" + "If the CaseId is not defined, ResInsight's Current Case is used.\n" + "The RequestedTimeSteps must contain a list of 1-based indices to the requested time steps. If not defined, all the time steps are returned.\n" + ) +{ + if (nargout < 1) + { + error("riGetGridPropertyForSelectedCells: Missing output argument.\n"); + print_usage(); + return octave_value_list (); + } + + int nargin = args.length (); + if (nargin < 1) + { + error("riGetGridPropertyForSelectedCells: Too few arguments. The name of the property requested is necessary.\n"); + print_usage(); + return octave_value_list (); + } + + if (nargin > 4) + { + error("riGetGridPropertyForSelectedCells: Too many arguments.\n"); + print_usage(); + return octave_value_list (); + } + + std::vector argIndices; + argIndices.push_back(0); + argIndices.push_back(1); + argIndices.push_back(2); + argIndices.push_back(3); + + // Check if we have a CaseId: + if (!args(argIndices[0]).is_numeric_type()) + { + argIndices[0] = -1; + for (size_t aIdx = 1; aIdx < argIndices.size(); ++aIdx) + --argIndices[aIdx]; + } + + // Check if we have a Requested TimeSteps + + if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || args(argIndices[2]).is_numeric_type()) && !args(argIndices[2]).is_string())) + { + argIndices[2] = -1; + for (size_t aIdx = 3; aIdx < argIndices.size(); ++aIdx) + --argIndices[aIdx]; + } + + // Check if we have a PorosityModel + + int lastArgumentIndex = argIndices[3] ; + if (!(nargin > argIndices[3] && args(argIndices[3]).is_string())) + { + argIndices[3] = -1; + for (size_t aIdx = 4; aIdx < argIndices.size(); ++aIdx) + --argIndices[aIdx]; + } + + // Check if we have more arguments than we should + if (nargin > lastArgumentIndex + 1) + { + error("riGetGridPropertyForSelectedCells: Unexpected argument after the PorosityModel.\n"); + print_usage(); + return octave_value_list (); + } + + // Setup the argument list + + Matrix propertyFrames; + int caseId = -1; + std::string propertyName = "UNDEFINED"; + int32NDArray requestedTimeSteps; + std::string porosityModel = "Matrix"; + + if (argIndices[0] >= 0) caseId = args(argIndices[0]).int_value(); + if (argIndices[1] >= 0) propertyName = args(argIndices[1]).char_matrix_value().row_as_string(0); + if (argIndices[2] >= 0) requestedTimeSteps = args(argIndices[2]).int32_array_value(); + if (argIndices[3] >= 0) porosityModel = args(argIndices[3]).string_value(); + + if (porosityModel != "Matrix" && porosityModel != "Fracture") + { + error("riGetGridPropertyForSelectedCells: The value for \"PorosityModel\" is unknown. Please use either \"Matrix\" or \"Fracture\"\n"); + print_usage(); + return octave_value_list (); + } + + getGridPropertyForSelectedCells(propertyFrames, "127.0.0.1", 40001, caseId, propertyName.c_str(), requestedTimeSteps, porosityModel.c_str()); + + return octave_value(propertyFrames); +} diff --git a/OctavePlugin/riGetSelectedCells.cpp b/OctavePlugin/riGetSelectedCells.cpp new file mode 100644 index 0000000000..73f2abb5f3 --- /dev/null +++ b/OctavePlugin/riGetSelectedCells.cpp @@ -0,0 +1,130 @@ +#include +#include + +#include +#include "riSettings.h" +#include "RiaSocketDataTransfer.cpp" // NB! Include cpp-file to avoid linking of additional file in oct-compile configuration + +void getSelectedCells(int32NDArray& selectedCellInfo, const QString &hostName, quint16 port, const qint64& caseId) +{ + QString serverName = hostName; + quint16 serverPort = port; + + QTcpSocket socket; + socket.connectToHost(serverName, serverPort); + + if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs)) + { + error((("Connection: ") + socket.errorString()).toLatin1().data()); + return; + } + + // Create command and send it: + + QString command = QString("GetSelectedCells %1").arg(caseId); + QByteArray cmdBytes = command.toLatin1(); + + QDataStream socketStream(&socket); + socketStream.setVersion(riOctavePlugin::qtDataStreamVersion); + + socketStream << (qint64)(cmdBytes.size()); + socket.write(cmdBytes); + + // Get response. First wait for the header + + while (socket.bytesAvailable() < (int)(2*sizeof(quint64))) + { + if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs)) + { + error((("Waiting for header: ") + socket.errorString()).toLatin1().data()); + return; + } + } + + // Read timestep count and blocksize + + quint64 columnCount; + quint64 byteCountForOneTimestep; + size_t selectedCellCount; + + socketStream >> columnCount; + socketStream >> byteCountForOneTimestep; + + selectedCellCount = byteCountForOneTimestep / sizeof(qint32); + + dim_vector dv (2, 1); + dv(0) = selectedCellCount; + dv(1) = columnCount; + selectedCellInfo.resize(dv); + + if (!(byteCountForOneTimestep && columnCount)) + { + error ("No selected cells found in ResInsight"); + return; + } + + qint32* internalMatrixData = (qint32*)selectedCellInfo.fortran_vec()->mex_get_data(); + QStringList errorMessages; + if (!RiaSocketDataTransfer::readBlockDataFromSocket(&socket, (char*)(internalMatrixData), columnCount * byteCountForOneTimestep, errorMessages)) + { + for (int i = 0; i < errorMessages.size(); i++) + { + error(errorMessages[i].toLatin1().data()); + } + + OCTAVE_QUIT; + } + + QString tmp = QString("riGetSelectedCells : Read selected cell info"); + + octave_stdout << tmp.toStdString() << " Selected cells: " << selectedCellCount << ", Columns: " << columnCount << std::endl; + + return; +} + + + +DEFUN_DLD (riGetSelectedCells, args, nargout, + "Usage:\n" + "\n" + " Matrix[numSelectedCells][5] riGetSelectedCells()\n" + "\n" + "This function returns a two dimensional matrix containing cell info for each selected cell.\n" + "The columns contain the following information:\n" + "[CaseId, GridIdx, I, J, K]\n" + " CaseId : The ID of the case the cell resides in.\n" + " GridIdx : The index of the grid the cell resides in. (Main grid has index 0)\n" + " I, J, K : 1-based index address of the cell in the grid.\n" + ) +{ + int nargin = args.length (); + if (nargin > 1) + { + error("riGetSelectedCells: Too many arguments.\n"); + print_usage(); + } + else if (nargout < 1) + { + error("riGetSelectedCells: Missing output argument.\n"); + print_usage(); + } + else + { + qint64 caseId = -1; + + if (nargin > 0) + { + unsigned int argCaseId = args(0).uint_value(); + caseId = argCaseId; + } + + int32NDArray propertyFrames; + + getSelectedCells(propertyFrames, "127.0.0.1", 40001, caseId); + + return octave_value(propertyFrames); + } + + return octave_value(); +} + From cb06ce11bb392cd8d5f074eac5b0d26774ff5e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Fri, 4 Aug 2017 16:30:21 +0200 Subject: [PATCH 40/61] #1682 Respect disable result lighting for NNC results --- ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp index 79724f3e15..0a3761044f 100644 --- a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp @@ -648,6 +648,8 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors bool showNncsWithScalarMappedColor = false; + RimEclipseView* eclipseView = nullptr; + if (cellResultColors) { size_t scalarSetIndex = cellResultColors->scalarResultIndex(); @@ -656,6 +658,7 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors { showNncsWithScalarMappedColor = true; } + eclipseView = cellResultColors->reservoirView(); } if (showNncsWithScalarMappedColor) @@ -673,12 +676,14 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors { // Move NNC closer to camera to avoid z-fighting with grid surface caf::ScalarMapperEffectGenerator nncEffgen(mapper, caf::PO_NEG_LARGE); + if (eclipseView) nncEffgen.disableLighting(eclipseView->isLightingDisabled()); nncEffect = nncEffgen.generateCachedEffect(); } else { // If no grid is present, use same offset as grid geometry to be able to see mesh lines caf::ScalarMapperEffectGenerator nncEffgen(mapper, caf::PO_1); + if (eclipseView) nncEffgen.disableLighting(eclipseView->isLightingDisabled()); nncEffect = nncEffgen.generateCachedEffect(); } From 79c48338a70082a58578a81df34fa33abda62a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Mon, 7 Aug 2017 15:28:27 +0200 Subject: [PATCH 41/61] #1741 Add octave interface command to get names of available NNC properties --- .../ReservoirDataModel/RigNNCData.cpp | 22 +++ .../ReservoirDataModel/RigNNCData.h | 9 ++ .../SocketInterface/RiaNNCCommands.cpp | 71 ++++++++ OctavePlugin/CMakeLists.txt | 2 + OctavePlugin/riGetNNCPropertyNames.cpp | 152 ++++++++++++++++++ 5 files changed, 256 insertions(+) create mode 100644 OctavePlugin/riGetNNCPropertyNames.cpp diff --git a/ApplicationCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationCode/ReservoirDataModel/RigNNCData.cpp index 939a5ec967..7d66310b0d 100644 --- a/ApplicationCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigNNCData.cpp @@ -293,6 +293,28 @@ const std::vector* RigNNCData::dynamicConnectionScalarResultByName(const return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigNNCData::availableProperties(NNCResultType resultType) const +{ + std::vector properties; + + for (auto it : m_connectionResults) + { + if (resultType == NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0) + { + properties.push_back(it.first); + } + else if (resultType == NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0) + { + properties.push_back(it.first); + } + } + + return properties; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigNNCData.h b/ApplicationCode/ReservoirDataModel/RigNNCData.h index c7fe6f3dc3..b9548614a1 100644 --- a/ApplicationCode/ReservoirDataModel/RigNNCData.h +++ b/ApplicationCode/ReservoirDataModel/RigNNCData.h @@ -58,6 +58,13 @@ public: class RigNNCData : public cvf::Object { public: + enum NNCResultType + { + NNC_DYNAMIC, + NNC_STATIC, + NNC_GENERATED + }; + static QString propertyNameFluxWat() { return "FLRWAT"; } static QString propertyNameFluxOil() { return "FLROIL"; } static QString propertyNameFluxGas() { return "FLRGAS"; } @@ -82,6 +89,8 @@ public: const std::vector< std::vector >* dynamicConnectionScalarResultByName(const QString& nncDataType) const; const std::vector* dynamicConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) const; + std::vector availableProperties(NNCResultType resultType) const; + void setScalarResultIndex(const QString& nncDataType, size_t scalarResultIndex); bool hasScalarValues(size_t scalarResultIndex); diff --git a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp index 01d8bd3bd8..226327011a 100644 --- a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp @@ -214,3 +214,74 @@ public: }; static bool RiaGetStaticNNCValues_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetStaticNNCValues::commandName()); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaGetNNCPropertyNames: public RiaSocketCommand +{ +public: + static QString commandName () { return QString("GetNNCPropertyNames"); } + + virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) + { + RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); + + if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid())) + { + // No data available + socketStream << (quint64)0; + return true; + } + + RigNNCData* nncData = rimCase->eclipseCaseData()->mainGrid()->nncData(); + + std::vector propertyTypes; + std::vector propertyNames; + + std::vector resultTypes; + std::vector resultTypeNames; + + resultTypes.push_back(RigNNCData::NNC_DYNAMIC); + resultTypeNames.push_back("DynamicNative"); + resultTypes.push_back(RigNNCData::NNC_STATIC); + resultTypeNames.push_back("StaticNative"); + resultTypes.push_back(RigNNCData::NNC_GENERATED); + resultTypeNames.push_back("Generated"); + + for (size_t rtIdx = 0; rtIdx < resultTypes.size(); ++rtIdx) + { + std::vector availableParameters = nncData->availableProperties(resultTypes[rtIdx]); + + for (const QString& parameter : availableParameters) + { + propertyNames.push_back(parameter); + propertyTypes.push_back(resultTypeNames[rtIdx]); + } + } + + qint64 byteCount = 0; + + for (size_t ptIdx = 0; ptIdx < propertyNames.size(); ++ptIdx) + { + byteCount += propertyNames[ptIdx].size() * sizeof(QChar); + byteCount += propertyTypes[ptIdx].size() * sizeof(QChar); + } + + // Byte count + socketStream << byteCount; + + // Parameter count + socketStream << (quint64)propertyNames.size(); + + for (size_t ptIdx = 0; ptIdx < propertyNames.size(); ++ptIdx) + { + socketStream << propertyNames[ptIdx]; + socketStream << propertyTypes[ptIdx]; + } + + return true; + } +}; + +static bool RiaGetNNCPropertyNames_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetNNCPropertyNames::commandName()); diff --git a/OctavePlugin/CMakeLists.txt b/OctavePlugin/CMakeLists.txt index c0a3436b28..642d82387d 100644 --- a/OctavePlugin/CMakeLists.txt +++ b/OctavePlugin/CMakeLists.txt @@ -9,6 +9,7 @@ set(CPP_SOURCES riGetActiveCellInfo.cpp riGetMainGridDimensions.cpp riGetNNCConnections.cpp + riGetNNCPropertyNames.cpp riGetCurrentCase.cpp riGetCaseGroups.cpp riGetDynamicNNCValues.cpp @@ -178,6 +179,7 @@ if (RESINSIGHT_OCTAVE_PLUGIN_QMAKE AND RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE) "${CMAKE_CURRENT_BINARY_DIR}/riGetActiveCellInfo.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetMainGridDimensions.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetNNCConnections.oct" + "${CMAKE_CURRENT_BINARY_DIR}/riGetNNCPropertyNames.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetDynamicNNCValues.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetStaticNNCValues.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetCurrentCase.oct" diff --git a/OctavePlugin/riGetNNCPropertyNames.cpp b/OctavePlugin/riGetNNCPropertyNames.cpp new file mode 100644 index 0000000000..5223f8d49c --- /dev/null +++ b/OctavePlugin/riGetNNCPropertyNames.cpp @@ -0,0 +1,152 @@ +#include +#include +#include + +#include "riSettings.h" + +void getNNCPropertyNames(std::vector& propNames, std::vector& propTypes, const QString &hostName, quint16 port, + const qint64& caseId) +{ + QString serverName = hostName; + quint16 serverPort = port; + + QTcpSocket socket; + socket.connectToHost(serverName, serverPort); + + if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs)) + { + error((("Connection: ") + socket.errorString()).toLatin1().data()); + return; + } + + // Create command and send it: + + QString command; + command += QString("GetNNCPropertyNames") + " " + QString::number(caseId); + QByteArray cmdBytes = command.toLatin1(); + + QDataStream socketStream(&socket); + socketStream.setVersion(riOctavePlugin::qtDataStreamVersion); + + socketStream << (qint64)(cmdBytes.size()); + socket.write(cmdBytes); + + // Get response. First wait for the header + + while (socket.bytesAvailable() < (int)(sizeof(quint64))) + { + if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs)) + { + error((("Waiting for header: ") + socket.errorString()).toLatin1().data()); + return; + } + } + + quint64 byteCount; + socketStream >> byteCount; + QString byteCountString = QString::number(byteCount); + + //error(byteCountString.toLatin1().data()); + + while (socket.bytesAvailable() < (int)(byteCount)) + { + if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs)) + { + error((("Waiting for data: ") + socket.errorString()).toLatin1().data()); + return; + } + OCTAVE_QUIT; + } + + quint64 propCount; + socketStream >> propCount; + + QString propName; + QString propType; + + for (size_t i = 0; i < propCount; i++) + { + socketStream >> propName; + socketStream >> propType; + + propNames.push_back(propName); + propTypes.push_back(propType); + } + + return; +} + + + +DEFUN_DLD (riGetNNCPropertyNames, args, nargout, + "Usage:\n" + "\n" + " riGetNNCPropertyNames([CaseId])\n" + "\n" + "This function returns the name and type of all the NNC properties in the case as a Vector of Structures.\n" + "The Structure is defined as: \n" + "PropertyInfo {\n" + " PropName = string # Name of the NNC property as received from the analysis tool \n" + " PropType = string # The type of the property: \"StaticNative\", \"DynamicNative\", \"Generated\" \n" + "} \n" + "If the CaseId is not defined, ResInsight's Current Case is used.\n" + ) +{ + int nargin = args.length (); + if (nargin > 1) + { + error("riGetNNCPropertyNames: Too many arguments, this function takes one optional argument.\n"); + print_usage(); + } + else if (nargout != 1) + { + error("riGetNNCPropertyNames: Wrong number of output arguments, this function requires one output argument.\n"); + print_usage(); + } + else + { + qint64 argCaseId = -1; + + if (nargin == 1) + { + argCaseId = args(0).uint_value(); + } + + std::vector propertyNames; + std::vector propertyTypes; + + getNNCPropertyNames(propertyNames, propertyTypes, "127.0.0.1", 40001, argCaseId); + + size_t caseCount = propertyNames.size(); + + if (propertyNames.size() != propertyTypes.size() ) + { + error("riGetNNCPropertyNames: Inconsistent data received from ResInsight.\n"); + } + else + { + // Create cells with N items for each field in the data structure + + Cell cellValuesB(caseCount, 1); + Cell cellValuesC(caseCount, 1); + + for (size_t i = 0; i < caseCount; i++) + { + cellValuesB(i) = propertyNames[i].toLatin1().data(); + cellValuesC(i) = propertyTypes[i].toLatin1().data(); + } + + // Build a map between the field name and field cell values + + octave_map m; + + m.assign(riOctavePlugin::propertyInfo_PropName, cellValuesB); + m.assign(riOctavePlugin::propertyInfo_PropType, cellValuesC); + + return octave_value(m); + } + } + + return octave_value(); +} + From a3e6ae0dae9d4d9cad1317fad844227384ee8917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Mon, 7 Aug 2017 15:28:47 +0200 Subject: [PATCH 42/61] Fix build warning with size_t to int conversion --- .../SocketInterface/RiaCaseInfoCommands.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp index 77b7228d81..8925caa5a4 100644 --- a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp @@ -627,11 +627,11 @@ public: if (caseId == reservoirCase->caseId) { - caseNumber.push_back(caseId); - gridNumber.push_back(gridIndex); - cellI.push_back(i + 1); - cellJ.push_back(j + 1); - cellK.push_back(k + 1); + caseNumber.push_back(static_cast(caseId)); + gridNumber.push_back(static_cast(gridIndex)); + cellI.push_back(static_cast(i + 1)); + cellJ.push_back(static_cast(j + 1)); + cellK.push_back(static_cast(k + 1)); } } } From c6575460da5a8314f7f8893fe99b0123616ed87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Mon, 7 Aug 2017 15:29:10 +0200 Subject: [PATCH 43/61] Fix documentation for riGetSelectedCells --- OctavePlugin/riGetSelectedCells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OctavePlugin/riGetSelectedCells.cpp b/OctavePlugin/riGetSelectedCells.cpp index 73f2abb5f3..e1cd77e247 100644 --- a/OctavePlugin/riGetSelectedCells.cpp +++ b/OctavePlugin/riGetSelectedCells.cpp @@ -87,7 +87,7 @@ void getSelectedCells(int32NDArray& selectedCellInfo, const QString &hostName, q DEFUN_DLD (riGetSelectedCells, args, nargout, "Usage:\n" "\n" - " Matrix[numSelectedCells][5] riGetSelectedCells()\n" + " Matrix[numSelectedCells][5] riGetSelectedCells([CaseId])\n" "\n" "This function returns a two dimensional matrix containing cell info for each selected cell.\n" "The columns contain the following information:\n" From ca1e08a1a452c546adfca3d520a652c45e89e667 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 7 Aug 2017 12:36:29 +0200 Subject: [PATCH 44/61] #1676 Disable HDF5 by default --- ApplicationCode/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index b153477085..aa7c42e0ad 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -179,8 +179,7 @@ add_subdirectory(GeoMech/GeoMechDataModel) # # HDF5 -#option(RESINSIGHT_ENABLE_HDF5 "Use HDF5" OFF) -set(RESINSIGHT_ENABLE_HDF5 true) +option(RESINSIGHT_ENABLE_HDF5 "Use HDF5" OFF) if(RESINSIGHT_ENABLE_HDF5) add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB) find_package(HDF5 REQUIRED COMPONENTS CXX) From bc4edf6db30a952f6e1f7e390c9a9d81acec8b38 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 8 Aug 2017 07:07:22 +0200 Subject: [PATCH 45/61] #1676 #1388 Windows : Add path to HDF5 files and link with HDF5 static libs --- ApplicationCode/CMakeLists.txt | 49 +++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index aa7c42e0ad..f66fbe706c 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -179,29 +179,46 @@ add_subdirectory(GeoMech/GeoMechDataModel) # # HDF5 +# option(RESINSIGHT_ENABLE_HDF5 "Use HDF5" OFF) if(RESINSIGHT_ENABLE_HDF5) - add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB) - find_package(HDF5 REQUIRED COMPONENTS CXX) - if (HDF5_FOUND) - add_definitions(${HDF5_DEFINITIONS}) - include_directories(${HDF5_INCLUDE_DIRS}) + if(MSVC) + # Must specyfy libraries manually + # Using find_package causes linking of zlib, and crashes with linking of zlib defined by Qt + set(RESINSIGHT_HDF5_INCLUDE_DIR "" CACHE PATH "Path to HDF5 includes") + set(RESINSIGHT_HDF5_LIBRARY_DIR "" CACHE PATH "Path to HDF5 libraries") + + include_directories(${RESINSIGHT_HDF5_INCLUDE_DIR}) + list(APPEND THIRD_PARTY_LIBRARIES - ${HDF5_LIBRARIES} + # libzlib.lib is not included here, as it is linked implicitly by Qt + + ${RESINSIGHT_HDF5_LIBRARY_DIR}/libhdf5.lib + ${RESINSIGHT_HDF5_LIBRARY_DIR}/libhdf5_cpp.lib + ${RESINSIGHT_HDF5_LIBRARY_DIR}/libszip.lib ) + else() + add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB) + find_package(HDF5 REQUIRED COMPONENTS CXX) + if (HDF5_FOUND) + add_definitions(${HDF5_DEFINITIONS}) + include_directories(${HDF5_INCLUDE_DIRS}) - list( APPEND CPP_SOURCES - FileInterface/RifHdf5Reader.h - FileInterface/RifHdf5Reader.cpp - ) - - source_group( "FileInterface" FILES FileInterface/RifHdf5Reader.h FileInterface/RifHdf5Reader.cpp ) - - add_definitions(-DUSE_HDF5) - # TODO add_subdirectory(HDF/Hdf5Reader) - message( STATUS "Linking HD5 libraries : ${HDF5_LIBRARIES}" ) + list(APPEND THIRD_PARTY_LIBRARIES + ${HDF5_LIBRARIES} + ) + endif() endif() + + list( APPEND CPP_SOURCES + FileInterface/RifHdf5Reader.h + FileInterface/RifHdf5Reader.cpp + ) + + source_group( "FileInterface" FILES FileInterface/RifHdf5Reader.h FileInterface/RifHdf5Reader.cpp ) + + add_definitions(-DUSE_HDF5) endif() ############################################################################# From 1655585f1eac895abd9de17d6f3d845090feabea Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 8 Aug 2017 09:05:47 +0200 Subject: [PATCH 46/61] #1676 Remove option RESINSIGHT_ENABLE_HDF5 Always link HDF library files if HDF is available. Windows : Use root folder to HDF as path for include and library files --- ApplicationCode/CMakeLists.txt | 52 +++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index f66fbe706c..64ab560815 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -180,37 +180,43 @@ add_subdirectory(GeoMech/GeoMechDataModel) # # HDF5 # -option(RESINSIGHT_ENABLE_HDF5 "Use HDF5" OFF) -if(RESINSIGHT_ENABLE_HDF5) - if(MSVC) - # Must specyfy libraries manually - # Using find_package causes linking of zlib, and crashes with linking of zlib defined by Qt +if(MSVC) + # Must specyfy libraries manually + # Using find_package causes linking of zlib, and crashes with linking of zlib defined by Qt - set(RESINSIGHT_HDF5_INCLUDE_DIR "" CACHE PATH "Path to HDF5 includes") - set(RESINSIGHT_HDF5_LIBRARY_DIR "" CACHE PATH "Path to HDF5 libraries") + set(RESINSIGHT_HDF5_DIR "" CACHE PATH "Path to HDF5") + if(NOT ${RESINSIGHT_HDF5_DIR} EQUAL "") - include_directories(${RESINSIGHT_HDF5_INCLUDE_DIR}) + include_directories(${RESINSIGHT_HDF5_DIR}/include) - list(APPEND THIRD_PARTY_LIBRARIES + list(APPEND THIRD_PARTY_LIBRARIES # libzlib.lib is not included here, as it is linked implicitly by Qt - ${RESINSIGHT_HDF5_LIBRARY_DIR}/libhdf5.lib - ${RESINSIGHT_HDF5_LIBRARY_DIR}/libhdf5_cpp.lib - ${RESINSIGHT_HDF5_LIBRARY_DIR}/libszip.lib - ) - else() - add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB) - find_package(HDF5 REQUIRED COMPONENTS CXX) - if (HDF5_FOUND) - add_definitions(${HDF5_DEFINITIONS}) - include_directories(${HDF5_INCLUDE_DIRS}) + ${RESINSIGHT_HDF5_DIR}/lib/libhdf5.lib + ${RESINSIGHT_HDF5_DIR}/lib/libhdf5_cpp.lib + ${RESINSIGHT_HDF5_DIR}/lib/libszip.lib + ) - list(APPEND THIRD_PARTY_LIBRARIES - ${HDF5_LIBRARIES} - ) - endif() + set(RESINSIGHT_USE_HDF5 1) + message( STATUS "Using HDF5 from : ${RESINSIGHT_HDF5_DIR}" ) endif() +else() + add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB) + find_package(HDF5 REQUIRED COMPONENTS CXX) + if (HDF5_FOUND) + add_definitions(${HDF5_DEFINITIONS}) + include_directories(${HDF5_INCLUDE_DIRS}) + list(APPEND THIRD_PARTY_LIBRARIES + ${HDF5_LIBRARIES} + ) + + set(RESINSIGHT_USE_HDF5 1) + message( STATUS "Using HDF5 libraries : ${HDF5_LIBRARIES}" ) + endif() +endif() + +if (${RESINSIGHT_USE_HDF5}) list( APPEND CPP_SOURCES FileInterface/RifHdf5Reader.h FileInterface/RifHdf5Reader.cpp From 590e2ed753ea181e7ff6e2e1c89a9783db4ef31b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 8 Aug 2017 11:23:30 +0200 Subject: [PATCH 47/61] #1748 libecl : Add INSTALL_ERT to control install targets --- ThirdParty/Ert/CMakeLists.txt | 5 +++- ThirdParty/Ert/lib/CMakeLists.txt | 46 ++++++++++++++++--------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/ThirdParty/Ert/CMakeLists.txt b/ThirdParty/Ert/CMakeLists.txt index 500b0adecf..24958a4bb3 100644 --- a/ThirdParty/Ert/CMakeLists.txt +++ b/ThirdParty/Ert/CMakeLists.txt @@ -331,6 +331,9 @@ if (BUILD_PYTHON) endif() endif() -install(EXPORT ecl-config DESTINATION share/cmake/ecl) +if (INSTALL_ERT) + install(EXPORT ecl-config DESTINATION share/cmake/ecl) +endif() + export(TARGETS ecl FILE eclConfig.cmake) export(PACKAGE ecl) diff --git a/ThirdParty/Ert/lib/CMakeLists.txt b/ThirdParty/Ert/lib/CMakeLists.txt index d5f95a7ff4..09a179f846 100644 --- a/ThirdParty/Ert/lib/CMakeLists.txt +++ b/ThirdParty/Ert/lib/CMakeLists.txt @@ -211,30 +211,32 @@ set_target_properties(ecl PROPERTIES VERSION ${ERT_VERSION_MAJOR}.${ERT_VERSION_MINOR} SOVERSION ${ERT_VERSION_MAJOR}) -install(TARGETS ecl - EXPORT ecl-config - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(DIRECTORY include/ - DESTINATION include - PATTERN *.h -) -install(DIRECTORY include/ - DESTINATION include - PATTERN *.hpp EXCLUDE -) -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ - DESTINATION include - PATTERN *.h -) - -if (ERT_BUILD_CXX) +if (INSTALL_ERT) + install(TARGETS ecl + EXPORT ecl-config + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(DIRECTORY include/ DESTINATION include - PATTERN *.hpp -) -endif () + PATTERN *.h + ) + install(DIRECTORY include/ + DESTINATION include + PATTERN *.hpp EXCLUDE + ) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ + DESTINATION include + PATTERN *.h + ) + + if (ERT_BUILD_CXX) + install(DIRECTORY include/ + DESTINATION include + PATTERN *.hpp + ) + endif () +endif() if (NOT BUILD_TESTS) return () From cc4789d79c9681839b3373f23939a4df886d6177 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 8 Aug 2017 11:45:16 +0200 Subject: [PATCH 48/61] #1686 Remove setting of BUILD_PYTHON and ERT_BUILD_CXX These flags are set to correct values by default in libecl, it is not required to set these in ResInsight cmake --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94c5d9e7fb..69101e3adc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,9 +91,7 @@ else() # Disable install of ERT libs and headers, as Ert code is compiled and linked directly SET(INSTALL_ERT OFF CACHE BOOL "ERT: Install library") - SET(BUILD_PYTHON OFF CACHE BOOL "ERT: Run py_compile on the python wrappers") SET(ERT_USE_OPENMP ${OPENMP_FOUND} CACHE BOOL "ERT: Compile using OpenMP") - SET(ERT_BUILD_CXX ON CACHE BOOL "ERT: Enable build of CXX wrappers" FORCE) # Remember original state set(ORIGINAL_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) From fb158b29bd7baa683909a01832a6078293164009 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 8 Aug 2017 13:07:49 +0200 Subject: [PATCH 49/61] #1747 Build System : Include hdf5 in package name --- ApplicationCode/CMakeLists.txt | 4 ++-- CMakeLists.txt | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 64ab560815..0b7a8475d6 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -197,7 +197,7 @@ if(MSVC) ${RESINSIGHT_HDF5_DIR}/lib/libszip.lib ) - set(RESINSIGHT_USE_HDF5 1) + set(RESINSIGHT_USE_HDF5 1 PARENT_SCOPE) message( STATUS "Using HDF5 from : ${RESINSIGHT_HDF5_DIR}" ) endif() else() @@ -211,7 +211,7 @@ else() ${HDF5_LIBRARIES} ) - set(RESINSIGHT_USE_HDF5 1) + set(RESINSIGHT_USE_HDF5 1 PARENT_SCOPE) message( STATUS "Using HDF5 libraries : ${HDF5_LIBRARIES}" ) endif() endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 69101e3adc..95876d9b61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -431,6 +431,9 @@ if(NOT ${OCTAVE_VERSION_STRING} EQUAL "") set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_oct-${OCTAVE_VERSION_STRING}") endif() +if(RESINSIGHT_USE_HDF5) + set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_hdf5") +endif() # Append el5 when compiled on RHEL5 and el6 if compiled on RHEL6 if (NOT "${RESINSIGHT_RHEL_SYSTEM_NAME}" STREQUAL "") From 7e3e538a43a89e3ead2bffe3db8f17c8776a223c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Tue, 8 Aug 2017 13:12:43 +0200 Subject: [PATCH 50/61] #1662 Octave interface to push generated NNC values back into ResInsight --- .../RivNNCGeometryGenerator.cpp | 4 + .../ProjectDataModel/RimDefines.cpp | 4 + .../RigCaseCellResultsData.cpp | 9 + .../ReservoirDataModel/RigNNCData.cpp | 179 ++++++++++- .../ReservoirDataModel/RigNNCData.h | 18 +- .../RigResultAccessorFactory.cpp | 13 + .../SocketInterface/RiaNNCCommands.cpp | 292 ++++++++++++++++++ OctavePlugin/CMakeLists.txt | 2 + OctavePlugin/riSetNNCProperty.cpp | 195 ++++++++++++ 9 files changed, 697 insertions(+), 19 deletions(-) create mode 100644 OctavePlugin/riSetNNCProperty.cpp diff --git a/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.cpp b/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.cpp index 7db42e23db..7a40c5186b 100644 --- a/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.cpp +++ b/ApplicationCode/ModelVisualization/RivNNCGeometryGenerator.cpp @@ -164,6 +164,10 @@ void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords, { nncResultVals = m_nncData->dynamicConnectionScalarResult(scalarResultIndex, timeStepIndex); } + else if (resultType == RimDefines::GENERATED) + { + nncResultVals = m_nncData->generatedConnectionScalarResult(scalarResultIndex, timeStepIndex); + } if (!nncResultVals) { diff --git a/ApplicationCode/ProjectDataModel/RimDefines.cpp b/ApplicationCode/ProjectDataModel/RimDefines.cpp index dd4c5d33ea..7d7c899df1 100644 --- a/ApplicationCode/ProjectDataModel/RimDefines.cpp +++ b/ApplicationCode/ProjectDataModel/RimDefines.cpp @@ -110,6 +110,10 @@ bool RimDefines::isPerCellFaceResult(const QString& resultName) { return true; } + else if (resultName.endsWith("IJK")) + { + return true; + } return false; } diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index da8272a49f..7da08b7077 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -350,6 +350,15 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "FLRGASK+")); statisticsCalculator = calc; } + else if (resultName.endsWith("IJK")) + { + cvf::ref calc = new RigEclipseMultiPropertyStatCalc(); + QString baseName = resultName.left(resultName.size() - 3); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::GENERATED, QString("%1I").arg(baseName))); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::GENERATED, QString("%1J").arg(baseName))); + calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::GENERATED, QString("%1K").arg(baseName))); + statisticsCalculator = calc; + } else { statisticsCalculator = new RigEclipseNativeStatCalc(this, scalarResultIndex); diff --git a/ApplicationCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationCode/ReservoirDataModel/RigNNCData.cpp index 7d66310b0d..9f00e714f3 100644 --- a/ApplicationCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigNNCData.cpp @@ -293,6 +293,154 @@ const std::vector* RigNNCData::dynamicConnectionScalarResultByName(const return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector< std::vector >& RigNNCData::makeGeneratedConnectionScalarResult(QString nncDataType, size_t timeStepCount) +{ + auto& results = m_connectionResults[nncDataType]; + results.resize(timeStepCount); + return results; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector< std::vector >* RigNNCData::generatedConnectionScalarResult(size_t scalarResultIndex) const +{ + QString nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (nncDataType.isNull()) return nullptr; + + auto it = m_connectionResults.find(nncDataType); + + if (it != m_connectionResults.end()) + { + return &(it->second); + } + else + { + return nullptr; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector* RigNNCData::generatedConnectionScalarResult(size_t scalarResultIndex, size_t timeStep) const +{ + QString nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (nncDataType.isNull()) return nullptr; + + auto it = m_connectionResults.find(nncDataType); + + if (it != m_connectionResults.end()) + { + if (it->second.size() > timeStep) + { + return &(it->second[timeStep]); + } + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector< std::vector >* RigNNCData::generatedConnectionScalarResult(size_t scalarResultIndex) +{ + QString nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (nncDataType.isNull()) return nullptr; + + auto it = m_connectionResults.find(nncDataType); + + if (it != m_connectionResults.end()) + { + return &(it->second); + } + else + { + return nullptr; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector* RigNNCData::generatedConnectionScalarResult(size_t scalarResultIndex, size_t timeStep) +{ + QString nncDataType = getNNCDataTypeFromScalarResultIndex(scalarResultIndex); + if (nncDataType.isNull()) return nullptr; + + auto it = m_connectionResults.find(nncDataType); + + if (it != m_connectionResults.end()) + { + if (it->second.size() > timeStep) + { + return &(it->second[timeStep]); + } + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector>* RigNNCData::generatedConnectionScalarResultByName(const QString& nncDataType) const +{ + auto it = m_connectionResults.find(nncDataType); + if (it != m_connectionResults.end()) + { + return &(it->second); + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector* RigNNCData::generatedConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) const +{ + auto it = m_connectionResults.find(nncDataType); + if (it != m_connectionResults.end()) + { + if (it->second.size() > timeStep) + { + return &(it->second[timeStep]); + } + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector>* RigNNCData::generatedConnectionScalarResultByName(const QString& nncDataType) +{ + auto it = m_connectionResults.find(nncDataType); + if (it != m_connectionResults.end()) + { + return &(it->second); + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector* RigNNCData::generatedConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) +{ + auto it = m_connectionResults.find(nncDataType); + if (it != m_connectionResults.end()) + { + if (it->second.size() > timeStep) + { + return &(it->second[timeStep]); + } + } + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -302,11 +450,15 @@ std::vector RigNNCData::availableProperties(NNCResultType resultType) c for (auto it : m_connectionResults) { - if (resultType == NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0) + if (resultType == NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 && isNative(it.first)) { properties.push_back(it.first); } - else if (resultType == NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0) + else if (resultType == NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 && isNative(it.first)) + { + properties.push_back(it.first); + } + else if (resultType == NNC_GENERATED && !isNative(it.first)) { properties.push_back(it.first); } @@ -348,21 +500,20 @@ const QString RigNNCData::getNNCDataTypeFromScalarResultIndex(size_t scalarResul return QString(); } -/* //-------------------------------------------------------------------------------------------------- -/// TODO: Possibly not needed ! +/// //-------------------------------------------------------------------------------------------------- -const std::vector& RigNNCData::findConnectionIndices( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const +bool RigNNCData::isNative(QString nncDataType) const { - ConnectionSearchMap::const_iterator it; - static std::vector empty; - - it = m_cellIdxToFaceToConnectionIdxMap.find(reservoirCellIndex); - if (it != m_cellIdxToFaceToConnectionIdxMap.end()) + if (nncDataType == RigNNCData::propertyNameCombTrans() || + nncDataType == RigNNCData::propertyNameFluxGas() || + nncDataType == RigNNCData::propertyNameFluxOil() || + nncDataType == RigNNCData::propertyNameFluxWat() || + nncDataType == RigNNCData::propertyNameRiCombMult() || + nncDataType == RigNNCData::propertyNameRiCombTrans() || + nncDataType == RigNNCData::propertyNameRiCombTransByArea()) { - return it->second[face]; + return true; } - - return empty; + return false; } -*/ diff --git a/ApplicationCode/ReservoirDataModel/RigNNCData.h b/ApplicationCode/ReservoirDataModel/RigNNCData.h index b9548614a1..2e64fbaa7c 100644 --- a/ApplicationCode/ReservoirDataModel/RigNNCData.h +++ b/ApplicationCode/ReservoirDataModel/RigNNCData.h @@ -83,24 +83,32 @@ public: std::vector& makeStaticConnectionScalarResult(QString nncDataType); const std::vector* staticConnectionScalarResult(size_t scalarResultIndex) const; const std::vector* staticConnectionScalarResultByName(const QString& nncDataType) const; + std::vector< std::vector >& makeDynamicConnectionScalarResult(QString nncDataType, size_t timeStepCount); const std::vector< std::vector >* dynamicConnectionScalarResult(size_t scalarResultIndex) const; const std::vector* dynamicConnectionScalarResult(size_t scalarResultIndex, size_t timeStep) const; const std::vector< std::vector >* dynamicConnectionScalarResultByName(const QString& nncDataType) const; const std::vector* dynamicConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) const; + std::vector< std::vector >& makeGeneratedConnectionScalarResult(QString nncDataType, size_t timeStepCount); + const std::vector< std::vector >* generatedConnectionScalarResult(size_t scalarResultIndex) const; + const std::vector* generatedConnectionScalarResult(size_t scalarResultIndex, size_t timeStep) const; + std::vector< std::vector >* generatedConnectionScalarResult(size_t scalarResultIndex); + std::vector* generatedConnectionScalarResult(size_t scalarResultIndex, size_t timeStep); + const std::vector< std::vector >* generatedConnectionScalarResultByName(const QString& nncDataType) const; + const std::vector* generatedConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) const; + std::vector< std::vector >* generatedConnectionScalarResultByName(const QString& nncDataType); + std::vector* generatedConnectionScalarResultByName(const QString& nncDataType, size_t timeStep); + std::vector availableProperties(NNCResultType resultType) const; void setScalarResultIndex(const QString& nncDataType, size_t scalarResultIndex); bool hasScalarValues(size_t scalarResultIndex); -private: // This section is possibly not needed - //const std::vector& findConnectionIndices(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const; - //typedef std::map, 7 > > ConnectionSearchMap; - //ConnectionSearchMap m_cellIdxToFaceToConnectionIdxMap; - +private: const QString getNNCDataTypeFromScalarResultIndex(size_t scalarResultIndex) const; + bool isNative(QString nncDataType) const; private: std::vector m_connections; diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp index 464d9e56bb..7190a884b2 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp @@ -161,6 +161,19 @@ cvf::ref RigResultAccessorFactory::createFromUiResultName(Rig return cellFaceAccessObject; } + else if (uiResultName.endsWith("IJK")) + { + cvf::ref cellFaceAccessObject = new RigCombTransResultAccessor(grid); + QString baseName = uiResultName.left(uiResultName.size() - 3); + + cvf::ref iAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, QString("%1I").arg(baseName)); + cvf::ref jAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, QString("%1J").arg(baseName)); + cvf::ref kAccessor = RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, QString("%1K").arg(baseName)); + + cellFaceAccessObject->setTransResultAccessors(iAccessor.p(), jAccessor.p(), kAccessor.p()); + + return cellFaceAccessObject; + } return RigResultAccessorFactory::createNativeFromUiResultName(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName); } diff --git a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp index 226327011a..cba732309b 100644 --- a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp @@ -19,6 +19,7 @@ #include "RiaSocketCommand.h" #include "RiaSocketServer.h" +#include "RiaSocketDataTransfer.h" #include "RiaSocketTools.h" #include "RiaApplication.h" #include "RiaPreferences.h" @@ -37,6 +38,9 @@ #include "RimEclipseView.h" #include "RimEclipseWellCollection.h" #include "RimReservoirCellResultsStorage.h" +#include "RimEclipseInputCase.h" +#include "RimEclipseInputProperty.h" +#include "RimEclipseInputPropertyCollection.h" #include #include @@ -285,3 +289,291 @@ public: }; static bool RiaGetNNCPropertyNames_init = RiaSocketCommandFactory::instance()->registerCreator(RiaGetNNCPropertyNames::commandName()); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaSetNNCProperty: public RiaSocketCommand +{ +public: + RiaSetNNCProperty() : + m_currentReservoir(NULL), + m_currentScalarIndex(cvf::UNDEFINED_SIZE_T), + m_timeStepCountToRead(0), + m_bytesPerTimeStepToRead(0), + m_currentTimeStepNumberToRead(0), + m_invalidConnectionCountDetected(false), + m_porosityModelEnum(RifReaderInterface::MATRIX_RESULTS) + {} + + static QString commandName () { return QString("SetNNCProperty"); } + + virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) + { + RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); + + QString propertyName = args[2]; + + // Find the requested data, or create a set if we are setting data and it is not found + if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid())) + { + QString caseId = args[1]; + server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find case with id %1").arg(caseId)); + return true; + } + + // If we have not read the header and there are data enough: Read it. + // Do nothing if we have not enough data + if (m_timeStepCountToRead == 0 || m_bytesPerTimeStepToRead == 0) + { + if (server->currentClient()->bytesAvailable() < (int)sizeof(quint64)*2) return true; + + socketStream >> m_timeStepCountToRead; + socketStream >> m_bytesPerTimeStepToRead; + } + + RigNNCData* nncData = rimCase->eclipseCaseData()->mainGrid()->nncData(); + + auto nncResults = nncData->generatedConnectionScalarResultByName(propertyName); + + if (nncResults == nullptr) + { + nncData->makeGeneratedConnectionScalarResult(propertyName, m_timeStepCountToRead); + } + + if (rimCase && rimCase->results(m_porosityModelEnum)) + { + bool ok = createIJKCellResults(rimCase->results(m_porosityModelEnum), propertyName); + if (!ok) + { + server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the property named: \"%2\"").arg(propertyName)); + return true; + } + size_t scalarResultIndex = rimCase->results(m_porosityModelEnum)->findOrLoadScalarResult(QString("%1IJK").arg(propertyName)); + nncData->setScalarResultIndex(propertyName, scalarResultIndex); + } + + // Create a list of all the requested time steps + m_requestedTimesteps.clear(); + + if (args.size() <= 4) + { + // Select all + for (size_t tsIdx = 0; tsIdx < m_timeStepCountToRead; ++tsIdx) + { + m_requestedTimesteps.push_back(tsIdx); + } + } + else + { + bool timeStepReadError = false; + for (int argIdx = 4; argIdx < args.size(); ++argIdx) + { + bool conversionOk = false; + int tsIdx = args[argIdx].toInt(&conversionOk); + + if (conversionOk) + { + m_requestedTimesteps.push_back(tsIdx); + } + else + { + timeStepReadError = true; + } + } + + if (timeStepReadError) + { + server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: riSetNNCProperty : \n") + + RiaSocketServer::tr("An error occurred while interpreting the requested time steps.")); + } + + } + + if (! m_requestedTimesteps.size()) + { + server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("No time steps specified")); + + return true; + } + + m_currentReservoir = rimCase; + m_currentPropertyName = propertyName; + + if (server->currentClient()->bytesAvailable()) + { + return this->interpretMore(server, server->currentClient()); + } + + return false; + } + + static bool createIJKCellResults(RimReservoirCellResultsStorage* results, QString propertyName) + { + bool ok; + ok = scalarResultExistsOrCreate(results, QString("%1IJK").arg(propertyName)); + if (!ok) return false; + ok = scalarResultExistsOrCreate(results, QString("%1I").arg(propertyName)); + if (!ok) return false; + ok = scalarResultExistsOrCreate(results, QString("%1J").arg(propertyName)); + if (!ok) return false; + ok = scalarResultExistsOrCreate(results, QString("%1K").arg(propertyName)); + + return ok; + } + + static bool scalarResultExistsOrCreate(RimReservoirCellResultsStorage* results, QString propertyName) + { + size_t scalarResultIndex = results->findOrLoadScalarResult(propertyName); + if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) + { + scalarResultIndex = results->cellResults()->addEmptyScalarResult(RimDefines::GENERATED, propertyName, true); + } + + if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) + { + std::vector< std::vector >* scalarResultFrames = nullptr; + scalarResultFrames = &(results->cellResults()->cellScalarResults(scalarResultIndex)); + size_t timeStepCount = results->cellResults()->maxTimeStepCount(); + scalarResultFrames->resize(timeStepCount); + return true; + } + + return false; + } + + virtual bool interpretMore(RiaSocketServer* server, QTcpSocket* currentClient) + { + if (m_invalidConnectionCountDetected) return true; + + // If nothing should be read, or we already have read everything, do nothing + if ((m_timeStepCountToRead == 0) || (m_currentTimeStepNumberToRead >= m_timeStepCountToRead) ) return true; + + if (!currentClient->bytesAvailable()) return false; + + if (m_timeStepCountToRead != m_requestedTimesteps.size()) + { + CVF_ASSERT(false); + } + + // Check if a complete timestep is available, return and whait for readyRead() if not + if (currentClient->bytesAvailable() < (int)m_bytesPerTimeStepToRead) return false; + + RigNNCData* nncData = m_currentReservoir->eclipseCaseData()->mainGrid()->nncData(); + + size_t connectionCountFromOctave = m_bytesPerTimeStepToRead / sizeof(double); + size_t connectionCount = nncData->connections().size(); + std::vector< std::vector >* resultsToAdd = nncData->generatedConnectionScalarResultByName(m_currentPropertyName); + + if (connectionCountFromOctave != connectionCount) + { + server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + + RiaSocketServer::tr("The number of connections in the data coming from octave does not match the case: '%1'\n").arg(m_currentReservoir->caseUserDescription()) + + RiaSocketServer::tr(" Octave: %1\n").arg(connectionCountFromOctave) + + RiaSocketServer::tr(" %1: Connection count: %2").arg(m_currentReservoir->caseUserDescription()).arg(connectionCount)); + + connectionCountFromOctave = 0; + m_invalidConnectionCountDetected = true; + currentClient->abort(); + + return true; + } + + for (size_t tIdx = 0; tIdx < m_timeStepCountToRead; ++tIdx) + { + size_t tsId = m_requestedTimesteps[tIdx]; + resultsToAdd->at(tsId).resize(connectionCount, HUGE_VAL); + } + + std::vector readBuffer; + double * internalMatrixData = nullptr; + + QDataStream socketStream(currentClient); + socketStream.setVersion(riOctavePlugin::qtDataStreamVersion); + + // Read available complete time step data + while ((currentClient->bytesAvailable() >= (int)m_bytesPerTimeStepToRead) && (m_currentTimeStepNumberToRead < m_timeStepCountToRead)) + { + internalMatrixData = resultsToAdd->at(m_requestedTimesteps[m_currentTimeStepNumberToRead]).data(); + + QStringList errorMessages; + if (!RiaSocketDataTransfer::readBlockDataFromSocket(currentClient, (char*)(internalMatrixData), m_bytesPerTimeStepToRead, errorMessages)) + { + for (int i = 0; i < errorMessages.size(); i++) + { + server->errorMessageDialog()->showMessage(errorMessages[i]); + } + + currentClient->abort(); + return true; + } + ++m_currentTimeStepNumberToRead; + } + + + // If we have read all the data, refresh the views + + if (m_currentTimeStepNumberToRead == m_timeStepCountToRead) + { + if (m_currentReservoir != nullptr) + { + // Create a new input property if we have an input reservoir + RimEclipseInputCase* inputRes = dynamic_cast(m_currentReservoir); + if (inputRes) + { + RimEclipseInputProperty* inputProperty = inputRes->m_inputPropertyCollection->findInputProperty(m_currentPropertyName); + if (!inputProperty) + { + inputProperty = new RimEclipseInputProperty; + inputProperty->resultName = m_currentPropertyName; + inputProperty->eclipseKeyword = ""; + inputProperty->fileName = ""; + inputRes->m_inputPropertyCollection->inputProperties.push_back(inputProperty); + inputRes->m_inputPropertyCollection()->updateConnectedEditors(); + } + inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED_NOT_SAVED; + } + + if( m_currentScalarIndex != cvf::UNDEFINED_SIZE_T && + m_currentReservoir->eclipseCaseData() && + m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum) ) + { + m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(m_currentScalarIndex); + } + + for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i) + { + if (m_currentReservoir->reservoirViews[i]) + { + // As new result might have been introduced, update all editors connected + m_currentReservoir->reservoirViews[i]->cellResult->updateConnectedEditors(); + + // It is usually not needed to create new display model, but if any derived geometry based on generated data (from Octave) + // a full display model rebuild is required + m_currentReservoir->reservoirViews[i]->scheduleCreateDisplayModelAndRedraw(); + } + } + } + + return true; + } + + return false; + + } + +private: + RimEclipseCase* m_currentReservoir; + size_t m_currentScalarIndex; + QString m_currentPropertyName; + std::vector m_requestedTimesteps; + RifReaderInterface::PorosityModelResultType m_porosityModelEnum; + + quint64 m_timeStepCountToRead; + quint64 m_bytesPerTimeStepToRead; + size_t m_currentTimeStepNumberToRead; + + bool m_invalidConnectionCountDetected; +}; + +static bool RiaSetNNCProperty_init = RiaSocketCommandFactory::instance()->registerCreator(RiaSetNNCProperty::commandName()); diff --git a/OctavePlugin/CMakeLists.txt b/OctavePlugin/CMakeLists.txt index 642d82387d..34f98a9188 100644 --- a/OctavePlugin/CMakeLists.txt +++ b/OctavePlugin/CMakeLists.txt @@ -32,6 +32,7 @@ set(CPP_SOURCES riGetWellNames.cpp riGetWellStatus.cpp riGetWellCells.cpp + riSetNNCProperty.cpp ) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -202,6 +203,7 @@ if (RESINSIGHT_OCTAVE_PLUGIN_QMAKE AND RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE) "${CMAKE_CURRENT_BINARY_DIR}/riGetWellNames.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetWellStatus.oct" "${CMAKE_CURRENT_BINARY_DIR}/riGetWellCells.oct" + "${CMAKE_CURRENT_BINARY_DIR}/riSetNNCProperty.oct" SOURCES ${CPP_SOURCES} riSettings.h diff --git a/OctavePlugin/riSetNNCProperty.cpp b/OctavePlugin/riSetNNCProperty.cpp new file mode 100644 index 0000000000..c4803bd171 --- /dev/null +++ b/OctavePlugin/riSetNNCProperty.cpp @@ -0,0 +1,195 @@ +#include +#include + +#include + +#include "riSettings.h" +#include "RiaSocketDataTransfer.cpp" // NB! Include cpp-file to avoid linking of additional file in oct-compile configuration + + +void setNNCProperty(const Matrix& propertyFrames, const QString &hostName, quint16 port, + const qint64& caseId, QString propertyName, const int32NDArray& requestedTimeSteps) +{ + QTcpSocket socket; + socket.connectToHost(hostName, port); + + if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs)) + { + error((("Connection: ") + socket.errorString()).toLatin1().data()); + return; + } + + QDataStream socketStream(&socket); + socketStream.setVersion(riOctavePlugin::qtDataStreamVersion); + + // Create command as a string with arguments , and send it: + + QString command; + command += "SetNNCProperty " + QString::number(caseId) + " " + propertyName; + + for (int i = 0; i < requestedTimeSteps.length(); ++i) + { + if (i == 0) command += " "; + command += QString::number(static_cast(requestedTimeSteps.elem(i)) - 1); // To make the index 0-based + if (i != requestedTimeSteps.length() -1) command += " "; + } + + QByteArray cmdBytes = command.toLatin1(); + + socketStream << (qint64)(cmdBytes.size()); + socket.write(cmdBytes); + + // Write property data header + + dim_vector mxDims = propertyFrames.dims(); + + qint64 connectionCount = mxDims.elem(0); + qint64 timeStepCount = mxDims.elem(1); + qint64 timeStepByteCount = connectionCount * sizeof(double); + + socketStream << (qint64)(timeStepCount); + socketStream << (qint64)timeStepByteCount; + + const double* internalData = propertyFrames.fortran_vec(); + + QStringList errorMessages; + if (!RiaSocketDataTransfer::writeBlockDataToSocket(&socket, (const char *)internalData, timeStepByteCount*timeStepCount, errorMessages)) + { + for (int i = 0; i < errorMessages.size(); i++) + { + octave_stdout << errorMessages[i].toStdString(); + } + + return; + } + + QString tmp = QString("riSetNNCProperty : Wrote %1").arg(propertyName); + + if (caseId == -1) + { + tmp += QString(" to current case."); + } + else + { + tmp += QString(" to case with Id = %1.").arg(caseId); + } + octave_stdout << tmp.toStdString() << " NNC Connections : " << connectionCount << " Time steps : " << timeStepCount << std::endl; + + while(socket.bytesToWrite() && socket.state() == QAbstractSocket::ConnectedState) + { + // octave_stdout << "Bytes to write: " << socket.bytesToWrite() << std::endl; + socket.waitForBytesWritten(riOctavePlugin::shortTimeOutMilliSecs); + OCTAVE_QUIT; + } + + //octave_stdout << " Socket write completed" << std::endl; + + if (socket.bytesToWrite() && socket.state() != QAbstractSocket::ConnectedState) + { + error("riSetNNCProperty : ResInsight refused to accept the data. Maybe the dimensions or porosity model is wrong"); + } + +#ifdef WIN32 + // TODO: Due to synchronization issues seen on Windows 10, it is required to do a sleep here to be able to catch disconnect + // signals from the socket. No sleep causes the server to hang. + Sleep(100); +#endif //WIN32 + + return; +} + + + +DEFUN_DLD (riSetNNCProperty, args, nargout, + "Usage:\n" + "\n" + "\triSetNNCProperty(Matrix[numNNCConnections][numTimeSteps], [CaseId], PropertyName, [TimeStepIndices]) \n" + "\n" + "Interprets the supplied matrix as a property set defined for the NNC connections in the case, " + "and puts the data into ResInsight as a \"Generated\" property with the name \"PropertyName\"." + "The \"TimeStepIndices\" argument is used to \"label\" all the time steps present in the supplied data matrix " + "and must thus be complete. The time step data will then be put into ResInsight at the time steps requested.\n" + "If the CaseId is not defined, ResInsight's Current Case is used." + ) +{ + int nargin = args.length (); + if (nargin < 2) + { + error("riSetNNCProperty: Too few arguments. The data matrix and the name of the property requested is necessary\n"); + print_usage(); + return octave_value_list (); + } + + if (nargin > 4) + { + error("riSetNNCProperty: Too many arguments.\n"); + print_usage(); + return octave_value_list (); + } + + Matrix propertyFrames = args(0).matrix_value(); + + if (error_state) + { + error("riSetNNCProperty: The supplied first argument is not a valid Matrix"); + print_usage(); + + return octave_value_list (); + } + + + dim_vector mxDims = propertyFrames.dims(); + if (mxDims.length() != 2) + { + error("riSetNNCProperty: The supplied Data Matrix must have two dimensions: numNNCConnections*numTimesteps"); + print_usage(); + + return octave_value_list (); + } + std::vector argIndices; + argIndices.push_back(0); + argIndices.push_back(1); + argIndices.push_back(2); + argIndices.push_back(3); + + // Check if we have a CaseId: + if (!args(argIndices[1]).is_numeric_type()) + { + argIndices[1] = -1; + for (size_t aIdx = 2; aIdx < argIndices.size(); ++aIdx) + --argIndices[aIdx]; + } + + // Check if we have a Requested TimeSteps + if (!(nargin > argIndices[3] && args(argIndices[3]).is_matrix_type() && !args(argIndices[3]).is_string())) + { + argIndices[3] = -1; + for (size_t aIdx = 4; aIdx < argIndices.size(); ++aIdx) + --argIndices[aIdx]; + } + + int caseId = -1; + std::string propertyName = "UNDEFINED"; + int32NDArray requestedTimeSteps; + + if (argIndices[1] >= 0) caseId = args(argIndices[1]).int_value(); + if (argIndices[2] >= 0) propertyName = args(argIndices[2]).char_matrix_value().row_as_string(0); + if (argIndices[3] >= 0) requestedTimeSteps = args(argIndices[3]).int32_array_value(); + + if (requestedTimeSteps.length()) + { + + int timeStepCount = mxDims.elem(1); + if (requestedTimeSteps.length() != timeStepCount) + { + error("riSetNNCProperty: The number of time steps in the input matrix must match the number of time steps in the TimeStepIndices array."); + print_usage(); + return octave_value_list (); + } + } + + setNNCProperty(propertyFrames, "127.0.0.1", 40001, caseId, propertyName.c_str(), requestedTimeSteps); + + return octave_value_list (); +} + From acd7b4784dd4f03d0562e8197a46d941d203be32 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 8 Aug 2017 13:48:54 +0200 Subject: [PATCH 51/61] #1747 Build System : Make variable available to both current and parent scope --- ApplicationCode/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 0b7a8475d6..051ba37a3d 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -197,7 +197,7 @@ if(MSVC) ${RESINSIGHT_HDF5_DIR}/lib/libszip.lib ) - set(RESINSIGHT_USE_HDF5 1 PARENT_SCOPE) + set(RESINSIGHT_USE_HDF5 1) message( STATUS "Using HDF5 from : ${RESINSIGHT_HDF5_DIR}" ) endif() else() @@ -211,7 +211,7 @@ else() ${HDF5_LIBRARIES} ) - set(RESINSIGHT_USE_HDF5 1 PARENT_SCOPE) + set(RESINSIGHT_USE_HDF5 1) message( STATUS "Using HDF5 libraries : ${HDF5_LIBRARIES}" ) endif() endif() @@ -227,6 +227,9 @@ if (${RESINSIGHT_USE_HDF5}) add_definitions(-DUSE_HDF5) endif() +# make variable available to parent scope +set(RESINSIGHT_USE_HDF5 ${RESINSIGHT_USE_HDF5} PARENT_SCOPE) + ############################################################################# # Qt specifics: Moc, ui, resources ############################################################################# From d5d5cedbf50267d923a28600efaed68f96d83536 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 9 Aug 2017 08:31:18 +0200 Subject: [PATCH 52/61] #1686 Remove explicit include of Ert Ert includes are implicit defined by tartget_link_library --- ApplicationCode/CMakeLists.txt | 1 - CMakeLists.txt | 21 ++++++------------- .../custom-opm-flowdiag-app/CMakeLists.txt | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 051ba37a3d..535cedfb47 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -27,7 +27,6 @@ include_directories( ${ResInsight_SOURCE_DIR}/ThirdParty ${ResInsight_SOURCE_DIR}/ThirdParty/NRLib/nrlib/well ${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src - ${ERT_INCLUDE_DIRS} ${boost-Subset_SOURCE_DIR} ${custom-opm-flowdiagnostics_SOURCE_DIR}/opm-flowdiagnostics/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 95876d9b61..e8f06fd163 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,8 @@ if (RESINSIGHT_ERT_EXTERNAL_LIB_ROOT OR RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT) message(FATAL_ERROR "Both RESINSIGHT_ERT_EXTERNAL_LIB_ROOT and RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT must be defined") endif() + message(FATAL_ERROR "TODO: Building using and external system installed ERT is broken.") + list(APPEND ERT_INCLUDE_DIRS ${RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT} ) @@ -109,25 +111,18 @@ else() endif() if (RESINSIGHT_ERT_EXTERNAL_SOURCE_ROOT) - set(ERT_INCLUDE_ROOT "${RESINSIGHT_ERT_EXTERNAL_SOURCE_ROOT}") - add_subdirectory(${ERT_SOURCE_PATH} ${CMAKE_BINARY_DIR}/ThirdParty/Ert) + add_subdirectory(${RESINSIGHT_ERT_EXTERNAL_SOURCE_ROOT} ${CMAKE_BINARY_DIR}/ThirdParty/Ert) else() - set(ERT_INCLUDE_ROOT ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/lib/include) add_subdirectory(ThirdParty/Ert) endif () - list(APPEND ERT_INCLUDE_DIRS - ${CMAKE_BINARY_DIR}/ThirdParty/Ert/lib/include - ${ERT_INCLUDE_ROOT}/ - ) - - list(APPEND ERT_LIBRARIES - ecl + list(APPEND THIRD_PARTY_LIBRARIES + ecl ) if (MSVC) set_property(TARGET - ${ERT_LIBRARIES} + ecl PROPERTY FOLDER "Thirdparty/ERT" ) endif() @@ -137,10 +132,6 @@ else() endif(RESINSIGHT_ERT_EXTERNAL_LIB_ROOT OR RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT) -list(APPEND THIRD_PARTY_LIBRARIES - ${ERT_LIBRARIES} -) - ################################################################################ # Subset of Boost, used by NRLib and flow diagnostics application diff --git a/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt b/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt index cd458bfda0..69efc74e7f 100644 --- a/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt +++ b/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt @@ -6,7 +6,6 @@ include_directories( ../custom-opm-flowdiagnostics/opm-flowdiagnostics opm-flowdiagnostics-applications opmCore - ${ERT_INCLUDE_DIRS} ${boost-Subset_SOURCE_DIR} ) @@ -27,3 +26,4 @@ add_library(custom-opm-flowdiag-app ${project_source_files_complete_path1} ) +target_link_libraries(custom-opm-flowdiag-app ecl) From a47c5b5d84a58ab37833916fa20da02e559bbd78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Fri, 11 Aug 2017 11:20:40 +0200 Subject: [PATCH 53/61] #1690 Summary: Import clipboard data from Excel as new curves --- .../CMakeLists_files.cmake | 2 + .../RicNewSummaryPlotFeature.cpp | 4 +- .../RicNewSummaryPlotFeature.h | 3 +- .../RicPasteAsciiDataToSummaryPlotFeature.cpp | 282 ++++++++++++++++++ .../RicPasteAsciiDataToSummaryPlotFeature.h | 63 ++++ .../Summary/CMakeLists_files.cmake | 2 + .../Summary/RimAsciiDataCurve.cpp | 237 +++++++++++++++ .../Summary/RimAsciiDataCurve.h | 82 +++++ .../Summary/RimSummaryPlot.cpp | 107 ++++++- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 + 10 files changed, 783 insertions(+), 3 deletions(-) create mode 100644 ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp create mode 100644 ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h create mode 100644 ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp create mode 100644 ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h diff --git a/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index cee17de51a..4586c8619a 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -9,6 +9,7 @@ set (SOURCE_GROUP_HEADER_FILES ${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.h ${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.h +${CEE_CURRENT_LIST_DIR}RicPasteAsciiDataToSummaryPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicViewZoomAllFeature.h ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.h ${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.h @@ -23,6 +24,7 @@ set (SOURCE_GROUP_SOURCE_FILES ${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.cpp +${CEE_CURRENT_LIST_DIR}RicPasteAsciiDataToSummaryPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicViewZoomAllFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.cpp ${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.cpp diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp index 9bee510e0e..5be48ad550 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp @@ -93,7 +93,7 @@ void RicNewSummaryPlotFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewSummaryPlotFeature::createNewSummaryPlot(RimSummaryPlotCollection* summaryPlotColl, RimSummaryCase* summaryCase) +RimSummaryPlot* RicNewSummaryPlotFeature::createNewSummaryPlot(RimSummaryPlotCollection* summaryPlotColl, RimSummaryCase* summaryCase) { RimSummaryPlot* plot = new RimSummaryPlot(); summaryPlotColl->summaryPlots().push_back(plot); @@ -118,4 +118,6 @@ void RicNewSummaryPlotFeature::createNewSummaryPlot(RimSummaryPlotCollection* su mainPlotWindow->selectAsCurrentItem(newCurveFilter); mainPlotWindow->setExpanded(newCurveFilter, true); } + + return plot; } diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h index dd6cb6a379..86cb124ac3 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h @@ -22,6 +22,7 @@ class RimSummaryCase; class RimSummaryPlotCollection; +class RimSummaryPlot; //================================================================================================== /// @@ -31,7 +32,7 @@ class RicNewSummaryPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; public: - static void createNewSummaryPlot(RimSummaryPlotCollection* summaryPlotColl, RimSummaryCase* summaryCase); + static RimSummaryPlot* createNewSummaryPlot(RimSummaryPlotCollection* summaryPlotColl, RimSummaryCase* summaryCase); protected: // Overrides diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp new file mode 100644 index 0000000000..9af6f2de9c --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp @@ -0,0 +1,282 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicPasteAsciiDataToSummaryPlotFeature.h" + +#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" +#include "RicNewSummaryPlotFeature.h" + +#include "RiaLogging.h" + +#include "RimSummaryPlot.h" +#include "RimSummaryPlotCollection.h" +#include "RimAsciiDataCurve.h" +#include "RimSummaryCurveAppearanceCalculator.h" + +#include "cafPdmDefaultObjectFactory.h" +#include "cafPdmDocument.h" +#include "cafPdmObjectGroup.h" +#include "cafSelectionManager.h" + +#include "cvfAssert.h" +#include "cvfColor3.h" + +#include +#include +#include +#include + + +CAF_CMD_SOURCE_INIT(RicPasteAsciiDataToSummaryPlotFeature, "RicPasteExcelToSummaryPlotFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicPasteAsciiDataToSummaryPlotFeature::isCommandEnabled() +{ + caf::PdmObjectHandle* destinationObject = dynamic_cast(caf::SelectionManager::instance()->selectedItem()); + + RimSummaryPlot* summaryPlot = nullptr; + destinationObject->firstAncestorOrThisOfType(summaryPlot); + if (!summaryPlot) + { + RimSummaryPlotCollection* summaryPlotCollection = nullptr; + destinationObject->firstAncestorOrThisOfType(summaryPlotCollection); + if (!summaryPlotCollection) + { + return false; + } + } + + return hasPastedText(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered(bool isChecked) +{ + caf::PdmObjectHandle* destinationObject = dynamic_cast(caf::SelectionManager::instance()->selectedItem()); + + RimSummaryPlot* summaryPlot = nullptr; + destinationObject->firstAncestorOrThisOfType(summaryPlot); + if (!summaryPlot) + { + RimSummaryPlotCollection* summaryPlotCollection = nullptr; + destinationObject->firstAncestorOrThisOfType(summaryPlotCollection); + if (!summaryPlotCollection) + { + return; + } + summaryPlot = RicNewSummaryPlotFeature::createNewSummaryPlot(summaryPlotCollection, nullptr); + if (!summaryPlot) + { + return; + } + } + QString text = getPastedData(); + + std::vector curves = parseCurves(text); + + for (RimAsciiDataCurve* curve : curves) + { + summaryPlot->addAsciiDataCruve(curve); + } + + summaryPlot->updateConnectedEditors(); + summaryPlot->loadDataAndUpdate(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPasteAsciiDataToSummaryPlotFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Paste Excel Data to Summary Curve"); + + RicPasteFeatureImpl::setIconAndShortcuts(actionToSetup); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicPasteAsciiDataToSummaryPlotFeature::getPastedData() +{ + if (hasPastedText()) + { + QClipboard* clipboard = QApplication::clipboard(); + return clipboard->text(); + } + return QString(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicPasteAsciiDataToSummaryPlotFeature::hasPastedText() +{ + QClipboard* clipboard = QApplication::clipboard(); + const QMimeData* mimeData = clipboard->mimeData(); + return mimeData->hasText(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurves(QString& data) +{ + std::vector curves; + std::vector headers; + + QTextStream tableData(&data); + + { + QString header; + + do { + header = tableData.readLine(); + } while (header.isEmpty() && !tableData.atEnd()); + + // No header row found + if (header.isEmpty()) return curves; + + QStringList columnHeaders = header.split('\t'); + + for (size_t i = 1; i < columnHeaders.size(); ++i) + { + headers.push_back(columnHeaders[static_cast(i)]); + } + + // No columns found + if (headers.empty()) return curves; + } + + size_t numColumns = headers.size(); + std::vector timeSteps; + std::vector< std::vector > values; + values.resize(numColumns); + + size_t row = 0; + while (!tableData.atEnd()) + { + ++row; + QString line = tableData.readLine(); + + // Skip empty lines + if (line.isEmpty()) continue; + + QStringList columns = line.split('\t'); + + if (columns.size() != numColumns + 1) + { + RiaLogging::warning(QString("Invalid number of columns in row %1").arg(row)); + continue; + } + + QDateTime date = parseDateString(columns[0]); + if (!date.isValid()) + { + RiaLogging::warning(QString("First column of row %1 could not be parsed as a date: %2").arg(row).arg(columns[0])); + continue; + } + timeSteps.push_back(date); + + for (size_t col = 1; col < columns.size(); ++col) + { + bool ok; + values[col - 1].push_back(columns[static_cast(col)].toDouble(&ok)); + if (!ok) + { + RiaLogging::warning(QString("Could not parse value at row %1 column %2 as double: %3. Defaulting to 0.0").arg(row).arg(col).arg(columns[static_cast(col)])); + } + } + } + + std::map< CurveType, std::vector > curveToTypeMap; + + for (size_t i = 0; i < values.size(); ++i) + { + RimAsciiDataCurve* curve = new RimAsciiDataCurve(); + curve->setTimeSteps(timeSteps); + curve->setValues(values[i]); + curve->setTitle(headers[i]); + curveToTypeMap[guessCurveType(headers[i])].push_back(curve); + curves.push_back(curve); + } + + for (auto& it : curveToTypeMap) + { + for (int i = 0; i < it.second.size(); ++i) + { + cvf::Color3f color; + switch (it.first) + { + case CURVE_GAS: + color = RimSummaryCurveAppearanceCalculator::cycledRedColor(i); + break; + case CURVE_OIL: + color = RimSummaryCurveAppearanceCalculator::cycledGreenColor(i); + break; + case CURVE_WAT: + color = RimSummaryCurveAppearanceCalculator::cycledBlueColor(i); + break; + default: + color = RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(i); + break; + } + it.second[i]->setColor(color); + } + } + + return curves; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QDateTime RicPasteAsciiDataToSummaryPlotFeature::parseDateString(const QString& date) +{ + QDateTime parsedDate; + + parsedDate = QDateTime::fromString(date, "dd.MM.yyyy hh:mm"); + if (parsedDate.isValid()) return parsedDate; + + parsedDate = QDateTime::fromString(date, "dd.MM.yyyy"); + + return parsedDate; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicPasteAsciiDataToSummaryPlotFeature::CurveType RicPasteAsciiDataToSummaryPlotFeature::guessCurveType(const QString& curveName) +{ + if (curveName.contains("SW") || curveName.contains("water", Qt::CaseInsensitive)) + { + return CURVE_WAT; + } + else if (curveName.contains("oil", Qt::CaseInsensitive)) + { + return CURVE_OIL; + } + else if (curveName.contains("gas", Qt::CaseInsensitive)) + { + return CURVE_GAS; + } + return CURVE_UNKNOWN; +} diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h new file mode 100644 index 0000000000..e25c63389d --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" +#include "cafPdmPointer.h" + + +#include + +#include + +class RimSummaryCurve; +class RimSummaryCurveFilter; +class RimAsciiDataCurve; + +//================================================================================================== +/// +//================================================================================================== +class RicPasteAsciiDataToSummaryPlotFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +public: + enum CurveType + { + CURVE_GAS, + CURVE_OIL, + CURVE_WAT, + CURVE_UNKNOWN, + }; + +protected: + // Overrides + virtual bool isCommandEnabled() override; + virtual void onActionTriggered( bool isChecked ) override; + virtual void setupActionLook(QAction* actionToSetup) override; + +private: + static QString getPastedData(); + static bool hasPastedText(); + + static std::vector parseCurves(QString& data); + + static QDateTime parseDateString(const QString& date); + + static CurveType guessCurveType(const QString& curveName); +}; diff --git a/ApplicationCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/Summary/CMakeLists_files.cmake index 4e539739a2..bca4161d18 100644 --- a/ApplicationCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -5,6 +5,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2") endif() set (SOURCE_GROUP_HEADER_FILES +${CEE_CURRENT_LIST_DIR}RimAsciiDataCurve.h ${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.h ${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.h ${CEE_CURRENT_LIST_DIR}RimSummaryCase.h @@ -22,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RimSummaryYAxisProperties.h ) set (SOURCE_GROUP_SOURCE_FILES +${CEE_CURRENT_LIST_DIR}RimAsciiDataCurve.cpp ${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.cpp ${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.cpp ${CEE_CURRENT_LIST_DIR}RimSummaryCase.cpp diff --git a/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp new file mode 100644 index 0000000000..9c8ba5dbbf --- /dev/null +++ b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -0,0 +1,237 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimAsciiDataCurve.h" + +#include "RiaApplication.h" + +#include "RifReaderEclipseSummary.h" + +#include "RigSummaryCaseData.h" + +#include "RimDefines.h" +#include "RimEclipseResultCase.h" +#include "RimProject.h" +#include "RimSummaryCase.h" +#include "RimSummaryFilter.h" +#include "RimSummaryPlot.h" +#include "RimSummaryTimeAxisProperties.h" + +#include "RiuLineSegmentQwtPlotCurve.h" +#include "RiuSummaryQwtPlot.h" + +#include "cafPdmUiComboBoxEditor.h" +#include "cafPdmUiListEditor.h" +#include "cafPdmUiTreeOrdering.h" + +#include "qwt_date.h" + + +CAF_PDM_SOURCE_INIT(RimAsciiDataCurve, "AsciiDataCurve"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimAsciiDataCurve::RimAsciiDataCurve() +{ + CAF_PDM_InitObject("ASCII Data Curve", ":/SummaryCurve16x16.png", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_plotAxis, "PlotAxis", "Axis", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_timeSteps, "TimeSteps", "Time Steps", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_values, "Values", "Values", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_title, "Title", "Title", "", "", ""); + + m_symbolSkipPixelDistance = 10.0f; + m_curveThickness = 2; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimAsciiDataCurve::~RimAsciiDataCurve() +{ +} + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimAsciiDataCurve::yValues() const +{ + return m_values; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RimAsciiDataCurve::timeSteps() const +{ + static std::vector timeSteps; + timeSteps.clear(); + + for (const QDateTime& dateTime : m_timeSteps()) + { + timeSteps.push_back(dateTime.toTime_t()); + } + + return timeSteps; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAsciiDataCurve::setYAxis(RimDefines::PlotAxis plotAxis) +{ + m_plotAxis = plotAxis; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimDefines::PlotAxis RimAsciiDataCurve::yAxis() const +{ + return m_plotAxis(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimAsciiDataCurve::createCurveAutoName() +{ + return m_title(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAsciiDataCurve::updateZoomInParentPlot() +{ + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfType(plot); + + plot->updateZoomInQwt(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAsciiDataCurve::onLoadDataAndUpdate() +{ + this->RimPlotCurve::updateCurvePresentation(); + + if (isCurveVisible()) + { + std::vector dateTimes = this->timeSteps(); + std::vector values = this->yValues(); + + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfType(plot); + bool isLogCurve = plot->isLogarithmicScaleEnabled(this->yAxis()); + + if (dateTimes.size() > 0 && dateTimes.size() == values.size()) + { + if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE) + { + m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve); + } + else + { + double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale(); + + std::vector times; + if ( dateTimes.size() ) + { + time_t startDate = dateTimes[0]; + for ( time_t& date: dateTimes ) + { + times.push_back(timeScale*(date - startDate)); + } + } + + m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve); + } + + } + else + { + m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector(), std::vector(), isLogCurve); + } + + updateZoomInParentPlot(); + + if (m_parentQwtPlot) m_parentQwtPlot->replot(); + } + + updateQwtPlotAxis(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAsciiDataCurve::updateQwtPlotAxis() +{ + if (m_qwtPlotCurve) + { + if (this->yAxis() == RimDefines::PLOT_AXIS_LEFT) + { + m_qwtPlotCurve->setYAxis(QwtPlot::yLeft); + } + else + { + m_qwtPlotCurve->setYAxis(QwtPlot::yRight); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAsciiDataCurve::setTimeSteps(const std::vector& timeSteps) +{ + m_timeSteps = timeSteps; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAsciiDataCurve::setValues(const std::vector& values) +{ + m_values = values; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimAsciiDataCurve::setTitle(const QString& title) +{ + m_title = title; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimAsciiDataCurve::curveData(std::vector* timeSteps, std::vector* values) const +{ + CVF_ASSERT(timeSteps && values); + + *timeSteps = m_timeSteps(); + *values = m_values(); + + return true; +} + diff --git a/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h new file mode 100644 index 0000000000..e8d8058705 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPointer.h" +#include "cafPdmPtrField.h" +#include "cafPdmChildField.h" + +#include "RifEclipseSummaryAddress.h" +#include "RimDefines.h" +#include "RimPlotCurve.h" + +#include "cafAppEnum.h" + +#include + +class RifReaderEclipseSummary; +class RimSummaryCase; +class RimSummaryFilter; +class RiuLineSegmentQwtPlotCurve; +class RimAsciiDataCurveAutoName; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimAsciiDataCurve : public RimPlotCurve +{ + CAF_PDM_HEADER_INIT; + +public: + RimAsciiDataCurve(); + virtual ~RimAsciiDataCurve(); + + std::vector yValues() const; + const std::vector& timeSteps() const; + + void setYAxis(RimDefines::PlotAxis plotAxis); + RimDefines::PlotAxis yAxis() const; + void updateQwtPlotAxis(); + + void setTimeSteps(const std::vector& timeSteps); + void setValues(const std::vector& values); + void setTitle(const QString& title); + +protected: + // RimPlotCurve overrides + + virtual QString createCurveAutoName() override; + virtual void updateZoomInParentPlot() override; + virtual void onLoadDataAndUpdate() override; + +private: + bool curveData(std::vector* timeSteps, std::vector* values) const; + +private: + // Fields + caf::PdmField< caf::AppEnum< RimDefines::PlotAxis > > m_plotAxis; + + caf::PdmField< std::vector > m_timeSteps; + caf::PdmField< std::vector > m_values; + caf::PdmField< QString > m_title; +}; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 4356570764..57671e0189 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -28,6 +28,7 @@ #include "RimSummaryPlotCollection.h" #include "RimSummaryTimeAxisProperties.h" #include "RimSummaryYAxisProperties.h" +#include "RimAsciiDataCurve.h" #include "RiuMainPlotWindow.h" #include "RiuSummaryQwtPlot.h" @@ -72,6 +73,9 @@ RimSummaryPlot::RimSummaryPlot() CAF_PDM_InitFieldNoDefault(&m_gridTimeHistoryCurves, "GridTimeHistoryCurves", "", "", "", ""); m_gridTimeHistoryCurves.uiCapability()->setUiTreeHidden(true); + CAF_PDM_InitFieldNoDefault(&m_asciiDataCurves, "AsciiDataCurves", "", "", "", ""); + m_asciiDataCurves.uiCapability()->setUiTreeHidden(true); + CAF_PDM_InitFieldNoDefault(&m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis", "", "", ""); m_leftYAxisProperties.uiCapability()->setUiTreeHidden(true); @@ -359,6 +363,68 @@ QString RimSummaryPlot::asciiDataForPlotExport() const } } + { + std::vector > timeSteps; + + std::vector > > allCurveData; + std::vector > allCurveNames; + //Vectors containing cases - curves - data points/curve name + + for (RimAsciiDataCurve* curve : m_asciiDataCurves) + { + if (!curve->isCurveVisible()) continue; + + size_t casePosInList = cvf::UNDEFINED_SIZE_T; + + if (casePosInList == cvf::UNDEFINED_SIZE_T) + { + std::vector curveTimeSteps = curve->timeSteps(); + timeSteps.push_back(curveTimeSteps); + + std::vector > curveDataForCase; + std::vector curveYData = curve->yValues(); + curveDataForCase.push_back(curveYData); + allCurveData.push_back(curveDataForCase); + + std::vector curveNamesForCase; + curveNamesForCase.push_back(curve->curveName()); + allCurveNames.push_back(curveNamesForCase); + } + else + { + std::vector curveYData = curve->yValues(); + allCurveData[casePosInList].push_back(curveYData); + + QString curveName = curve->curveName(); + allCurveNames[casePosInList].push_back(curveName); + } + } + + for (size_t i = 0; i < timeSteps.size(); i++) //cases + { + out += "\n\n"; + + for (size_t j = 0; j < timeSteps[i].size(); j++) //time steps & data points + { + if (j == 0) + { + out += "Date and time"; + for (size_t k = 0; k < allCurveNames[i].size(); k++) // curves + { + out += "\t" + (allCurveNames[i][k]); + } + } + out += "\n"; + out += QDateTime::fromTime_t(timeSteps[i][j]).toUTC().toString("yyyy-MM-dd hh:mm:ss "); + + for (size_t k = 0; k < allCurveData[i].size(); k++) // curves + { + out += "\t" + QString::number(allCurveData[i][k][j], 'g', 6); + } + } + } + } + return out; } @@ -691,6 +757,21 @@ void RimSummaryPlot::addGridTimeHistoryCurve(RimGridTimeHistoryCurve* curve) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::addAsciiDataCruve(RimAsciiDataCurve* curve) +{ + CVF_ASSERT(curve); + + m_asciiDataCurves.push_back(curve); + if (m_qwtPlot) + { + curve->setParentQwtPlot(m_qwtPlot); + this->updateAxes(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -742,6 +823,7 @@ void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering uiTreeOrdering.add(&m_curveFilters); uiTreeOrdering.add(&m_summaryCurves); uiTreeOrdering.add(&m_gridTimeHistoryCurves); + uiTreeOrdering.add(&m_asciiDataCurves); uiTreeOrdering.skipRemainingChildren(true); } @@ -768,6 +850,11 @@ void RimSummaryPlot::loadDataAndUpdate() curve->loadDataAndUpdate(); } + for (RimAsciiDataCurve* curve : m_asciiDataCurves) + { + curve->loadDataAndUpdate(); + } + this->updateAxes(); updateZoomInQwt(); @@ -867,6 +954,11 @@ QWidget* RimSummaryPlot::createViewWidget(QWidget* mainWindowParent) { curve->setParentQwtPlot(m_qwtPlot); } + + for (RimAsciiDataCurve* curve : m_asciiDataCurves) + { + curve->setParentQwtPlot(m_qwtPlot); + } } return m_qwtPlot; @@ -937,6 +1029,11 @@ void RimSummaryPlot::detachAllCurves() { curve->detachQwtCurve(); } + + for (RimAsciiDataCurve* curve : m_asciiDataCurves) + { + curve->detachQwtCurve(); + } } //-------------------------------------------------------------------------------------------------- @@ -960,6 +1057,14 @@ caf::PdmObject* RimSummaryPlot::findRimCurveFromQwtCurve(const QwtPlotCurve* qwt } } + for (RimAsciiDataCurve* curve : m_asciiDataCurves) + { + if (curve->qwtPlotCurve() == qwtCurve) + { + return curve; + } + } + for (RimSummaryCurveFilter* curveFilter: m_curveFilters) { RimSummaryCurve* foundCurve = curveFilter->findRimCurveFromQwtCurve(qwtCurve); @@ -974,7 +1079,7 @@ caf::PdmObject* RimSummaryPlot::findRimCurveFromQwtCurve(const QwtPlotCurve* qwt //-------------------------------------------------------------------------------------------------- size_t RimSummaryPlot::curveCount() const { - return m_summaryCurves.size() + m_gridTimeHistoryCurves.size(); + return m_summaryCurves.size() + m_gridTimeHistoryCurves.size() + m_asciiDataCurves.size(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h index d4cd5c2284..bfd5f9a7e5 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -36,6 +36,7 @@ class RimSummaryCurveFilter; class RimSummaryYAxisProperties; class RimSummaryTimeAxisProperties; class RimGridTimeHistoryCurve; +class RimAsciiDataCurve; class PdmUiTreeOrdering; class QwtPlotCurve; @@ -61,6 +62,8 @@ public: void addGridTimeHistoryCurve(RimGridTimeHistoryCurve* curve); + void addAsciiDataCruve(RimAsciiDataCurve* curve); + caf::PdmObject* findRimCurveFromQwtCurve(const QwtPlotCurve* curve) const; size_t curveCount() const; @@ -125,6 +128,7 @@ private: caf::PdmChildArrayField m_gridTimeHistoryCurves; caf::PdmChildArrayField m_summaryCurves; caf::PdmChildArrayField m_curveFilters; + caf::PdmChildArrayField m_asciiDataCurves; caf::PdmField m_isAutoZoom; caf::PdmChildField m_leftYAxisProperties; From 2ec68d08fb67b43cf96dcaf636d132a8da7dff28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Fri, 11 Aug 2017 13:56:27 +0200 Subject: [PATCH 54/61] #1690 Add import settings to pasting ASCII data to summary plot --- .../CMakeLists_files.cmake | 2 + .../RicPasteAsciiDataToSummaryPlotFeature.cpp | 41 +++-- .../RicPasteAsciiDataToSummaryPlotFeature.h | 5 +- ...icPasteAsciiDataToSummaryPlotFeatureUi.cpp | 158 ++++++++++++++++++ .../RicPasteAsciiDataToSummaryPlotFeatureUi.h | 86 ++++++++++ 5 files changed, 267 insertions(+), 25 deletions(-) create mode 100644 ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp create mode 100644 ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h diff --git a/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index 4586c8619a..106c69d48c 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -10,6 +10,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.h ${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.h ${CEE_CURRENT_LIST_DIR}RicPasteAsciiDataToSummaryPlotFeature.h +${CEE_CURRENT_LIST_DIR}RicPasteAsciiDataToSummaryPlotFeatureUi.h ${CEE_CURRENT_LIST_DIR}RicViewZoomAllFeature.h ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.h ${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.h @@ -25,6 +26,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.cpp ${CEE_CURRENT_LIST_DIR}RicPasteAsciiDataToSummaryPlotFeature.cpp +${CEE_CURRENT_LIST_DIR}RicPasteAsciiDataToSummaryPlotFeatureUi.cpp ${CEE_CURRENT_LIST_DIR}RicViewZoomAllFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.cpp ${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.cpp diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp index 9af6f2de9c..1df3b7bda6 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp @@ -20,6 +20,7 @@ #include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" #include "RicNewSummaryPlotFeature.h" +#include "RicPasteAsciiDataToSummaryPlotFeatureUi.h" #include "RiaLogging.h" @@ -32,6 +33,8 @@ #include "cafPdmDocument.h" #include "cafPdmObjectGroup.h" #include "cafSelectionManager.h" +#include "cafPdmUiPropertyViewDialog.h" +#include "cafPdmSettings.h" #include "cvfAssert.h" #include "cvfColor3.h" @@ -89,9 +92,18 @@ void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered(bool isChecked) return; } } + + RicPasteAsciiDataToSummaryPlotFeatureUi pasteOptions; + caf::PdmSettings::readFieldsFromApplicationStore(&pasteOptions); + + caf::PdmUiPropertyViewDialog propertyDialog(NULL, &pasteOptions, "Set Paste Options", ""); + if (propertyDialog.exec() != QDialog::Accepted) return; + + caf::PdmSettings::writeFieldsToApplicationStore(&pasteOptions); + QString text = getPastedData(); - std::vector curves = parseCurves(text); + std::vector curves = parseCurves(text, pasteOptions); for (RimAsciiDataCurve* curve : curves) { @@ -138,7 +150,7 @@ bool RicPasteAsciiDataToSummaryPlotFeature::hasPastedText() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurves(QString& data) +std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurves(QString& data, const RicPasteAsciiDataToSummaryPlotFeatureUi& settings) { std::vector curves; std::vector headers; @@ -180,7 +192,7 @@ std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurv // Skip empty lines if (line.isEmpty()) continue; - QStringList columns = line.split('\t'); + QStringList columns = line.split(settings.cellSeparator()); if (columns.size() != numColumns + 1) { @@ -188,7 +200,7 @@ std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurv continue; } - QDateTime date = parseDateString(columns[0]); + QDateTime date = QDateTime::fromString(columns[0], settings.dateFormat()); if (!date.isValid()) { RiaLogging::warning(QString("First column of row %1 could not be parsed as a date: %2").arg(row).arg(columns[0])); @@ -199,7 +211,7 @@ std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurv for (size_t col = 1; col < columns.size(); ++col) { bool ok; - values[col - 1].push_back(columns[static_cast(col)].toDouble(&ok)); + values[col - 1].push_back(settings.decimalLocale().toDouble(columns[static_cast(col)], &ok)); if (!ok) { RiaLogging::warning(QString("Could not parse value at row %1 column %2 as double: %3. Defaulting to 0.0").arg(row).arg(col).arg(columns[static_cast(col)])); @@ -227,10 +239,10 @@ std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurv switch (it.first) { case CURVE_GAS: - color = RimSummaryCurveAppearanceCalculator::cycledRedColor(i); + color = RimSummaryCurveAppearanceCalculator::cycledGreenColor(i); break; case CURVE_OIL: - color = RimSummaryCurveAppearanceCalculator::cycledGreenColor(i); + color = RimSummaryCurveAppearanceCalculator::cycledRedColor(i); break; case CURVE_WAT: color = RimSummaryCurveAppearanceCalculator::cycledBlueColor(i); @@ -246,21 +258,6 @@ std::vector RicPasteAsciiDataToSummaryPlotFeature::parseCurv return curves; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QDateTime RicPasteAsciiDataToSummaryPlotFeature::parseDateString(const QString& date) -{ - QDateTime parsedDate; - - parsedDate = QDateTime::fromString(date, "dd.MM.yyyy hh:mm"); - if (parsedDate.isValid()) return parsedDate; - - parsedDate = QDateTime::fromString(date, "dd.MM.yyyy"); - - return parsedDate; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h index e25c63389d..9e51e39099 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h @@ -29,6 +29,7 @@ class RimSummaryCurve; class RimSummaryCurveFilter; class RimAsciiDataCurve; +class RicPasteAsciiDataToSummaryPlotFeatureUi; //================================================================================================== /// @@ -55,9 +56,7 @@ private: static QString getPastedData(); static bool hasPastedText(); - static std::vector parseCurves(QString& data); - - static QDateTime parseDateString(const QString& date); + static std::vector parseCurves(QString& data, const RicPasteAsciiDataToSummaryPlotFeatureUi& settings); static CurveType guessCurveType(const QString& curveName); }; diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp new file mode 100644 index 0000000000..83f8a5a2c8 --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp @@ -0,0 +1,158 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicPasteAsciiDataToSummaryPlotFeatureUi.h" + +namespace caf { + + template<> + void RicPasteAsciiDataToSummaryPlotFeatureUi::DecimalSeparatorEnum::setUp() + { + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::DECIMAL_DOT, "DOT", "Dot: ."); + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::DECIMAL_COMMA, "COMMA", "Comma: ,"); + setDefault(RicPasteAsciiDataToSummaryPlotFeatureUi::DECIMAL_DOT); + } + + template<> + void RicPasteAsciiDataToSummaryPlotFeatureUi::DateFormatEnum::setUp() + { + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::DATE_DDMMYYYY_DOT_SEPARATED, "dd.MM.yyyy", "Day.Month.Year (dd.MM.yyyy)"); + setDefault(RicPasteAsciiDataToSummaryPlotFeatureUi::DATE_DDMMYYYY_DOT_SEPARATED); + } + + template<> + void RicPasteAsciiDataToSummaryPlotFeatureUi::TimeFormatEnum::setUp() + { + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::TIME_NONE, "NONE", "None"); + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::TIME_HHMM, "hh:mm", "Hour:Minute (hh:mm)"); + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::TIME_HHMMSS, "hh:mm:ss", "Hour:Minute:Second (hh:mm:ss)"); + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::TIME_HHMMSSZZZ, "hh:mm:ss.zzz", "Hour:Minute:Second.Millisecond (hh:mm:ss.zzz)"); + setDefault(RicPasteAsciiDataToSummaryPlotFeatureUi::TIME_NONE); + } + + template<> + void RicPasteAsciiDataToSummaryPlotFeatureUi::CellSeparatorEnum::setUp() + { + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::CELL_TAB, "TAB", "Tab"); + addItem(RicPasteAsciiDataToSummaryPlotFeatureUi::CELL_COMMA, "COMMA", "Comma"); + setDefault(RicPasteAsciiDataToSummaryPlotFeatureUi::CELL_TAB); + } +} + + +CAF_PDM_SOURCE_INIT(RicPasteAsciiDataToSummaryPlotFeatureUi, "RicPasteExcelToSummaryPlotFeatureUi"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicPasteAsciiDataToSummaryPlotFeatureUi::RicPasteAsciiDataToSummaryPlotFeatureUi() +{ + CAF_PDM_InitObject("RicPasteAsciiDataToSummaryPlotFeatureUi", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_decimalSeparator, "DecimalSeparator", "Decimal Separator", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_dateFormat, "DateFormat", "Date Format", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_timeFormat, "TimeFormat", "Time Format", "", "", ""); + CAF_PDM_InitField(&m_useCustomDateFormat, "UseCustomDateFormat", false, "Use Custom Date Format", "", "", ""); + CAF_PDM_InitField(&m_customDateFormat, "CustomDateFormat", QString(), "Custom Date Format", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_cellSeparator, "CellSeparator", "Cell Separator", "", "", ""); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicPasteAsciiDataToSummaryPlotFeatureUi::dateFormat() const +{ + if (m_useCustomDateFormat()) + { + return m_customDateFormat(); + } + else + { + QString format = m_dateFormat().text(); + if (m_timeFormat() != TIME_NONE) + { + format += " " + m_timeFormat().text(); + } + return format; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QLocale RicPasteAsciiDataToSummaryPlotFeatureUi::decimalLocale() const +{ + switch (m_decimalSeparator()) + { + case DECIMAL_COMMA: + return QLocale::Norwegian; + case DECIMAL_DOT: + default: + return QLocale::c(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicPasteAsciiDataToSummaryPlotFeatureUi::cellSeparator() const +{ + switch (m_cellSeparator()) + { + case CELL_COMMA: + return ","; + case CELL_TAB: + default: + return "\t"; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPasteAsciiDataToSummaryPlotFeatureUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +{ + { + caf::PdmUiGroup* valuesGroup = uiOrdering.addNewGroup("Values"); + valuesGroup->add(&m_decimalSeparator); + } + + { + caf::PdmUiGroup* dateGroup = uiOrdering.addNewGroup("Dates"); + dateGroup->add(&m_useCustomDateFormat); + if (m_useCustomDateFormat()) + { + dateGroup->add(&m_customDateFormat); + } + else + { + dateGroup->add(&m_dateFormat); + dateGroup->add(&m_timeFormat); + } + } + + { + caf::PdmUiGroup* cellGroup = uiOrdering.addNewGroup("Cells"); + + cellGroup->add(&m_cellSeparator); + } + + uiOrdering.skipRemainingFields(); +} diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h new file mode 100644 index 0000000000..820c76696c --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmObject.h" +#include "cafPdmField.h" +#include "cafAppEnum.h" + +#include +#include + +//================================================================================================== +/// +//================================================================================================== +class RicPasteAsciiDataToSummaryPlotFeatureUi : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + enum DecimalSeparator + { + DECIMAL_COMMA, + DECIMAL_DOT, + }; + + typedef caf::AppEnum DecimalSeparatorEnum; + + enum DateFormat + { + DATE_DDMMYYYY_DOT_SEPARATED, + }; + + typedef caf::AppEnum DateFormatEnum; + + enum TimeFormat + { + TIME_NONE, + TIME_HHMM, + TIME_HHMMSS, + TIME_HHMMSSZZZ, + }; + + typedef caf::AppEnum TimeFormatEnum; + + enum CellSeparator + { + CELL_COMMA, + CELL_TAB, + }; + + typedef caf::AppEnum CellSeparatorEnum; + +public: + RicPasteAsciiDataToSummaryPlotFeatureUi(); + + QString dateFormat() const; + QLocale decimalLocale() const; + QString cellSeparator() const; + +protected: + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + +private: + caf::PdmField m_decimalSeparator; + caf::PdmField m_dateFormat; + caf::PdmField m_timeFormat; + caf::PdmField m_useCustomDateFormat; + caf::PdmField m_customDateFormat; + caf::PdmField m_cellSeparator; +}; From 63bb85b9982fc7e79c7b44502842cac4fb1ef5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Fri, 11 Aug 2017 15:37:46 +0200 Subject: [PATCH 55/61] #1387 Command to delete existing sour sim data from ResInsight --- .../Commands/CMakeLists_files.cmake | 4 ++ .../Commands/RicDeleteSourSimDataFeature.cpp | 67 +++++++++++++++++++ .../Commands/RicDeleteSourSimDataFeature.h | 40 +++++++++++ .../FileInterface/RifReaderEclipseOutput.cpp | 8 +++ .../RimContextCommandBuilder.cpp | 1 + 5 files changed, 120 insertions(+) create mode 100644 ApplicationCode/Commands/RicDeleteSourSimDataFeature.cpp create mode 100644 ApplicationCode/Commands/RicDeleteSourSimDataFeature.h diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake index 806e5bc397..1e35d7a66f 100644 --- a/ApplicationCode/Commands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CMakeLists_files.cmake @@ -44,6 +44,8 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h ${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h +${CEE_CURRENT_LIST_DIR}RicDeleteSourSimDataFeature.h + ${CEE_CURRENT_LIST_DIR}RicCommandFeature.h ${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h @@ -86,6 +88,8 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp +${CEE_CURRENT_LIST_DIR}RicDeleteSourSimDataFeature.cpp + ${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp ) diff --git a/ApplicationCode/Commands/RicDeleteSourSimDataFeature.cpp b/ApplicationCode/Commands/RicDeleteSourSimDataFeature.cpp new file mode 100644 index 0000000000..acf0191fae --- /dev/null +++ b/ApplicationCode/Commands/RicDeleteSourSimDataFeature.cpp @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicDeleteSourSimDataFeature.h" + +#include "RimEclipseResultCase.h" + +#include "cafSelectionManager.h" + +#include + + +CAF_CMD_SOURCE_INIT(RicDeleteSourSimDataFeature, "RicDeleteSourSimDataFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicDeleteSourSimDataFeature::isCommandEnabled() +{ + return getSelectedEclipseCase() != nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteSourSimDataFeature::onActionTriggered(bool isChecked) +{ + RimEclipseResultCase* eclipseCase = getSelectedEclipseCase(); + + if (eclipseCase == nullptr) return; + + eclipseCase->setSourSimFileName(QString()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteSourSimDataFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Delete SourSim Data"); + actionToSetup->setIcon(QIcon(":/Erase.png")); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseResultCase* RicDeleteSourSimDataFeature::getSelectedEclipseCase() +{ + caf::PdmUiItem* selectedItem = caf::SelectionManager::instance()->selectedItem(); + RimEclipseResultCase* eclipseCase = dynamic_cast(selectedItem); + return eclipseCase; +} diff --git a/ApplicationCode/Commands/RicDeleteSourSimDataFeature.h b/ApplicationCode/Commands/RicDeleteSourSimDataFeature.h new file mode 100644 index 0000000000..c76ea20d01 --- /dev/null +++ b/ApplicationCode/Commands/RicDeleteSourSimDataFeature.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight 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. +// +// ResInsight 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 at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +class RimEclipseResultCase; + +//================================================================================================== +/// +//================================================================================================== +class RicDeleteSourSimDataFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + virtual bool isCommandEnabled(); + virtual void onActionTriggered( bool isChecked ); + virtual void setupActionLook( QAction* actionToSetup ); + +private: + static RimEclipseResultCase* getSelectedEclipseCase(); +}; diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index c426148ac2..2b42f7e325 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -458,6 +458,14 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RifReaderInterface::MATRIX_RESULTS); CVF_ASSERT(matrixModelResults); + if (fileName.isEmpty()) + { + RiaLogging::info("HDF: Removing all existing Sour Sim data ..."); + matrixModelResults->eraseAllSourSimData(); + + return; + } + RiaLogging::info(QString("HDF: Start import of data from : ").arg(fileName)); RiaLogging::info("HDF: Removing all existing Sour Sim data ..."); diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 1ed541ec64..dab7048433 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -410,6 +410,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection() { commandIds << "RicReloadCaseFeature"; commandIds << "RicExecuteScriptForCasesFeature"; + commandIds << "RicDeleteSourSimDataFeature"; } else if (dynamic_cast(uiItem)) { From 6747289a892c31a120b52214f1cd6b6e31431dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Fri, 11 Aug 2017 15:49:38 +0200 Subject: [PATCH 56/61] #1763 Hide soursim file field and result category if HDF5 support is not compiled in --- ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp | 3 +++ .../ProjectDataModel/RimEclipseResultDefinition.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 2b42f7e325..6a16003c34 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -494,7 +494,7 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) if (hdfTimeSteps.size() != m_timeSteps.size()) { RiaLogging::error("HDF: Time step count does not match"); - RiaLogging::error(QString("HDF: Elicpse count %1").arg(m_timeSteps.size())); + RiaLogging::error(QString("HDF: Eclipse count %1").arg(m_timeSteps.size())); RiaLogging::error(QString("HDF: HDF count %1").arg(hdfTimeSteps.size())); return; @@ -509,7 +509,7 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) QString dateStr("yyyy.MMM.ddd hh:mm"); - RiaLogging::error(QString("HDF: Elicpse date %1").arg(m_timeSteps[i].toString(dateStr))); + RiaLogging::error(QString("HDF: Eclipse date %1").arg(m_timeSteps[i].toString(dateStr))); RiaLogging::error(QString("HDF: HDF date %1").arg(hdfTimeSteps[i].toString(dateStr))); isTimeStampsEqual = false; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index d1cfb0a5f6..e12f0b4375 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -77,6 +77,9 @@ RimEclipseResultCase::RimEclipseResultCase() CAF_PDM_InitField(&m_sourSimFileName, "SourSimFileName", QString(), "SourSim File Name", "", "", ""); m_sourSimFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); +#ifndef USE_HDF5 + m_sourSimFileName.uiCapability()->setUiHidden(true); +#endif m_activeCellInfoIsReadFromFile = false; m_gridAndWellDataIsReadFromFile = false; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index f1a0278e58..b2a2923075 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -430,11 +430,16 @@ QList RimEclipseResultDefinition::calculateValueOptions( hasSourSimRLFile = eclResCase->hasSourSimFile(); } +#ifndef USE_HDF5 + // If using ResInsight without HDF5 support, ignore SourSim files and + // do not show it as a result category. + hasSourSimRLFile = false; +#endif + RimGridTimeHistoryCurve* timeHistoryCurve; this->firstAncestorOrThisOfType(timeHistoryCurve); - // Do not include flow diagnostics results if not available or is a time history curve if ( !hasFlowDiagFluxes || timeHistoryCurve != nullptr || !hasSourSimRLFile) { using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >; From 93502706be4d877889a23fc795216712f3082b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Fri, 11 Aug 2017 15:59:19 +0200 Subject: [PATCH 57/61] #1762 SourSimRL: Use *.sourres as filter in file open dialog --- .../ProjectDataModel/RimEclipseResultCase.cpp | 14 ++++++++++++++ .../ProjectDataModel/RimEclipseResultCase.h | 1 + 2 files changed, 15 insertions(+) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index e12f0b4375..938453f5a7 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -521,3 +521,17 @@ void RimEclipseResultCase::fieldChangedByUi(const caf::PdmFieldHandle* changedFi return RimEclipseCase::fieldChangedByUi(changedField, oldValue, newValue); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultCase::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) +{ + if (field == &m_sourSimFileName) + { + caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast(attribute); + if (myAttr) + { + myAttr->m_fileSelectionFilter = "SourSim (*.sourres)"; + } + } +} diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h index 53d45c50b1..a543cb3b1d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.h @@ -61,6 +61,7 @@ public: protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute); private: void loadAndUpdateSourSimData(); From e6fda312551331deb767dfa1e19f190d1ca39714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Fri, 11 Aug 2017 16:08:21 +0200 Subject: [PATCH 58/61] #1761 Use eclipse case directory as default path when selecting SourSim file --- .../ProjectDataModel/RimEclipseResultCase.cpp | 1 + Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp | 9 ++++++++- Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index 938453f5a7..1cda3b867d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -532,6 +532,7 @@ void RimEclipseResultCase::defineEditorAttribute(const caf::PdmFieldHandle* fiel if (myAttr) { myAttr->m_fileSelectionFilter = "SourSim (*.sourres)"; + myAttr->m_defaultPath = QFileInfo(caseFileName()).absolutePath(); } } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp index 40a91b2518..3cc56f4317 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.cpp @@ -154,7 +154,14 @@ void PdmUiFilePathEditor::fileSelectionClicked() QString defaultPath; if ( m_lineEdit->text().isEmpty()) { - defaultPath = QDir::homePath(); + if (m_attributes.m_defaultPath.isNull()) + { + defaultPath = QDir::homePath(); + } + else + { + defaultPath = m_attributes.m_defaultPath; + } } else { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h index 5826cc65cb..410506a4d9 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFilePathEditor.h @@ -61,6 +61,7 @@ public: m_selectSaveFileName = false; m_fileSelectionFilter = "All files (*.* *)"; + m_defaultPath = QString(); m_selectDirectory = false; m_appendUiSelectedFolderToText = false; m_multipleItemSeparator = ';'; @@ -69,6 +70,7 @@ public: bool m_selectSaveFileName; QString m_fileSelectionFilter; + QString m_defaultPath; bool m_selectDirectory; bool m_appendUiSelectedFolderToText; QChar m_multipleItemSeparator; From 993a7c20385cc3b5e65a6430a30dc6e5a04af3ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Mon, 14 Aug 2017 10:24:12 +0200 Subject: [PATCH 59/61] #1760 Add markdown formatted documentation for new Octave interface commands --- .../NNCOctaveInterfaceSpecification.txt | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 OctavePlugin/NNCOctaveInterfaceSpecification.txt diff --git a/OctavePlugin/NNCOctaveInterfaceSpecification.txt b/OctavePlugin/NNCOctaveInterfaceSpecification.txt new file mode 100644 index 0000000000..4a2d71eeb4 --- /dev/null +++ b/OctavePlugin/NNCOctaveInterfaceSpecification.txt @@ -0,0 +1,62 @@ + +#### Matrix[numNNCConnections][2] riGetNNCConnections([CaseId]) + +This function returns a two dimensional matrix containing grid and IJK information about each NNC connection. +Each row contains a from and to cell for the connection. +The cells are specified in a structure defined as: + + CellInfo = { + GridIndex = int # Index of the grid the cell resides in. + # Main grid has index 0. + I, J, K = int # 1-based index address of the cell in the grid. + } + +#### Matrix[numSelectedCells][5] riGetSelectedCells([CaseId]) + +This function returns a two dimensional matrix containing the cell info for each selected cell in the case with `CaseId`. +The columns contain the following information: + + [CaseId, GridIdx, I, J, K] + CaseId # The ID of the case the cell resides in. + GridIdx # The index of the grid the cell resides in. + # Main grid has index 0 + I, J, K # 1-based index of the cell in the grid. + + +If the CaseId is not defined, ResInsight's Current Case is used. + +#### Vector[PropertyInfo] riGetNNCPropertyNames([CaseId]) + +This function returns the name and type of all NNC properties in the case as a vector of structures. + +The structure is defined as: + + PropertyInfo { + PropName = string # Name of the property as received from + # the analysis tool + PropType = string # The type of the property: "StaticNative", + # "DynamicNative", "Generated" + } + +If the CaseId is not defined, ResInsight's Current Case is used. + +#### Matrix[numConnections][numTimestepsRequested] riGetDynamicNNCValues([CaseId], PropertyName, [RequestedTimeSteps]) + +This function returns a two dimensional matrix: [Num Connections][Num Time Steps Requested] containing the value of the requested property from the case with CaseId. The order of connections is the same as the order from `riGetNNCConnectio + +If the CaseId is not defined, ResInsight's Current Case is used. +The RequestedTimeSteps must contain a list of indices to the requested time steps. If not defined, all the timesteps are returned. + +#### Vector[numConnections] riGetStaticNNCValues([CaseId], PropertyName) + +This function returns a vector of values for the requested static property for each NNC connection. The order of connections is the same as the order from `riGetNNCConnections`. + +If the CaseId is not defined, ResInsight's Current Case is used. + +#### riSetNNCProperty(Matrix[numNNCConnections][numTimeSteps], [CaseId], PropertyName, [TimeStepIndices]) + +Interprets the supplied matrix as a property set defined for the NNC connections in the case, and puts the data into ResInsight as a "Generated" property with the name "PropertyName". +The "TimeStepIndices" argument is used to "label" all the steps present in the supplied data matrix and must thus be complete. +The time step data will then be put into ResInsight at the time steps requested. + +If the CaseId is not defined, ResInsight's Current Case is used. From 1ceb6e8effa8ee2edb37772e422bcf13f0541a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 16 Aug 2017 07:41:24 +0200 Subject: [PATCH 60/61] Upped to version 2017.05.2-fdev.02 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index dd90572af4..b225efa5a0 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,7 +1,7 @@ set(RESINSIGHT_MAJOR_VERSION 2017) set(RESINSIGHT_MINOR_VERSION 05) -set(RESINSIGHT_INCREMENT_VERSION "2-fdev.01") +set(RESINSIGHT_INCREMENT_VERSION "2-fdev.02") # https://github.com/CRAVA/crava/tree/master/libs/nrlib From 2febb1ea0b4febcd330af856f6e952c5981181a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 16 Aug 2017 08:42:04 +0200 Subject: [PATCH 61/61] #1760 Add missing documentation of riGetGridPropertyForSelectedCells --- .../NNCOctaveInterfaceSpecification.txt | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/OctavePlugin/NNCOctaveInterfaceSpecification.txt b/OctavePlugin/NNCOctaveInterfaceSpecification.txt index 4a2d71eeb4..9c7ebaa882 100644 --- a/OctavePlugin/NNCOctaveInterfaceSpecification.txt +++ b/OctavePlugin/NNCOctaveInterfaceSpecification.txt @@ -1,16 +1,4 @@ -#### Matrix[numNNCConnections][2] riGetNNCConnections([CaseId]) - -This function returns a two dimensional matrix containing grid and IJK information about each NNC connection. -Each row contains a from and to cell for the connection. -The cells are specified in a structure defined as: - - CellInfo = { - GridIndex = int # Index of the grid the cell resides in. - # Main grid has index 0. - I, J, K = int # 1-based index address of the cell in the grid. - } - #### Matrix[numSelectedCells][5] riGetSelectedCells([CaseId]) This function returns a two dimensional matrix containing the cell info for each selected cell in the case with `CaseId`. @@ -25,6 +13,15 @@ The columns contain the following information: If the CaseId is not defined, ResInsight's Current Case is used. + +#### Matrix[numSelectedCells][numTimestepsRequested] riGetGridPropertyForSelectedCells([CaseId], PropertyName, [RequestedTimeSteps], [PorosityModel = "Matrix"|"Fracture"] ) + +This function returns a two dimensional matrix: [numSelectedCells][numTimestepsRequested] containing the requested property data from the case with CaseId. + +If the CaseId is not defined, ResInsight's Current Case is used. +The RequestedTimeSteps must contain a list of 1-based indices to the requested time steps. If not defined, all the time steps are returned. + + #### Vector[PropertyInfo] riGetNNCPropertyNames([CaseId]) This function returns the name and type of all NNC properties in the case as a vector of structures. @@ -40,6 +37,19 @@ The structure is defined as: If the CaseId is not defined, ResInsight's Current Case is used. + +#### Matrix[numNNCConnections][2] riGetNNCConnections([CaseId]) + +This function returns a two dimensional matrix containing grid and IJK information about each NNC connection. +Each row contains a from and to cell for the connection. +The cells are specified in a structure defined as: + + CellInfo = { + GridIndex = int # Index of the grid the cell resides in. + # Main grid has index 0. + I, J, K = int # 1-based index address of the cell in the grid. + } + #### Matrix[numConnections][numTimestepsRequested] riGetDynamicNNCValues([CaseId], PropertyName, [RequestedTimeSteps]) This function returns a two dimensional matrix: [Num Connections][Num Time Steps Requested] containing the value of the requested property from the case with CaseId. The order of connections is the same as the order from `riGetNNCConnectio @@ -60,3 +70,4 @@ The "TimeStepIndices" argument is used to "label" all the steps present in the s The time step data will then be put into ResInsight at the time steps requested. If the CaseId is not defined, ResInsight's Current Case is used. +