mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Property filters for geo mech (#314)
Added GUI objects for property filters for geo mech models.
This commit is contained in:
parent
8f2090eccf
commit
6191422103
@ -54,6 +54,9 @@ ${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNncCollection.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechModels.h
|
${CEE_CURRENT_LIST_DIR}RimGeoMechModels.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechCase.h
|
${CEE_CURRENT_LIST_DIR}RimGeoMechCase.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechView.h
|
${CEE_CURRENT_LIST_DIR}RimGeoMechView.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilter.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilterCollection.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechResultSlot.h
|
${CEE_CURRENT_LIST_DIR}RimGeoMechResultSlot.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimView.h
|
${CEE_CURRENT_LIST_DIR}RimView.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimCase.h
|
${CEE_CURRENT_LIST_DIR}RimCase.h
|
||||||
@ -109,6 +112,9 @@ ${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNncCollection.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechModels.cpp
|
${CEE_CURRENT_LIST_DIR}RimGeoMechModels.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechCase.cpp
|
${CEE_CURRENT_LIST_DIR}RimGeoMechCase.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechView.cpp
|
${CEE_CURRENT_LIST_DIR}RimGeoMechView.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilter.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilterCollection.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechResultSlot.cpp
|
${CEE_CURRENT_LIST_DIR}RimGeoMechResultSlot.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimView.cpp
|
${CEE_CURRENT_LIST_DIR}RimView.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimCase.cpp
|
${CEE_CURRENT_LIST_DIR}RimCase.cpp
|
||||||
|
189
ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilter.cpp
Normal file
189
ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilter.cpp
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2015- Statoil ASA
|
||||||
|
// Copyright (C) 2015- Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RimGeoMechPropertyFilter.h"
|
||||||
|
#include "RimGeoMechPropertyFilterCollection.h"
|
||||||
|
#include "RimGeoMechResultDefinition.h"
|
||||||
|
|
||||||
|
#include "cvfMath.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiDoubleSliderEditor.h"
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
#include "RigFemPartResultsCollection.h"
|
||||||
|
#include "RigGeoMechCaseData.h"
|
||||||
|
#include "RimGeoMechView.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include "RigCaseCellResultsData.h"
|
||||||
|
#include "RimCellPropertyFilterCollection.h"
|
||||||
|
#include "RimReservoirCellResultsStorage.h"
|
||||||
|
#include "RimResultDefinition.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiDoubleSliderEditor.h"
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimGeoMechPropertyFilter, "GeoMechPropertyFilter");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechPropertyFilter::RimGeoMechPropertyFilter()
|
||||||
|
: m_parentContainer(NULL)
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("GeoMech Property Filter", ":/CellFilter_Values.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&resultDefinition, "ResultDefinition", "Result definition", "", "", "");
|
||||||
|
resultDefinition = new RimGeoMechResultDefinition();
|
||||||
|
resultDefinition->setOwnerPropertyFilter(this);
|
||||||
|
|
||||||
|
// Set to hidden to avoid this item to been displayed as a child item
|
||||||
|
// Fields in this object are displayed using defineUiOrdering()
|
||||||
|
resultDefinition.setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&lowerBound, "LowerBound", 0.0, "Min", "", "", "");
|
||||||
|
lowerBound.setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&upperBound, "UpperBound", 0.0, "Max", "", "", "");
|
||||||
|
upperBound.setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||||
|
|
||||||
|
updateIconState();
|
||||||
|
|
||||||
|
m_minimumResultValue = cvf::UNDEFINED_DOUBLE;
|
||||||
|
m_maximumResultValue = cvf::UNDEFINED_DOUBLE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechPropertyFilter::~RimGeoMechPropertyFilter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if ( &lowerBound == changedField
|
||||||
|
|| &upperBound == changedField
|
||||||
|
|| &isActive == changedField
|
||||||
|
|| &filterMode == changedField)
|
||||||
|
{
|
||||||
|
this->updateIconState();
|
||||||
|
((RimView*)resultDefinition->reservoirView())->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||||
|
resultDefinition->reservoirView()->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilter::setParentContainer(RimGeoMechPropertyFilterCollection* parentContainer)
|
||||||
|
{
|
||||||
|
m_parentContainer = parentContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechPropertyFilterCollection* RimGeoMechPropertyFilter::parentContainer()
|
||||||
|
{
|
||||||
|
return m_parentContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilter::updateDefaultValues()
|
||||||
|
{
|
||||||
|
CVF_ASSERT(m_parentContainer);
|
||||||
|
|
||||||
|
computeResultValueRange();
|
||||||
|
|
||||||
|
lowerBound = m_minimumResultValue;
|
||||||
|
upperBound = m_maximumResultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
|
{
|
||||||
|
uiOrdering.add(&name);
|
||||||
|
|
||||||
|
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||||
|
group1->add(&(resultDefinition->m_resultPositionTypeUiField));
|
||||||
|
group1->add(&(resultDefinition->m_resultVariableUiField));
|
||||||
|
|
||||||
|
uiOrdering.add(&isActive);
|
||||||
|
uiOrdering.add(&filterMode);
|
||||||
|
|
||||||
|
uiOrdering.add(&lowerBound);
|
||||||
|
uiOrdering.add(&upperBound);
|
||||||
|
uiOrdering.add(&filterMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||||
|
{
|
||||||
|
if (m_minimumResultValue == cvf::UNDEFINED_DOUBLE || m_maximumResultValue == cvf::UNDEFINED_DOUBLE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field == &lowerBound || field == &upperBound)
|
||||||
|
{
|
||||||
|
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||||
|
if (!myAttr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
myAttr->m_minimum = m_minimumResultValue;
|
||||||
|
myAttr->m_maximum = m_maximumResultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilter::computeResultValueRange()
|
||||||
|
{
|
||||||
|
CVF_ASSERT(m_parentContainer);
|
||||||
|
|
||||||
|
double min = 0.0;
|
||||||
|
double max = 0.0;
|
||||||
|
|
||||||
|
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||||
|
if (resultAddress.isValid() && resultDefinition->ownerCaseData())
|
||||||
|
{
|
||||||
|
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_maximumResultValue = max;
|
||||||
|
m_minimumResultValue = min;
|
||||||
|
|
||||||
|
lowerBound.setUiName(QString("Min (%1)").arg(min));
|
||||||
|
upperBound.setUiName(QString("Max (%1)").arg(max));
|
||||||
|
}
|
75
ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilter.h
Normal file
75
ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilter.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2015- Statoil ASA
|
||||||
|
// Copyright (C) 2015- Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// 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 "RimCellFilter.h"
|
||||||
|
|
||||||
|
/*class RimEclipseView;
|
||||||
|
class RimCellPropertyFilterCollection;
|
||||||
|
class RimResultDefinition;
|
||||||
|
|
||||||
|
class RigGridBase;
|
||||||
|
class RigCaseCellResultsData;
|
||||||
|
*/
|
||||||
|
|
||||||
|
class RimGeoMechResultDefinition;
|
||||||
|
class RimGeoMechPropertyFilterCollection;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimGeoMechPropertyFilter : public RimCellFilter
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
enum EvaluationRegionType
|
||||||
|
{
|
||||||
|
RANGE_FILTER_REGION,
|
||||||
|
GLOBAL_REGION
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimGeoMechPropertyFilter();
|
||||||
|
virtual ~RimGeoMechPropertyFilter();
|
||||||
|
|
||||||
|
void setParentContainer(RimGeoMechPropertyFilterCollection* parentContainer);
|
||||||
|
RimGeoMechPropertyFilterCollection* parentContainer();
|
||||||
|
void updateDefaultValues();
|
||||||
|
void computeResultValueRange();
|
||||||
|
|
||||||
|
caf::PdmField<RimGeoMechResultDefinition*> resultDefinition;
|
||||||
|
|
||||||
|
caf::PdmField<double> lowerBound;
|
||||||
|
caf::PdmField<double> upperBound;
|
||||||
|
|
||||||
|
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) ;
|
||||||
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||||
|
|
||||||
|
private:
|
||||||
|
RimGeoMechPropertyFilterCollection* m_parentContainer;
|
||||||
|
double m_minimumResultValue, m_maximumResultValue;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,178 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2015- Statoil ASA
|
||||||
|
// Copyright (C) 2015- Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RimGeoMechPropertyFilterCollection.h"
|
||||||
|
#include "RimGeoMechPropertyFilter.h"
|
||||||
|
#include "RimGeoMechView.h"
|
||||||
|
#include "RimGeoMechResultSlot.h"
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimGeoMechPropertyFilterCollection, "GeoMechPropertyFilters");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechPropertyFilterCollection::RimGeoMechPropertyFilterCollection()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("GeoMech Property Filters", ":/CellFilter_Values.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
|
||||||
|
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
||||||
|
active.setUiHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechPropertyFilterCollection::~RimGeoMechPropertyFilterCollection()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilterCollection::setReservoirView(RimGeoMechView* reservoirView)
|
||||||
|
{
|
||||||
|
m_reservoirView = reservoirView;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
||||||
|
{
|
||||||
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
|
||||||
|
propertyFilter->resultDefinition->setReservoirView(m_reservoirView.p());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechView* RimGeoMechPropertyFilterCollection::reservoirView()
|
||||||
|
{
|
||||||
|
CVF_ASSERT(!m_reservoirView.isNull());
|
||||||
|
return m_reservoirView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilterCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
this->updateUiIconFromToggleField();
|
||||||
|
|
||||||
|
((RimView*)m_reservoirView)->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||||
|
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechPropertyFilter* RimGeoMechPropertyFilterCollection::createAndAppendPropertyFilter()
|
||||||
|
{
|
||||||
|
RimGeoMechPropertyFilter* propertyFilter = new RimGeoMechPropertyFilter();
|
||||||
|
|
||||||
|
propertyFilter->resultDefinition->setReservoirView(m_reservoirView.p());
|
||||||
|
|
||||||
|
propertyFilter->setParentContainer(this);
|
||||||
|
propertyFilters.push_back(propertyFilter);
|
||||||
|
|
||||||
|
propertyFilter->resultDefinition->setResultAddress(m_reservoirView->cellResult()->resultAddress());
|
||||||
|
propertyFilter->resultDefinition->loadResult();
|
||||||
|
propertyFilter->updateDefaultValues();
|
||||||
|
|
||||||
|
propertyFilter->name = QString("New Filter (%1)").arg(propertyFilters().size());
|
||||||
|
|
||||||
|
return propertyFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilterCollection::loadAndInitializePropertyFilters()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
||||||
|
{
|
||||||
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
|
||||||
|
|
||||||
|
propertyFilter->resultDefinition->loadResult();
|
||||||
|
propertyFilter->computeResultValueRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilterCollection::initAfterRead()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
||||||
|
{
|
||||||
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
|
||||||
|
|
||||||
|
propertyFilter->setParentContainer(this);
|
||||||
|
propertyFilter->resultDefinition->setReservoirView(m_reservoirView.p());
|
||||||
|
propertyFilter->updateIconState();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->updateUiIconFromToggleField();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechPropertyFilterCollection::remove(RimGeoMechPropertyFilter* propertyFilter)
|
||||||
|
{
|
||||||
|
propertyFilters.removeChildObject(propertyFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGeoMechPropertyFilterCollection::hasActiveFilters() const
|
||||||
|
{
|
||||||
|
if (!active) return false;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
||||||
|
{
|
||||||
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
|
||||||
|
if (propertyFilter->isActive() && propertyFilter->resultDefinition->hasResult()) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Returns whether any of the active property filters are based on a dynamic result
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGeoMechPropertyFilterCollection::hasActiveDynamicFilters() const
|
||||||
|
{
|
||||||
|
return hasActiveFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmFieldHandle* RimGeoMechPropertyFilterCollection::objectToggleField()
|
||||||
|
{
|
||||||
|
return &active;
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2015- Statoil ASA
|
||||||
|
// Copyright (C) 2015- Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// 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 "cafPdmObject.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
|
||||||
|
class RimGeoMechPropertyFilter;
|
||||||
|
class RimGeoMechView;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimGeoMechPropertyFilterCollection : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimGeoMechPropertyFilterCollection();
|
||||||
|
virtual ~RimGeoMechPropertyFilterCollection();
|
||||||
|
|
||||||
|
void setReservoirView(RimGeoMechView* reservoirView);
|
||||||
|
RimGeoMechView* reservoirView();
|
||||||
|
|
||||||
|
|
||||||
|
// Fields:
|
||||||
|
caf::PdmField<bool> active;
|
||||||
|
caf::PdmPointersField<RimGeoMechPropertyFilter*> propertyFilters;
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
RimGeoMechPropertyFilter* createAndAppendPropertyFilter();
|
||||||
|
void remove(RimGeoMechPropertyFilter* propertyFilter);
|
||||||
|
|
||||||
|
bool hasActiveFilters() const;
|
||||||
|
bool hasActiveDynamicFilters() const;
|
||||||
|
|
||||||
|
|
||||||
|
void loadAndInitializePropertyFilters();
|
||||||
|
|
||||||
|
|
||||||
|
// Overridden methods
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overridden methods
|
||||||
|
virtual void initAfterRead();
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmPointer<RimGeoMechView> m_reservoirView;
|
||||||
|
};
|
335
ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp
Normal file
335
ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp
Normal file
@ -0,0 +1,335 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2015- Statoil ASA
|
||||||
|
// Copyright (C) 2015- Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RimGeoMechResultDefinition.h"
|
||||||
|
#include "RimGeoMechView.h"
|
||||||
|
#include "RimDefines.h"
|
||||||
|
#include "RimGeoMechCase.h"
|
||||||
|
#include "RifGeoMechReaderInterface.h"
|
||||||
|
#include "cafPdmUiListEditor.h"
|
||||||
|
#include "RigGeoMechCaseData.h"
|
||||||
|
#include "RigFemPartResultsCollection.h"
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RimGeoMechPropertyFilter.h"
|
||||||
|
#include "RigFemResultAddress.h"
|
||||||
|
|
||||||
|
namespace caf {
|
||||||
|
|
||||||
|
template<>
|
||||||
|
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");
|
||||||
|
setDefault(RIG_NODAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimGeoMechResultDefinition, "GeoMechResultDefinition");
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechResultDefinition::RimGeoMechResultDefinition(void)
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Color Result", ":/CellResult.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_resultPositionType, "ResultPositionType" , "Result Position", "", "", "");
|
||||||
|
m_resultPositionType.setUiHidden(true);
|
||||||
|
CAF_PDM_InitField(&m_resultFieldName, "ResultFieldName", QString(""), "Field Name", "", "", "");
|
||||||
|
m_resultFieldName.setUiHidden(true);
|
||||||
|
CAF_PDM_InitField(&m_resultComponentName, "ResultComponentName", QString(""), "Component", "", "", "");
|
||||||
|
m_resultComponentName.setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_resultPositionTypeUiField, "ResultPositionTypeUi", "Result Position", "", "", "");
|
||||||
|
m_resultPositionTypeUiField.setIOWritable(false);
|
||||||
|
m_resultPositionTypeUiField.setIOReadable(false);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_resultVariableUiField, "ResultVariableUI", QString(""), "Value", "", "", "");
|
||||||
|
m_resultVariableUiField.setIOWritable(false);
|
||||||
|
m_resultVariableUiField.setIOReadable(false);
|
||||||
|
|
||||||
|
m_resultVariableUiField.setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||||
|
m_resultVariableUiField.setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechResultDefinition::~RimGeoMechResultDefinition(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QList<caf::PdmOptionItemInfo> RimGeoMechResultDefinition::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||||
|
{
|
||||||
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
*useOptionsOnly = true;
|
||||||
|
|
||||||
|
if (m_reservoirView)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (&m_resultVariableUiField == fieldNeedingOptions)
|
||||||
|
{
|
||||||
|
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
|
||||||
|
QStringList uiVarNames;
|
||||||
|
QStringList varNames;
|
||||||
|
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames);
|
||||||
|
|
||||||
|
for (int oIdx = 0; oIdx < uiVarNames.size(); ++oIdx)
|
||||||
|
{
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(uiVarNames[oIdx], varNames[oIdx]));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
for (auto fieldIt = fieldCompNames.begin(); fieldIt != fieldCompNames.end(); ++fieldIt)
|
||||||
|
{
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(fieldIt->first), QString::fromStdString(fieldIt->first)));
|
||||||
|
|
||||||
|
for (auto compIt = fieldIt->second.begin(); compIt != fieldIt->second.end(); ++compIt)
|
||||||
|
{
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(" " + *compIt), QString::fromStdString(fieldIt->first + " " + *compIt)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechResultDefinition::setReservoirView(RimGeoMechView* ownerReservoirView)
|
||||||
|
{
|
||||||
|
m_reservoirView = ownerReservoirView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechView* RimGeoMechResultDefinition::reservoirView()
|
||||||
|
{
|
||||||
|
return m_reservoirView;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if(&m_resultPositionTypeUiField == changedField)
|
||||||
|
{
|
||||||
|
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
|
||||||
|
QStringList uiVarNames;
|
||||||
|
QStringList varNames;
|
||||||
|
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames);
|
||||||
|
|
||||||
|
if (m_resultPositionTypeUiField() == m_resultPositionType()
|
||||||
|
&& varNames.contains(composeUiVarString(m_resultFieldName(), m_resultComponentName())))
|
||||||
|
{
|
||||||
|
m_resultVariableUiField = composeUiVarString(m_resultFieldName(), m_resultComponentName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_resultVariableUiField = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (&m_resultVariableUiField == changedField)
|
||||||
|
{
|
||||||
|
QStringList fieldComponentNames = m_resultVariableUiField().split(QRegExp("\\s+"));
|
||||||
|
if (fieldComponentNames.size() > 0)
|
||||||
|
{
|
||||||
|
m_resultPositionType = m_resultPositionTypeUiField;
|
||||||
|
m_resultFieldName = fieldComponentNames[0];
|
||||||
|
if (fieldComponentNames.size() > 1)
|
||||||
|
{
|
||||||
|
m_resultComponentName = fieldComponentNames[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_resultComponentName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_reservoirView->geoMechCase()->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress()))
|
||||||
|
{
|
||||||
|
m_reservoirView->hasUserRequestedAnimation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_propertyFilter)
|
||||||
|
{
|
||||||
|
m_propertyFilter->updateDefaultValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_reservoirView->createDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_propertyFilter)
|
||||||
|
{
|
||||||
|
m_propertyFilter->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::map<std::string, std::vector<std::string> > RimGeoMechResultDefinition::getResultMetaDataForUIFieldSetting()
|
||||||
|
{
|
||||||
|
RimGeoMechCase* gmCase = m_reservoirView->geoMechCase();
|
||||||
|
if (gmCase && gmCase->geoMechData())
|
||||||
|
{
|
||||||
|
return gmCase->geoMechData()->femPartResults()->scalarFieldAndComponentNames(m_resultPositionTypeUiField());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return std::map<std::string, std::vector<std::string> >() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RimGeoMechResultDefinition::getUiAndResultVariableStringList(QStringList* uiNames, QStringList* variableNames,
|
||||||
|
const std::map<std::string, std::vector<std::string> >& fieldCompNames)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(uiNames && variableNames);
|
||||||
|
|
||||||
|
std::map<std::string, std::vector<std::string> >::const_iterator fieldIt;
|
||||||
|
for (fieldIt = fieldCompNames.begin(); fieldIt != fieldCompNames.end(); ++fieldIt)
|
||||||
|
{
|
||||||
|
QString resultFieldName = QString::fromStdString(fieldIt->first);
|
||||||
|
|
||||||
|
if (resultFieldName == "E" || resultFieldName == "S") continue; // We will not show the native Stress and Strain
|
||||||
|
|
||||||
|
QString resultFieldUiName = convertToUiResultFieldName(resultFieldName);
|
||||||
|
|
||||||
|
uiNames->push_back(resultFieldUiName);
|
||||||
|
variableNames->push_back(resultFieldName);
|
||||||
|
|
||||||
|
std::vector<std::string>::const_iterator compIt;
|
||||||
|
for (compIt = fieldIt->second.begin(); compIt != fieldIt->second.end(); ++compIt)
|
||||||
|
{
|
||||||
|
QString resultCompName = QString::fromStdString(*compIt);
|
||||||
|
uiNames->push_back(" " + resultCompName);
|
||||||
|
variableNames->push_back(composeUiVarString(resultFieldName, resultCompName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString RimGeoMechResultDefinition::composeUiVarString(const QString& resultFieldName, const QString& resultComponentName)
|
||||||
|
{
|
||||||
|
return resultFieldName + " " + resultComponentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechResultDefinition::initAfterRead()
|
||||||
|
{
|
||||||
|
m_resultPositionTypeUiField = m_resultPositionType;
|
||||||
|
m_resultVariableUiField = composeUiVarString(m_resultFieldName(), m_resultComponentName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechResultDefinition::loadResult()
|
||||||
|
{
|
||||||
|
if (m_reservoirView->geoMechCase())
|
||||||
|
{
|
||||||
|
m_reservoirView->geoMechCase()->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigGeoMechCaseData* RimGeoMechResultDefinition::ownerCaseData()
|
||||||
|
{
|
||||||
|
return m_reservoirView->geoMechCase()->geoMechData();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGeoMechResultDefinition::hasResult()
|
||||||
|
{
|
||||||
|
return ownerCaseData()->femPartResults()->assertResultsLoaded(this->resultAddress());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimGeoMechResultDefinition::resultFieldUiName()
|
||||||
|
{
|
||||||
|
return convertToUiResultFieldName(m_resultFieldName());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimGeoMechResultDefinition::resultComponentUiName()
|
||||||
|
{
|
||||||
|
return m_resultComponentName();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimGeoMechResultDefinition::convertToUiResultFieldName(QString resultFieldName)
|
||||||
|
{
|
||||||
|
if (resultFieldName == "E") return "NativeAbaqus Strain";
|
||||||
|
if (resultFieldName == "S") return "NativeAbaqus Stess";
|
||||||
|
if (resultFieldName == "NE") return "E"; // Make NE and NS appear as E and S
|
||||||
|
if (resultFieldName == "NS") return "S";
|
||||||
|
|
||||||
|
return resultFieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RimGeoMechResultDefinition::setOwnerPropertyFilter( RimGeoMechPropertyFilter* propertyFilter )
|
||||||
|
{
|
||||||
|
m_propertyFilter = propertyFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RimGeoMechResultDefinition::setResultAddress( const RigFemResultAddress& resultAddress )
|
||||||
|
{
|
||||||
|
m_resultPositionType = resultAddress.resultPosType;
|
||||||
|
m_resultFieldName = QString::fromStdString(resultAddress.fieldName);
|
||||||
|
m_resultComponentName = QString::fromStdString(resultAddress.componentName);
|
||||||
|
|
||||||
|
m_resultPositionTypeUiField = m_resultPositionType;
|
||||||
|
m_resultVariableUiField = composeUiVarString(m_resultFieldName(), m_resultComponentName());
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2015- Statoil ASA
|
||||||
|
// Copyright (C) 2015- Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// 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 "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
#include "cafAppEnum.h"
|
||||||
|
#include "RigFemResultPosEnum.h"
|
||||||
|
#include "RigFemResultAddress.h"
|
||||||
|
|
||||||
|
class RimGeoMechView;
|
||||||
|
class RimGeoMechPropertyFilter;
|
||||||
|
class RifGeoMechReaderInterface;
|
||||||
|
class RigGeoMechCaseData;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimGeoMechResultDefinition : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimGeoMechResultDefinition(void);
|
||||||
|
virtual ~RimGeoMechResultDefinition(void);
|
||||||
|
|
||||||
|
void setReservoirView(RimGeoMechView* ownerReservoirView);
|
||||||
|
RimGeoMechView* reservoirView();
|
||||||
|
|
||||||
|
RigGeoMechCaseData* ownerCaseData();
|
||||||
|
bool hasResult();
|
||||||
|
void loadResult();
|
||||||
|
|
||||||
|
RigFemResultAddress resultAddress() { return RigFemResultAddress(resultPositionType(), resultFieldName().toStdString(), resultComponentName().toStdString());}
|
||||||
|
|
||||||
|
RigFemResultPosEnum resultPositionType() { return m_resultPositionType();}
|
||||||
|
QString resultFieldName() { return m_resultFieldName();}
|
||||||
|
QString resultComponentName() { return m_resultComponentName();}
|
||||||
|
void setResultAddress(const RigFemResultAddress& resultAddress);
|
||||||
|
|
||||||
|
void setOwnerPropertyFilter(RimGeoMechPropertyFilter* propertyFilter);
|
||||||
|
|
||||||
|
QString resultFieldUiName();
|
||||||
|
QString resultComponentUiName();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend class RimGeoMechPropertyFilter; // Property filter needs the ui fields
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||||
|
bool * useOptionsOnly);
|
||||||
|
std::map<std::string, std::vector<std::string> > getResultMetaDataForUIFieldSetting();
|
||||||
|
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
static void getUiAndResultVariableStringList(QStringList* uiNames, QStringList* variableNames,
|
||||||
|
const std::map<std::string, std::vector<std::string> >& fieldCompNames);
|
||||||
|
static QString composeUiVarString(const QString& resultFieldName, const QString& resultComponentName);
|
||||||
|
|
||||||
|
virtual void initAfterRead();
|
||||||
|
|
||||||
|
caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionType;
|
||||||
|
caf::PdmField<QString> m_resultFieldName;
|
||||||
|
caf::PdmField<QString> m_resultComponentName;
|
||||||
|
|
||||||
|
caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionTypeUiField;
|
||||||
|
caf::PdmField<QString> m_resultVariableUiField;
|
||||||
|
|
||||||
|
caf::PdmPointer<RimGeoMechView> m_reservoirView;
|
||||||
|
caf::PdmPointer<RimGeoMechPropertyFilter> m_propertyFilter;
|
||||||
|
|
||||||
|
static QString convertToUiResultFieldName(QString resultFieldName);
|
||||||
|
};
|
@ -18,27 +18,8 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "RimGeoMechResultSlot.h"
|
#include "RimGeoMechResultSlot.h"
|
||||||
#include "RimGeoMechView.h"
|
|
||||||
#include "RimLegendConfig.h"
|
#include "RimLegendConfig.h"
|
||||||
#include "RimDefines.h"
|
#include "RimView.h"
|
||||||
#include "RimGeoMechCase.h"
|
|
||||||
#include "RifGeoMechReaderInterface.h"
|
|
||||||
#include "cafPdmUiListEditor.h"
|
|
||||||
#include "RigGeoMechCaseData.h"
|
|
||||||
#include "RigFemPartResultsCollection.h"
|
|
||||||
#include "RiuMainWindow.h"
|
|
||||||
|
|
||||||
namespace caf {
|
|
||||||
|
|
||||||
template<>
|
|
||||||
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");
|
|
||||||
setDefault(RIG_NODAL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimGeoMechResultSlot, "GeoMechResultSlot");
|
CAF_PDM_SOURCE_INIT(RimGeoMechResultSlot, "GeoMechResultSlot");
|
||||||
@ -49,29 +30,8 @@ CAF_PDM_SOURCE_INIT(RimGeoMechResultSlot, "GeoMechResultSlot");
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimGeoMechResultSlot::RimGeoMechResultSlot(void)
|
RimGeoMechResultSlot::RimGeoMechResultSlot(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
CAF_PDM_InitObject("Color Result", ":/CellResult.png", "", "");
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
|
||||||
this->legendConfig = new RimLegendConfig();
|
this->legendConfig = new RimLegendConfig();
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_resultPositionType, "ResultPositionType" , "Result Position", "", "", "");
|
|
||||||
m_resultPositionType.setUiHidden(true);
|
|
||||||
CAF_PDM_InitField(&m_resultFieldName, "ResultFieldName", QString(""), "Field Name", "", "", "");
|
|
||||||
m_resultFieldName.setUiHidden(true);
|
|
||||||
CAF_PDM_InitField(&m_resultComponentName, "ResultComponentName", QString(""), "Component", "", "", "");
|
|
||||||
m_resultComponentName.setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_resultPositionTypeUiField, "ResultPositionTypeUi", "Result Position", "", "", "");
|
|
||||||
m_resultPositionTypeUiField.setIOWritable(false);
|
|
||||||
m_resultPositionTypeUiField.setIOReadable(false);
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_resultVariableUiField, "ResultVariableUI", QString(""), "Value", "", "", "");
|
|
||||||
m_resultVariableUiField.setIOWritable(false);
|
|
||||||
m_resultVariableUiField.setIOReadable(false);
|
|
||||||
|
|
||||||
m_resultVariableUiField.setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
|
||||||
m_resultVariableUiField.setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -80,216 +40,3 @@ RimGeoMechResultSlot::RimGeoMechResultSlot(void)
|
|||||||
RimGeoMechResultSlot::~RimGeoMechResultSlot(void)
|
RimGeoMechResultSlot::~RimGeoMechResultSlot(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QList<caf::PdmOptionItemInfo> RimGeoMechResultSlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
|
||||||
{
|
|
||||||
QList<caf::PdmOptionItemInfo> options;
|
|
||||||
*useOptionsOnly = true;
|
|
||||||
|
|
||||||
if (m_reservoirView)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (&m_resultVariableUiField == fieldNeedingOptions)
|
|
||||||
{
|
|
||||||
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
|
|
||||||
QStringList uiVarNames;
|
|
||||||
QStringList varNames;
|
|
||||||
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames);
|
|
||||||
|
|
||||||
for (int oIdx = 0; oIdx < uiVarNames.size(); ++oIdx)
|
|
||||||
{
|
|
||||||
options.push_back(caf::PdmOptionItemInfo(uiVarNames[oIdx], varNames[oIdx]));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGeoMechResultSlot::setReservoirView(RimGeoMechView* ownerReservoirView)
|
|
||||||
{
|
|
||||||
m_reservoirView = ownerReservoirView;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimGeoMechView* RimGeoMechResultSlot::reservoirView()
|
|
||||||
{
|
|
||||||
return m_reservoirView;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGeoMechResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
||||||
{
|
|
||||||
if(&m_resultPositionTypeUiField == changedField)
|
|
||||||
{
|
|
||||||
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
|
|
||||||
QStringList uiVarNames;
|
|
||||||
QStringList varNames;
|
|
||||||
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames);
|
|
||||||
|
|
||||||
if (m_resultPositionTypeUiField() == m_resultPositionType()
|
|
||||||
&& varNames.contains(composeUiVarString(m_resultFieldName(), m_resultComponentName())))
|
|
||||||
{
|
|
||||||
m_resultVariableUiField = composeUiVarString(m_resultFieldName(), m_resultComponentName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_resultVariableUiField = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (&m_resultVariableUiField == changedField)
|
|
||||||
{
|
|
||||||
QStringList fieldComponentNames = m_resultVariableUiField().split(QRegExp("\\s+"));
|
|
||||||
if (fieldComponentNames.size() > 0)
|
|
||||||
{
|
|
||||||
m_resultPositionType = m_resultPositionTypeUiField;
|
|
||||||
m_resultFieldName = fieldComponentNames[0];
|
|
||||||
if (fieldComponentNames.size() > 1)
|
|
||||||
{
|
|
||||||
m_resultComponentName = fieldComponentNames[1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_resultComponentName = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_reservoirView->geoMechCase()->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress()))
|
|
||||||
{
|
|
||||||
m_reservoirView->hasUserRequestedAnimation = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_reservoirView->createDisplayModelAndRedraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::map<std::string, std::vector<std::string> > RimGeoMechResultSlot::getResultMetaDataForUIFieldSetting()
|
|
||||||
{
|
|
||||||
RimGeoMechCase* gmCase = m_reservoirView->geoMechCase();
|
|
||||||
if (gmCase && gmCase->geoMechData())
|
|
||||||
{
|
|
||||||
return gmCase->geoMechData()->femPartResults()->scalarFieldAndComponentNames(m_resultPositionTypeUiField());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return std::map<std::string, std::vector<std::string> >() ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RimGeoMechResultSlot::getUiAndResultVariableStringList(QStringList* uiNames, QStringList* variableNames,
|
|
||||||
const std::map<std::string, std::vector<std::string> >& fieldCompNames)
|
|
||||||
{
|
|
||||||
CVF_ASSERT(uiNames && variableNames);
|
|
||||||
|
|
||||||
std::map<std::string, std::vector<std::string> >::const_iterator fieldIt;
|
|
||||||
for (fieldIt = fieldCompNames.begin(); fieldIt != fieldCompNames.end(); ++fieldIt)
|
|
||||||
{
|
|
||||||
QString resultFieldName = QString::fromStdString(fieldIt->first);
|
|
||||||
|
|
||||||
if (resultFieldName == "E" || resultFieldName == "S") continue; // We will not show the native Stress and Strain
|
|
||||||
|
|
||||||
QString resultFieldUiName = convertToUiResultFieldName(resultFieldName);
|
|
||||||
|
|
||||||
uiNames->push_back(resultFieldUiName);
|
|
||||||
variableNames->push_back(resultFieldName);
|
|
||||||
|
|
||||||
std::vector<std::string>::const_iterator compIt;
|
|
||||||
for (compIt = fieldIt->second.begin(); compIt != fieldIt->second.end(); ++compIt)
|
|
||||||
{
|
|
||||||
QString resultCompName = QString::fromStdString(*compIt);
|
|
||||||
uiNames->push_back(" " + resultCompName);
|
|
||||||
variableNames->push_back(composeUiVarString(resultFieldName, resultCompName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString RimGeoMechResultSlot::composeUiVarString(const QString& resultFieldName, const QString& resultComponentName)
|
|
||||||
{
|
|
||||||
return resultFieldName + " " + resultComponentName;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGeoMechResultSlot::initAfterRead()
|
|
||||||
{
|
|
||||||
m_resultPositionTypeUiField = m_resultPositionType;
|
|
||||||
m_resultVariableUiField = composeUiVarString(m_resultFieldName(), m_resultComponentName());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGeoMechResultSlot::loadResult()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RigGeoMechCaseData* RimGeoMechResultSlot::ownerCaseData()
|
|
||||||
{
|
|
||||||
return m_reservoirView->geoMechCase()->geoMechData();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RimGeoMechResultSlot::hasResult()
|
|
||||||
{
|
|
||||||
return ownerCaseData()->femPartResults()->assertResultsLoaded(this->resultAddress());
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimGeoMechResultSlot::resultFieldUiName()
|
|
||||||
{
|
|
||||||
return convertToUiResultFieldName(m_resultFieldName());
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimGeoMechResultSlot::resultComponentUiName()
|
|
||||||
{
|
|
||||||
return m_resultComponentName();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimGeoMechResultSlot::convertToUiResultFieldName(QString resultFieldName)
|
|
||||||
{
|
|
||||||
if (resultFieldName == "E") return "NativeAbaqus Strain";
|
|
||||||
if (resultFieldName == "S") return "NativeAbaqus Stess";
|
|
||||||
if (resultFieldName == "NE") return "E"; // Make NE and NS appear as E and S
|
|
||||||
if (resultFieldName == "NS") return "S";
|
|
||||||
|
|
||||||
return resultFieldName;
|
|
||||||
}
|
|
||||||
|
@ -19,22 +19,17 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "RimGeoMechResultDefinition.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmObject.h"
|
|
||||||
#include "cafPdmPointer.h"
|
|
||||||
#include "cafAppEnum.h"
|
|
||||||
#include "RigFemResultPosEnum.h"
|
|
||||||
#include "RigFemResultAddress.h"
|
|
||||||
|
|
||||||
class RimLegendConfig;
|
class RimLegendConfig;
|
||||||
class RimGeoMechView;
|
|
||||||
class RifGeoMechReaderInterface;
|
|
||||||
class RigGeoMechCaseData;
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimGeoMechResultSlot : public caf::PdmObject
|
class RimGeoMechResultSlot : public RimGeoMechResultDefinition
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
@ -42,46 +37,5 @@ public:
|
|||||||
RimGeoMechResultSlot(void);
|
RimGeoMechResultSlot(void);
|
||||||
virtual ~RimGeoMechResultSlot(void);
|
virtual ~RimGeoMechResultSlot(void);
|
||||||
|
|
||||||
void setReservoirView(RimGeoMechView* ownerReservoirView);
|
|
||||||
RimGeoMechView* reservoirView();
|
|
||||||
|
|
||||||
RigGeoMechCaseData* ownerCaseData();
|
|
||||||
bool hasResult();
|
|
||||||
|
|
||||||
RigFemResultAddress resultAddress() { return RigFemResultAddress(resultPositionType(), resultFieldName().toStdString(), resultComponentName().toStdString());}
|
|
||||||
|
|
||||||
RigFemResultPosEnum resultPositionType() { return m_resultPositionType();}
|
|
||||||
QString resultFieldName() { return m_resultFieldName();}
|
|
||||||
QString resultComponentName() { return m_resultComponentName();}
|
|
||||||
|
|
||||||
QString resultFieldUiName();
|
|
||||||
QString resultComponentUiName();
|
|
||||||
|
|
||||||
caf::PdmField<RimLegendConfig*> legendConfig;
|
caf::PdmField<RimLegendConfig*> legendConfig;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
||||||
bool * useOptionsOnly);
|
|
||||||
std::map<std::string, std::vector<std::string> > getResultMetaDataForUIFieldSetting();
|
|
||||||
|
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
|
||||||
static void getUiAndResultVariableStringList(QStringList* uiNames, QStringList* variableNames,
|
|
||||||
const std::map<std::string, std::vector<std::string> >& fieldCompNames);
|
|
||||||
static QString composeUiVarString(const QString& resultFieldName, const QString& resultComponentName);
|
|
||||||
|
|
||||||
virtual void initAfterRead();
|
|
||||||
void loadResult();
|
|
||||||
|
|
||||||
caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionType;
|
|
||||||
caf::PdmField<QString> m_resultFieldName;
|
|
||||||
caf::PdmField<QString> m_resultComponentName;
|
|
||||||
|
|
||||||
caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionTypeUiField;
|
|
||||||
caf::PdmField<QString> m_resultVariableUiField;
|
|
||||||
|
|
||||||
caf::PdmPointer<RimGeoMechView> m_reservoirView;
|
|
||||||
|
|
||||||
static QString convertToUiResultFieldName(QString resultFieldName);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include "RivGeoMechVizLogic.h"
|
#include "RivGeoMechVizLogic.h"
|
||||||
#include "RigFemPartGrid.h"
|
#include "RigFemPartGrid.h"
|
||||||
#include "RigFemPartResultsCollection.h"
|
#include "RigFemPartResultsCollection.h"
|
||||||
|
#include "RimGeoMechPropertyFilterCollection.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -72,6 +73,9 @@ RimGeoMechView::RimGeoMechView(void)
|
|||||||
rangeFilterCollection = new RimCellRangeFilterCollection();
|
rangeFilterCollection = new RimCellRangeFilterCollection();
|
||||||
rangeFilterCollection->setReservoirView(this);
|
rangeFilterCollection->setReservoirView(this);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&propertyFilterCollection, "PropertyFilters", "Property Filters", "", "", "");
|
||||||
|
propertyFilterCollection = new RimGeoMechPropertyFilterCollection();
|
||||||
|
propertyFilterCollection->setReservoirView(this);
|
||||||
|
|
||||||
this->cellResult()->setReservoirView(this);
|
this->cellResult()->setReservoirView(this);
|
||||||
this->cellResult()->legendConfig()->setPosition(cvf::Vec2ui(10, 120));
|
this->cellResult()->legendConfig()->setPosition(cvf::Vec2ui(10, 120));
|
||||||
@ -148,6 +152,7 @@ void RimGeoMechView::loadDataAndUpdate()
|
|||||||
progress.setProgressDescription("Create Display model");
|
progress.setProgressDescription("Create Display model");
|
||||||
|
|
||||||
updateViewerWidget();
|
updateViewerWidget();
|
||||||
|
this->propertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||||
|
|
||||||
createDisplayModelAndRedraw();
|
createDisplayModelAndRedraw();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class RimGeoMechCase;
|
|||||||
class RivGeoMechPartMgr;
|
class RivGeoMechPartMgr;
|
||||||
class RimCellRangeFilterCollection;
|
class RimCellRangeFilterCollection;
|
||||||
class RivGeoMechVizLogic;
|
class RivGeoMechVizLogic;
|
||||||
|
class RimGeoMechPropertyFilterCollection;
|
||||||
class RigFemPart;
|
class RigFemPart;
|
||||||
|
|
||||||
namespace cvf {
|
namespace cvf {
|
||||||
@ -62,6 +62,7 @@ public:
|
|||||||
virtual void loadDataAndUpdate();
|
virtual void loadDataAndUpdate();
|
||||||
|
|
||||||
caf::PdmField<RimGeoMechResultSlot*> cellResult;
|
caf::PdmField<RimGeoMechResultSlot*> cellResult;
|
||||||
|
caf::PdmField<RimGeoMechPropertyFilterCollection*> propertyFilterCollection;
|
||||||
|
|
||||||
bool isTimeStepDependentDataVisible();
|
bool isTimeStepDependentDataVisible();
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include "RimCaseCollection.h"
|
#include "RimCaseCollection.h"
|
||||||
#include "RimCellPropertyFilterCollection.h"
|
#include "RimCellPropertyFilterCollection.h"
|
||||||
#include "RimCellRangeFilterCollection.h"
|
#include "RimCellRangeFilterCollection.h"
|
||||||
|
#include "RimGeoMechPropertyFilterCollection.h"
|
||||||
|
#include "RimGeoMechPropertyFilter.h"
|
||||||
#include "RimIdenticalGridCaseGroup.h"
|
#include "RimIdenticalGridCaseGroup.h"
|
||||||
#include "RimInputCase.h"
|
#include "RimInputCase.h"
|
||||||
#include "RimInputProperty.h"
|
#include "RimInputProperty.h"
|
||||||
@ -50,6 +52,7 @@
|
|||||||
#include "RimGeoMechCase.h"
|
#include "RimGeoMechCase.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -309,6 +312,52 @@ RimCellPropertyFilter* RimUiTreeModelPdm::addPropertyFilter(const QModelIndex& i
|
|||||||
return propertyFilter;
|
return propertyFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGeoMechPropertyFilter* RimUiTreeModelPdm::addGeoMechPropertyFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex)
|
||||||
|
{
|
||||||
|
caf::PdmUiTreeItem* currentItem = getTreeItemFromIndex(itemIndex);
|
||||||
|
|
||||||
|
QModelIndex collectionIndex;
|
||||||
|
RimGeoMechPropertyFilterCollection* propertyFilterCollection = NULL;
|
||||||
|
caf::PdmUiTreeItem* propertyFilterCollectionItem = NULL;
|
||||||
|
int position = 0;
|
||||||
|
|
||||||
|
if (dynamic_cast<RimGeoMechPropertyFilter*>(currentItem->dataObject().p()))
|
||||||
|
{
|
||||||
|
RimGeoMechPropertyFilter* propertyFilter = dynamic_cast<RimGeoMechPropertyFilter*>(currentItem->dataObject().p());
|
||||||
|
propertyFilterCollection = propertyFilter->parentContainer();
|
||||||
|
propertyFilterCollectionItem = currentItem->parent();
|
||||||
|
position = itemIndex.row();
|
||||||
|
collectionIndex = itemIndex.parent();
|
||||||
|
}
|
||||||
|
else if (dynamic_cast<RimGeoMechPropertyFilterCollection*>(currentItem->dataObject().p()))
|
||||||
|
{
|
||||||
|
propertyFilterCollection = dynamic_cast<RimGeoMechPropertyFilterCollection*>(currentItem->dataObject().p());
|
||||||
|
propertyFilterCollectionItem = currentItem;
|
||||||
|
position = propertyFilterCollectionItem->childCount();
|
||||||
|
collectionIndex = itemIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
beginInsertRows(collectionIndex, position, position);
|
||||||
|
|
||||||
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilterCollection->createAndAppendPropertyFilter();
|
||||||
|
caf::PdmUiTreeItem* childItem = new caf::PdmUiTreeItem(propertyFilterCollectionItem, position, propertyFilter);
|
||||||
|
|
||||||
|
endInsertRows();
|
||||||
|
|
||||||
|
insertedModelIndex = index(position, 0, collectionIndex);
|
||||||
|
|
||||||
|
if (propertyFilterCollection)
|
||||||
|
{
|
||||||
|
static_cast<RimView*>(propertyFilterCollection->reservoirView())->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return propertyFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -29,6 +29,7 @@ class QFileSystemWatcher;
|
|||||||
|
|
||||||
class RimCellPropertyFilter;
|
class RimCellPropertyFilter;
|
||||||
class RimCellRangeFilter;
|
class RimCellRangeFilter;
|
||||||
|
class RimGeoMechPropertyFilter;
|
||||||
class RimEclipseCase;
|
class RimEclipseCase;
|
||||||
class RimEclipseView;
|
class RimEclipseView;
|
||||||
class RimInputProperty;
|
class RimInputProperty;
|
||||||
@ -58,6 +59,7 @@ public:
|
|||||||
void deleteAllWellPaths(const QModelIndex& itemIndex);
|
void deleteAllWellPaths(const QModelIndex& itemIndex);
|
||||||
|
|
||||||
RimCellPropertyFilter* addPropertyFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
RimCellPropertyFilter* addPropertyFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||||
|
RimGeoMechPropertyFilter* addGeoMechPropertyFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||||
RimCellRangeFilter* addRangeFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
RimCellRangeFilter* addRangeFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||||
|
|
||||||
RimView* addReservoirView(const std::vector<caf::PdmUiItem*>& treeSelection);
|
RimView* addReservoirView(const std::vector<caf::PdmUiItem*>& treeSelection);
|
||||||
|
@ -52,6 +52,9 @@
|
|||||||
|
|
||||||
#include "RimCellRangeFilterCollection.h"
|
#include "RimCellRangeFilterCollection.h"
|
||||||
#include "RimCellPropertyFilterCollection.h"
|
#include "RimCellPropertyFilterCollection.h"
|
||||||
|
#include "RimCellRangeFilterCollection.h"
|
||||||
|
#include "RimGeoMechPropertyFilter.h"
|
||||||
|
#include "RimGeoMechPropertyFilterCollection.h"
|
||||||
#include "RimResultSlot.h"
|
#include "RimResultSlot.h"
|
||||||
#include "RimStatisticsCaseCollection.h"
|
#include "RimStatisticsCaseCollection.h"
|
||||||
#include "RimIdenticalGridCaseGroup.h"
|
#include "RimIdenticalGridCaseGroup.h"
|
||||||
@ -156,6 +159,16 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addAction(QString("Delete"), this, SLOT(slotDeletePropertyFilter()));
|
menu.addAction(QString("Delete"), this, SLOT(slotDeletePropertyFilter()));
|
||||||
}
|
}
|
||||||
|
else if (dynamic_cast<RimGeoMechPropertyFilterCollection*>(uiItem->dataObject().p()))
|
||||||
|
{
|
||||||
|
menu.addAction(QString("New Property Filter"), this, SLOT(slotAddGeoMechPropertyFilter()));
|
||||||
|
}
|
||||||
|
else if (dynamic_cast<RimGeoMechPropertyFilter*>(uiItem->dataObject().p()))
|
||||||
|
{
|
||||||
|
menu.addAction(QString("Insert Property Filter"), this, SLOT(slotAddGeoMechPropertyFilter()));
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(QString("Delete"), this, SLOT(slotDeleteGeoMechPropertyFilter()));
|
||||||
|
}
|
||||||
else if (dynamic_cast<RimCalcScript*>(uiItem->dataObject().p()))
|
else if (dynamic_cast<RimCalcScript*>(uiItem->dataObject().p()))
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
@ -361,6 +374,37 @@ void RimUiTreeView::slotAddPropertyFilter()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimUiTreeView::slotAddGeoMechPropertyFilter()
|
||||||
|
{
|
||||||
|
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||||
|
if (myModel)
|
||||||
|
{
|
||||||
|
QModelIndex insertedIndex;
|
||||||
|
RimGeoMechPropertyFilter* propFilter = myModel->addGeoMechPropertyFilter(currentIndex(), insertedIndex);
|
||||||
|
setCurrentIndex(insertedIndex);
|
||||||
|
if (propFilter)
|
||||||
|
{
|
||||||
|
propFilter->parentContainer()->reservoirView()->createDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimUiTreeView::slotDeleteGeoMechPropertyFilter()
|
||||||
|
{
|
||||||
|
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||||
|
if (myModel)
|
||||||
|
{
|
||||||
|
myModel->deletePropertyFilter(currentIndex());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -68,6 +68,8 @@ private slots:
|
|||||||
|
|
||||||
void slotAddPropertyFilter();
|
void slotAddPropertyFilter();
|
||||||
void slotDeletePropertyFilter();
|
void slotDeletePropertyFilter();
|
||||||
|
void slotAddGeoMechPropertyFilter();
|
||||||
|
void slotDeleteGeoMechPropertyFilter();
|
||||||
|
|
||||||
void slotEditScript();
|
void slotEditScript();
|
||||||
void slotNewScript();
|
void slotNewScript();
|
||||||
|
Loading…
Reference in New Issue
Block a user