mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
This commit is contained in:
@@ -59,6 +59,8 @@ public:
|
||||
|
||||
virtual cvf::Vec3d displayModelOffset() const;
|
||||
|
||||
virtual void updateFormationNamesData() = 0;
|
||||
|
||||
private:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override { return &caseUserDescription; }
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace caf
|
||||
addItem(RimDefines::STATIC_NATIVE, "STATIC_NATIVE", "Static");
|
||||
addItem(RimDefines::GENERATED, "GENERATED", "Generated");
|
||||
addItem(RimDefines::INPUT_PROPERTY, "INPUT_PROPERTY", "Input Property");
|
||||
|
||||
addItem(RimDefines::FORMATION_NAMES, "FORMATION_NAMES", "Formation Names");
|
||||
setDefault(RimDefines::DYNAMIC_NATIVE);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
STATIC_NATIVE,
|
||||
GENERATED,
|
||||
INPUT_PROPERTY,
|
||||
FORMATION_NAMES,
|
||||
REMOVED
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
@@ -283,6 +284,30 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(changedField == &activeFormationNames)
|
||||
{
|
||||
updateFormationNamesData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCase::updateFormationNamesData()
|
||||
{
|
||||
RigCaseData* rigEclipseCase = reservoirData();
|
||||
if(rigEclipseCase)
|
||||
{
|
||||
if(activeFormationNames())
|
||||
{
|
||||
rigEclipseCase->setActiveFormationNames(activeFormationNames()->formationNamesData());
|
||||
}
|
||||
else
|
||||
{
|
||||
rigEclipseCase->setActiveFormationNames(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -303,9 +328,14 @@ void RimEclipseCase::computeCachedData()
|
||||
rigEclipseCase->mainGrid()->computeCachedData();
|
||||
pInf.incrementProgress();
|
||||
|
||||
pInf.setNextProgressIncrement(17);
|
||||
pInf.setProgressDescription("Calculating faults");
|
||||
rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
|
||||
pInf.incrementProgress();
|
||||
|
||||
pInf.setProgressDescription("Calculating Formation Names Result");
|
||||
this->updateFormationNamesData();
|
||||
pInf.incrementProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,8 @@ protected:
|
||||
virtual void initAfterRead();
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||
|
||||
virtual void updateFormationNamesData() override;
|
||||
|
||||
// Internal methods
|
||||
protected:
|
||||
void computeCachedData();
|
||||
|
||||
@@ -453,6 +453,11 @@ bool RimEclipseResultDefinition::isTernarySaturationSelected() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::hasCategoryResult() const
|
||||
{
|
||||
if (this->m_resultType() == RimDefines::FORMATION_NAMES
|
||||
&& m_eclipseCase
|
||||
&& m_eclipseCase->reservoirData()
|
||||
&& m_eclipseCase->reservoirData()->activeFormationNames() ) return true;
|
||||
|
||||
if (!this->hasStaticResult()) return false;
|
||||
|
||||
return this->resultVariable().contains("NUM", Qt::CaseInsensitive);
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <limits.h>
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
|
||||
|
||||
@@ -990,7 +991,20 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
|
||||
{
|
||||
size_t adjustedTimeStep = m_currentTimeStep;
|
||||
if (resultColors->hasStaticResult()) adjustedTimeStep = 0;
|
||||
resultColors->legendConfig()->setCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()), cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex(), adjustedTimeStep));
|
||||
|
||||
if(resultColors->resultType() != RimDefines::FORMATION_NAMES)
|
||||
{
|
||||
resultColors->legendConfig()->setCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()),
|
||||
cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex(), adjustedTimeStep));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector =
|
||||
eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
|
||||
std::set<int> nameIndices;
|
||||
for(int i = 0; i < fnVector.size(); ++i) nameIndices.insert(i);
|
||||
resultColors->legendConfig()->setCategories(nameIndices, nameIndices);
|
||||
}
|
||||
}
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "RimFormationNames.h"
|
||||
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
@@ -50,40 +50,3 @@ private:
|
||||
|
||||
cvf::ref<RigFormationNames> m_formationNamesData;
|
||||
};
|
||||
|
||||
class RigFormationNames: public cvf::Object
|
||||
{
|
||||
public:
|
||||
int formationIndexFromKLayerIdx(size_t Kidx)
|
||||
{
|
||||
if(Kidx >= m_nameIndexPrKLayer.size()) return -1;
|
||||
return m_nameIndexPrKLayer[Kidx];
|
||||
}
|
||||
|
||||
QString formationNameFromKLayerIdx(size_t Kidx)
|
||||
{
|
||||
int idx = formationIndexFromKLayerIdx(Kidx);
|
||||
if (idx >= m_formationNames.size()) return "";
|
||||
if (idx == -1) return "";
|
||||
|
||||
return m_formationNames[idx];
|
||||
}
|
||||
|
||||
void appendFormationRange(const QString& name, int kStartIdx, int kEndIdx)
|
||||
{
|
||||
CVF_ASSERT(kStartIdx <= kEndIdx);
|
||||
int nameIdx = static_cast<int>(m_formationNames.size());
|
||||
m_formationNames.push_back(name);
|
||||
if (kEndIdx >= static_cast<int>(m_nameIndexPrKLayer.size())) m_nameIndexPrKLayer.resize(kEndIdx + 1, -1);
|
||||
|
||||
for (int kIdx = kStartIdx; kIdx <= kEndIdx; ++kIdx)
|
||||
{
|
||||
m_nameIndexPrKLayer[kIdx] = nameIdx;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::vector<int> m_nameIndexPrKLayer;
|
||||
std::vector<QString> m_formationNames;
|
||||
};
|
||||
|
||||
@@ -27,12 +27,14 @@
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimFormationNames.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
@@ -114,7 +116,10 @@ bool RimGeoMechCase::openGeoMechCase(std::string* errorMessage)
|
||||
// Also, several places is checked for this data to validate availability of data
|
||||
m_geoMechCaseData = NULL;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
this->updateFormationNamesData();
|
||||
}
|
||||
return fileOpenSuccess;
|
||||
}
|
||||
|
||||
@@ -240,6 +245,36 @@ std::vector<QDateTime> RimGeoMechCase::dateTimeVectorFromTimeStepStrings(const Q
|
||||
return dates;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if(changedField == &activeFormationNames)
|
||||
{
|
||||
updateFormationNamesData();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechCase::updateFormationNamesData()
|
||||
{
|
||||
RigGeoMechCaseData* rigCaseData = geoMechData();
|
||||
if(rigCaseData && rigCaseData->femPartResults())
|
||||
{
|
||||
if(activeFormationNames())
|
||||
{
|
||||
rigCaseData->femPartResults()->setActiveFormationNames(activeFormationNames()->formationNamesData());
|
||||
}
|
||||
else
|
||||
{
|
||||
rigCaseData->femPartResults()->setActiveFormationNames(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -69,7 +69,13 @@ public:
|
||||
|
||||
static std::vector<QDateTime> dateTimeVectorFromTimeStepStrings(const QStringList& timeStepStrings);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
virtual void updateFormationNamesData() override;
|
||||
|
||||
virtual void initAfterRead();
|
||||
static QString subStringOfDigits(const QString& timeStepString, int numberOfDigitsToFind);
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ void caf::AppEnum< RigFemResultPosEnum >::setUp()
|
||||
addItem(RIG_NODAL, "NODAL", "Nodal");
|
||||
addItem(RIG_ELEMENT_NODAL, "ELEMENT_NODAL", "Element Nodal");
|
||||
addItem(RIG_INTEGRATION_POINT,"INTEGRATION_POINT","Integration Point");
|
||||
addItem(RIG_FORMATION_NAMES, "FORMATION_NAMES", "Formation Names");
|
||||
setDefault(RIG_NODAL);
|
||||
}
|
||||
}
|
||||
@@ -143,7 +144,6 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
{
|
||||
m_resultVariableUiField = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Get the possible property filter owner
|
||||
|
||||
@@ -60,6 +60,8 @@ public:
|
||||
QString resultFieldUiName();
|
||||
QString resultComponentUiName();
|
||||
|
||||
bool hasCategoryResult() { return m_resultPositionType() == RIG_FORMATION_NAMES; }
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGeoMechView, "GeoMechView");
|
||||
@@ -418,7 +419,17 @@ void RimGeoMechView::updateLegends()
|
||||
|
||||
cellResult()->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
cellResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if (cellResult()->hasCategoryResult())
|
||||
{
|
||||
const std::vector<QString>& fnVector =
|
||||
gmCase->femPartResults()->activeFormationNames()->formationNames();
|
||||
std::set<int> nameIndices;
|
||||
for (int i = 0; i < fnVector.size(); ++i) nameIndices.insert(i);
|
||||
|
||||
cellResult()->legendConfig->setCategories(nameIndices, nameIndices);
|
||||
}
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend());
|
||||
|
||||
cvf::String legendTitle = cvfqt::Utils::toString(
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "cvfScalarMapperDiscreteLog.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "RimGeoMechCellColors.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
|
||||
@@ -757,11 +758,17 @@ QList<caf::PdmOptionItemInfo> RimLegendConfig::calculateValueOptions(const caf::
|
||||
QStringList optionTexts;
|
||||
|
||||
bool isCategoryResult = false;
|
||||
RimEclipseCellColors* cellColors = NULL;
|
||||
this->firstAnchestorOrThisOfType(cellColors);
|
||||
if (cellColors && cellColors->hasCategoryResult())
|
||||
{
|
||||
isCategoryResult = true;
|
||||
RimEclipseCellColors* eclCellColors = nullptr;
|
||||
this->firstAnchestorOrThisOfType(eclCellColors);
|
||||
RimGeoMechCellColors* gmCellColors = nullptr;
|
||||
this->firstAnchestorOrThisOfType(gmCellColors);
|
||||
|
||||
if ( ( eclCellColors && eclCellColors->hasCategoryResult())
|
||||
|| ( gmCellColors && gmCellColors->hasCategoryResult()) )
|
||||
{
|
||||
isCategoryResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldNeedingOptions == &m_mappingMode)
|
||||
|
||||
Reference in New Issue
Block a user