mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1087 - pre-proto - Adding units to fracture template and adding command feature for converting length values in ellipseFractureDefinition.
This commit is contained in:
@@ -52,6 +52,7 @@ ${CEE_CURRENT_LIST_DIR}RicExportSimWellFractureWellCompletionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExportSelectedSimWellFractureWellCompletionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExportSelectedWellPathFractureWellCompletionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicConvertFractureTemplateUnitFeature.h
|
||||
|
||||
|
||||
|
||||
@@ -107,6 +108,7 @@ ${CEE_CURRENT_LIST_DIR}RicExportSimWellFractureWellCompletionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExportSelectedSimWellFractureWellCompletionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExportSelectedWellPathFractureWellCompletionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicConvertFractureTemplateUnitFeature.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicConvertFractureTemplateUnitFeature.h"
|
||||
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RifEclipseExportTools.h"
|
||||
#include "RifEclipseExportTools.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFracture.h"
|
||||
#include "RimFractureExportSettings.h"
|
||||
#include "RimView.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include <QFileInfo>
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicConvertFractureTemplateUnitFeature, "RicConvertFractureTemplateUnitFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicConvertFractureTemplateUnitFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
if (!pdmUiItem) return;
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (!objHandle) return;
|
||||
|
||||
RimEllipseFractureTemplate* ellipseFractureTemplate = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(ellipseFractureTemplate);
|
||||
|
||||
ellipseFractureTemplate->changeUnits();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicConvertFractureTemplateUnitFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/FractureTemplate16x16.png"));
|
||||
//TODO: Add unit to text
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
if (!pdmUiItem) return;
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (!objHandle) return;
|
||||
|
||||
RimEllipseFractureTemplate* ellipseFractureTemplate = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(ellipseFractureTemplate);
|
||||
|
||||
if (ellipseFractureTemplate->fractureTemplateUnit == RimEllipseFractureTemplate::UNITS_METRIC)
|
||||
{
|
||||
actionToSetup->setText("Change to Field units in fracture template");
|
||||
}
|
||||
else if (ellipseFractureTemplate->fractureTemplateUnit == RimEllipseFractureTemplate::UNITS_FIELD)
|
||||
{
|
||||
actionToSetup->setText("Change to metric units in fracture template");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicConvertFractureTemplateUnitFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicConvertFractureTemplateUnitFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
||||
|
||||
};
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimFractureTemplate.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
@@ -382,13 +383,20 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicSimWellFracturesDeleteAllFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFractureTemplateCollection*>(uiItem) ||
|
||||
dynamic_cast<RimEllipseFractureTemplate*>(uiItem) ||
|
||||
dynamic_cast<RimStimPlanFractureTemplate*>(uiItem))
|
||||
dynamic_cast<RimStimPlanFractureTemplate*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewEllipseFractureTemplateFeature";
|
||||
commandIds << "RicNewStimPlanFractureTemplateFeature";
|
||||
commandIds << "RicFractureDefinitionsDeleteAllFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEllipseFractureTemplate*>(uiItem))
|
||||
{
|
||||
commandIds << "RicConvertFractureTemplateUnitFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewEllipseFractureTemplateFeature";
|
||||
commandIds << "RicNewStimPlanFractureTemplateFeature";
|
||||
commandIds << "RicFractureDefinitionsDeleteAllFeature";
|
||||
}
|
||||
|
||||
|
||||
if (dynamic_cast<RimView*>(uiItem))
|
||||
|
||||
@@ -149,13 +149,52 @@ std::vector<cvf::Vec3f> RimEllipseFractureTemplate::fracturePolygon()
|
||||
return polygon;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEllipseFractureTemplate::changeUnits()
|
||||
{
|
||||
if (fractureTemplateUnit == RimEllipseFractureTemplate::UNITS_METRIC)
|
||||
{
|
||||
halfLength = convertMtoFeet(halfLength);
|
||||
height = convertMtoFeet(height);
|
||||
width = convertMtoInch(width);
|
||||
fractureTemplateUnit = RimFractureTemplate::UNITS_FIELD;
|
||||
//TODO: Darcy unit?
|
||||
}
|
||||
else if (fractureTemplateUnit == RimEllipseFractureTemplate::UNITS_FIELD)
|
||||
{
|
||||
halfLength = convertFeetToM(halfLength);
|
||||
height = convertFeetToM(height);
|
||||
width = convertInchToM(width);
|
||||
fractureTemplateUnit = RimFractureTemplate::UNITS_METRIC;
|
||||
//TODO: Darcy unit?
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEllipseFractureTemplate::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
RimFractureTemplate::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
|
||||
if (fractureTemplateUnit == RimFractureTemplate::UNITS_METRIC)
|
||||
{
|
||||
halfLength.uiCapability()->setUiName("Halflenght Xf [m]");
|
||||
height.uiCapability()->setUiName("Height [m]");
|
||||
width.uiCapability()->setUiName("Width [m]");
|
||||
}
|
||||
else if (fractureTemplateUnit == RimFractureTemplate::UNITS_FIELD)
|
||||
{
|
||||
halfLength.uiCapability()->setUiName("Halflenght Xf [Ft]");
|
||||
height.uiCapability()->setUiName("Height [Ft]");
|
||||
width.uiCapability()->setUiName("Width [inches]");
|
||||
}
|
||||
|
||||
|
||||
uiOrdering.add(&name);
|
||||
|
||||
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Fracture geometry");
|
||||
@@ -171,3 +210,42 @@ void RimEllipseFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
propertyGroup->add(&skinFactor);
|
||||
propertyGroup->add(&perforationLength);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
float RimEllipseFractureTemplate::convertMtoFeet(float length)
|
||||
{
|
||||
length = length*(100/(2.54*12));
|
||||
return length;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
float RimEllipseFractureTemplate::convertMtoInch(float length)
|
||||
{
|
||||
length = length*(100 / 2.54);
|
||||
return length;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
float RimEllipseFractureTemplate::convertInchToM(float length)
|
||||
{
|
||||
length = length*(2.54 / 100);
|
||||
return length;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
float RimEllipseFractureTemplate::convertFeetToM(float length)
|
||||
{
|
||||
length = (length*12)*(2.54 / 100);
|
||||
return length;
|
||||
|
||||
}
|
||||
@@ -55,8 +55,14 @@ public:
|
||||
|
||||
void fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* polygonIndices);
|
||||
std::vector<cvf::Vec3f> fracturePolygon();
|
||||
|
||||
|
||||
void changeUnits();
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
private:
|
||||
static float convertMtoFeet(float length);
|
||||
static float convertMtoInch(float length);
|
||||
|
||||
static float convertInchToM(float length);
|
||||
static float convertFeetToM(float length);
|
||||
};
|
||||
|
||||
@@ -51,6 +51,17 @@ namespace caf
|
||||
|
||||
setDefault(RimFractureTemplate::INFINITE_CONDUCTIVITY);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
|
||||
void caf::AppEnum< RimFractureTemplate::FracUnitEnum>::setUp()
|
||||
{
|
||||
addItem(RimFractureTemplate::UNITS_METRIC, "MetricUnits", "Metric");
|
||||
addItem(RimFractureTemplate::UNITS_FIELD, "FieldsUnits", "Field units");
|
||||
|
||||
setDefault(RimFractureTemplate::UNITS_METRIC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +75,9 @@ RimFractureTemplate::RimFractureTemplate(void)
|
||||
CAF_PDM_InitObject("Fracture Template", ":/FractureTemplate16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString("Fracture Template"), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&fractureTemplateUnit, "fractureTemplateUnit", caf::AppEnum<FracUnitEnum>(UNITS_METRIC), "Units used in frac template", "", "", "");
|
||||
fractureTemplateUnit.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
|
||||
CAF_PDM_InitField(&orientation, "Orientation", caf::AppEnum<FracOrientationEnum>(TRANSVERSE_WELL_PATH), "Fracture orientation", "", "", "");
|
||||
CAF_PDM_InitField(&azimuthAngle, "AzimuthAngle", 0.0f, "Azimuth Angle", "", "", ""); //Is this correct description?
|
||||
@@ -103,6 +117,7 @@ void RimFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureTemplate::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
|
||||
if (orientation == RimFractureTemplate::ALONG_WELL_PATH
|
||||
|| orientation == RimFractureTemplate::TRANSVERSE_WELL_PATH)
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
#include "RigEclipseCaseData.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@@ -60,7 +61,14 @@ public:
|
||||
FINITE_CONDUCTIVITY,
|
||||
};
|
||||
caf::PdmField< caf::AppEnum< FracConductivityEnum > > fractureConductivity;
|
||||
|
||||
|
||||
enum FracUnitEnum //TODO: USE enum from RigEclipseCaseData
|
||||
{
|
||||
UNITS_METRIC,
|
||||
UNITS_FIELD,
|
||||
};
|
||||
caf::PdmField< caf::AppEnum< FracUnitEnum > > fractureTemplateUnit;
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user