mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Update opm-flowdiagnostics-application to include handling of new Ert
This commit is contained in:
@@ -14,7 +14,7 @@ set(ERT_GITHUB_SHA "e2a5a9cc20705537d07822958d925e092a323367")
|
|||||||
set(OPM_FLOWDIAGNOSTICS_SHA "a14dc4ba1302bcc1e0aeb35c5de6b4bd39bce98")
|
set(OPM_FLOWDIAGNOSTICS_SHA "a14dc4ba1302bcc1e0aeb35c5de6b4bd39bce98")
|
||||||
|
|
||||||
# https://github.com/OPM/opm-flowdiagnostics-applications
|
# https://github.com/OPM/opm-flowdiagnostics-applications
|
||||||
set(OPM_FLOWDIAGNOSTICS_APPLICATIONS_SHA "afd3f6c454f52dcfa0a6aa96be9823176a6daa48")
|
set(OPM_FLOWDIAGNOSTICS_APPLICATIONS_SHA "1b521494ce9c09a1286dd0a81a1333caa123c680")
|
||||||
|
|
||||||
# https://github.com/OPM/opm-parser/blob/master/opm/parser/eclipse/Units/Units.hpp
|
# https://github.com/OPM/opm-parser/blob/master/opm/parser/eclipse/Units/Units.hpp
|
||||||
# This file was moved from opm-core to opm-parser october 2016
|
# This file was moved from opm-core to opm-parser october 2016
|
||||||
|
|||||||
@@ -73,6 +73,35 @@ include (${project}-prereqs)
|
|||||||
include (CMakeLists_files.cmake)
|
include (CMakeLists_files.cmake)
|
||||||
|
|
||||||
macro (config_hook)
|
macro (config_hook)
|
||||||
|
if (NOT ERT_FOUND)
|
||||||
|
set (HAVE_ERT_ECL_TYPE_H 0)
|
||||||
|
else ()
|
||||||
|
# ERT_FOUND
|
||||||
|
cmake_push_check_state ()
|
||||||
|
|
||||||
|
set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR})
|
||||||
|
set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES})
|
||||||
|
|
||||||
|
check_cxx_source_compiles (
|
||||||
|
"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <ert/ecl/ecl_kw.h>
|
||||||
|
#include <ert/ecl/ecl_type.h>
|
||||||
|
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
ecl_kw_type* kw = nullptr;
|
||||||
|
|
||||||
|
std::cout << ecl_type_get_type(ecl_kw_get_data_type(kw)) << std::endl;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
HAVE_ERT_ECL_TYPE_H)
|
||||||
|
|
||||||
|
cmake_pop_check_state ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
list (APPEND "${project}_CONFIG_VARS" HAVE_ERT_ECL_TYPE_H)
|
||||||
endmacro (config_hook)
|
endmacro (config_hook)
|
||||||
|
|
||||||
macro (prereqs_hook)
|
macro (prereqs_hook)
|
||||||
|
|||||||
@@ -46,11 +46,27 @@
|
|||||||
#include <ert/ecl/ecl_util.h>
|
#include <ert/ecl/ecl_util.h>
|
||||||
#include <ert/util/ert_unique_ptr.hpp>
|
#include <ert/util/ert_unique_ptr.hpp>
|
||||||
|
|
||||||
|
#if defined(HAVE_ERT_ECL_TYPE_H) && HAVE_ERT_ECL_TYPE_H
|
||||||
|
#include <ert/ecl/ecl_type.h>
|
||||||
|
#endif // defined(HAVE_ERT_ECL_TYPE_H) && HAVE_ERT_ECL_TYPE_H
|
||||||
|
|
||||||
/// \file
|
/// \file
|
||||||
///
|
///
|
||||||
/// Implementation of ECL Result-Set Interface.
|
/// Implementation of ECL Result-Set Interface.
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
inline ecl_type_enum
|
||||||
|
getKeywordElementType(const ecl_kw_type* kw)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_ERT_ECL_TYPE_H) && HAVE_ERT_ECL_TYPE_H
|
||||||
|
return ecl_type_get_type(ecl_kw_get_data_type(kw));
|
||||||
|
|
||||||
|
#else // ! (defined(HAVE_ERT_ECL_TYPE_H) && HAVE_ERT_ECL_TYPE_H)
|
||||||
|
|
||||||
|
return ecl_kw_get_type(kw);
|
||||||
|
#endif // defined(HAVE_ERT_ECL_TYPE_H) && HAVE_ERT_ECL_TYPE_H
|
||||||
|
}
|
||||||
|
|
||||||
namespace ECLImpl {
|
namespace ECLImpl {
|
||||||
using FilePtr = ::ERT::ert_unique_ptr<ecl_file_type, ecl_file_close>;
|
using FilePtr = ::ERT::ert_unique_ptr<ecl_file_type, ecl_file_close>;
|
||||||
|
|
||||||
@@ -294,7 +310,7 @@ namespace {
|
|||||||
static std::vector<T>
|
static std::vector<T>
|
||||||
as(const ecl_kw_type* kw, std::false_type)
|
as(const ecl_kw_type* kw, std::false_type)
|
||||||
{
|
{
|
||||||
assert (ecl_kw_get_type(kw) == Input);
|
assert (getKeywordElementType(kw) == Input);
|
||||||
|
|
||||||
return Details::getData<
|
return Details::getData<
|
||||||
T, typename Details::ElementType<Input>::type
|
T, typename Details::ElementType<Input>::type
|
||||||
@@ -352,7 +368,7 @@ namespace {
|
|||||||
static std::vector<std::string>
|
static std::vector<std::string>
|
||||||
as(const ecl_kw_type* kw, std::true_type)
|
as(const ecl_kw_type* kw, std::true_type)
|
||||||
{
|
{
|
||||||
assert (ecl_kw_get_type(kw) == ECL_CHAR_TYPE);
|
assert (getKeywordElementType(kw) == ECL_CHAR_TYPE);
|
||||||
|
|
||||||
auto result = std::vector<std::string>{};
|
auto result = std::vector<std::string>{};
|
||||||
result.reserve(ecl_kw_get_size(kw));
|
result.reserve(ecl_kw_get_size(kw));
|
||||||
@@ -758,7 +774,7 @@ namespace Opm {
|
|||||||
const auto makeStringVector =
|
const auto makeStringVector =
|
||||||
typename std::is_same<T, std::string>::type{};
|
typename std::is_same<T, std::string>::type{};
|
||||||
|
|
||||||
switch (ecl_kw_get_type(kw)) {
|
switch (getKeywordElementType(kw)) {
|
||||||
case ECL_CHAR_TYPE:
|
case ECL_CHAR_TYPE:
|
||||||
return ECLImpl::GetKeywordData<ECL_CHAR_TYPE>::
|
return ECLImpl::GetKeywordData<ECL_CHAR_TYPE>::
|
||||||
as<T>(kw, makeStringVector);
|
as<T>(kw, makeStringVector);
|
||||||
|
|||||||
Reference in New Issue
Block a user