#3017 Restructure UI

This commit is contained in:
Magne Sjaastad 2018-06-07 16:50:50 +02:00
parent 350d0bbee4
commit dae054cf8f
4 changed files with 75 additions and 122 deletions

View File

@ -23,23 +23,8 @@
#include "RimFractureTemplate.h" #include "RimFractureTemplate.h"
#include "RimProject.h" #include "RimProject.h"
#include "cafPdmUiSliderEditor.h"
CAF_PDM_SOURCE_INIT(RimFractureContainment, "FractureContainment"); CAF_PDM_SOURCE_INIT(RimFractureContainment, "FractureContainment");
namespace caf
{
template<>
void caf::AppEnum<RimFractureContainment::FaultTruncType>::setUp()
{
addItem(RimFractureContainment::DISABLED, "DISABLED", "Continue Across");
addItem(RimFractureContainment::TRUNCATE_AT_FAULT, "TRUNCATE_AT_FAULT", "Truncate At Faults");
addItem(RimFractureContainment::CONTINUE_IN_CONTAINMENT_ZONE, "CONTINUE_IN_CONTAINMENT_ZONE", "Continue in Containment Zone");
setDefault(RimFractureContainment::DISABLED);
}
} // namespace caf
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -47,20 +32,13 @@ RimFractureContainment::RimFractureContainment()
{ {
CAF_PDM_InitObject("Fracture Containment", "", "", ""); CAF_PDM_InitObject("Fracture Containment", "", "", "");
CAF_PDM_InitField( CAF_PDM_InitField(&m_useContainment, "IsUsingFractureContainment", false, "Use Containment", "", "", "");
&m_isUsingFractureContainment_OBSOLETE, "IsUsingFractureContainment", false, "Fracture Containment", "", "", "");
m_isUsingFractureContainment_OBSOLETE.xmlCapability()->setIOWritable(false);
m_isUsingFractureContainment_OBSOLETE.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_topKLayer, "TopKLayer", 0, " Top Layer", "", "", ""); CAF_PDM_InitField(&m_topKLayer, "TopKLayer", 0, " Top Layer", "", "", "");
// m_topKLayer.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_baseKLayer, "BaseKLayer", 0, " Base Layer", "", "", ""); CAF_PDM_InitField(&m_baseKLayer, "BaseKLayer", 0, " Base Layer", "", "", "");
// m_topKLayer.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_faultTruncation, "FaultTruncationType", "Fault Truncation", "", "", "");
CAF_PDM_InitField(&m_truncateAtFaults, "TruncateAtFaults", false, "Truncate At Faults", "", "", "");
CAF_PDM_InitField(&m_useFaultThrow, "UseFaultThrow", false, " Use Fault Throw", "", "", ""); CAF_PDM_InitField(&m_useFaultThrow, "UseFaultThrow", false, " Use Fault Throw", "", "", "");
CAF_PDM_InitField(&m_faultThrowValue, "FaultThrowValue", 0.0f, " Fault Throw", "", "", ""); CAF_PDM_InitField(&m_maximumFaultThrow, "FaultThrowValue", 0.0f, " Maximum Fault Throw", "", "", "");
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -71,32 +49,11 @@ RimFractureContainment::~RimFractureContainment() {}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimFractureContainment::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, double RimFractureContainment::maximumFaultThrow() const
bool* useOptionsOnly)
{ {
// TODO: Remove this if (m_truncateAtFaults() && m_useFaultThrow())
return caf::PdmObject::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureContainment::initAfterRead()
{ {
if (m_isUsingFractureContainment_OBSOLETE()) return m_maximumFaultThrow;
{
m_faultTruncation = CONTINUE_IN_CONTAINMENT_ZONE;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFractureContainment::faultThrow() const
{
if ((m_faultTruncation() == CONTINUE_IN_CONTAINMENT_ZONE || m_faultTruncation() == TRUNCATE_AT_FAULT) && m_useFaultThrow())
{
return m_faultThrowValue;
} }
return -1.0; return -1.0;
@ -107,7 +64,7 @@ double RimFractureContainment::faultThrow() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimFractureContainment::isEnabled() const bool RimFractureContainment::isEnabled() const
{ {
return m_faultTruncation() != DISABLED; return (m_useContainment() || m_truncateAtFaults());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -120,7 +77,7 @@ bool RimFractureContainment::isEclipseCellWithinContainment(const RigMainGrid*
{ {
if (!isEnabled()) return true; if (!isEnabled()) return true;
if (m_faultTruncation() == CONTINUE_IN_CONTAINMENT_ZONE || m_faultTruncation() == TRUNCATE_AT_FAULT) if (m_useContainment())
{ {
CVF_ASSERT(mainGrid); CVF_ASSERT(mainGrid);
@ -140,7 +97,7 @@ bool RimFractureContainment::isEclipseCellWithinContainment(const RigMainGrid*
} }
} }
if (m_faultTruncation() == TRUNCATE_AT_FAULT) if (m_truncateAtFaults())
{ {
if (containmentCells.count(globalCellIndex) > 0) if (containmentCells.count(globalCellIndex) > 0)
{ {
@ -176,21 +133,27 @@ void RimFractureContainment::setBaseKLayer(int baseKLayer)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimFractureContainment::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimFractureContainment::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{ {
uiOrdering.add(&m_faultTruncation); uiOrdering.add(&m_useContainment);
if (m_faultTruncation() == CONTINUE_IN_CONTAINMENT_ZONE || m_faultTruncation() == TRUNCATE_AT_FAULT)
{
uiOrdering.add(&m_topKLayer); uiOrdering.add(&m_topKLayer);
uiOrdering.add(&m_baseKLayer); uiOrdering.add(&m_baseKLayer);
uiOrdering.add(&m_useFaultThrow); m_topKLayer.uiCapability()->setUiReadOnly(!m_useContainment());
if (m_useFaultThrow()) m_baseKLayer.uiCapability()->setUiReadOnly(!m_useContainment());
{
uiOrdering.add(&m_faultThrowValue);
}
}
uiOrdering.skipRemainingFields(); uiOrdering.add(&m_truncateAtFaults);
uiOrdering.add(&m_useFaultThrow);
uiOrdering.add(&m_maximumFaultThrow);
m_useFaultThrow.uiCapability()->setUiReadOnly(!m_truncateAtFaults());
if (m_truncateAtFaults() && m_useFaultThrow())
{
m_maximumFaultThrow.uiCapability()->setUiReadOnly(false);
}
else
{
m_maximumFaultThrow.uiCapability()->setUiReadOnly(true);
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -200,8 +163,6 @@ void RimFractureContainment::fieldChangedByUi(const caf::PdmFieldHandle* changed
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue) const QVariant& newValue)
{ {
if (changedField == &m_faultTruncation || changedField == &m_topKLayer || changedField == &m_baseKLayer ||
changedField == &m_useFaultThrow || changedField == &m_faultThrowValue)
{ {
RimProject* proj; RimProject* proj;
this->firstAncestorOrThisOfType(proj); this->firstAncestorOrThisOfType(proj);
@ -211,7 +172,7 @@ void RimFractureContainment::fieldChangedByUi(const caf::PdmFieldHandle* changed
} }
} }
if (changedField == &m_useFaultThrow || changedField == &m_faultTruncation) if (changedField == &m_useFaultThrow || changedField == &m_useContainment || changedField == &m_truncateAtFaults)
{ {
RimFractureTemplate* fractureTemplate = nullptr; RimFractureTemplate* fractureTemplate = nullptr;
this->firstAncestorOrThisOfType(fractureTemplate); this->firstAncestorOrThisOfType(fractureTemplate);

View File

@ -19,7 +19,6 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafAppEnum.h"
class RigMainGrid; class RigMainGrid;
@ -34,36 +33,24 @@ public:
RimFractureContainment(); RimFractureContainment();
~RimFractureContainment(); ~RimFractureContainment();
enum FaultTruncType
{
DISABLED,
TRUNCATE_AT_FAULT,
CONTINUE_IN_CONTAINMENT_ZONE
};
bool isEnabled() const; bool isEnabled() const;
bool isEclipseCellWithinContainment(const RigMainGrid* mainGrid, size_t anchorEclipseCell, size_t globalCellIndex, const std::set<size_t>& containmentCells) const; bool isEclipseCellWithinContainment(const RigMainGrid* mainGrid, size_t anchorEclipseCell, size_t globalCellIndex, const std::set<size_t>& containmentCells) const;
void setTopKLayer(int topKLayer); void setTopKLayer(int topKLayer);
void setBaseKLayer(int baseKLayer); void setBaseKLayer(int baseKLayer);
double faultThrow() const; // Negative value means do not test for fault throw double maximumFaultThrow() const; // Negative value means do not test for fault throw
private: private:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
virtual void initAfterRead() override;
private: private:
friend caf::AppEnum< FaultTruncType >; caf::PdmField<bool> m_useContainment;
caf::PdmField< caf::AppEnum< FaultTruncType > > m_faultTruncation;
caf::PdmField<int> m_topKLayer; caf::PdmField<int> m_topKLayer;
caf::PdmField<int> m_baseKLayer; caf::PdmField<int> m_baseKLayer;
caf::PdmField<bool> m_truncateAtFaults;
caf::PdmField<bool> m_useFaultThrow; caf::PdmField<bool> m_useFaultThrow;
caf::PdmField<float> m_faultThrowValue; caf::PdmField<float> m_maximumFaultThrow;
caf::PdmField<bool> m_isUsingFractureContainment_OBSOLETE;
}; };

View File

@ -18,7 +18,6 @@
#include "RimFractureContainmentTools.h" #include "RimFractureContainmentTools.h"
#include "RigActiveCellInfo.h"
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
#include "RigFault.h" #include "RigFault.h"
#include "RigHexIntersectionTools.h" #include "RigHexIntersectionTools.h"
@ -43,7 +42,7 @@ void RimFractureContainmentTools::appendNeighborCellForFace(const std::set<size_
size_t currentCell, size_t currentCell,
cvf::StructGridInterface::FaceType face, cvf::StructGridInterface::FaceType face,
std::set<size_t>& connectedCells, std::set<size_t>& connectedCells,
double faultThrow) double maximumFaultThrow)
{ {
// TODO: Remove when we know if LGR can have faults // TODO: Remove when we know if LGR can have faults
@ -53,7 +52,7 @@ void RimFractureContainmentTools::appendNeighborCellForFace(const std::set<size_
size_t candidate; size_t candidate;
if (mainGrid->cellIJKNeighbor(anchorI, anchorJ, anchorK, face, &candidate)) if (mainGrid->cellIJKNeighbor(anchorI, anchorJ, anchorK, face, &candidate))
{ {
appendNeighborCells(allFracturedCells, mainGrid, candidate, connectedCells, faultThrow); appendNeighborCells(allFracturedCells, mainGrid, candidate, connectedCells, maximumFaultThrow);
} }
} }
@ -65,12 +64,12 @@ void RimFractureContainmentTools::checkFaultAndAppendNeighborCell(const std::set
size_t globalReservoirCellIndex, size_t globalReservoirCellIndex,
cvf::StructGridInterface::FaceType face, cvf::StructGridInterface::FaceType face,
std::set<size_t>& connectedCells, std::set<size_t>& connectedCells,
double faultThrow) double maximumFaultThrow)
{ {
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(globalReservoirCellIndex, face); const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(globalReservoirCellIndex, face);
if (fault) if (fault)
{ {
if (faultThrow < 0.0) if (maximumFaultThrow < 0.0)
{ {
return; return;
} }
@ -98,15 +97,16 @@ void RimFractureContainmentTools::checkFaultAndAppendNeighborCell(const std::set
const RigCell& currentCell = mainGrid->globalCellArray()[globalReservoirCellIndex]; const RigCell& currentCell = mainGrid->globalCellArray()[globalReservoirCellIndex];
const RigCell& neightborCell = mainGrid->globalCellArray()[neighborGlobalReservoirCellIndex]; const RigCell& neightborCell = mainGrid->globalCellArray()[neighborGlobalReservoirCellIndex];
auto diffBetweenFaceCenters = currentCell.faceCenter(face) - neightborCell.faceCenter(cvf::StructGridInterface::oppositeFace(face)); auto diffBetweenFaceCenters =
if (diffBetweenFaceCenters.length() < faultThrow) currentCell.faceCenter(face) - neightborCell.faceCenter(cvf::StructGridInterface::oppositeFace(face));
if (diffBetweenFaceCenters.length() > maximumFaultThrow)
{ {
return; return;
} }
} }
} }
appendNeighborCellForFace(allFracturedCells, mainGrid, globalReservoirCellIndex, face, connectedCells, faultThrow); appendNeighborCellForFace(allFracturedCells, mainGrid, globalReservoirCellIndex, face, connectedCells, maximumFaultThrow);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -116,7 +116,7 @@ void RimFractureContainmentTools::appendNeighborCells(const std::set<size_t>& al
const RigMainGrid* mainGrid, const RigMainGrid* mainGrid,
size_t currentCell, size_t currentCell,
std::set<size_t>& connectedCells, std::set<size_t>& connectedCells,
double faultThrow) double maximumFaultThrow)
{ {
if (std::find(connectedCells.begin(), connectedCells.end(), currentCell) != connectedCells.end()) if (std::find(connectedCells.begin(), connectedCells.end(), currentCell) != connectedCells.end())
{ {
@ -133,14 +133,20 @@ void RimFractureContainmentTools::appendNeighborCells(const std::set<size_t>& al
connectedCells.insert(currentCell); connectedCells.insert(currentCell);
// Check faults in IJ directions // Check faults in IJ directions
checkFaultAndAppendNeighborCell(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_I, connectedCells, faultThrow); checkFaultAndAppendNeighborCell(
checkFaultAndAppendNeighborCell(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_I, connectedCells, faultThrow); allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_I, connectedCells, maximumFaultThrow);
checkFaultAndAppendNeighborCell(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_J, connectedCells, faultThrow); checkFaultAndAppendNeighborCell(
checkFaultAndAppendNeighborCell(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_J, connectedCells, faultThrow); allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_I, connectedCells, maximumFaultThrow);
checkFaultAndAppendNeighborCell(
allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_J, connectedCells, maximumFaultThrow);
checkFaultAndAppendNeighborCell(
allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_J, connectedCells, maximumFaultThrow);
// Append cells without fault check in K direction // Append cells without fault check in K direction
appendNeighborCellForFace(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_K, connectedCells, faultThrow); appendNeighborCellForFace(
appendNeighborCellForFace(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_K, connectedCells, faultThrow); allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_K, connectedCells, maximumFaultThrow);
appendNeighborCellForFace(
allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_K, connectedCells, maximumFaultThrow);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -157,24 +163,25 @@ std::set<size_t> RimFractureContainmentTools::fracturedCellsTruncatedByFaults(co
if (eclipseCaseData) if (eclipseCaseData)
{ {
auto mainGrid = eclipseCaseData->mainGrid(); auto mainGrid = eclipseCaseData->mainGrid();
auto activeCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::MATRIX_MODEL);
if (mainGrid && activeCellInfo) if (mainGrid)
{ {
std::set<size_t> cellsIntersectingFracturePlane = std::set<size_t> cellsIntersectingFracturePlane = getCellsIntersectingFracturePlane(mainGrid, fracture);
getCellsIntersectingFracturePlane(mainGrid, activeCellInfo, fracture);
size_t anchorCellGlobalIndex = fracture->findAnchorEclipseCell(mainGrid); size_t anchorCellGlobalIndex = fracture->findAnchorEclipseCell(mainGrid);
// Negative faultThrow disables test on faultThrow // Negative faultThrow disables test on faultThrow
double faultThrow = -1.0; double maximumFaultThrow = -1.0;
if (fracture && fracture->fractureTemplate()) if (fracture && fracture->fractureTemplate())
{ {
faultThrow = fracture->fractureTemplate()->fractureContainment()->faultThrow(); maximumFaultThrow = fracture->fractureTemplate()->fractureContainment()->maximumFaultThrow();
} }
appendNeighborCells( appendNeighborCells(cellsIntersectingFracturePlane,
cellsIntersectingFracturePlane, mainGrid, anchorCellGlobalIndex, fracturedCellsContainedByFaults, faultThrow); mainGrid,
anchorCellGlobalIndex,
fracturedCellsContainedByFaults,
maximumFaultThrow);
} }
/* /*
@ -195,7 +202,6 @@ std::set<size_t> RimFractureContainmentTools::fracturedCellsTruncatedByFaults(co
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::set<size_t> RimFractureContainmentTools::getCellsIntersectingFracturePlane(const RigMainGrid* mainGrid, std::set<size_t> RimFractureContainmentTools::getCellsIntersectingFracturePlane(const RigMainGrid* mainGrid,
const RigActiveCellInfo* activeCellInfo,
RimFracture* fracture) RimFracture* fracture)
{ {
std::set<size_t> eclipseCellIndices; std::set<size_t> eclipseCellIndices;

View File

@ -24,7 +24,6 @@
#include <vector> #include <vector>
class RigMainGrid; class RigMainGrid;
class RigActiveCellInfo;
class RimFracture; class RimFracture;
class RimEclipseCase; class RimEclipseCase;
@ -35,26 +34,26 @@ public:
private: private:
// TODO: Try to change RimStimPlanFractureTemplate::fractureTriangleGeometry to be able to use const RimFracture // TODO: Try to change RimStimPlanFractureTemplate::fractureTriangleGeometry to be able to use const RimFracture
static std::set<size_t> static std::set<size_t> getCellsIntersectingFracturePlane(const RigMainGrid* mainGrid,
getCellsIntersectingFracturePlane(const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo, RimFracture* fracture); RimFracture* fracture);
static void appendNeighborCellForFace(const std::set<size_t>& allFracturedCells, static void appendNeighborCellForFace(const std::set<size_t>& allFracturedCells,
const RigMainGrid* mainGrid, const RigMainGrid* mainGrid,
size_t currentCell, size_t currentCell,
cvf::StructGridInterface::FaceType face, cvf::StructGridInterface::FaceType face,
std::set<size_t>& connectedCells, std::set<size_t>& connectedCells,
double faultThrow); double maximumFaultThrow);
static void checkFaultAndAppendNeighborCell(const std::set<size_t>& allFracturedCells, static void checkFaultAndAppendNeighborCell(const std::set<size_t>& allFracturedCells,
const RigMainGrid* mainGrid, const RigMainGrid* mainGrid,
size_t currentCell, size_t currentCell,
cvf::StructGridInterface::FaceType face, cvf::StructGridInterface::FaceType face,
std::set<size_t>& connectedCells, std::set<size_t>& connectedCells,
double faultThrow); double maximumFaultThrow);
static void appendNeighborCells(const std::set<size_t>& allFracturedCells, static void appendNeighborCells(const std::set<size_t>& allFracturedCells,
const RigMainGrid* mainGrid, const RigMainGrid* mainGrid,
size_t currentCell, size_t currentCell,
std::set<size_t>& connectedCells, std::set<size_t>& connectedCells,
double faultThrow); double maximumFaultThrow);
}; };