mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2509 Fracture : Add copy / paste of StimPlan
This commit is contained in:
parent
0d7e4f460c
commit
0acab5cd65
@ -6,10 +6,12 @@ endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteEllipseFractureFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteStimPlanFractureFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteEllipseFractureFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteStimPlanFractureFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 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 "RicPasteStimPlanFractureFeature.h"
|
||||
|
||||
#include "../OperationsUsingObjReferences/RicPasteFeatureImpl.h"
|
||||
|
||||
#include "RicNewEllipseFractureTemplateFeature.h"
|
||||
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
|
||||
#include "cafPdmObjectGroup.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QString>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicPasteStimPlanFractureFeature, "RicPasteStimPlanFractureFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPasteStimPlanFractureFeature::isCommandEnabled()
|
||||
{
|
||||
caf::PdmObjectGroup objectGroup;
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);
|
||||
|
||||
std::vector<caf::PdmPointer<RimStimPlanFractureTemplate>> typedObjects;
|
||||
objectGroup.objectsByType(&typedObjects);
|
||||
|
||||
if (typedObjects.size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fractureTemplateCollection())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPasteStimPlanFractureFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
auto fractureTemplateColl = fractureTemplateCollection();
|
||||
if (!fractureTemplateColl) return;
|
||||
|
||||
caf::PdmObjectGroup objectGroup;
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);
|
||||
|
||||
std::vector<caf::PdmPointer<RimStimPlanFractureTemplate>> typedObjects;
|
||||
objectGroup.objectsByType(&typedObjects);
|
||||
|
||||
for (const auto& source : typedObjects)
|
||||
{
|
||||
auto copyOfStimPlanTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(
|
||||
source->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
|
||||
fractureTemplateColl->fractureDefinitions.push_back(copyOfStimPlanTemplate);
|
||||
|
||||
RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(fractureTemplateColl, copyOfStimPlanTemplate);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPasteStimPlanFractureFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Paste (StimPlan Fracture)");
|
||||
|
||||
RicPasteFeatureImpl::setIconAndShortcuts(actionToSetup);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFractureTemplateCollection* RicPasteStimPlanFractureFeature::fractureTemplateCollection()
|
||||
{
|
||||
RimFractureTemplateCollection* fractureTemplateColl = nullptr;
|
||||
|
||||
auto destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
||||
if (destinationObject)
|
||||
{
|
||||
destinationObject->firstAncestorOrThisOfType(fractureTemplateColl);
|
||||
}
|
||||
|
||||
return fractureTemplateColl;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 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"
|
||||
|
||||
class RimFractureTemplateCollection;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectGroup;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicPasteStimPlanFractureFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
private:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
static RimFractureTemplateCollection* fractureTemplateCollection();
|
||||
};
|
@ -40,9 +40,9 @@ CAF_CMD_SOURCE_INIT(RicNewEllipseFractureTemplateFeature, "RicNewEllipseFracture
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(RimFractureTemplateCollection* templateCollection,
|
||||
RimEllipseFractureTemplate* ellipseFractureTemplate)
|
||||
RimFractureTemplate* fractureTemplate)
|
||||
{
|
||||
ellipseFractureTemplate->loadDataAndUpdate();
|
||||
fractureTemplate->loadDataAndUpdate();
|
||||
|
||||
templateCollection->updateConnectedEditors();
|
||||
|
||||
@ -59,7 +59,7 @@ void RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(RimFr
|
||||
}
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(ellipseFractureTemplate);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(fractureTemplate);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -22,11 +22,11 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimEllipseFractureTemplate;
|
||||
class RimFractureTemplate;
|
||||
class RimFractureTemplateCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewEllipseFractureTemplateFeature : public caf::CmdFeature
|
||||
{
|
||||
@ -34,12 +34,10 @@ class RicNewEllipseFractureTemplateFeature : public caf::CmdFeature
|
||||
|
||||
public:
|
||||
static void selectFractureTemplateAndUpdate(RimFractureTemplateCollection* templateCollection,
|
||||
RimEllipseFractureTemplate* ellipseFractureTemplate);
|
||||
RimFractureTemplate* ellipseFractureTemplate);
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
||||
|
||||
};
|
||||
|
@ -324,30 +324,20 @@ std::vector<std::pair<QString, QString>> RimEllipseFractureTemplate::uiResultNam
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEllipseFractureTemplate::convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit)
|
||||
{
|
||||
if (neededUnit == fractureTemplateUnit())
|
||||
{
|
||||
return;
|
||||
}
|
||||
setFractureTemplateUnit(neededUnit);
|
||||
RimFractureTemplate::convertToUnitSystem(neededUnit);
|
||||
|
||||
if (neededUnit == RiaEclipseUnitTools::UNITS_FIELD)
|
||||
{
|
||||
m_halfLength = RiaEclipseUnitTools::meterToFeet(m_halfLength);
|
||||
m_height = RiaEclipseUnitTools::meterToFeet(m_height);
|
||||
m_width = RiaEclipseUnitTools::meterToInch(m_width);
|
||||
m_wellDiameter = RiaEclipseUnitTools::meterToInch(m_wellDiameter);
|
||||
m_perforationLength = RiaEclipseUnitTools::meterToFeet(m_perforationLength);
|
||||
|
||||
setFractureTemplateUnit(RiaEclipseUnitTools::UNITS_FIELD);
|
||||
}
|
||||
else if (neededUnit == RiaEclipseUnitTools::UNITS_METRIC)
|
||||
{
|
||||
m_halfLength = RiaEclipseUnitTools::feetToMeter(m_halfLength);
|
||||
m_height = RiaEclipseUnitTools::feetToMeter(m_height);
|
||||
m_width = RiaEclipseUnitTools::inchToMeter(m_width);
|
||||
m_wellDiameter = RiaEclipseUnitTools::inchToMeter(m_wellDiameter);
|
||||
m_perforationLength = RiaEclipseUnitTools::feetToMeter(m_perforationLength);
|
||||
|
||||
setFractureTemplateUnit(RiaEclipseUnitTools::UNITS_METRIC);
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,14 +352,12 @@ void RimEllipseFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
m_halfLength.uiCapability()->setUiName("Halflenght X<sub>f</sub> [m]");
|
||||
m_height.uiCapability()->setUiName("Height [m]");
|
||||
m_width.uiCapability()->setUiName("Width [m]");
|
||||
m_wellDiameter.uiCapability()->setUiName("Well Diameter [m]");
|
||||
}
|
||||
else if (fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_FIELD)
|
||||
{
|
||||
m_halfLength.uiCapability()->setUiName("Halflenght X<sub>f</sub> [Ft]");
|
||||
m_height.uiCapability()->setUiName("Height [Ft]");
|
||||
m_width.uiCapability()->setUiName("Width [inches]");
|
||||
m_wellDiameter.uiCapability()->setUiName("Well Diameter [inches]");
|
||||
}
|
||||
|
||||
if (conductivityType() == FINITE_CONDUCTIVITY)
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
RimEllipseFractureTemplate(void);
|
||||
virtual ~RimEllipseFractureTemplate(void);
|
||||
|
||||
void loadDataAndUpdate();
|
||||
void loadDataAndUpdate() override;
|
||||
|
||||
void fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
|
||||
std::vector<cvf::uint>* polygonIndices);
|
||||
|
@ -563,6 +563,25 @@ double RimFractureTemplate::kh() const
|
||||
return effectivePermeability() * fractureWidth();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureTemplate::convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit)
|
||||
{
|
||||
if (neededUnit == RiaEclipseUnitTools::UNITS_FIELD)
|
||||
{
|
||||
m_perforationLength = RiaEclipseUnitTools::feetToMeter(m_perforationLength);
|
||||
m_wellDiameter = RiaEclipseUnitTools::inchToMeter(m_wellDiameter);
|
||||
}
|
||||
else if (neededUnit == RiaEclipseUnitTools::UNITS_METRIC)
|
||||
{
|
||||
m_perforationLength = RiaEclipseUnitTools::meterToFeet(m_perforationLength);
|
||||
m_wellDiameter = RiaEclipseUnitTools::meterToInch(m_wellDiameter);
|
||||
}
|
||||
|
||||
// TODO : Convert NON-darcy values
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -140,7 +140,9 @@ public:
|
||||
double dFactor() const;
|
||||
double kh() const;
|
||||
|
||||
virtual void convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit) = 0;
|
||||
virtual void convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit);
|
||||
|
||||
virtual void loadDataAndUpdate() = 0;
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -502,10 +502,32 @@ bool RimStimPlanFractureTemplate::showStimPlanMesh() const
|
||||
void RimStimPlanFractureTemplate::convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit)
|
||||
{
|
||||
setFractureTemplateUnit(neededUnit);
|
||||
RimFractureTemplate::convertToUnitSystem(neededUnit);
|
||||
|
||||
m_readError = false;
|
||||
loadDataAndUpdate();
|
||||
setDefaultsBasedOnXMLfile();
|
||||
|
||||
if (m_stimPlanFractureDefinitionData.isNull()) return;
|
||||
|
||||
if (neededUnit == RiaEclipseUnitTools::UNITS_FIELD)
|
||||
{
|
||||
m_wellPathDepthAtFracture = RiaEclipseUnitTools::meterToFeet(m_wellPathDepthAtFracture);
|
||||
}
|
||||
else if (neededUnit == RiaEclipseUnitTools::UNITS_METRIC)
|
||||
{
|
||||
m_wellPathDepthAtFracture = RiaEclipseUnitTools::feetToMeter(m_wellPathDepthAtFracture);
|
||||
}
|
||||
|
||||
m_activeTimeStepIndex = static_cast<int>(m_stimPlanFractureDefinitionData->totalNumberTimeSteps() - 1);
|
||||
bool polygonPropertySet = setBorderPolygonResultNameToDefault();
|
||||
|
||||
if (polygonPropertySet) RiaLogging::info(QString("Calculating polygon outline based on %1 at timestep %2").arg(m_borderPolygonResultName).arg(m_stimPlanFractureDefinitionData->timeSteps()[m_activeTimeStepIndex]));
|
||||
else RiaLogging::info(QString("Property for polygon calculation not set."));
|
||||
|
||||
if (!m_stimPlanFractureDefinitionData->conductivityResultNames().isEmpty())
|
||||
{
|
||||
m_conductivityResultNameOnFile = m_stimPlanFractureDefinitionData->conductivityResultNames().front();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
int activeTimeStepIndex();
|
||||
|
||||
void loadDataAndUpdate();
|
||||
void loadDataAndUpdate() override;
|
||||
void setDefaultsBasedOnXMLfile();
|
||||
|
||||
void setFileName(const QString& fileName);
|
||||
|
@ -533,6 +533,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimFractureTemplateCollection*>(uiItem))
|
||||
{
|
||||
menuBuilder << "RicPasteEllipseFractureFeature";
|
||||
menuBuilder << "RicPasteStimPlanFractureFeature";
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
||||
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
||||
@ -542,7 +543,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if (dynamic_cast<RimStimPlanFractureTemplate*>(uiItem))
|
||||
{
|
||||
//menuBuilder << "RicPasteEllipseFractureFeature";
|
||||
menuBuilder << "RicPasteStimPlanFractureFeature";
|
||||
menuBuilder << "RicPasteEllipseFractureFeature";
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
||||
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
||||
@ -552,6 +554,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimEllipseFractureTemplate*>(uiItem))
|
||||
{
|
||||
menuBuilder << "RicPasteEllipseFractureFeature";
|
||||
menuBuilder << "RicPasteStimPlanFractureFeature";
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
||||
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
||||
|
Loading…
Reference in New Issue
Block a user