Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustments for release #10921

Merged
merged 6 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ResInsightWithCache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ env.BUILDCACHE_DIR }}
key: ${{ matrix.config.os }}-${{ matrix.config.cc }}-cache-v02-${{ steps.current-time.outputs.formattedTime }}
key: ${{ matrix.config.os }}-${{ matrix.config.cc }}-cache-v03-${{ steps.current-time.outputs.formattedTime }}
- name: Create Folder for buildcache
run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force
shell: pwsh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicPasteEclipseViewsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteGeoMechViewsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteIntersectionsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteCellFiltersFeature.h
)

set(SOURCE_GROUP_SOURCE_FILES
Expand All @@ -16,6 +17,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicPasteEclipseViewsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteGeoMechViewsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteIntersectionsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteCellFiltersFeature.cpp
)

list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "RicCopyReferencesToClipboardFeature.h"

#include "RimBoxIntersection.h"
#include "RimCellFilter.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimEnsembleCurveSet.h"
Expand Down Expand Up @@ -136,6 +137,7 @@ bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported( caf::PdmObjec
if ( dynamic_cast<RimGridCrossPlotDataSet*>( pdmObject ) ) return true;
if ( dynamic_cast<RimModeledWellPath*>( pdmObject ) ) return true;
if ( dynamic_cast<RimSummaryMultiPlot*>( pdmObject ) ) return true;
if ( dynamic_cast<RimCellFilter*>( pdmObject ) ) return true;

// Copy support based combined logic
RimWellAllocationPlot* wellAllocPlot = pdmObject->firstAncestorOrThisOfType<RimWellAllocationPlot>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- 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 "RicPasteCellFiltersFeature.h"

#include "RicPasteFeatureImpl.h"

#include "RimCase.h"
#include "RimCellFilter.h"
#include "RimCellFilterCollection.h"

#include "cafPdmObjectGroup.h"
#include "cafPdmPointer.h"
#include "cafSelectionManager.h"

#include <QAction>

CAF_CMD_SOURCE_INIT( RicPasteCellFiltersFeature, "RicPasteCellFiltersFeature" );

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPasteCellFiltersFeature::isCommandEnabled() const
{
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );

std::vector<caf::PdmPointer<RimCellFilter>> typedObjects;
objectGroup.objectsByType( &typedObjects );
if ( typedObjects.empty() )
{
return false;
}

if ( dynamic_cast<RimCellFilterCollection*>( caf::SelectionManager::instance()->selectedItem() ) )
{
return true;
}

return false;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteCellFiltersFeature::onActionTriggered( bool isChecked )
{
auto cellFilterCollection = dynamic_cast<RimCellFilterCollection*>( caf::SelectionManager::instance()->selectedItem() );
if ( !cellFilterCollection ) return;

auto eclipseCase = cellFilterCollection->firstAncestorOfType<RimCase>();

caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );

for ( auto obj : objectGroup.objects )
{
auto duplicatedObject =
dynamic_cast<RimCellFilter*>( obj->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );

if ( duplicatedObject )
{
cellFilterCollection->addFilterAndNotifyChanges( duplicatedObject, eclipseCase );
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteCellFiltersFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Paste Filter" );

RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteCellFiltersFeature::pasteGeometryCellFilters( RimCellFilterCollection* cellFilterCollection )
{
if ( !cellFilterCollection ) return;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- 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.
//
/////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "cafCmdFeature.h"

class RimCellFilterCollection;

//==================================================================================================
///
//==================================================================================================
class RicPasteCellFiltersFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

protected:
bool isCommandEnabled() const override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;

private:
void pasteGeometryCellFilters( RimCellFilterCollection* cellFilterCollection );
};
24 changes: 17 additions & 7 deletions ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ bool RifOpmCommonEclipseSummary::open( const QString& fileName, bool includeRest
{
auto temporarySummaryFile = std::make_unique<Opm::EclIO::ESmry>( smspecFileName.toStdString(), includeRestartFiles );

temporarySummaryFile->make_esmry_file();
if ( temporarySummaryFile->numberOfTimeSteps() > 0 )
{
temporarySummaryFile->make_esmry_file();
}

RifOpmCommonEclipseSummary::increaseEsmryFileCount();
}
Expand Down Expand Up @@ -214,15 +217,22 @@ void RifOpmCommonEclipseSummary::buildMetaData()

if ( m_enhancedReader )
{
keywords = m_enhancedReader->keywordList();
startOfSimulation = m_enhancedReader->startdate();
daysSinceStartOfSimulation = m_enhancedReader->get( "TIME" );
keywords = m_enhancedReader->keywordList();
startOfSimulation = m_enhancedReader->startdate();

if ( m_enhancedReader->numberOfTimeSteps() > 0 )
{
daysSinceStartOfSimulation = m_enhancedReader->get( "TIME" );
}
}
else if ( m_standardReader )
{
keywords = m_standardReader->keywordList();
startOfSimulation = m_standardReader->startdate();
daysSinceStartOfSimulation = m_standardReader->get( "TIME" );
keywords = m_standardReader->keywordList();
startOfSimulation = m_standardReader->startdate();
if ( m_standardReader->numberOfTimeSteps() > 0 )
{
daysSinceStartOfSimulation = m_standardReader->get( "TIME" );
}
}

const auto startAsTimeT = std::chrono::system_clock::to_time_t( startOfSimulation );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,16 @@ RimUserDefinedIndexFilter* RimCellFilterCollection::addNewUserDefinedIndexFilter
return pFilter;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCellFilterCollection::addFilterAndNotifyChanges( RimCellFilter* pFilter, RimCase* srcCase )
{
addFilter( pFilter );
pFilter->setCase( srcCase );
onFilterUpdated( pFilter );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class RimCellFilterCollection : public caf::PdmObject
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
RimUserDefinedIndexFilter* addNewUserDefinedIndexFilter( RimCase* srcCase, const std::vector<size_t>& defCellIndexes = {} );

void addFilterAndNotifyChanges( RimCellFilter* pFilter, RimCase* srcCase );
void removeFilter( RimCellFilter* filter );
void notifyGridReload();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
}
else if ( dynamic_cast<RimCellFilterCollection*>( firstUiItem ) )
{
menuBuilder << "RicPasteCellFiltersFeature";
menuBuilder << "Separator";
menuBuilder << "RicNewPolygonFilterFeature";
menuBuilder << "RicNewUserDefinedFilterFeature";
menuBuilder << "RicNewUserDefinedIndexFilterFeature";
Expand Down
5 changes: 4 additions & 1 deletion ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ void RimEclipseCellColors::changeLegendConfig( QString resultVarNameOfNewLegend
int caseId = 0;
if ( eclipseCase() ) caseId = eclipseCase()->caseId();

auto newLegend = createLegendForResult( caseId, resultVarNameOfNewLegend, m_useDiscreteLogLevels, hasCategoryResult() );
bool useCategoryLegend = hasCategoryResult();
if ( m_resultType() == RiaDefines::ResultCatType::FORMATION_NAMES ) useCategoryLegend = true;

auto newLegend = createLegendForResult( caseId, resultVarNameOfNewLegend, m_useDiscreteLogLevels, useCategoryLegend );

newLegend->changed.connect( this, &RimEclipseCellColors::onLegendConfigChanged );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ double RimSummaryCurve::computeCurveZValue()
{
zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE );
}
else if ( sumCase->ensemble() )
else if ( firstAncestorOrThisOfType<RimEnsembleCurveSetCollection>() )
{
zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_CURVE );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ void RigVisibleCategoriesCalculator::appendVisibleIntersectionCells( RimEclipseV

for ( const auto geoGenerator : intersectionGeoGenerators )
{
if ( !geoGenerator->isAnyGeometryPresent() ) continue;

for ( const auto& cIdx : geoGenerator->triangleToCellIndex() )
{
visibleCells.insert( cIdx );
Expand Down
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions ApplicationLibCode/UnitTests/opm-summary-Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "opm/io/eclipse/ExtESmry.hpp"

#include <QDebug>
#include <QFile>

static const QString H5_TEST_DATA_DIRECTORY = QString( "%1/h5-file/" ).arg( TEST_DATA_DIR );

Expand Down Expand Up @@ -295,6 +296,20 @@ TEST( OpmSummaryTests, OpmComputeSegmentTopology )
}
}

TEST( OpmSummaryTests, OpenEmptySummaryFile )
{
QString SUMMARY_TEST_DATA_DIRECTORY = QString( "%1/SummaryData/empty-file/" ).arg( TEST_DATA_DIR );
QString rootPath = SUMMARY_TEST_DATA_DIRECTORY + "BLASTO_PRED-19";
QString smspecFilePath = rootPath + ".SMSPEC";

Opm::EclIO::ESmry eSmry( smspecFilePath.toStdString() );

// Test to verify that is is possible to read an empty summary file
// eSmry.make_esmry_file() will fail if the summary file is empty

EXPECT_TRUE( eSmry.numberOfTimeSteps() == 0 );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion ResInsightVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(RESINSIGHT_PATCH_VERSION 0)

# Opional text with no restrictions
#set(RESINSIGHT_VERSION_TEXT "-dev")
set(RESINSIGHT_VERSION_TEXT "-RC_02")
set(RESINSIGHT_VERSION_TEXT "-RC_03")

# Optional text
# Must be unique and increasing within one combination of major/minor/patch version
Expand Down