mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
Guard result metadata copy against a main case without results
This commit is contained in:
1 parent
0db64b400b
commit
d3ce3146fd
3 files changed
+48
-2
No files matched your search
@@ -3364,8 +3364,12 @@ void RigCaseCellResultsData::copyResultsMetaDataFromMainCase( RigEclipseCaseData
|
||||
RiaDefines::PorosityModelType poroModel,
|
||||
std::vector<RimEclipseCase*> destinationCases )
|
||||
{
|
||||
std::vector<RigEclipseResultAddress> resAddresses = mainCaseResultsData->results( poroModel )->existingResults();
|
||||
std::vector<RigEclipseTimeStepInfo> timeStepInfos = mainCaseResultsData->results( poroModel )->timeStepInfos( resAddresses[0] );
|
||||
std::vector<RigEclipseResultAddress> resAddresses = mainCaseResultsData->results( poroModel )->existingResults();
|
||||
std::vector<RigEclipseTimeStepInfo> timeStepInfos;
|
||||
if ( !resAddresses.empty() )
|
||||
{
|
||||
timeStepInfos = mainCaseResultsData->results( poroModel )->timeStepInfos( resAddresses[0] );
|
||||
}
|
||||
|
||||
const std::vector<RigEclipseResultInfo> resultInfos = mainCaseResultsData->results( poroModel )->infoForEachResultIndex();
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ set(SOURCE_UNITTEST_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderOpmCommon-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderEclipseSummary-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellInfo-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigEclipseCaseDataTools-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigEclipseCrossPlotDataExtractor-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultTools-Test.cpp
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026 Equinor 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// A main case without any results must not be indexed for its first result.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( RigCaseCellResultsData, CopyResultsMetaDataFromMainCaseWithoutResults )
|
||||
{
|
||||
std::unique_ptr<RimEclipseResultCase> resultCase( new RimEclipseResultCase );
|
||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( resultCase.get() );
|
||||
|
||||
const auto poroModel = RiaDefines::PorosityModelType::MATRIX_MODEL;
|
||||
ASSERT_TRUE( eclipseCase->results( poroModel )->existingResults().empty() );
|
||||
|
||||
RigCaseCellResultsData::copyResultsMetaDataFromMainCase( eclipseCase.p(), poroModel, {} );
|
||||
}
|
||||
Reference in new issue
Block a user