Skip to content

Commit

Permalink
#1040 - pre-proto - Setting correct center of fracture for SimWellFra…
Browse files Browse the repository at this point in the history
…cture
  • Loading branch information
astridkbjorke committed Jan 6, 2017
1 parent 31505c3 commit cf2b47d
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions ApplicationCode/ProjectDataModel/RimFracture.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class RimFracture : public caf::PdmObject

private:
bool isRecomputeGeometryFlagSet();
// cvf::Vec3d fracturePositionForUi() const;


private:
cvf::ref<RigFracture> m_rigFracture;
Expand Down
49 changes: 48 additions & 1 deletion ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "", "", "");

}
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand All @@ -153,6 +179,14 @@ void RimSimWellFracture::setIJK(size_t i, size_t j, size_t k)

}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSimWellFracture::setCellCenterPosition()
{
cellCenterPosition = centerPointForFracture();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand All @@ -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;
}
8 changes: 7 additions & 1 deletion ApplicationCode/ProjectDataModel/RimSimWellFracture.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrField.h"

#include "cvfBase.h"
Expand Down Expand Up @@ -51,16 +52,21 @@ class RimSimWellFracture : public RimFracture
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;
};
21 changes: 4 additions & 17 deletions ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "", "", "");
Expand Down Expand Up @@ -178,26 +176,15 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder

}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathFracture::wellPositionForUi() const
{
cvf::Vec3d v = positionAtWellpath();

v.z() = -v.z();

return v;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathFracture::setWellPositionFromUi(const cvf::Vec3d& vec)
cvf::Vec3d RimWellPathFracture::fracturePositionForUi() const
{
cvf::Vec3d v = vec;
cvf::Vec3d v = positionAtWellpath;

v.z() = -v.z();

positionAtWellpath = v;
return v;
}
4 changes: 1 addition & 3 deletions ApplicationCode/ProjectDataModel/RimWellPathFracture.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class RimWellPathFracture : public RimFracture

protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
cvf::Vec3d fracturePositionForUi() const;

private:
cvf::Vec3d wellPositionForUi() const;
void setWellPositionFromUi(const cvf::Vec3d& vec);
};

0 comments on commit cf2b47d

Please sign in to comment.