mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1585 corrected calculations of achor cell on fracture
Move IJK achor cell visualization to SimWellFracture Remove unused IJK fields and IJK anchor cell from RimFracture, because they are ambigous for well path fractions. Should be a list, but not implemented yet
This commit is contained in:
@@ -63,6 +63,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include "RigHexIntersectionTools.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimFracture, "Fracture");
|
||||
|
||||
@@ -81,11 +82,14 @@ RimFracture::RimFracture(void)
|
||||
CAF_PDM_InitFieldNoDefault(&m_uiAnchorPosition, "ui_positionAtWellpath", "Fracture Position", "", "", "");
|
||||
m_uiAnchorPosition.registerGetMethod(this, &RimFracture::fracturePositionForUi);
|
||||
m_uiAnchorPosition.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitField(&azimuth, "Azimuth", 0.0, "Azimuth", "", "", "");
|
||||
azimuth.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&perforationLength, "PerforationLength", 1.0, "Perforation Length", "", "", "");
|
||||
CAF_PDM_InitField(&perforationEfficiency, "perforationEfficiency", 1.0, "perforation Efficiency", "", "", "");
|
||||
perforationEfficiency.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&wellDiameter, "wellDiameter", 0.216, "Well Diameter at Fracture", "", "", "");
|
||||
CAF_PDM_InitField(&dip, "Dip", 0.0, "Dip", "", "", "");
|
||||
CAF_PDM_InitField(&tilt, "Tilt", 0.0, "Tilt", "", "", "");
|
||||
@@ -94,19 +98,6 @@ RimFracture::RimFracture(void)
|
||||
|
||||
CAF_PDM_InitField(&stimPlanTimeIndexToPlot, "timeIndexToPlot", 0, "StimPlan Time Step", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_anchorPosEclipseCellI, "I", 1, "Fracture location cell I", "", "", "");
|
||||
m_anchorPosEclipseCellI.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_anchorPosEclipseCellJ, "J", 1, "Fracture location cell J", "", "", "");
|
||||
m_anchorPosEclipseCellJ.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_anchorPosEclipseCellK, "K", 1, "Fracture location cell K", "", "", "");
|
||||
m_anchorPosEclipseCellK.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_displayIJK, "Cell_IJK", "Cell IJK", "", "", "");
|
||||
m_displayIJK.registerGetMethod(this, &RimFracture::createOneBasedIJKText);
|
||||
m_displayIJK.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
m_fracturePartMgr = new RivWellFracturePartMgr(this);
|
||||
}
|
||||
|
||||
@@ -304,14 +295,6 @@ cvf::Vec3d RimFracture::fracturePositionForUi() const
|
||||
return v;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFracture::createOneBasedIJKText() const
|
||||
{
|
||||
return QString("Cell : [%1, %2, %3]").arg(m_anchorPosEclipseCellI + 1).arg(m_anchorPosEclipseCellJ + 1).arg(m_anchorPosEclipseCellK + 1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -452,41 +435,42 @@ void RimFracture::setAnchorPosition(const cvf::Vec3d& pos)
|
||||
m_anchorPosition = pos;
|
||||
clearDisplayGeometryCache();
|
||||
|
||||
// Update ijk
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimFracture::findAnchorEclipseCell(const RigMainGrid* mainGrid ) const
|
||||
{
|
||||
std::vector<size_t> cellindecies;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
|
||||
RimEclipseView* activeRiv = dynamic_cast<RimEclipseView*>(activeView);
|
||||
if (!activeRiv) return;
|
||||
|
||||
const RigMainGrid* mainGrid = activeRiv->mainGrid();
|
||||
if (!mainGrid) return;
|
||||
|
||||
cvf::BoundingBox pointBBox;
|
||||
pointBBox.add(m_anchorPosition);
|
||||
|
||||
mainGrid->findIntersectingCells(pointBBox, &cellindecies);
|
||||
std::vector<size_t> cellIndices;
|
||||
mainGrid->findIntersectingCells(pointBBox, &cellIndices);
|
||||
|
||||
if (cellindecies.size() > 0)
|
||||
size_t cellContainingAchorPoint = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
for ( size_t cellIndex : cellIndices )
|
||||
{
|
||||
size_t i = cvf::UNDEFINED_SIZE_T;
|
||||
size_t j = cvf::UNDEFINED_SIZE_T;
|
||||
size_t k = cvf::UNDEFINED_SIZE_T;
|
||||
auto cornerIndices = mainGrid->globalCellArray()[cellIndex].cornerIndices();
|
||||
cvf::Vec3d vertices[8];
|
||||
vertices[0] = (mainGrid->nodes()[cornerIndices[0]]);
|
||||
vertices[1] = (mainGrid->nodes()[cornerIndices[1]]);
|
||||
vertices[2] = (mainGrid->nodes()[cornerIndices[2]]);
|
||||
vertices[3] = (mainGrid->nodes()[cornerIndices[3]]);
|
||||
vertices[4] = (mainGrid->nodes()[cornerIndices[4]]);
|
||||
vertices[5] = (mainGrid->nodes()[cornerIndices[5]]);
|
||||
vertices[6] = (mainGrid->nodes()[cornerIndices[6]]);
|
||||
vertices[7] = (mainGrid->nodes()[cornerIndices[7]]);
|
||||
|
||||
size_t gridCellIndex = cellindecies[0];
|
||||
|
||||
if (mainGrid->ijkFromCellIndex(gridCellIndex, &i, &j, &k))
|
||||
if ( RigHexIntersectionTools::isPointInCell(m_anchorPosition, vertices) )
|
||||
{
|
||||
m_anchorPosEclipseCellI = static_cast<int>(i);
|
||||
m_anchorPosEclipseCellJ = static_cast<int>(j);
|
||||
m_anchorPosEclipseCellK = static_cast<int>(k);
|
||||
}
|
||||
cellContainingAchorPoint = cellIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return cellContainingAchorPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -72,6 +72,8 @@ public:
|
||||
cvf::Vec3d anchorPosition() const ;
|
||||
void setAnchorPosition(const cvf::Vec3d& pos);
|
||||
|
||||
size_t findAnchorEclipseCell(const RigMainGrid* mainGrid) const;
|
||||
|
||||
cvf::Mat4f transformMatrix() const;
|
||||
|
||||
void setFractureTemplate(RimFractureTemplate* fractureTemplate);
|
||||
@@ -99,21 +101,15 @@ protected:
|
||||
private:
|
||||
cvf::Vec3d fracturePositionForUi() const;
|
||||
|
||||
QString createOneBasedIJKText() const;
|
||||
|
||||
virtual cvf::BoundingBox boundingBoxInDomainCoords() override;
|
||||
|
||||
protected:
|
||||
caf::PdmPtrField<RimFractureTemplate*> m_fractureTemplate;
|
||||
caf::PdmProxyValueField<cvf::Vec3d> m_uiAnchorPosition;
|
||||
caf::PdmProxyValueField<QString> m_displayIJK;
|
||||
|
||||
private:
|
||||
caf::PdmField<cvf::Vec3d> m_anchorPosition;
|
||||
|
||||
caf::PdmField<int> m_anchorPosEclipseCellI; // Zero based indexing
|
||||
caf::PdmField<int> m_anchorPosEclipseCellJ; // Zero based indexing
|
||||
caf::PdmField<int> m_anchorPosEclipseCellK; // Zero based indexing
|
||||
|
||||
cvf::ref<RivWellFracturePartMgr> m_fracturePartMgr;
|
||||
};
|
||||
|
||||
@@ -45,6 +45,10 @@ RimSimWellFracture::RimSimWellFracture(void)
|
||||
CAF_PDM_InitField(&m_location, "MeasuredDepth", 0.0f, "Pseudo Length Location", "", "", "");
|
||||
m_location.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_displayIJK, "Cell_IJK", "Cell IJK", "", "", "");
|
||||
m_displayIJK.registerGetMethod(this, &RimSimWellFracture::createOneBasedIJKText);
|
||||
m_displayIJK.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitField(&m_branchIndex, "Branch", 0, "Branch", "", "", "");
|
||||
}
|
||||
|
||||
@@ -263,6 +267,20 @@ QList<caf::PdmOptionItemInfo> RimSimWellFracture::calculateValueOptions(const ca
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMainGrid* RimSimWellFracture::ownerCaseMainGrid() const
|
||||
{
|
||||
RimEclipseView* ownerEclView;
|
||||
this->firstAncestorOrThisOfType(ownerEclView);
|
||||
|
||||
if (ownerEclView)
|
||||
return ownerEclView->mainGrid();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -297,3 +315,19 @@ void RimSimWellFracture::setBranchGeometry()
|
||||
m_branchCenterLines.push_back(wellPathWithMD);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSimWellFracture::createOneBasedIJKText() const
|
||||
{
|
||||
RigMainGrid* mainGrid = ownerCaseMainGrid();
|
||||
size_t i,j,k;
|
||||
size_t anchorCellIdx = findAnchorEclipseCell(mainGrid);
|
||||
if (anchorCellIdx == cvf::UNDEFINED_SIZE_T) return "";
|
||||
|
||||
bool ok = mainGrid->ijkFromCellIndex(anchorCellIdx, &i, &j, &k);
|
||||
if (!ok) return "";
|
||||
|
||||
return QString("[%1, %2, %3]").arg(i + 1).arg(j + 1).arg(k + 1);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
|
||||
RigMainGrid* ownerCaseMainGrid() const;
|
||||
|
||||
private:
|
||||
void updateBranchGeometry();
|
||||
void setBranchGeometry();
|
||||
@@ -62,4 +64,8 @@ private:
|
||||
caf::PdmField<float> m_location;
|
||||
caf::PdmField<int> m_branchIndex;
|
||||
std::vector<RigSimulationWellCoordsAndMD> m_branchCenterLines;
|
||||
|
||||
caf::PdmProxyValueField<QString> m_displayIJK;
|
||||
QString createOneBasedIJKText() const;
|
||||
|
||||
};
|
||||
|
||||
@@ -177,7 +177,6 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
|
||||
|
||||
caf::PdmUiGroup* fractureCenterGroup = uiOrdering.addNewGroup("Fracture Center Info");
|
||||
fractureCenterGroup->add(&m_uiAnchorPosition);
|
||||
fractureCenterGroup->add(&m_displayIJK);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -70,7 +70,8 @@ int RigHexIntersectionTools::lineHexCellIntersection(const cvf::Vec3d p1, const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigHexIntersectionTools::isPointInCell(const cvf::Vec3d point, const cvf::Vec3d hexCorners[8])
|
||||
bool RigHexIntersectionTools::isPointInCell(const cvf::Vec3d point,
|
||||
const cvf::Vec3d hexCorners[8])
|
||||
{
|
||||
cvf::Ray ray;
|
||||
ray.setOrigin(point);
|
||||
|
||||
Reference in New Issue
Block a user