mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1040 - pre-proto - Setting correct center of fracture for SimWellFracture
This commit is contained in:
@@ -75,6 +75,7 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
fracture->name = "Simulation Well Fracture";
|
||||
fracture->setIJK(simWellItem->i, simWellItem->j, simWellItem->k);
|
||||
fracture->setCellCenterPosition();
|
||||
|
||||
|
||||
RimOilField* oilfield = nullptr;
|
||||
|
||||
@@ -72,6 +72,8 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
|
||||
fracture->fractureDefinition = fracDef;
|
||||
}
|
||||
|
||||
fracture->setIJK(0, 0, 0);
|
||||
fracture->setCellCenterPosition();
|
||||
|
||||
fractureCollection->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(fracture);
|
||||
|
||||
@@ -53,6 +53,8 @@ public:
|
||||
|
||||
private:
|
||||
bool isRecomputeGeometryFlagSet();
|
||||
// cvf::Vec3d fracturePositionForUi() const;
|
||||
|
||||
|
||||
private:
|
||||
cvf::ref<RigFracture> m_rigFracture;
|
||||
|
||||
@@ -60,6 +60,14 @@ RimSimWellFracture::RimSimWellFracture(void)
|
||||
CAF_PDM_InitField(&m_j, "J", 1, "Fracture location cell J", "", "", "");
|
||||
CAF_PDM_InitField(&m_k, "K", 1, "Fracture location cell K", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&cellCenterPosition, "cellCenterPosition", cvf::Vec3d::ZERO, "Fracture Position cell center", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&ui_cellCenterPosition, "ui_cellCenterPosition", "Fracture Position cell center", "", "", "");
|
||||
ui_cellCenterPosition.registerGetMethod(this, &RimSimWellFracture::fracturePositionForUi);
|
||||
ui_cellCenterPosition.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
cellCenterPosition.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&fractureDefinition, "FractureDef", "FractureDef", "", "", "");
|
||||
|
||||
}
|
||||
@@ -120,7 +128,7 @@ cvf::Vec3d RimSimWellFracture::centerPointForFracture()
|
||||
const RigMainGrid* mainGrid = mainView->eclipseCase()->reservoirData()->mainGrid();
|
||||
if (!mainGrid) return undef;
|
||||
|
||||
size_t gridCellIndex = mainGrid->cellIndexFromIJK(m_i, m_j, m_k);
|
||||
size_t gridCellIndex = mainGrid->cellIndexFromIJK(m_i-1, m_j-1, m_k-1); // cellIndexFromIJK uses 0-based indexing
|
||||
const RigCell& rigCell = mainGrid->cell(gridCellIndex);
|
||||
cvf::Vec3d center = rigCell.center();
|
||||
return center;
|
||||
@@ -134,6 +142,24 @@ RimFractureDefinition* RimSimWellFracture::attachedFractureDefinition()
|
||||
return fractureDefinition();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
|
||||
if (changedField == &m_i || changedField == &m_j || changedField == &m_k)
|
||||
{
|
||||
cellCenterPosition = centerPointForFracture();
|
||||
}
|
||||
|
||||
setRecomputeGeometryFlag();
|
||||
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
if (proj) proj->createDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -153,6 +179,14 @@ void RimSimWellFracture::setIJK(size_t i, size_t j, size_t k)
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellFracture::setCellCenterPosition()
|
||||
{
|
||||
cellCenterPosition = centerPointForFracture();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -166,7 +200,20 @@ void RimSimWellFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderi
|
||||
geometryGroup->add(&m_i);
|
||||
geometryGroup->add(&m_j);
|
||||
geometryGroup->add(&m_k);
|
||||
geometryGroup->add(&ui_cellCenterPosition);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimSimWellFracture::fracturePositionForUi() const
|
||||
{
|
||||
cvf::Vec3d v = cellCenterPosition;
|
||||
|
||||
v.z() = -v.z();
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
@@ -51,16 +52,21 @@ public:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
void setIJK(size_t i, size_t j, size_t k);
|
||||
|
||||
void setCellCenterPosition();
|
||||
// Overrides from RimFracture
|
||||
virtual cvf::Vec3d centerPointForFracture() override;
|
||||
virtual RimFractureDefinition* attachedFractureDefinition() override;
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
cvf::Vec3d fracturePositionForUi() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_i; //Eclipse indexing, lowest value is 1
|
||||
caf::PdmField<int> m_j;
|
||||
caf::PdmField<int> m_k;
|
||||
caf::PdmField<cvf::Vec3d> cellCenterPosition;
|
||||
caf::PdmProxyValueField<cvf::Vec3d> ui_cellCenterPosition;
|
||||
};
|
||||
|
||||
@@ -56,11 +56,9 @@ RimWellPathFracture::RimWellPathFracture(void)
|
||||
CAF_PDM_InitField( &positionAtWellpath, "PositionAtWellpath", cvf::Vec3d::ZERO, "Fracture Position along Well Path", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&ui_positionAtWellpath, "ui_positionAtWellpath", "Fracture Position at Well Path", "", "", "");
|
||||
ui_positionAtWellpath.registerGetMethod(this, &RimWellPathFracture::wellPositionForUi);
|
||||
ui_positionAtWellpath.registerSetMethod(this, &RimWellPathFracture::setWellPositionFromUi);
|
||||
ui_positionAtWellpath.registerGetMethod(this, &RimWellPathFracture::fracturePositionForUi);
|
||||
ui_positionAtWellpath.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
|
||||
CAF_PDM_InitField(&i, "I", 1, "Fracture location cell I", "", "", "");
|
||||
CAF_PDM_InitField(&j, "J", 1, "Fracture location cell J", "", "", "");
|
||||
CAF_PDM_InitField(&k, "K", 1, "Fracture location cell K", "", "", "");
|
||||
@@ -178,26 +176,15 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimWellPathFracture::wellPositionForUi() const
|
||||
cvf::Vec3d RimWellPathFracture::fracturePositionForUi() const
|
||||
{
|
||||
cvf::Vec3d v = positionAtWellpath();
|
||||
cvf::Vec3d v = positionAtWellpath;
|
||||
|
||||
v.z() = -v.z();
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathFracture::setWellPositionFromUi(const cvf::Vec3d& vec)
|
||||
{
|
||||
cvf::Vec3d v = vec;
|
||||
|
||||
v.z() = -v.z();
|
||||
|
||||
positionAtWellpath = v;
|
||||
}
|
||||
|
||||
@@ -67,8 +67,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
cvf::Vec3d fracturePositionForUi() const;
|
||||
|
||||
private:
|
||||
cvf::Vec3d wellPositionForUi() const;
|
||||
void setWellPositionFromUi(const cvf::Vec3d& vec);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user