2017-06-08 15:54:06 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 - Statoil ASA
|
2018-05-25 01:13:11 -05:00
|
|
|
//
|
2017-06-08 15:54:06 -05:00
|
|
|
// 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.
|
2018-05-25 01:13:11 -05:00
|
|
|
//
|
2017-06-08 15:54:06 -05:00
|
|
|
// 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.
|
2018-05-25 01:13:11 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-06-08 15:54:06 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2017-09-07 15:05:20 -05:00
|
|
|
|
2017-06-08 15:54:06 -05:00
|
|
|
#include "RimFractureContainment.h"
|
2017-09-07 15:05:20 -05:00
|
|
|
|
2017-06-20 04:18:19 -05:00
|
|
|
#include "RigMainGrid.h"
|
2017-09-07 15:05:20 -05:00
|
|
|
|
2018-05-25 01:58:04 -05:00
|
|
|
#include "RimFractureTemplate.h"
|
2017-06-27 06:19:21 -05:00
|
|
|
#include "RimProject.h"
|
2017-06-08 15:54:06 -05:00
|
|
|
|
2017-09-07 15:05:20 -05:00
|
|
|
#include "cafPdmUiSliderEditor.h"
|
|
|
|
|
2017-06-08 15:54:06 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RimFractureContainment, "FractureContainment");
|
|
|
|
|
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
template<>
|
2018-05-25 01:13:11 -05:00
|
|
|
void caf::AppEnum<RimFractureContainment::FaultTruncType>::setUp()
|
2017-06-08 15:54:06 -05:00
|
|
|
{
|
2018-05-25 01:58:04 -05:00
|
|
|
addItem(RimFractureContainment::DISABLED, "DISABLED", "Continue Across");
|
2017-06-08 15:54:06 -05:00
|
|
|
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);
|
|
|
|
}
|
2018-05-25 01:13:11 -05:00
|
|
|
} // namespace caf
|
2017-06-08 15:54:06 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
///
|
2017-06-08 15:54:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimFractureContainment::RimFractureContainment()
|
|
|
|
{
|
|
|
|
CAF_PDM_InitObject("Fracture Containment", "", "", "");
|
|
|
|
|
2018-05-30 07:01:50 -05:00
|
|
|
CAF_PDM_InitField(
|
|
|
|
&m_isUsingFractureContainment_OBSOLETE, "IsUsingFractureContainment", false, "Fracture Containment", "", "", "");
|
2018-05-25 01:58:04 -05:00
|
|
|
m_isUsingFractureContainment_OBSOLETE.xmlCapability()->setIOWritable(false);
|
|
|
|
m_isUsingFractureContainment_OBSOLETE.uiCapability()->setUiHidden(true);
|
|
|
|
|
2017-06-20 04:18:19 -05:00
|
|
|
CAF_PDM_InitField(&m_topKLayer, "TopKLayer", 0, "Top Layer", "", "", "");
|
2018-05-25 01:13:11 -05:00
|
|
|
// m_topKLayer.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
2017-06-20 04:18:19 -05:00
|
|
|
CAF_PDM_InitField(&m_baseKLayer, "BaseKLayer", 0, "Base Layer", "", "", "");
|
2018-05-25 01:13:11 -05:00
|
|
|
// m_topKLayer.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
2017-06-08 15:54:06 -05:00
|
|
|
|
2018-05-25 01:13:11 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_faultTruncation, "FaultTruncationType", "Fault Truncation", "", "", "");
|
2018-06-04 04:16:34 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitField(&m_useFaultThrow, "UseFaultThrow", false, "Use Fault Throw", "", "", "");
|
|
|
|
CAF_PDM_InitField(&m_faultThrowValue, "FaultThrowValue", 0.0f, " Fault Throw", "", "", "");
|
2017-06-20 04:18:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
///
|
2017-06-20 04:18:19 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
RimFractureContainment::~RimFractureContainment() {}
|
2017-06-08 15:54:06 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
///
|
2017-06-08 15:54:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> RimFractureContainment::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly)
|
2017-06-08 15:54:06 -05:00
|
|
|
{
|
2018-05-25 01:58:04 -05:00
|
|
|
// TODO: Remove this
|
|
|
|
return caf::PdmObject::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimFractureContainment::initAfterRead()
|
|
|
|
{
|
|
|
|
if (m_isUsingFractureContainment_OBSOLETE())
|
2017-06-08 15:54:06 -05:00
|
|
|
{
|
2018-05-25 01:58:04 -05:00
|
|
|
m_faultTruncation = CONTINUE_IN_CONTAINMENT_ZONE;
|
2017-06-08 15:54:06 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-04 04:16:34 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RimFractureContainment::faultThrow() const
|
|
|
|
{
|
|
|
|
if ((m_faultTruncation() == CONTINUE_IN_CONTAINMENT_ZONE || m_faultTruncation() == TRUNCATE_AT_FAULT) && m_useFaultThrow())
|
|
|
|
{
|
|
|
|
return m_faultThrowValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1.0;
|
|
|
|
}
|
|
|
|
|
2017-06-20 04:18:19 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
///
|
2017-06-20 04:18:19 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
bool RimFractureContainment::isEnabled() const
|
|
|
|
{
|
2018-05-25 01:58:04 -05:00
|
|
|
return m_faultTruncation() != DISABLED;
|
2018-05-25 01:13:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-30 07:01:50 -05:00
|
|
|
bool RimFractureContainment::isEclipseCellWithinContainment(const RigMainGrid* mainGrid,
|
|
|
|
size_t anchorEclipseCell,
|
|
|
|
size_t globalCellIndex,
|
|
|
|
const std::set<size_t>& containmentCells) const
|
2017-06-20 04:18:19 -05:00
|
|
|
{
|
2018-05-25 01:58:04 -05:00
|
|
|
if (!isEnabled()) return true;
|
2017-06-20 04:18:19 -05:00
|
|
|
|
2018-05-30 07:01:50 -05:00
|
|
|
if (m_faultTruncation() == CONTINUE_IN_CONTAINMENT_ZONE || m_faultTruncation() == TRUNCATE_AT_FAULT)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(mainGrid);
|
2017-06-20 04:18:19 -05:00
|
|
|
|
2018-05-30 07:01:50 -05:00
|
|
|
size_t i, j, k;
|
|
|
|
if (globalCellIndex >= mainGrid->globalCellArray().size()) return false;
|
2017-06-20 04:18:19 -05:00
|
|
|
|
2018-05-30 07:01:50 -05:00
|
|
|
mainGrid->ijkFromCellIndex(globalCellIndex, &i, &j, &k);
|
2017-06-20 04:18:19 -05:00
|
|
|
|
2018-05-30 07:01:50 -05:00
|
|
|
if (k + 1 < static_cast<size_t>(m_topKLayer()))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k + 1 > static_cast<size_t>(m_baseKLayer()))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2017-06-20 09:35:06 -05:00
|
|
|
}
|
|
|
|
|
2018-05-30 07:01:50 -05:00
|
|
|
if (m_faultTruncation() == TRUNCATE_AT_FAULT)
|
2017-06-20 09:35:06 -05:00
|
|
|
{
|
2018-05-30 07:01:50 -05:00
|
|
|
if (containmentCells.count(globalCellIndex) > 0)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2017-06-20 09:35:06 -05:00
|
|
|
}
|
2017-06-20 04:18:19 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-06-08 15:54:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
///
|
2018-03-05 07:17:18 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimFractureContainment::setTopKLayer(int topKLayer)
|
|
|
|
{
|
|
|
|
m_topKLayer = topKLayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
///
|
2018-03-05 07:17:18 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimFractureContainment::setBaseKLayer(int baseKLayer)
|
|
|
|
{
|
|
|
|
m_baseKLayer = baseKLayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
///
|
2017-06-08 15:54:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimFractureContainment::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
{
|
2018-05-25 01:58:04 -05:00
|
|
|
uiOrdering.add(&m_faultTruncation);
|
|
|
|
|
2018-05-30 07:01:50 -05:00
|
|
|
if (m_faultTruncation() == CONTINUE_IN_CONTAINMENT_ZONE || m_faultTruncation() == TRUNCATE_AT_FAULT)
|
2018-05-25 01:58:04 -05:00
|
|
|
{
|
|
|
|
uiOrdering.add(&m_topKLayer);
|
|
|
|
uiOrdering.add(&m_baseKLayer);
|
2018-06-04 04:16:34 -05:00
|
|
|
|
|
|
|
uiOrdering.add(&m_useFaultThrow);
|
|
|
|
if (m_useFaultThrow())
|
|
|
|
{
|
|
|
|
uiOrdering.add(&m_faultThrowValue);
|
|
|
|
}
|
2018-05-25 01:58:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
uiOrdering.skipRemainingFields();
|
2017-06-08 15:54:06 -05:00
|
|
|
}
|
|
|
|
|
2017-06-27 06:19:21 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
///
|
2017-06-27 06:19:21 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-25 01:13:11 -05:00
|
|
|
void RimFractureContainment::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue)
|
2017-06-27 06:19:21 -05:00
|
|
|
{
|
2018-06-04 04:16:34 -05:00
|
|
|
if (changedField == &m_faultTruncation || changedField == &m_topKLayer || changedField == &m_baseKLayer ||
|
|
|
|
changedField == &m_useFaultThrow || changedField == &m_faultThrowValue)
|
2017-06-27 06:19:21 -05:00
|
|
|
{
|
|
|
|
RimProject* proj;
|
|
|
|
this->firstAncestorOrThisOfType(proj);
|
2017-08-02 03:50:11 -05:00
|
|
|
if (proj)
|
|
|
|
{
|
|
|
|
proj->reloadCompletionTypeResultsInAllViews();
|
|
|
|
}
|
2017-06-27 06:19:21 -05:00
|
|
|
}
|
2018-05-25 01:58:04 -05:00
|
|
|
|
2018-06-04 04:16:34 -05:00
|
|
|
if (changedField == &m_useFaultThrow || changedField == &m_faultTruncation)
|
2018-05-25 01:58:04 -05:00
|
|
|
{
|
|
|
|
RimFractureTemplate* fractureTemplate = nullptr;
|
|
|
|
this->firstAncestorOrThisOfType(fractureTemplate);
|
|
|
|
if (fractureTemplate)
|
|
|
|
{
|
|
|
|
fractureTemplate->updateConnectedEditors();
|
|
|
|
}
|
|
|
|
}
|
2017-06-27 06:19:21 -05:00
|
|
|
}
|