mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -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 "RivFemElmVisibilityCalculator.h"
|
||||||
#include "cvfBase.h"
|
|
||||||
|
#include "RigCaseToCaseCellMapper.h"
|
||||||
#include "RigFemPart.h"
|
#include "RigFemPart.h"
|
||||||
#include "RigFemPartGrid.h"
|
#include "RigFemPartGrid.h"
|
||||||
#include "cvfStructGrid.h"
|
#include "RigFemPartResultsCollection.h"
|
||||||
#include "cvfStructGridGeometryGenerator.h"
|
#include "RigGeoMechCaseData.h"
|
||||||
#include "RimGeoMechPropertyFilterCollection.h"
|
|
||||||
#include "RimEclipsePropertyFilter.h"
|
#include "RimEclipsePropertyFilter.h"
|
||||||
|
#include "RimGeoMechCase.h"
|
||||||
#include "RimGeoMechPropertyFilter.h"
|
#include "RimGeoMechPropertyFilter.h"
|
||||||
|
#include "RimGeoMechPropertyFilterCollection.h"
|
||||||
#include "RimGeoMechResultDefinition.h"
|
#include "RimGeoMechResultDefinition.h"
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RimGeoMechCase.h"
|
|
||||||
|
|
||||||
#include "RigGeoMechCaseData.h"
|
|
||||||
#include "RigFemPartResultsCollection.h"
|
|
||||||
#include "RimViewController.h"
|
#include "RimViewController.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
#include "RigCaseToCaseCellMapper.h"
|
|
||||||
|
#include "cvfBase.h"
|
||||||
|
#include "cvfStructGrid.h"
|
||||||
|
#include "cvfStructGridGeometryGenerator.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -109,23 +113,59 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
|||||||
{
|
{
|
||||||
RimGeoMechPropertyFilter* propertyFilter = propFilterColl->propertyFilters()[i];
|
RimGeoMechPropertyFilter* propertyFilter = propFilterColl->propertyFilters()[i];
|
||||||
|
|
||||||
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();
|
const RimCellFilter::FilterModeType filterType = propertyFilter->filterMode();
|
||||||
|
|
||||||
RigGeoMechCaseData* caseData = propFilterColl->reservoirView()->geoMechCase()->geoMechData();
|
RigGeoMechCaseData* caseData = propFilterColl->reservoirView()->geoMechCase()->geoMechData();
|
||||||
|
|
||||||
|
RigFemResultAddress resVarAddress = propertyFilter->resultDefinition->resultAddress();
|
||||||
|
|
||||||
const std::vector<float>& resVals = caseData->femPartResults()->resultValues(resVarAddress,
|
const std::vector<float>& resVals = caseData->femPartResults()->resultValues(resVarAddress,
|
||||||
grid->elementPartId(),
|
grid->elementPartId(),
|
||||||
timeStepIndex);
|
timeStepIndex);
|
||||||
|
|
||||||
|
if (propertyFilter->isActive() && propertyFilter->resultDefinition->hasResult())
|
||||||
|
{
|
||||||
|
if (propertyFilter->resultDefinition->resultAddress().resultPosType == RIG_FORMATION_NAMES)
|
||||||
|
{
|
||||||
|
std::vector<int> integerVector = propertyFilter->selectedCategoryValues();
|
||||||
|
std::set<int> integerSet;
|
||||||
|
for (auto val : integerVector)
|
||||||
|
{
|
||||||
|
integerSet.insert(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||||
|
{
|
||||||
|
if ((*cellVisibility)[cellIndex])
|
||||||
|
{
|
||||||
|
size_t resultValueIndex = grid->elementNodeResultIdx(cellIndex, 0);
|
||||||
|
double scalarValue = resVals[resultValueIndex];
|
||||||
|
int intValue = nearbyint(scalarValue);
|
||||||
|
if (integerSet.find(intValue) != integerSet.end())
|
||||||
|
{
|
||||||
|
if (filterType == RimCellFilter::EXCLUDE)
|
||||||
|
{
|
||||||
|
(*cellVisibility)[cellIndex] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (filterType == RimCellFilter::INCLUDE)
|
||||||
|
{
|
||||||
|
(*cellVisibility)[cellIndex] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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)
|
#pragma omp parallel for schedule(dynamic)
|
||||||
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||||
{
|
{
|
||||||
@ -169,6 +209,7 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
@ -802,7 +802,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
|||||||
|
|
||||||
if (propertyFilter->isValueSelectionActive())
|
if (propertyFilter->isValueSelectionActive())
|
||||||
{
|
{
|
||||||
std::vector<int> integerVector = propertyFilter->selectedValues();
|
std::vector<int> integerVector = propertyFilter->selectedCategoryValues();
|
||||||
std::set<int> integerSet;
|
std::set<int> integerSet;
|
||||||
for (auto val : integerVector)
|
for (auto val : integerVector)
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,8 @@ RimCellFilter::RimCellFilter()
|
|||||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||||
isActive.uiCapability()->setUiHidden(true);
|
isActive.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_selectedCategoryValues, "SelectedValues", "Values", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&filterMode, "FilterType", "Filter Type", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&filterMode, "FilterType", "Filter Type", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +67,14 @@ caf::PdmFieldHandle* RimCellFilter::userDescriptionField()
|
|||||||
return &name;
|
return &name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<int> RimCellFilter::selectedCategoryValues() const
|
||||||
|
{
|
||||||
|
return m_selectedCategoryValues;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -113,6 +123,40 @@ caf::PdmFieldHandle* RimCellFilter::objectToggleField()
|
|||||||
return &isActive;
|
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));
|
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<bool> isActive;
|
||||||
caf::PdmField< caf::AppEnum< FilterModeType > > filterMode;
|
caf::PdmField< caf::AppEnum< FilterModeType > > filterMode;
|
||||||
|
|
||||||
|
std::vector<int> selectedCategoryValues() const;
|
||||||
|
|
||||||
void updateIconState();
|
void updateIconState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||||
|
|
||||||
void setCategoryValues(const std::vector<int>& categoryValues);
|
void setCategoryValues(const std::vector<int>& categoryValues);
|
||||||
void setCategoryNames(const std::vector<QString>& categoryNames);
|
void setCategoryNames(const std::vector<QString>& categoryNames);
|
||||||
|
void clearCategories();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<int> m_categoryValues;
|
std::vector<int> m_categoryValues;
|
||||||
std::vector<QString> m_categoryNames;
|
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", "", "", "");
|
CAF_PDM_InitField(&m_upperBound, "UpperBound", 0.0, "Max", "", "", "");
|
||||||
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_selectedValues, "SelectedValues", "Values", "", "", "");
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_valueSelection, "ValueSelection", false, "Value Selection", "", "", "");
|
CAF_PDM_InitField(&m_valueSelection, "ValueSelection", false, "Value Selection", "", "", "");
|
||||||
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||||
|
|
||||||
@ -119,14 +117,6 @@ bool RimEclipsePropertyFilter::isValueSelectionActive() const
|
|||||||
return false;
|
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
|
|| &obsoleteField_evaluationRegion == changedField
|
||||||
|| &isActive == changedField
|
|| &isActive == changedField
|
||||||
|| &filterMode == changedField
|
|| &filterMode == changedField
|
||||||
|| &m_selectedValues == changedField
|
|| &m_selectedCategoryValues == changedField
|
||||||
|| &m_valueSelection == changedField)
|
|| &m_valueSelection == changedField)
|
||||||
{
|
{
|
||||||
updateFilterName();
|
updateFilterName();
|
||||||
@ -173,7 +163,7 @@ void RimEclipsePropertyFilter::setToDefaultValues()
|
|||||||
m_lowerBound = m_minimumResultValue;
|
m_lowerBound = m_minimumResultValue;
|
||||||
m_upperBound = m_maximumResultValue;
|
m_upperBound = m_maximumResultValue;
|
||||||
|
|
||||||
m_selectedValues = m_categoryValues;
|
m_selectedCategoryValues = m_categoryValues;
|
||||||
m_valueSelection = true;
|
m_valueSelection = true;
|
||||||
|
|
||||||
updateFieldVisibility();
|
updateFieldVisibility();
|
||||||
@ -201,7 +191,7 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
|||||||
uiOrdering.add(&m_lowerBound);
|
uiOrdering.add(&m_lowerBound);
|
||||||
uiOrdering.add(&m_upperBound);
|
uiOrdering.add(&m_upperBound);
|
||||||
|
|
||||||
uiOrdering.add(&m_selectedValues);
|
uiOrdering.add(&m_selectedCategoryValues);
|
||||||
|
|
||||||
uiOrdering.setForgetRemainingFields(true);
|
uiOrdering.setForgetRemainingFields(true);
|
||||||
|
|
||||||
@ -218,40 +208,6 @@ void RimEclipsePropertyFilter::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTr
|
|||||||
updateActiveState();
|
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)
|
if (!m_valueSelection)
|
||||||
{
|
{
|
||||||
m_selectedValues.uiCapability()->setUiHidden(true);
|
m_selectedCategoryValues.uiCapability()->setUiHidden(true);
|
||||||
m_lowerBound.uiCapability()->setUiHidden(false);
|
m_lowerBound.uiCapability()->setUiHidden(false);
|
||||||
m_upperBound.uiCapability()->setUiHidden(false);
|
m_upperBound.uiCapability()->setUiHidden(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_selectedValues.uiCapability()->setUiHidden(false);
|
m_selectedCategoryValues.uiCapability()->setUiHidden(false);
|
||||||
m_lowerBound.uiCapability()->setUiHidden(true);
|
m_lowerBound.uiCapability()->setUiHidden(true);
|
||||||
m_upperBound.uiCapability()->setUiHidden(true);
|
m_upperBound.uiCapability()->setUiHidden(true);
|
||||||
}
|
}
|
||||||
@ -327,7 +283,7 @@ void RimEclipsePropertyFilter::updateFieldVisibility()
|
|||||||
m_lowerBound.uiCapability()->setUiHidden(false);
|
m_lowerBound.uiCapability()->setUiHidden(false);
|
||||||
m_upperBound.uiCapability()->setUiHidden(false);
|
m_upperBound.uiCapability()->setUiHidden(false);
|
||||||
|
|
||||||
m_selectedValues.uiCapability()->setUiHidden(true);
|
m_selectedCategoryValues.uiCapability()->setUiHidden(true);
|
||||||
m_valueSelection.uiCapability()->setUiHidden(true);
|
m_valueSelection.uiCapability()->setUiHidden(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,8 +321,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
|
|||||||
double min = 0.0;
|
double min = 0.0;
|
||||||
double max = 0.0;
|
double max = 0.0;
|
||||||
|
|
||||||
m_categoryValues.clear();
|
clearCategories();
|
||||||
m_categoryNames.clear();
|
|
||||||
|
|
||||||
size_t scalarIndex = resultDefinition->scalarResultIndex();
|
size_t scalarIndex = resultDefinition->scalarResultIndex();
|
||||||
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
|
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
|
||||||
@ -416,20 +371,20 @@ void RimEclipsePropertyFilter::updateFilterName()
|
|||||||
}
|
}
|
||||||
else
|
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 += "..";
|
||||||
newFiltername += QString::number(m_selectedValues()[m_selectedValues().size() - 1]);
|
newFiltername += QString::number(m_selectedCategoryValues()[m_selectedCategoryValues().size() - 1]);
|
||||||
}
|
}
|
||||||
else
|
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);
|
newFiltername += QString::number(val);
|
||||||
|
|
||||||
if (i < m_selectedValues().size() - 1)
|
if (i < m_selectedCategoryValues().size() - 1)
|
||||||
{
|
{
|
||||||
newFiltername += ", ";
|
newFiltername += ", ";
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ public:
|
|||||||
|
|
||||||
void rangeValues(double* lower, double* upper) const;
|
void rangeValues(double* lower, double* upper) const;
|
||||||
bool isValueSelectionActive() const;
|
bool isValueSelectionActive() const;
|
||||||
std::vector<int> selectedValues() const;
|
|
||||||
|
|
||||||
RimEclipsePropertyFilterCollection* parentContainer();
|
RimEclipsePropertyFilterCollection* parentContainer();
|
||||||
void setToDefaultValues();
|
void setToDefaultValues();
|
||||||
@ -62,7 +61,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
|
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);
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||||
|
|
||||||
@ -78,7 +76,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
caf::PdmField<double> m_lowerBound;
|
caf::PdmField<double> m_lowerBound;
|
||||||
caf::PdmField<double> m_upperBound;
|
caf::PdmField<double> m_upperBound;
|
||||||
caf::PdmField< std::vector<int> > m_selectedValues;
|
|
||||||
caf::PdmField<bool> m_valueSelection;
|
caf::PdmField<bool> m_valueSelection;
|
||||||
|
|
||||||
double m_minimumResultValue;
|
double m_minimumResultValue;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "RigFemPartResultsCollection.h"
|
#include "RigFemPartResultsCollection.h"
|
||||||
#include "RigGeoMechCaseData.h"
|
#include "RigGeoMechCaseData.h"
|
||||||
|
#include "RigFormationNames.h"
|
||||||
|
|
||||||
#include "RimGeoMechPropertyFilterCollection.h"
|
#include "RimGeoMechPropertyFilterCollection.h"
|
||||||
#include "RimGeoMechResultDefinition.h"
|
#include "RimGeoMechResultDefinition.h"
|
||||||
@ -80,7 +81,8 @@ void RimGeoMechPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
if ( &lowerBound == changedField
|
if ( &lowerBound == changedField
|
||||||
|| &upperBound == changedField
|
|| &upperBound == changedField
|
||||||
|| &isActive == changedField
|
|| &isActive == changedField
|
||||||
|| &filterMode == changedField)
|
|| &filterMode == changedField
|
||||||
|
|| &m_selectedCategoryValues == changedField)
|
||||||
{
|
{
|
||||||
this->updateIconState();
|
this->updateIconState();
|
||||||
this->updateFilterName();
|
this->updateFilterName();
|
||||||
@ -117,6 +119,10 @@ void RimGeoMechPropertyFilter::setToDefaultValues()
|
|||||||
|
|
||||||
lowerBound = m_minimumResultValue;
|
lowerBound = m_minimumResultValue;
|
||||||
upperBound = m_maximumResultValue;
|
upperBound = m_maximumResultValue;
|
||||||
|
|
||||||
|
m_selectedCategoryValues = m_categoryValues;
|
||||||
|
|
||||||
|
this->updateFieldVisibility();
|
||||||
this->updateFilterName();
|
this->updateFilterName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +143,8 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
|||||||
uiOrdering.add(&lowerBound);
|
uiOrdering.add(&lowerBound);
|
||||||
uiOrdering.add(&upperBound);
|
uiOrdering.add(&upperBound);
|
||||||
|
|
||||||
|
uiOrdering.add(&m_selectedCategoryValues);
|
||||||
|
|
||||||
updateReadOnlyStateOfAllFields();
|
updateReadOnlyStateOfAllFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,6 +197,25 @@ bool RimGeoMechPropertyFilter::isPropertyFilterControlled()
|
|||||||
return 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,11 +257,21 @@ void RimGeoMechPropertyFilter::computeResultValueRange()
|
|||||||
double min = 0.0;
|
double min = 0.0;
|
||||||
double max = 0.0;
|
double max = 0.0;
|
||||||
|
|
||||||
|
clearCategories();
|
||||||
|
|
||||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||||
if (resultAddress.isValid() && resultDefinition->ownerCaseData())
|
if (resultAddress.isValid() && resultDefinition->ownerCaseData())
|
||||||
|
{
|
||||||
|
if (resultDefinition->hasCategoryResult())
|
||||||
|
{
|
||||||
|
const std::vector<QString>& fnVector = resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames()->formationNames();
|
||||||
|
setCategoryNames(fnVector);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
|
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_maximumResultValue = max;
|
m_maximumResultValue = max;
|
||||||
m_minimumResultValue = min;
|
m_minimumResultValue = min;
|
||||||
@ -250,6 +287,13 @@ void RimGeoMechPropertyFilter::updateFilterName()
|
|||||||
{
|
{
|
||||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||||
QString newFiltername;
|
QString newFiltername;
|
||||||
|
|
||||||
|
if (resultAddress.resultPosType == RIG_FORMATION_NAMES)
|
||||||
|
{
|
||||||
|
newFiltername = "Formation Names";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QString posName;
|
QString posName;
|
||||||
|
|
||||||
switch (resultAddress.resultPosType)
|
switch (resultAddress.resultPosType)
|
||||||
@ -262,9 +306,10 @@ void RimGeoMechPropertyFilter::updateFilterName()
|
|||||||
QString fieldUiName = resultDefinition->resultFieldUiName();
|
QString fieldUiName = resultDefinition->resultFieldUiName();
|
||||||
QString compoUiName = resultDefinition->resultComponentUiName();
|
QString compoUiName = resultDefinition->resultComponentUiName();
|
||||||
|
|
||||||
|
|
||||||
newFiltername = posName + ", " + fieldUiName + ", " + compoUiName + " ("
|
newFiltername = posName + ", " + fieldUiName + ", " + compoUiName + " ("
|
||||||
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
|
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
this->name = newFiltername;
|
this->name = newFiltername;
|
||||||
|
|
||||||
uiCapability()->updateConnectedEditors();
|
uiCapability()->updateConnectedEditors();
|
||||||
|
@ -50,6 +50,7 @@ public:
|
|||||||
void updateFilterName();
|
void updateFilterName();
|
||||||
void computeResultValueRange();
|
void computeResultValueRange();
|
||||||
|
|
||||||
|
void updateFieldVisibility();
|
||||||
void updateActiveState();
|
void updateActiveState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -73,6 +73,7 @@ void RimGeoMechPropertyFilterCollection::loadAndInitializePropertyFilters()
|
|||||||
propertyFilter->resultDefinition->setGeoMechCase(reservoirView()->geoMechCase());
|
propertyFilter->resultDefinition->setGeoMechCase(reservoirView()->geoMechCase());
|
||||||
propertyFilter->resultDefinition->loadResult();
|
propertyFilter->resultDefinition->loadResult();
|
||||||
propertyFilter->computeResultValueRange();
|
propertyFilter->computeResultValueRange();
|
||||||
|
propertyFilter->updateFieldVisibility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,6 +160,14 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
if (fieldComponentNames.size() > 0)
|
if (fieldComponentNames.size() > 0)
|
||||||
{
|
{
|
||||||
m_resultPositionType = m_resultPositionTypeUiField;
|
m_resultPositionType = m_resultPositionTypeUiField;
|
||||||
|
if (m_resultPositionType() == RIG_FORMATION_NAMES)
|
||||||
|
{
|
||||||
|
// Complete string of selected formation is stored in m_resultFieldName
|
||||||
|
m_resultFieldName = m_resultVariableUiField();
|
||||||
|
m_resultComponentName = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_resultFieldName = fieldComponentNames[0];
|
m_resultFieldName = fieldComponentNames[0];
|
||||||
if (fieldComponentNames.size() > 1)
|
if (fieldComponentNames.size() > 1)
|
||||||
{
|
{
|
||||||
@ -169,7 +177,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
{
|
{
|
||||||
m_resultComponentName = "";
|
m_resultComponentName = "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress()))
|
if (m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress()))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user