Merge fracture unit refactoring into dev #2509

Add display of M and F in front of fracture templates
Add convert of StimPlan templates
Add copy/paste of StimPlan templates
Remove obsolete unit conversion code
This commit is contained in:
Magne Sjaastad
2018-02-21 10:12:48 +01:00
32 changed files with 778 additions and 329 deletions

View File

@@ -290,7 +290,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
double radialTrans = RigFractureTransmissibilityEquations::fractureCellToWellRadialTrans(wellCell.getConductivtyValue(),
wellCell.cellSizeX(),
wellCell.cellSizeZ(),
fracture->wellRadius(caseToApply->eclipseCaseData()->unitsType()),
fracture->wellRadius(),
fracTemplate->skinFactor(),
cDarcyInCorrectUnit);
@@ -354,7 +354,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
RigCompletionDataGridCell(externalCell.m_globalCellIdx, caseToApply->mainGrid()),
fracture->fractureMD());
double diameter = 2.0 * fracture->wellRadius(caseToApply->eclipseCaseData()->unitsType());
double diameter = 2.0 * fracture->wellRadius();
compDat.setFromFracture(trans, fracture->fractureTemplate()->skinFactor(), diameter);
compDat.addMetadata(fracture->name(), QString::number(trans));
allCompletionsForOneFracture.push_back(compDat);

View File

@@ -42,7 +42,7 @@ RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath
{
std::vector<cvf::Vec3d> wellPathPoints = wellpathGeom->wellPathPointsIncludingInterpolatedIntersectionPoint(rimFracture->fractureMD());
cvf::Mat4d fractureXf = rimFracture->transformMatrix();
double wellRadius = rimFracture->wellRadius(rimFracture->fractureUnit());
double wellRadius = rimFracture->wellRadius();
std::vector<std::vector<cvf::Vec3d> > stpCellPolygons;
{
RimFractureTemplate* fractureTemplate = rimFracture->fractureTemplate();

View File

@@ -0,0 +1,25 @@
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
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
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\Fracture" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@@ -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 "RicPasteEllipseFractureFeature.h"
#include "../OperationsUsingObjReferences/RicPasteFeatureImpl.h"
#include "RicNewEllipseFractureTemplateFeature.h"
#include "RimEllipseFractureTemplate.h"
#include "RimFractureTemplateCollection.h"
#include "cafPdmObjectGroup.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QString>
CAF_CMD_SOURCE_INIT(RicPasteEllipseFractureFeature, "RicPasteEllipseFractureFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPasteEllipseFractureFeature::isCommandEnabled()
{
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);
std::vector<caf::PdmPointer<RimEllipseFractureTemplate>> typedObjects;
objectGroup.objectsByType(&typedObjects);
if (typedObjects.size() == 0)
{
return false;
}
if (fractureTemplateCollection())
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteEllipseFractureFeature::onActionTriggered(bool isChecked)
{
auto fractureTemplateColl = fractureTemplateCollection();
if (!fractureTemplateColl) return;
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);
std::vector<caf::PdmPointer<RimEllipseFractureTemplate>> typedObjects;
objectGroup.objectsByType(&typedObjects);
for (const auto& source : typedObjects)
{
auto rimReservoirView = dynamic_cast<RimEllipseFractureTemplate*>(
source->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
fractureTemplateColl->fractureDefinitions.push_back(rimReservoirView);
RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(fractureTemplateColl, rimReservoirView);
}
return;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteEllipseFractureFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Paste (Ellipse Fracture)");
RicPasteFeatureImpl::setIconAndShortcuts(actionToSetup);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFractureTemplateCollection* RicPasteEllipseFractureFeature::fractureTemplateCollection()
{
RimFractureTemplateCollection* fractureTemplateColl = nullptr;
auto destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
if (destinationObject)
{
destinationObject->firstAncestorOrThisOfType(fractureTemplateColl);
}
return fractureTemplateColl;
}

View File

@@ -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 RicPasteEllipseFractureFeature : 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();
};

View File

@@ -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;
}

View File

@@ -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();
};

View File

@@ -21,6 +21,7 @@
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimFractureTemplate.h"
#include "RimGeoMechView.h"
#include "RimIntersection.h"
#include "RimIntersectionBox.h"
@@ -162,6 +163,10 @@ bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported(caf::PdmObject
{
if (!wellAllocPlot && !rftPlot) return true;
}
else if (dynamic_cast<RimFractureTemplate*>(pdmObject))
{
return true;
}
return false;
}

View File

@@ -55,11 +55,20 @@ void RicConvertFractureTemplateUnitFeature::onActionTriggered(bool isChecked)
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (!objHandle) return;
RimEllipseFractureTemplate* ellipseFractureTemplate = nullptr;
objHandle->firstAncestorOrThisOfType(ellipseFractureTemplate);
RimFractureTemplate* fractureTemplate = nullptr;
objHandle->firstAncestorOrThisOfType(fractureTemplate);
ellipseFractureTemplate->changeUnits();
auto currentUnit = fractureTemplate->fractureTemplateUnit();
if (currentUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
fractureTemplate->convertToUnitSystem(RiaEclipseUnitTools::UNITS_FIELD);
}
else
{
fractureTemplate->convertToUnitSystem(RiaEclipseUnitTools::UNITS_METRIC);
}
fractureTemplate->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
@@ -73,16 +82,16 @@ void RicConvertFractureTemplateUnitFeature::setupActionLook(QAction* actionToSet
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (!objHandle) return;
RimEllipseFractureTemplate* ellipseFractureTemplate = nullptr;
objHandle->firstAncestorOrThisOfType(ellipseFractureTemplate);
if (!ellipseFractureTemplate) return;
RimFractureTemplate* fractureTemplate = nullptr;
objHandle->firstAncestorOrThisOfType(fractureTemplate);
if (!fractureTemplate) return;
QString text = "Convert Values to ";
if (ellipseFractureTemplate->fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_METRIC)
if (fractureTemplate->fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_METRIC)
{
text += "Field";
}
else if (ellipseFractureTemplate->fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_FIELD)
else if (fractureTemplate->fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_FIELD)
{
text += "Metric";
}

View File

@@ -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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -20,10 +20,10 @@
#include "RiaApplication.h"
#include "RimOilField.h"
#include "RimEclipseView.h"
#include "RimEllipseFractureTemplate.h"
#include "RimFractureTemplateCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
@@ -34,11 +34,36 @@
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewEllipseFractureTemplateFeature, "RicNewEllipseFractureTemplateFeature");
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(RimFractureTemplateCollection* templateCollection,
RimFractureTemplate* fractureTemplate)
{
fractureTemplate->loadDataAndUpdate();
templateCollection->updateConnectedEditors();
RimProject* project = RiaApplication::instance()->project();
std::vector<Rim3dView*> views;
project->allVisibleViews(views);
for (Rim3dView* view : views)
{
if (dynamic_cast<RimEclipseView*>(view))
{
view->updateConnectedEditors();
}
}
RiuMainWindow::instance()->selectAsCurrentItem(fractureTemplate);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewEllipseFractureTemplateFeature::onActionTriggered(bool isChecked)
{
@@ -49,35 +74,22 @@ void RicNewEllipseFractureTemplateFeature::onActionTriggered(bool isChecked)
if (oilfield == nullptr) return;
RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection();
if (fracDefColl)
{
RimEllipseFractureTemplate* ellipseFractureTemplate = new RimEllipseFractureTemplate();
fracDefColl->fractureDefinitions.push_back(ellipseFractureTemplate);
ellipseFractureTemplate->setName("Ellipse Fracture Template");
ellipseFractureTemplate->setFractureTemplateUnit(fracDefColl->defaultUnitsForFracTemplates());
ellipseFractureTemplate->setDefaultValuesFromUnit();
ellipseFractureTemplate->loadDataAndUpdate();
fracDefColl->updateConnectedEditors();
std::vector<Rim3dView*> views;
project->allVisibleViews(views);
for (Rim3dView* view : views)
{
if (dynamic_cast<RimEclipseView*>(view))
{
view->updateConnectedEditors();
}
}
RiuMainWindow::instance()->selectAsCurrentItem(ellipseFractureTemplate);
selectFractureTemplateAndUpdate(fracDefColl, ellipseFractureTemplate);
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewEllipseFractureTemplateFeature::setupActionLook(QAction* actionToSetup)
{
@@ -86,7 +98,7 @@ void RicNewEllipseFractureTemplateFeature::setupActionLook(QAction* actionToSetu
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewEllipseFractureTemplateFeature::isCommandEnabled()
{

View File

@@ -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,18 +22,22 @@
#include <vector>
class RimFractureTemplate;
class RimFractureTemplateCollection;
//==================================================================================================
///
///
//==================================================================================================
class RicNewEllipseFractureTemplateFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
public:
static void selectFractureTemplateAndUpdate(RimFractureTemplateCollection* templateCollection,
RimFractureTemplate* ellipseFractureTemplate);
protected:
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
virtual bool isCommandEnabled() override;
};

View File

@@ -93,17 +93,20 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
fracture->setName(QString("Fracture_") + fracNum);
auto unitSet = RiaEclipseUnitTools::UNITS_UNKNOWN;
{
RimEclipseResultCase* eclipseCase = nullptr;
simWell->firstAncestorOrThisOfType(eclipseCase);
fracture->setFractureUnit(eclipseCase->eclipseCaseData()->unitsType());
if (eclipseCase)
{
unitSet = eclipseCase->eclipseCaseData()->unitsType();
}
fracture->setFractureUnit(unitSet);
}
if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0)
{
RimFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->fractureDefinitions[0];
fracture->setFractureTemplate(fracDef);
}
RimFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->firstFractureOfUnit(unitSet);
fracture->setFractureTemplate(fracDef);
simWell->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(fracture);

View File

@@ -81,17 +81,19 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
fracture->setName(RicFractureNameGenerator::nameForNewFracture());
auto unitSet = RiaEclipseUnitTools::UNITS_UNKNOWN;
{
RimEclipseResultCase* eclipseCase = nullptr;
objHandle->firstAncestorOrThisOfType(eclipseCase);
fracture->setFractureUnit(eclipseCase->eclipseCaseData()->unitsType());
if (eclipseCase)
{
unitSet = eclipseCase->eclipseCaseData()->unitsType();
}
fracture->setFractureUnit(unitSet);
}
if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0)
{
RimFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->fractureDefinitions[0];
fracture->setFractureTemplate(fracDef);
}
RimFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->firstFractureOfUnit(unitSet);
fracture->setFractureTemplate(fracDef);
fracture->updateFracturePositionFromLocation();

View File

@@ -86,11 +86,11 @@ void RicNewWellPathFractureFeature::addFracture(RimWellPath* wellPath, double me
fracture->setName(RicFractureNameGenerator::nameForNewFracture());
if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0)
{
RimFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->fractureDefinitions[0];
fracture->setFractureTemplate(fracDef);
}
auto unitSet = wellPath->unitSystem();
fracture->setFractureUnit(unitSet);
RimFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->firstFractureOfUnit(unitSet);
fracture->setFractureTemplate(fracDef);
wellPath->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(fracture);