2017-01-02 07:13:34 -06:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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.
//
// 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.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
# include "RimFracture.h"
2017-01-19 03:43:23 -06:00
# include "RiaApplication.h"
2017-06-14 00:25:34 -05:00
# include "RiaEclipseUnitTools.h"
2017-03-06 08:14:11 -06:00
# include "RiaLogging.h"
2017-01-19 03:43:23 -06:00
2017-01-30 03:45:18 -06:00
# include "RifReaderInterface.h"
2017-01-31 08:58:13 -06:00
# include "RigActiveCellInfo.h"
2017-01-30 03:45:18 -06:00
# include "RigCaseCellResultsData.h"
2017-01-19 03:43:23 -06:00
# include "RigCell.h"
2017-01-23 08:22:51 -06:00
# include "RigCellGeometryTools.h"
2017-01-30 03:45:18 -06:00
# include "RigEclipseCaseData.h"
2017-01-19 03:43:23 -06:00
# include "RigMainGrid.h"
2017-01-30 03:45:18 -06:00
# include "RigResultAccessor.h"
# include "RigResultAccessorFactory.h"
2017-01-04 01:10:02 -06:00
# include "RigTesselatorTools.h"
2017-01-10 06:37:50 -06:00
2017-01-30 03:45:18 -06:00
# include "RimEclipseCase.h"
# include "RimEclipseCellColors.h"
2017-01-19 03:43:23 -06:00
# include "RimEclipseView.h"
2017-01-12 06:29:18 -06:00
# include "RimEllipseFractureTemplate.h"
2017-06-15 03:49:27 -05:00
# include "RimFractureTemplate.h"
2017-02-07 04:08:56 -06:00
# include "RimFractureTemplateCollection.h"
2017-01-19 03:43:23 -06:00
# include "RimOilField.h"
# include "RimProject.h"
2017-01-31 08:58:13 -06:00
# include "RimReservoirCellResultsStorage.h"
2017-02-15 05:16:01 -06:00
# include "RimStimPlanFractureTemplate.h"
2017-01-10 06:37:50 -06:00
# include "RimView.h"
2017-01-19 03:43:23 -06:00
# include "RivWellFracturePartMgr.h"
# include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
2017-02-15 04:29:44 -06:00
# include "cafPdmUiDoubleSliderEditor.h"
# include "cafPdmUiTreeOrdering.h"
2017-01-02 07:13:34 -06:00
2017-01-19 03:43:23 -06:00
# include "cvfBoundingBox.h"
# include "cvfGeometryTools.h"
2017-01-11 07:32:15 -06:00
# include "cvfMath.h"
2017-01-10 06:37:50 -06:00
# include "cvfMatrix4.h"
2017-01-13 08:49:21 -06:00
# include "cvfPlane.h"
2017-01-19 03:43:23 -06:00
2017-01-24 08:39:39 -06:00
# include "clipper/clipper.hpp"
2017-01-30 03:45:18 -06:00
# include <math.h>
2017-02-15 04:29:44 -06:00
2017-02-10 06:29:31 -06:00
# include <QDebug>
2017-02-15 05:16:01 -06:00
# include <QString>
2017-01-02 07:13:34 -06:00
2017-01-04 01:10:02 -06:00
CAF_PDM_XML_ABSTRACT_SOURCE_INIT ( RimFracture , " Fracture " ) ;
2017-01-02 07:13:34 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFracture : : RimFracture ( void )
{
CAF_PDM_InitObject ( " Fracture " , " " , " " , " " ) ;
2017-01-19 03:43:23 -06:00
CAF_PDM_InitFieldNoDefault ( & m_fractureTemplate , " FractureDef " , " Fracture Template " , " " , " " , " " ) ;
CAF_PDM_InitFieldNoDefault ( & m_anchorPosition , " anchorPosition " , " Anchor Position " , " " , " " , " " ) ;
m_anchorPosition . uiCapability ( ) - > setUiHidden ( true ) ;
2017-01-19 06:35:07 -06:00
CAF_PDM_InitFieldNoDefault ( & m_uiAnchorPosition , " ui_positionAtWellpath " , " Fracture Position " , " " , " " , " " ) ;
2017-01-19 03:43:23 -06:00
m_uiAnchorPosition . registerGetMethod ( this , & RimFracture : : fracturePositionForUi ) ;
m_uiAnchorPosition . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-01-10 03:53:54 -06:00
CAF_PDM_InitField ( & azimuth , " Azimuth " , 0.0 , " Azimuth " , " " , " " , " " ) ;
2017-02-15 05:16:01 -06:00
azimuth . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2017-06-08 04:00:35 -05:00
CAF_PDM_InitField ( & perforationLength , " PerforationLength " , 1.0 , " Perforation Length " , " " , " " , " " ) ;
2017-04-18 08:23:26 -05:00
CAF_PDM_InitField ( & perforationEfficiency , " perforationEfficiency " , 1.0 , " perforation Efficiency " , " " , " " , " " ) ;
perforationEfficiency . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2017-06-08 02:15:50 -05:00
CAF_PDM_InitField ( & wellDiameter , " wellDiameter " , 0.216 , " Well Diameter at Fracture " , " " , " " , " " ) ;
2017-03-06 06:32:42 -06:00
CAF_PDM_InitField ( & dip , " Dip " , 0.0 , " Dip " , " " , " " , " " ) ;
2017-03-29 03:12:01 -05:00
CAF_PDM_InitField ( & tilt , " Tilt " , 0.0 , " Tilt " , " " , " " , " " ) ;
2017-02-28 07:28:14 -06:00
CAF_PDM_InitField ( & showPolygonFractureOutline , " showPolygonFractureOutline " , true , " Show Polygon Outline " , " " , " " , " " ) ;
2017-06-14 00:25:34 -05:00
CAF_PDM_InitField ( & fractureUnit , " fractureUnit " , caf : : AppEnum < RiaEclipseUnitTools : : UnitSystem > ( RiaEclipseUnitTools : : UNITS_METRIC ) , " Fracture Unit System " , " " , " " , " " ) ;
2017-01-23 01:54:27 -06:00
2017-02-22 04:52:06 -06:00
CAF_PDM_InitField ( & stimPlanTimeIndexToPlot , " timeIndexToPlot " , 0 , " StimPlan Time Step " , " " , " " , " " ) ;
2017-01-10 03:53:54 -06:00
2017-06-09 10:21:59 -05:00
CAF_PDM_InitField ( & m_anchorPosEclipseCellI , " I " , 1 , " Fracture location cell I " , " " , " " , " " ) ;
m_anchorPosEclipseCellI . uiCapability ( ) - > setUiHidden ( true ) ;
2017-01-19 03:43:23 -06:00
2017-06-09 10:21:59 -05:00
CAF_PDM_InitField ( & m_anchorPosEclipseCellJ , " J " , 1 , " Fracture location cell J " , " " , " " , " " ) ;
m_anchorPosEclipseCellJ . uiCapability ( ) - > setUiHidden ( true ) ;
2017-01-19 03:43:23 -06:00
2017-06-09 10:21:59 -05:00
CAF_PDM_InitField ( & m_anchorPosEclipseCellK , " K " , 1 , " Fracture location cell K " , " " , " " , " " ) ;
m_anchorPosEclipseCellK . uiCapability ( ) - > setUiHidden ( true ) ;
2017-01-19 03:43:23 -06:00
CAF_PDM_InitFieldNoDefault ( & m_displayIJK , " Cell_IJK " , " Cell IJK " , " " , " " , " " ) ;
2017-06-09 10:21:59 -05:00
m_displayIJK . registerGetMethod ( this , & RimFracture : : createOneBasedIJKText ) ;
2017-01-19 03:43:23 -06:00
m_displayIJK . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-06-09 10:21:59 -05:00
m_fracturePartMgr = new RivWellFracturePartMgr ( this ) ;
2017-01-02 07:13:34 -06:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFracture : : ~ RimFracture ( )
{
}
2017-01-04 01:10:02 -06:00
2017-01-12 05:19:52 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-05-16 10:52:57 -05:00
std : : vector < size_t > RimFracture : : getPotentiallyFracturedCells ( const RigMainGrid * mainGrid )
2017-01-12 05:19:52 -06:00
{
std : : vector < size_t > cellindecies ;
if ( ! mainGrid ) return cellindecies ;
2017-06-12 05:45:09 -05:00
cvf : : BoundingBox fractureBBox = this - > boundingBoxInDomainCoords ( ) ;
2017-01-12 05:19:52 -06:00
2017-06-12 05:45:09 -05:00
mainGrid - > findIntersectingCells ( fractureBBox , & cellindecies ) ;
2017-01-12 05:19:52 -06:00
return cellindecies ;
}
2017-01-10 06:37:50 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : fieldChangedByUi ( const caf : : PdmFieldHandle * changedField , const QVariant & oldValue , const QVariant & newValue )
{
2017-06-08 02:15:50 -05:00
if ( changedField = = & fractureUnit )
{
2017-06-14 00:25:34 -05:00
if ( fractureUnit = = RiaEclipseUnitTools : : UNITS_METRIC )
2017-06-08 02:15:50 -05:00
{
2017-06-14 00:25:34 -05:00
wellDiameter = RiaEclipseUnitTools : : inchToMeter ( wellDiameter ) ;
perforationLength = RiaEclipseUnitTools : : feetToMeter ( perforationLength ) ;
2017-06-08 02:15:50 -05:00
}
2017-06-14 00:25:34 -05:00
else if ( fractureUnit = = RiaEclipseUnitTools : : UNITS_FIELD )
2017-06-08 02:15:50 -05:00
{
2017-06-14 00:25:34 -05:00
wellDiameter = RiaEclipseUnitTools : : meterToInch ( wellDiameter ) ;
perforationLength = RiaEclipseUnitTools : : meterToFeet ( perforationLength ) ;
2017-06-08 02:15:50 -05:00
}
this - > updateConnectedEditors ( ) ;
}
2017-01-23 02:46:33 -06:00
if ( changedField = = & m_fractureTemplate )
{
2017-06-15 03:49:27 -05:00
setFractureTemplate ( m_fractureTemplate ) ;
2017-01-23 02:46:33 -06:00
}
2017-01-19 03:43:23 -06:00
if ( changedField = = & azimuth | |
2017-02-15 08:49:53 -06:00
changedField = = & m_fractureTemplate | |
2017-02-22 06:29:20 -06:00
changedField = = & stimPlanTimeIndexToPlot | |
2017-02-28 07:28:14 -06:00
changedField = = this - > objectToggleField ( ) | |
2017-03-02 03:08:45 -06:00
changedField = = & showPolygonFractureOutline | |
2017-03-06 06:32:42 -06:00
changedField = = & fractureUnit | |
2017-03-29 03:12:01 -05:00
changedField = = & dip | |
changedField = = & tilt )
2017-01-10 06:37:50 -06:00
{
2017-01-23 01:54:27 -06:00
2017-06-12 05:45:09 -05:00
clearDisplayGeometryCache ( ) ;
2017-01-10 06:37:50 -06:00
RimView * rimView = nullptr ;
this - > firstAncestorOrThisOfType ( rimView ) ;
if ( rimView )
{
rimView - > createDisplayModelAndRedraw ( ) ;
}
2017-01-19 03:43:23 -06:00
else
{
// Can be triggered from well path, find active view
RimView * activeView = RiaApplication : : instance ( ) - > activeReservoirView ( ) ;
if ( activeView )
{
activeView - > createDisplayModelAndRedraw ( ) ;
}
}
2017-01-23 01:54:27 -06:00
2017-01-10 06:37:50 -06:00
}
2017-01-23 01:54:27 -06:00
2017-01-10 06:37:50 -06:00
}
2017-01-19 06:35:07 -06:00
//--------------------------------------------------------------------------------------------------
2017-02-06 04:44:24 -06:00
///
//--------------------------------------------------------------------------------------------------
cvf : : Vec3d RimFracture : : fracturePosition ( ) const
{
return m_anchorPosition ;
}
2017-01-04 01:10:02 -06:00
//--------------------------------------------------------------------------------------------------
2017-06-09 06:05:59 -05:00
///
//--------------------------------------------------------------------------------------------------
cvf : : BoundingBox RimFracture : : boundingBoxInDomainCoords ( )
{
2017-06-12 05:45:09 -05:00
std : : vector < cvf : : Vec3f > nodeCoordVec ;
std : : vector < cvf : : uint > triangleIndices ;
2017-06-09 06:05:59 -05:00
2017-06-12 05:45:09 -05:00
this - > triangleGeometry ( & triangleIndices , & nodeCoordVec ) ;
2017-06-09 06:05:59 -05:00
2017-06-12 05:45:09 -05:00
cvf : : BoundingBox fractureBBox ;
for ( cvf : : Vec3f nodeCoord : nodeCoordVec ) fractureBBox . add ( nodeCoord ) ;
return fractureBBox ;
2017-06-09 06:05:59 -05:00
}
2017-01-12 03:52:47 -06:00
2017-06-08 02:15:50 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFracture : : wellRadius ( ) const
{
2017-06-14 00:25:34 -05:00
if ( fractureUnit = = RiaEclipseUnitTools : : UNITS_METRIC )
2017-06-08 02:15:50 -05:00
{
return wellDiameter / 2 ;
}
2017-06-14 00:25:34 -05:00
else if ( fractureUnit = = RiaEclipseUnitTools : : UNITS_FIELD )
2017-06-08 02:15:50 -05:00
{
2017-06-14 00:25:34 -05:00
return RiaEclipseUnitTools : : inchToFeet ( wellDiameter / 2 ) ;
2017-06-08 02:15:50 -05:00
}
return cvf : : UNDEFINED_DOUBLE ;
}
2017-01-19 03:43:23 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-05-22 11:11:03 -05:00
cvf : : Vec3d RimFracture : : anchorPosition ( ) const
2017-01-19 03:43:23 -06:00
{
return m_anchorPosition ( ) ;
}
2017-01-12 03:52:47 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-05-22 11:11:03 -05:00
cvf : : Mat4f RimFracture : : transformMatrix ( ) const
2017-01-12 03:52:47 -06:00
{
2017-01-19 03:43:23 -06:00
cvf : : Vec3d center = anchorPosition ( ) ;
2017-01-12 03:52:47 -06:00
2017-03-06 06:32:42 -06:00
// Dip (in XY plane)
cvf : : Mat4f dipRotation = cvf : : Mat4f : : fromRotation ( cvf : : Vec3f : : Z_AXIS , cvf : : Math : : toRadians ( dip ( ) ) ) ;
2017-03-29 03:12:01 -05:00
// Dip (out of XY plane)
cvf : : Mat4f tiltRotation = cvf : : Mat4f : : fromRotation ( cvf : : Vec3f : : X_AXIS , cvf : : Math : : toRadians ( tilt ( ) ) ) ;
2017-01-10 06:37:50 -06:00
// Ellipsis geometry is produced in XY-plane, rotate 90 deg around X to get zero azimuth along Y
cvf : : Mat4f rotationFromTesselator = cvf : : Mat4f : : fromRotation ( cvf : : Vec3f : : X_AXIS , cvf : : Math : : toRadians ( 90.0f ) ) ;
2017-03-06 06:32:42 -06:00
2017-01-10 06:37:50 -06:00
// Azimuth rotation
2017-02-02 03:02:27 -06:00
cvf : : Mat4f azimuthRotation = cvf : : Mat4f : : fromRotation ( cvf : : Vec3f : : Z_AXIS , cvf : : Math : : toRadians ( - azimuth ( ) - 90 ) ) ;
2017-01-10 06:37:50 -06:00
2017-03-29 03:12:01 -05:00
cvf : : Mat4f m = azimuthRotation * rotationFromTesselator * dipRotation * tiltRotation ;
2017-01-10 06:37:50 -06:00
m . setTranslation ( cvf : : Vec3f ( center ) ) ;
2017-01-12 03:52:47 -06:00
return m ;
}
2017-01-04 01:10:02 -06:00
2017-01-06 06:13:25 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-12 05:45:09 -05:00
void RimFracture : : clearDisplayGeometryCache ( )
2017-01-06 06:13:25 -06:00
{
2017-06-09 10:21:59 -05:00
m_fracturePartMgr - > clearGeometryCache ( ) ;
2017-01-06 06:13:25 -06:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-12 05:45:09 -05:00
void RimFracture : : triangleGeometry ( std : : vector < cvf : : uint > * triangleIndices , std : : vector < cvf : : Vec3f > * nodeCoords )
2017-01-06 06:13:25 -06:00
{
2017-06-12 05:45:09 -05:00
RimFractureTemplate * fractureDef = fractureTemplate ( ) ;
if ( fractureDef )
{
fractureDef - > fractureTriangleGeometry ( nodeCoords , triangleIndices , fractureUnit ( ) ) ;
}
cvf : : Mat4f m = transformMatrix ( ) ;
for ( cvf : : Vec3f & v : * nodeCoords )
{
v . transformPoint ( m ) ;
}
2017-01-04 01:10:02 -06:00
}
2017-06-12 05:45:09 -05:00
2017-01-19 03:43:23 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf : : Vec3d RimFracture : : fracturePositionForUi ( ) const
{
cvf : : Vec3d v = m_anchorPosition ;
v . z ( ) = - v . z ( ) ;
return v ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-09 10:21:59 -05:00
QString RimFracture : : createOneBasedIJKText ( ) const
2017-01-19 03:43:23 -06:00
{
2017-06-09 10:21:59 -05:00
return QString ( " Cell : [%1, %2, %3] " ) . arg ( m_anchorPosEclipseCellI + 1 ) . arg ( m_anchorPosEclipseCellJ + 1 ) . arg ( m_anchorPosEclipseCellK + 1 ) ;
2017-01-19 03:43:23 -06:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList < caf : : PdmOptionItemInfo > RimFracture : : calculateValueOptions ( const caf : : PdmFieldHandle * fieldNeedingOptions , bool * useOptionsOnly )
{
QList < caf : : PdmOptionItemInfo > options ;
RimProject * proj = RiaApplication : : instance ( ) - > project ( ) ;
CVF_ASSERT ( proj ) ;
RimOilField * oilField = proj - > activeOilField ( ) ;
if ( oilField = = nullptr ) return options ;
if ( fieldNeedingOptions = = & m_fractureTemplate )
{
2017-02-07 04:08:56 -06:00
RimFractureTemplateCollection * fracDefColl = oilField - > fractureDefinitionCollection ( ) ;
2017-01-19 03:43:23 -06:00
if ( fracDefColl = = nullptr ) return options ;
2017-02-07 02:09:00 -06:00
for ( RimFractureTemplate * fracDef : fracDefColl - > fractureDefinitions ( ) )
2017-01-19 03:43:23 -06:00
{
options . push_back ( caf : : PdmOptionItemInfo ( fracDef - > name ( ) , fracDef ) ) ;
}
}
2017-02-15 05:16:01 -06:00
else if ( fieldNeedingOptions = = & stimPlanTimeIndexToPlot )
{
2017-06-09 10:21:59 -05:00
if ( fractureTemplate ( ) )
2017-02-15 05:16:01 -06:00
{
2017-06-09 10:21:59 -05:00
RimFractureTemplate * fracTemplate = fractureTemplate ( ) ;
2017-02-15 05:16:01 -06:00
if ( dynamic_cast < RimStimPlanFractureTemplate * > ( fracTemplate ) )
{
RimStimPlanFractureTemplate * fracTemplateStimPlan = dynamic_cast < RimStimPlanFractureTemplate * > ( fracTemplate ) ;
2017-06-13 04:38:22 -05:00
std : : vector < double > timeValues = fracTemplateStimPlan - > timeSteps ( ) ;
2017-02-15 05:16:01 -06:00
int index = 0 ;
for ( double value : timeValues )
{
options . push_back ( caf : : PdmOptionItemInfo ( QString : : number ( value ) , index ) ) ;
index + + ;
}
}
}
}
2017-01-19 03:43:23 -06:00
return options ;
}
2017-01-10 03:53:54 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : defineUiOrdering ( QString uiConfigName , caf : : PdmUiOrdering & uiOrdering )
{
2017-06-14 00:25:34 -05:00
if ( fractureUnit = = RiaEclipseUnitTools : : UNITS_METRIC )
2017-06-08 02:15:50 -05:00
{
wellDiameter . uiCapability ( ) - > setUiName ( " Well Diameter [m] " ) ;
2017-06-08 04:00:35 -05:00
perforationLength . uiCapability ( ) - > setUiName ( " Perforation Length [m] " ) ;
2017-06-08 02:15:50 -05:00
}
2017-06-14 00:25:34 -05:00
else if ( fractureUnit = = RiaEclipseUnitTools : : UNITS_FIELD )
2017-06-08 02:15:50 -05:00
{
wellDiameter . uiCapability ( ) - > setUiName ( " Well Diameter [inches] " ) ;
2017-06-08 04:00:35 -05:00
perforationLength . uiCapability ( ) - > setUiName ( " Perforation Length [Ft] " ) ;
2017-06-08 02:15:50 -05:00
}
2017-06-09 10:21:59 -05:00
if ( fractureTemplate ( ) )
2017-02-15 05:16:01 -06:00
{
2017-06-09 10:21:59 -05:00
if ( fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : ALONG_WELL_PATH
| | fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : TRANSVERSE_WELL_PATH )
2017-02-15 05:16:01 -06:00
{
azimuth . uiCapability ( ) - > setUiReadOnly ( true ) ;
}
2017-06-09 10:21:59 -05:00
else if ( fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : AZIMUTH )
2017-02-15 05:16:01 -06:00
{
azimuth . uiCapability ( ) - > setUiReadOnly ( false ) ;
}
2017-06-09 10:21:59 -05:00
if ( fractureTemplate ( ) - > orientationType = = RimFractureTemplate : : ALONG_WELL_PATH )
2017-06-02 08:34:37 -05:00
{
perforationEfficiency . uiCapability ( ) - > setUiHidden ( false ) ;
perforationLength . uiCapability ( ) - > setUiHidden ( false ) ;
}
else
{
perforationEfficiency . uiCapability ( ) - > setUiHidden ( true ) ;
perforationLength . uiCapability ( ) - > setUiHidden ( true ) ;
}
2017-06-09 10:21:59 -05:00
RimFractureTemplate * fracTemplate = fractureTemplate ( ) ;
2017-02-15 05:16:01 -06:00
if ( dynamic_cast < RimStimPlanFractureTemplate * > ( fracTemplate ) )
{
stimPlanTimeIndexToPlot . uiCapability ( ) - > setUiHidden ( false ) ;
2017-04-07 04:02:31 -05:00
stimPlanTimeIndexToPlot . uiCapability ( ) - > setUiReadOnly ( true ) ;
2017-06-07 04:19:41 -05:00
showPolygonFractureOutline . uiCapability ( ) - > setUiHidden ( false ) ;
2017-02-15 05:16:01 -06:00
}
else
{
stimPlanTimeIndexToPlot . uiCapability ( ) - > setUiHidden ( true ) ;
2017-06-07 04:19:41 -05:00
showPolygonFractureOutline . uiCapability ( ) - > setUiHidden ( true ) ;
2017-02-15 05:16:01 -06:00
}
}
else
{
stimPlanTimeIndexToPlot . uiCapability ( ) - > setUiHidden ( true ) ;
}
2017-01-10 03:53:54 -06:00
}
2017-01-10 06:37:50 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : defineEditorAttribute ( const caf : : PdmFieldHandle * field , QString uiConfigName , caf : : PdmUiEditorAttribute * attribute )
{
if ( field = = & azimuth )
{
caf : : PdmUiDoubleSliderEditorAttribute * myAttr = dynamic_cast < caf : : PdmUiDoubleSliderEditorAttribute * > ( attribute ) ;
if ( myAttr )
{
myAttr - > m_minimum = 0 ;
myAttr - > m_maximum = 360 ;
}
}
2017-04-18 08:23:26 -05:00
if ( field = = & perforationEfficiency )
{
caf : : PdmUiDoubleSliderEditorAttribute * myAttr = dynamic_cast < caf : : PdmUiDoubleSliderEditorAttribute * > ( attribute ) ;
if ( myAttr )
{
myAttr - > m_minimum = 0 ;
myAttr - > m_maximum = 1.0 ;
}
}
2017-01-10 06:37:50 -06:00
}
2017-02-15 04:29:44 -06:00
//--------------------------------------------------------------------------------------------------
2017-01-19 03:43:23 -06:00
///
//--------------------------------------------------------------------------------------------------
void RimFracture : : setAnchorPosition ( const cvf : : Vec3d & pos )
{
m_anchorPosition = pos ;
2017-06-12 05:45:09 -05:00
clearDisplayGeometryCache ( ) ;
2017-01-19 03:43:23 -06:00
// Update ijk
{
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 ;
2017-06-09 10:21:59 -05:00
cvf : : BoundingBox pointBBox ;
pointBBox . add ( m_anchorPosition ) ;
2017-01-19 03:43:23 -06:00
2017-06-09 10:21:59 -05:00
mainGrid - > findIntersectingCells ( pointBBox , & cellindecies ) ;
2017-01-19 03:43:23 -06:00
if ( cellindecies . size ( ) > 0 )
{
size_t i = cvf : : UNDEFINED_SIZE_T ;
size_t j = cvf : : UNDEFINED_SIZE_T ;
size_t k = cvf : : UNDEFINED_SIZE_T ;
size_t gridCellIndex = cellindecies [ 0 ] ;
if ( mainGrid - > ijkFromCellIndex ( gridCellIndex , & i , & j , & k ) )
{
2017-06-09 10:21:59 -05:00
m_anchorPosEclipseCellI = static_cast < int > ( i ) ;
m_anchorPosEclipseCellJ = static_cast < int > ( j ) ;
m_anchorPosEclipseCellK = static_cast < int > ( k ) ;
2017-01-19 03:43:23 -06:00
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-02-07 02:09:00 -06:00
void RimFracture : : setFractureTemplate ( RimFractureTemplate * fractureTemplate )
2017-01-19 03:43:23 -06:00
{
m_fractureTemplate = fractureTemplate ;
2017-02-23 02:22:19 -06:00
2017-06-09 10:21:59 -05:00
RimStimPlanFractureTemplate * stimPlanFracTemplate = dynamic_cast < RimStimPlanFractureTemplate * > ( fractureTemplate ) ;
2017-02-23 02:22:19 -06:00
if ( stimPlanFracTemplate )
{
2017-06-12 07:42:35 -05:00
stimPlanTimeIndexToPlot = stimPlanFracTemplate - > activeTimeStepIndex ( ) ;
2017-02-23 02:22:19 -06:00
}
2017-06-09 10:21:59 -05:00
this - > updateAzimuthFromFractureTemplate ( ) ;
2017-06-15 03:49:27 -05:00
this - > wellDiameter = fractureTemplate - > wellDiameterInFractureUnit ( fractureUnit ) ;
this - > perforationLength = fractureTemplate - > perforationLengthInFractureUnit ( fractureUnit ) ;
2017-01-19 03:43:23 -06:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-06-09 10:21:59 -05:00
RimFractureTemplate * RimFracture : : fractureTemplate ( ) const
2017-01-19 03:43:23 -06:00
{
return m_fractureTemplate ( ) ;
}
2017-01-19 00:28:04 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellFracturePartMgr * RimFracture : : fracturePartManager ( )
{
2017-06-09 10:21:59 -05:00
CVF_ASSERT ( m_fracturePartMgr . notNull ( ) ) ;
2017-01-19 00:28:04 -06:00
2017-06-09 10:21:59 -05:00
return m_fracturePartMgr . p ( ) ;
2017-01-19 00:28:04 -06:00
}