Files
ResInsight/ApplicationLibCode/ProjectDataModel/RimReservoirGridEnsembleSumo.h
T
Jørgen Herje c49f298a7d [ri-cloud-api]: Add grid data from sumo using api (#14653)
Add grid data from Sumo using ri-cloud-api

Load Eclipse grid data (roff) from Sumo as RimReservoirGridEnsemble, one case per realization, with async fetch of grid properties per timestep.

- New: RiaSumoGrid (transport), RifReaderSumoGridProperty (lazy property reader), RimReservoirGridEnsembleSumo, RimRoffCaseSumo, and a "Create Reservoir Grid Ensemble" command.
- Shared grid: IJK dimensions compared before download; one RigMainGrid is reused across the ensemble when they match, each realization still parses its own ACTNUM before releasing geometry.
- Rename folders: Summary/Sumo -> Summary/Cloud, RimSumoDataSource -> Cloud/ (PDM keywords unchanged, old project files still load).
- UI: cloud data sources also shown in the 3D window's Data Sources dock.
- Fix: realizations no longer lost on project reload; realizations missing data are now reported instead of silently skipped.
2026-09-10 10:33:58 +02:00

107 lines
4.5 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimReservoirGridEnsemble.h"
#include "cafPdmField.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrField.h"
#include <QString>
#include <vector>
class RimSumoDataSource;
//==================================================================================================
///
/// RimReservoirGridEnsembleSumo - Grid ensemble of one grid stored on Sumo, one case per realization
///
/// The realizations come from a RimSumoDataSource instead of an ensemble file set. As in the base
/// class the realization cases are not written to the project file, they are recreated from the data
/// source when the project is loaded, see createCaseObjects.
///
/// When all realizations report the same IJK dimensions, one RigMainGrid is kept in memory for the
/// whole ensemble. Every realization still downloads and parses its own grid blob to read its own
/// active cells, then releases the parsed geometry and points at the shared grid, see
/// RimRoffCaseSumo::openEclipseGridFile. Realizations are opened lazily, the first time one is
/// displayed; only the first realization is loaded when the ensemble is created.
///
//==================================================================================================
class RimReservoirGridEnsembleSumo : public RimReservoirGridEnsemble
{
CAF_PDM_HEADER_INIT;
public:
RimReservoirGridEnsembleSumo();
// gridDimensionsAreIdentical decides whether the realizations can share one grid. It comes from the
// dimensions reported by Sumo, so no grid has to be downloaded to decide.
void setSumoSource( RimSumoDataSource* dataSource,
const QString& gridName,
const std::vector<int>& realizations,
bool gridDimensionsAreIdentical );
// The realizations this grid exists for, which is not necessarily every realization of the ensemble.
void setGridRealizations( const std::vector<int>& realizations );
std::vector<int> gridRealizations() const;
// The realizations of the data source this grid has no data for, sorted. The data source decides which
// realizations the ensemble has, without regard for which data types exist for them, so a grid can be
// missing for some of them. Computed on demand: the realization selection can change after the ensemble
// is created, see RimSumoDataSource.
std::vector<int> realizationsWithoutGridData() const;
QString sumoGridName() const;
void createGridCasesFromSumoSource();
bool doComputeMobileVolumeWeightedMean() const override;
void setDoComputeMobileVolumeWeightedMean( bool enable ) override;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
void createCaseObjects() override;
bool detectGridDimensionEquality() override;
void loadGridsInSharedMode() override;
void setupBeforeSave() override;
private:
QString missingGridDataText() const;
private:
caf::PdmPtrField<RimSumoDataSource*> m_sumoDataSource;
caf::PdmField<QString> m_gridName;
// The realizations to create cases for, in the order the cases appear. The cases themselves are not
// written to the project file, see the class comment.
caf::PdmField<std::vector<int>> m_realizations;
caf::PdmField<std::vector<int>> m_gridRealizations;
// Reports the realizations without grid data. A proxy field, so it follows a changed realization
// selection instead of going stale.
caf::PdmProxyValueField<QString> m_missingGridDataInfo;
caf::PdmField<bool> m_gridDimensionsAreIdentical;
caf::PdmField<bool> m_doComputeMobileVolumeWeightedMean;
};