mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#837 GeoMech: Added formation property filter. Moved some functionality to RimCellFilter
This commit is contained in:
parent
384a8cc8e7
commit
b3f036fb0e
@ -18,23 +18,27 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivFemElmVisibilityCalculator.h"
|
||||
#include "cvfBase.h"
|
||||
|
||||
#include "RigCaseToCaseCellMapper.h"
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartGrid.h"
|
||||
#include "cvfStructGrid.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RigCaseToCaseCellMapper.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfStructGrid.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -109,46 +113,35 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
{
|
||||
RimGeoMechPropertyFilter* propertyFilter = propFilterColl->propertyFilters()[i];
|
||||
|
||||
const RimCellFilter::FilterModeType filterType = propertyFilter->filterMode();
|
||||
|
||||
RigGeoMechCaseData* caseData = propFilterColl->reservoirView()->geoMechCase()->geoMechData();
|
||||
|
||||
RigFemResultAddress resVarAddress = propertyFilter->resultDefinition->resultAddress();
|
||||
|
||||
const std::vector<float>& resVals = caseData->femPartResults()->resultValues(resVarAddress,
|
||||
grid->elementPartId(),
|
||||
timeStepIndex);
|
||||
|
||||
if (propertyFilter->isActive() && propertyFilter->resultDefinition->hasResult())
|
||||
{
|
||||
const double lowerBound = propertyFilter->lowerBound();
|
||||
const double upperBound = propertyFilter->upperBound();
|
||||
|
||||
RigFemResultAddress resVarAddress = propertyFilter->resultDefinition->resultAddress();
|
||||
|
||||
// Do a "Hack" to use elm nodal and not nodal POR results
|
||||
if (resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar") resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
|
||||
|
||||
const RimCellFilter::FilterModeType filterType = propertyFilter->filterMode();
|
||||
|
||||
RigGeoMechCaseData* caseData = propFilterColl->reservoirView()->geoMechCase()->geoMechData();
|
||||
|
||||
const std::vector<float>& resVals = caseData->femPartResults()->resultValues(resVarAddress,
|
||||
grid->elementPartId(),
|
||||
timeStepIndex);
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||
if (propertyFilter->resultDefinition->resultAddress().resultPosType == RIG_FORMATION_NAMES)
|
||||
{
|
||||
if ( (*cellVisibility)[cellIndex] )
|
||||
std::vector<int> integerVector = propertyFilter->selectedCategoryValues();
|
||||
std::set<int> integerSet;
|
||||
for (auto val : integerVector)
|
||||
{
|
||||
RigElementType eType = grid->elementType(cellIndex);
|
||||
int elmNodeCount = RigFemTypes::elmentNodeCount(eType);
|
||||
integerSet.insert(val);
|
||||
}
|
||||
|
||||
const int* elmNodeIndices = grid->connectivities(cellIndex);
|
||||
for(int enIdx = 0; enIdx < elmNodeCount; ++enIdx)
|
||||
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||
{
|
||||
if ((*cellVisibility)[cellIndex])
|
||||
{
|
||||
size_t resultValueIndex = cvf::UNDEFINED_SIZE_T;
|
||||
if (resVarAddress.resultPosType == RIG_NODAL)
|
||||
{
|
||||
resultValueIndex = elmNodeIndices[enIdx];
|
||||
}
|
||||
else
|
||||
{
|
||||
resultValueIndex = grid->elementNodeResultIdx(cellIndex, enIdx);
|
||||
}
|
||||
|
||||
size_t resultValueIndex = grid->elementNodeResultIdx(cellIndex, 0);
|
||||
double scalarValue = resVals[resultValueIndex];
|
||||
if (lowerBound <= scalarValue && scalarValue <= upperBound)
|
||||
int intValue = nearbyint(scalarValue);
|
||||
if (integerSet.find(intValue) != integerSet.end())
|
||||
{
|
||||
if (filterType == RimCellFilter::EXCLUDE)
|
||||
{
|
||||
@ -165,6 +158,54 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const double lowerBound = propertyFilter->lowerBound();
|
||||
const double upperBound = propertyFilter->upperBound();
|
||||
|
||||
// Do a "Hack" to use elm nodal and not nodal POR results
|
||||
if (resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar") resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||
{
|
||||
if ( (*cellVisibility)[cellIndex] )
|
||||
{
|
||||
RigElementType eType = grid->elementType(cellIndex);
|
||||
int elmNodeCount = RigFemTypes::elmentNodeCount(eType);
|
||||
|
||||
const int* elmNodeIndices = grid->connectivities(cellIndex);
|
||||
for(int enIdx = 0; enIdx < elmNodeCount; ++enIdx)
|
||||
{
|
||||
size_t resultValueIndex = cvf::UNDEFINED_SIZE_T;
|
||||
if (resVarAddress.resultPosType == RIG_NODAL)
|
||||
{
|
||||
resultValueIndex = elmNodeIndices[enIdx];
|
||||
}
|
||||
else
|
||||
{
|
||||
resultValueIndex = grid->elementNodeResultIdx(cellIndex, enIdx);
|
||||
}
|
||||
|
||||
double scalarValue = resVals[resultValueIndex];
|
||||
if (lowerBound <= scalarValue && scalarValue <= upperBound)
|
||||
{
|
||||
if (filterType == RimCellFilter::EXCLUDE)
|
||||
{
|
||||
(*cellVisibility)[cellIndex] = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (filterType == RimCellFilter::INCLUDE)
|
||||
{
|
||||
(*cellVisibility)[cellIndex] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
||||
|
||||
if (propertyFilter->isValueSelectionActive())
|
||||
{
|
||||
std::vector<int> integerVector = propertyFilter->selectedValues();
|
||||
std::vector<int> integerVector = propertyFilter->selectedCategoryValues();
|
||||
std::set<int> integerSet;
|
||||
for (auto val : integerVector)
|
||||
{
|
||||
|
@ -46,7 +46,9 @@ RimCellFilter::RimCellFilter()
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString("Filter Name"), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedCategoryValues, "SelectedValues", "Values", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&filterMode, "FilterType", "Filter Type", "", "", "");
|
||||
}
|
||||
|
||||
@ -65,6 +67,14 @@ caf::PdmFieldHandle* RimCellFilter::userDescriptionField()
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RimCellFilter::selectedCategoryValues() const
|
||||
{
|
||||
return m_selectedCategoryValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -113,6 +123,40 @@ caf::PdmFieldHandle* RimCellFilter::objectToggleField()
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimCellFilter::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
|
||||
if (&m_selectedCategoryValues == fieldNeedingOptions)
|
||||
{
|
||||
if (useOptionsOnly) *useOptionsOnly = true;
|
||||
|
||||
if (m_categoryValues.size() == m_categoryNames.size())
|
||||
{
|
||||
for (size_t i = 0; i < m_categoryValues.size(); i++)
|
||||
{
|
||||
int categoryValue = m_categoryValues[i];
|
||||
QString categoryName = m_categoryNames[i];
|
||||
|
||||
optionList.push_back(caf::PdmOptionItemInfo(categoryName, categoryValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it : m_categoryValues)
|
||||
{
|
||||
QString str = QString::number(it);
|
||||
optionList.push_back(caf::PdmOptionItemInfo(str, it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return optionList;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -134,3 +178,12 @@ void RimCellFilter::setCategoryNames(const std::vector<QString>& categoryNames)
|
||||
m_categoryValues.push_back(static_cast<int>(i));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::clearCategories()
|
||||
{
|
||||
m_categoryValues.clear();
|
||||
m_categoryNames.clear();
|
||||
}
|
||||
|
@ -45,16 +45,22 @@ public:
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmField< caf::AppEnum< FilterModeType > > filterMode;
|
||||
|
||||
std::vector<int> selectedCategoryValues() const;
|
||||
|
||||
void updateIconState();
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
void setCategoryValues(const std::vector<int>& categoryValues);
|
||||
void setCategoryNames(const std::vector<QString>& categoryNames);
|
||||
void clearCategories();
|
||||
|
||||
protected:
|
||||
std::vector<int> m_categoryValues;
|
||||
std::vector<QString> m_categoryNames;
|
||||
|
||||
caf::PdmField< std::vector<int> > m_selectedCategoryValues;
|
||||
};
|
||||
|
@ -78,8 +78,6 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
|
||||
CAF_PDM_InitField(&m_upperBound, "UpperBound", 0.0, "Max", "", "", "");
|
||||
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedValues, "SelectedValues", "Values", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_valueSelection, "ValueSelection", false, "Value Selection", "", "", "");
|
||||
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
@ -119,14 +117,6 @@ bool RimEclipsePropertyFilter::isValueSelectionActive() const
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RimEclipsePropertyFilter::selectedValues() const
|
||||
{
|
||||
return m_selectedValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -142,7 +132,7 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
|| &obsoleteField_evaluationRegion == changedField
|
||||
|| &isActive == changedField
|
||||
|| &filterMode == changedField
|
||||
|| &m_selectedValues == changedField
|
||||
|| &m_selectedCategoryValues == changedField
|
||||
|| &m_valueSelection == changedField)
|
||||
{
|
||||
updateFilterName();
|
||||
@ -173,7 +163,7 @@ void RimEclipsePropertyFilter::setToDefaultValues()
|
||||
m_lowerBound = m_minimumResultValue;
|
||||
m_upperBound = m_maximumResultValue;
|
||||
|
||||
m_selectedValues = m_categoryValues;
|
||||
m_selectedCategoryValues = m_categoryValues;
|
||||
m_valueSelection = true;
|
||||
|
||||
updateFieldVisibility();
|
||||
@ -201,7 +191,7 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
uiOrdering.add(&m_lowerBound);
|
||||
uiOrdering.add(&m_upperBound);
|
||||
|
||||
uiOrdering.add(&m_selectedValues);
|
||||
uiOrdering.add(&m_selectedCategoryValues);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
|
||||
@ -218,40 +208,6 @@ void RimEclipsePropertyFilter::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTr
|
||||
updateActiveState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimEclipsePropertyFilter::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
|
||||
if (&m_selectedValues == fieldNeedingOptions)
|
||||
{
|
||||
if (useOptionsOnly) *useOptionsOnly = true;
|
||||
|
||||
if (m_categoryValues.size() == m_categoryNames.size())
|
||||
{
|
||||
for (size_t i = 0; i < m_categoryValues.size(); i++)
|
||||
{
|
||||
int categoryValue = m_categoryValues[i];
|
||||
QString categoryName = m_categoryNames[i];
|
||||
|
||||
optionList.push_back(caf::PdmOptionItemInfo(categoryName, categoryValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it : m_categoryValues)
|
||||
{
|
||||
QString str = QString::number(it);
|
||||
optionList.push_back(caf::PdmOptionItemInfo(str, it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return optionList;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -311,13 +267,13 @@ void RimEclipsePropertyFilter::updateFieldVisibility()
|
||||
|
||||
if (!m_valueSelection)
|
||||
{
|
||||
m_selectedValues.uiCapability()->setUiHidden(true);
|
||||
m_selectedCategoryValues.uiCapability()->setUiHidden(true);
|
||||
m_lowerBound.uiCapability()->setUiHidden(false);
|
||||
m_upperBound.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_selectedValues.uiCapability()->setUiHidden(false);
|
||||
m_selectedCategoryValues.uiCapability()->setUiHidden(false);
|
||||
m_lowerBound.uiCapability()->setUiHidden(true);
|
||||
m_upperBound.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
@ -327,7 +283,7 @@ void RimEclipsePropertyFilter::updateFieldVisibility()
|
||||
m_lowerBound.uiCapability()->setUiHidden(false);
|
||||
m_upperBound.uiCapability()->setUiHidden(false);
|
||||
|
||||
m_selectedValues.uiCapability()->setUiHidden(true);
|
||||
m_selectedCategoryValues.uiCapability()->setUiHidden(true);
|
||||
m_valueSelection.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
}
|
||||
@ -365,8 +321,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
|
||||
double min = 0.0;
|
||||
double max = 0.0;
|
||||
|
||||
m_categoryValues.clear();
|
||||
m_categoryNames.clear();
|
||||
clearCategories();
|
||||
|
||||
size_t scalarIndex = resultDefinition->scalarResultIndex();
|
||||
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
|
||||
@ -416,20 +371,20 @@ void RimEclipsePropertyFilter::updateFilterName()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_selectedValues().size() == m_categoryValues.size())
|
||||
if (m_selectedCategoryValues().size() == m_categoryValues.size())
|
||||
{
|
||||
newFiltername += QString::number(m_selectedValues()[0]);
|
||||
newFiltername += QString::number(m_selectedCategoryValues()[0]);
|
||||
newFiltername += "..";
|
||||
newFiltername += QString::number(m_selectedValues()[m_selectedValues().size() - 1]);
|
||||
newFiltername += QString::number(m_selectedCategoryValues()[m_selectedCategoryValues().size() - 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < m_selectedValues().size(); i++)
|
||||
for (size_t i = 0; i < m_selectedCategoryValues().size(); i++)
|
||||
{
|
||||
int val = m_selectedValues()[i];
|
||||
int val = m_selectedCategoryValues()[i];
|
||||
newFiltername += QString::number(val);
|
||||
|
||||
if (i < m_selectedValues().size() - 1)
|
||||
if (i < m_selectedCategoryValues().size() - 1)
|
||||
{
|
||||
newFiltername += ", ";
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ public:
|
||||
|
||||
void rangeValues(double* lower, double* upper) const;
|
||||
bool isValueSelectionActive() const;
|
||||
std::vector<int> selectedValues() const;
|
||||
|
||||
RimEclipsePropertyFilterCollection* parentContainer();
|
||||
void setToDefaultValues();
|
||||
@ -62,7 +61,6 @@ public:
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
@ -78,7 +76,7 @@ private:
|
||||
private:
|
||||
caf::PdmField<double> m_lowerBound;
|
||||
caf::PdmField<double> m_upperBound;
|
||||
caf::PdmField< std::vector<int> > m_selectedValues;
|
||||
|
||||
caf::PdmField<bool> m_valueSelection;
|
||||
|
||||
double m_minimumResultValue;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
@ -77,10 +78,11 @@ RimGeoMechPropertyFilter::~RimGeoMechPropertyFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if ( &lowerBound == changedField
|
||||
if ( &lowerBound == changedField
|
||||
|| &upperBound == changedField
|
||||
|| &isActive == changedField
|
||||
|| &filterMode == changedField)
|
||||
|| &filterMode == changedField
|
||||
|| &m_selectedCategoryValues == changedField)
|
||||
{
|
||||
this->updateIconState();
|
||||
this->updateFilterName();
|
||||
@ -117,6 +119,10 @@ void RimGeoMechPropertyFilter::setToDefaultValues()
|
||||
|
||||
lowerBound = m_minimumResultValue;
|
||||
upperBound = m_maximumResultValue;
|
||||
|
||||
m_selectedCategoryValues = m_categoryValues;
|
||||
|
||||
this->updateFieldVisibility();
|
||||
this->updateFilterName();
|
||||
}
|
||||
|
||||
@ -137,6 +143,8 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
uiOrdering.add(&lowerBound);
|
||||
uiOrdering.add(&upperBound);
|
||||
|
||||
uiOrdering.add(&m_selectedCategoryValues);
|
||||
|
||||
updateReadOnlyStateOfAllFields();
|
||||
}
|
||||
|
||||
@ -189,6 +197,25 @@ bool RimGeoMechPropertyFilter::isPropertyFilterControlled()
|
||||
return isPropertyFilterControlled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::updateFieldVisibility()
|
||||
{
|
||||
if (resultDefinition->hasCategoryResult())
|
||||
{
|
||||
m_selectedCategoryValues.uiCapability()->setUiHidden(false);
|
||||
lowerBound.uiCapability()->setUiHidden(true);
|
||||
upperBound.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_selectedCategoryValues.uiCapability()->setUiHidden(true);
|
||||
lowerBound.uiCapability()->setUiHidden(false);
|
||||
upperBound.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -230,10 +257,20 @@ void RimGeoMechPropertyFilter::computeResultValueRange()
|
||||
double min = 0.0;
|
||||
double max = 0.0;
|
||||
|
||||
clearCategories();
|
||||
|
||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||
if (resultAddress.isValid() && resultDefinition->ownerCaseData())
|
||||
{
|
||||
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
|
||||
if (resultDefinition->hasCategoryResult())
|
||||
{
|
||||
const std::vector<QString>& fnVector = resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames()->formationNames();
|
||||
setCategoryNames(fnVector);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
|
||||
}
|
||||
}
|
||||
|
||||
m_maximumResultValue = max;
|
||||
@ -250,21 +287,29 @@ void RimGeoMechPropertyFilter::updateFilterName()
|
||||
{
|
||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||
QString newFiltername;
|
||||
QString posName;
|
||||
|
||||
switch (resultAddress.resultPosType)
|
||||
if (resultAddress.resultPosType == RIG_FORMATION_NAMES)
|
||||
{
|
||||
case RIG_NODAL: posName = "N"; break;
|
||||
case RIG_ELEMENT_NODAL: posName = "EN"; break;
|
||||
case RIG_INTEGRATION_POINT: posName = "IP"; break;
|
||||
newFiltername = "Formation Names";
|
||||
}
|
||||
else
|
||||
{
|
||||
QString posName;
|
||||
|
||||
switch (resultAddress.resultPosType)
|
||||
{
|
||||
case RIG_NODAL: posName = "N"; break;
|
||||
case RIG_ELEMENT_NODAL: posName = "EN"; break;
|
||||
case RIG_INTEGRATION_POINT: posName = "IP"; break;
|
||||
}
|
||||
|
||||
QString fieldUiName = resultDefinition->resultFieldUiName();
|
||||
QString compoUiName = resultDefinition->resultComponentUiName();
|
||||
|
||||
newFiltername = posName + ", " + fieldUiName + ", " + compoUiName + " ("
|
||||
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
|
||||
}
|
||||
|
||||
QString fieldUiName = resultDefinition->resultFieldUiName();
|
||||
QString compoUiName = resultDefinition->resultComponentUiName();
|
||||
|
||||
|
||||
newFiltername = posName + ", " + fieldUiName + ", " + compoUiName + " ("
|
||||
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
|
||||
this->name = newFiltername;
|
||||
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
void updateFilterName();
|
||||
void computeResultValueRange();
|
||||
|
||||
void updateFieldVisibility();
|
||||
void updateActiveState();
|
||||
|
||||
protected:
|
||||
|
@ -73,6 +73,7 @@ void RimGeoMechPropertyFilterCollection::loadAndInitializePropertyFilters()
|
||||
propertyFilter->resultDefinition->setGeoMechCase(reservoirView()->geoMechCase());
|
||||
propertyFilter->resultDefinition->loadResult();
|
||||
propertyFilter->computeResultValueRange();
|
||||
propertyFilter->updateFieldVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,17 +160,25 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
if (fieldComponentNames.size() > 0)
|
||||
{
|
||||
m_resultPositionType = m_resultPositionTypeUiField;
|
||||
m_resultFieldName = fieldComponentNames[0];
|
||||
if (fieldComponentNames.size() > 1)
|
||||
if (m_resultPositionType() == RIG_FORMATION_NAMES)
|
||||
{
|
||||
m_resultComponentName = fieldComponentNames[1];
|
||||
// Complete string of selected formation is stored in m_resultFieldName
|
||||
m_resultFieldName = m_resultVariableUiField();
|
||||
m_resultComponentName = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_resultComponentName = "";
|
||||
m_resultFieldName = fieldComponentNames[0];
|
||||
if (fieldComponentNames.size() > 1)
|
||||
{
|
||||
m_resultComponentName = fieldComponentNames[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
m_resultComponentName = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress()))
|
||||
{
|
||||
if (view) view->hasUserRequestedAnimation = true;
|
||||
|
Loading…
Reference in New Issue
Block a user