///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2024 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RimNamedObject.h" #include "Cloud/RiaSumoConnector.h" #include "cafPdmProxyValueField.h" //================================================================================================== // // Common data source describing a single Sumo ensemble. Holds the information required both for // summary ensembles (vector names) and for grid case ensembles (asset, grid names). The available // ensemble realizations - fetched from the realizations endpoint - are the source of truth, and the // user selects a subset of them ("ensemble selection"). Both summary and grid consumers listen to // the selected realization id subset. All values are populated by RimCloudDataSourceCollection, // which owns the RiaSumoConnector; this object does not talk to the connector directly. // //================================================================================================== class RimSumoDataSource : public RimNamedObject { CAF_PDM_HEADER_INIT; public: RimSumoDataSource(); SumoCaseId caseId() const; void setCaseId( const SumoCaseId& caseId ); QString assetName() const; void setAssetName( const QString& assetName ); QString caseName() const; void setCaseName( const QString& caseName ); QString ensembleName() const; void setEnsembleName( const QString& ensembleName ); // All realizations available for the ensemble (the source of truth). std::vector availableRealizationIds() const; void setAvailableRealizationIds( const std::vector& realizationIds ); // Whether the realizations have been fetched from Sumo. They are not written to the project file, so a // data source read back from one starts out without them, see // RimCloudDataSourceCollection::refreshDataSourcesFromSumo. Ask this rather than testing // availableRealizationIds() for emptiness: an empty list cannot tell "not fetched" from "fetched, and the // ensemble has none", and reading the first as the second removes the realization cases of every ensemble // created from this data source. bool hasFetchedRealizations() const; // The subset of realizations matching the realization filter. Both summary and grid creation listen to this. std::vector selectedRealizationIds() const; // Available summary vectors for the ensemble. Not shown in the UI, but used to populate the // ensemble's available result addresses (RimSummaryEnsembleSumo::updateResultAddresses). std::vector vectorNames() const; void setVectorNames( const std::vector& vectorNames ); std::vector gridNames() const; void setGridNames( const std::vector& gridNames ); QString selectedGridName() const; void setSelectedGridName( const QString& gridName ); bool doComputeMobileVolumeWeightedMean() const; void updateName(); private: void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void onRealizationFilterChanged(); void updateGridCaseEnsembles(); QString realizationFilterInfoText() const; QString availableRealizationsRangeText() const; private: caf::PdmField m_caseId; caf::PdmField m_assetName; caf::PdmField m_caseName; caf::PdmField m_ensembleName; caf::PdmField m_customName; caf::PdmField> m_availableRealizationIds; // Runtime only, deliberately not a PdmField: it describes whether this session has fetched the // realizations, which is never true for a data source just read from a project file. bool m_hasFetchedRealizations = false; caf::PdmField m_realizationFilter; caf::PdmProxyValueField m_realizationFilterInfo; caf::PdmField> m_vectorNames; caf::PdmField> m_gridNames; caf::PdmField m_selectedGridName; caf::PdmField m_doComputeMobileVolumeWeightedMean; };