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
commit c6b12b85e0
32 changed files with 778 additions and 329 deletions

View File

@ -1,6 +1,5 @@
---
Checks: '-*,modernize-use-nullptr'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
...

View File

@ -124,6 +124,7 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
Commands/ExportCommands/CMakeLists_files.cmake
Commands/FlowCommands/CMakeLists_files.cmake
Commands/FractureCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/IntersectionViewCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake

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);

View File

@ -40,6 +40,7 @@ bool hasNegativeValues(std::vector<double> xs);
cvf::ref<RigStimPlanFractureDefinition> RifStimPlanXmlReader::readStimPlanXMLFile(const QString& stimPlanFileName,
double conductivityScalingFactor,
MirrorMode mirrorMode,
RiaEclipseUnitTools::UnitSystem requiredUnit,
QString * errorMessage)
{
RiaLogging::info(QString("Starting to open StimPlan XML file: '%1'").arg(stimPlanFileName));
@ -56,7 +57,7 @@ cvf::ref<RigStimPlanFractureDefinition> RifStimPlanXmlReader::readStimPlanXMLFil
QXmlStreamReader xmlStream;
xmlStream.setDevice(&dataFile);
xmlStream.readNext();
readStimplanGridAndTimesteps(xmlStream, stimPlanFileData.p(), mirrorMode);
readStimplanGridAndTimesteps(xmlStream, stimPlanFileData.p(), mirrorMode, requiredUnit);
RiaEclipseUnitTools::UnitSystemType unitSystem = stimPlanFileData->unitSet();
@ -167,8 +168,9 @@ cvf::ref<RigStimPlanFractureDefinition> RifStimPlanXmlReader::readStimPlanXMLFil
///
//--------------------------------------------------------------------------------------------------
void RifStimPlanXmlReader::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStream,
RigStimPlanFractureDefinition* stimPlanFileData,
MirrorMode mirrorMode)
RigStimPlanFractureDefinition* stimPlanFileData,
MirrorMode mirrorMode,
RiaEclipseUnitTools::UnitSystem requiredUnit)
{
size_t startNegValuesYs = 0;
QString gridunit = "unknown";
@ -182,6 +184,8 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStr
if (xmlStream.isStartElement())
{
RiaEclipseUnitTools::UnitSystem destinationUnit = requiredUnit;
if (xmlStream.name() == "grid")
{
gridunit = getAttributeValueString(xmlStream, "uom");
@ -190,31 +194,51 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps(QXmlStreamReader &xmlStr
else if (gridunit == "ft") stimPlanFileData->m_unitSet = RiaEclipseUnitTools::UNITS_FIELD;
else stimPlanFileData->m_unitSet = RiaEclipseUnitTools::UNITS_UNKNOWN;
double tvdToTopPerfFt = getAttributeValueDouble(xmlStream, "TVDToTopPerfFt");
double tvdToBottomPerfFt = getAttributeValueDouble(xmlStream, "TVDToBottomPerfFt");
if (destinationUnit == RiaEclipseUnitTools::UNITS_UNKNOWN)
{
// Use file unit set if requested unit is unknown
destinationUnit = stimPlanFileData->m_unitSet;
}
stimPlanFileData->setTvdToTopPerf(tvdToTopPerfFt, RiaDefines::UNIT_FEET);
stimPlanFileData->setTvdToBottomPerf(tvdToBottomPerfFt, RiaDefines::UNIT_FEET);
double tvdToTopPerfFt = getAttributeValueDouble(xmlStream, "TVDToTopPerfFt");
double tvdToBotPerfFt = getAttributeValueDouble(xmlStream, "TVDToBottomPerfFt");
double tvdToTopPerfRequestedUnit = RifStimPlanXmlReader::valueInRequiredUnitSystem(RiaEclipseUnitTools::UNITS_FIELD, destinationUnit, tvdToTopPerfFt);
double tvdToBotPerfRequestedUnit = RifStimPlanXmlReader::valueInRequiredUnitSystem(RiaEclipseUnitTools::UNITS_FIELD, destinationUnit, tvdToBotPerfFt);
stimPlanFileData->setTvdToTopPerf(tvdToTopPerfRequestedUnit);
stimPlanFileData->setTvdToBottomPerf(tvdToBotPerfRequestedUnit);
}
if (xmlStream.name() == "xs")
{
size_t dummy;
std::vector<double> gridValues;
getGriddingValues(xmlStream, gridValues, dummy);
stimPlanFileData->m_fileXs = gridValues;
std::vector<double> gridValuesXs;
{
size_t dummy;
std::vector<double> gridValues;
getGriddingValues(xmlStream, gridValues, dummy);
stimPlanFileData->generateXsFromFileXs(mirrorMode == MIRROR_AUTO ? !hasNegativeValues(gridValues) : (bool)mirrorMode);
gridValuesXs = RifStimPlanXmlReader::valuesInRequiredUnitSystem(stimPlanFileData->m_unitSet, destinationUnit, gridValues);
}
stimPlanFileData->m_fileXs = gridValuesXs;
stimPlanFileData->generateXsFromFileXs(mirrorMode == MIRROR_AUTO ? !hasNegativeValues(gridValuesXs) : (bool)mirrorMode);
}
else if (xmlStream.name() == "ys")
{
std::vector<double> gridValues;
getGriddingValues(xmlStream, gridValues, startNegValuesYs);
std::vector<double> gridValuesYs;
{
std::vector<double> gridValues;
getGriddingValues(xmlStream, gridValues, startNegValuesYs);
gridValuesYs = RifStimPlanXmlReader::valuesInRequiredUnitSystem(stimPlanFileData->m_unitSet, destinationUnit, gridValues);
}
// Reorder and change sign
std::vector<double> ys;
for (double y : gridValues)
for (double y : gridValuesYs)
{
ys.insert(ys.begin(), -y);
}
@ -273,6 +297,56 @@ std::vector<std::vector<double>> RifStimPlanXmlReader::getAllDepthDataAtTimeSte
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RifStimPlanXmlReader::valuesInRequiredUnitSystem(RiaEclipseUnitTools::UnitSystem sourceUnit,
RiaEclipseUnitTools::UnitSystem requiredUnit,
const std::vector<double>& values)
{
if (sourceUnit == RiaEclipseUnitTools::UNITS_FIELD && requiredUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
std::vector<double> convertedValues;
for (const auto &valueInFeet : values)
{
convertedValues.push_back(RiaEclipseUnitTools::feetToMeter(valueInFeet));
}
return convertedValues;
}
else if (sourceUnit == RiaEclipseUnitTools::UNITS_METRIC && requiredUnit == RiaEclipseUnitTools::UNITS_FIELD)
{
std::vector<double> convertedValues;
for (const auto &valueInMeter : values)
{
convertedValues.push_back(RiaEclipseUnitTools::meterToFeet(valueInMeter));
}
return convertedValues;
}
return values;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RifStimPlanXmlReader::valueInRequiredUnitSystem(RiaEclipseUnitTools::UnitSystem sourceUnit,
RiaEclipseUnitTools::UnitSystem requiredUnit,
double value)
{
if (sourceUnit == RiaEclipseUnitTools::UNITS_FIELD && requiredUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::feetToMeter(value);
}
else if (sourceUnit == RiaEclipseUnitTools::UNITS_METRIC && requiredUnit == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::meterToFeet(value);
}
return value;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -38,12 +38,14 @@ public:
static cvf::ref<RigStimPlanFractureDefinition> readStimPlanXMLFile(const QString& stimPlanFileName,
double conductivityScalingFactor,
MirrorMode mirrorMode,
RiaEclipseUnitTools::UnitSystem requiredUnit,
QString * errorMessage);
private:
static void readStimplanGridAndTimesteps(QXmlStreamReader &xmlStream,
RigStimPlanFractureDefinition* stimPlanFileData,
MirrorMode mirrorMode);
MirrorMode mirrorMode,
RiaEclipseUnitTools::UnitSystem requiredUnit);
static double getAttributeValueDouble(QXmlStreamReader &xmlStream, QString parameterName);
static QString getAttributeValueString(QXmlStreamReader &xmlStream, QString parameterName);
@ -51,6 +53,11 @@ private:
static std::vector<std::vector<double>> getAllDepthDataAtTimeStep(QXmlStreamReader &xmlStream);
static std::vector<double> valuesInRequiredUnitSystem(RiaEclipseUnitTools::UnitSystem sourceUnit,
RiaEclipseUnitTools::UnitSystem requiredUnit,
const std::vector<double>& values);
static double valueInRequiredUnitSystem(RiaEclipseUnitTools::UnitSystem sourceUnit,
RiaEclipseUnitTools::UnitSystem requiredUnit,
double value);
};

View File

@ -664,7 +664,7 @@ cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanElementColorSurfacePar
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Part> RivWellFracturePartMgr::createContainmentMaskPart(const RimEclipseView& activeView)
{
std::vector<cvf::Vec3f> borderPolygonLocalCS = m_rimFracture->fractureTemplate()->fractureBorderPolygon(m_rimFracture->fractureUnit());
std::vector<cvf::Vec3f> borderPolygonLocalCS = m_rimFracture->fractureTemplate()->fractureBorderPolygon();
cvf::Mat4d frMx = m_rimFracture->transformMatrix();
cvf::BoundingBox frBBox;

View File

@ -112,38 +112,12 @@ void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* cha
///
//--------------------------------------------------------------------------------------------------
void RimEllipseFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices,
RiaEclipseUnitTools::UnitSystem neededUnit)
std::vector<cvf::uint>* triangleIndices)
{
RigEllipsisTesselator tesselator(20);
float a = cvf::UNDEFINED_FLOAT;
float b = cvf::UNDEFINED_FLOAT;
if (neededUnit == fractureTemplateUnit())
{
a = m_halfLength;
b = m_height / 2.0f;
}
else if (fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_METRIC && neededUnit == RiaEclipseUnitTools::UNITS_FIELD)
{
RiaLogging::info(QString("Converting fracture template geometry from metric to field"));
a = RiaEclipseUnitTools::meterToFeet(m_halfLength);
b = RiaEclipseUnitTools::meterToFeet(m_height / 2.0f);
}
else if (fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_FIELD && neededUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
RiaLogging::info(QString("Converting fracture template geometry from field to metric"));
a = RiaEclipseUnitTools::feetToMeter(m_halfLength);
b = RiaEclipseUnitTools::feetToMeter(m_height / 2.0f);
}
else
{
//Should never get here...
RiaLogging::error(QString("Error: Could not convert units for fracture / fracture template"));
return;
}
float a = m_halfLength;
float b = m_height / 2.0f;
tesselator.tesselateEllipsis(a, b, triangleIndices, nodeCoords);
}
@ -151,14 +125,14 @@ void RimEllipseFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3f
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3f> RimEllipseFractureTemplate::fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit)
std::vector<cvf::Vec3f> RimEllipseFractureTemplate::fractureBorderPolygon()
{
std::vector<cvf::Vec3f> polygon;
std::vector<cvf::Vec3f> nodeCoords;
std::vector<cvf::uint> triangleIndices;
fractureTriangleGeometry(&nodeCoords, &triangleIndices, neededUnit);
fractureTriangleGeometry(&nodeCoords, &triangleIndices);
for (size_t i = 1; i < nodeCoords.size(); i++)
{
@ -175,23 +149,11 @@ void RimEllipseFractureTemplate::changeUnits()
{
if (fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_METRIC)
{
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);
convertToUnitSystem(RiaEclipseUnitTools::UNITS_FIELD);
}
else if (fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_FIELD)
{
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);
convertToUnitSystem(RiaEclipseUnitTools::UNITS_METRIC);
}
this->updateConnectedEditors();
@ -233,7 +195,7 @@ void RimEllipseFractureTemplate::setupFractureGridCells()
double cond = conductivity();
std::vector<cvf::Vec3f> ellipseFracPolygon = fractureBorderPolygon(fractureTemplateUnit());
std::vector<cvf::Vec3f> ellipseFracPolygon = fractureBorderPolygon();
std::vector<cvf::Vec3d> ellipseFracPolygonDouble;
for (auto v : ellipseFracPolygon) ellipseFracPolygonDouble.push_back(static_cast<cvf::Vec3d>(v));
std::vector<std::vector<cvf::Vec3d> >clippedFracturePolygons = RigCellGeometryTools::intersectPolygons(cellPolygon, ellipseFracPolygonDouble);
@ -357,6 +319,28 @@ std::vector<std::pair<QString, QString>> RimEllipseFractureTemplate::uiResultNam
return propertyNamesAndUnits;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEllipseFractureTemplate::convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit)
{
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);
}
else if (neededUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
m_halfLength = RiaEclipseUnitTools::feetToMeter(m_halfLength);
m_height = RiaEclipseUnitTools::feetToMeter(m_height);
m_width = RiaEclipseUnitTools::inchToMeter(m_width);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -368,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)

View File

@ -46,12 +46,11 @@ public:
RimEllipseFractureTemplate(void);
virtual ~RimEllipseFractureTemplate(void);
void loadDataAndUpdate();
void loadDataAndUpdate() override;
void fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* polygonIndices,
RiaEclipseUnitTools::UnitSystem neededUnit);
std::vector<cvf::Vec3f> fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit);
std::vector<cvf::uint>* polygonIndices);
std::vector<cvf::Vec3f> fractureBorderPolygon();
void changeUnits();
const RigFractureGrid* fractureGrid() const;
@ -66,6 +65,9 @@ public:
virtual std::vector<std::pair<QString, QString>> uiResultNamesWithUnit() const override;
virtual void convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit) override;
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;

View File

@ -64,6 +64,7 @@
#include "cvfMatrix4.h"
#include "cvfPlane.h"
#include <QMessageBox>
#include <QString>
#include <math.h>
@ -197,6 +198,22 @@ void RimFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
{
if (changedField == &m_fractureTemplate)
{
if (fractureUnit() != m_fractureTemplate->fractureTemplateUnit())
{
QString fractureUnitText = RiaEclipseUnitTools::UnitSystemType::uiText(fractureUnit());
QString warningText = QString("Using a fracture template defined in a different unit is not supported.\n\nPlease select a "
"fracture template of unit '%1'")
.arg(fractureUnitText);
QMessageBox::warning(nullptr, "Fracture Template Selection", warningText);
PdmObjectHandle* prevValue = oldValue.value<caf::PdmPointer<PdmObjectHandle>>().rawPtr();
auto prevTemplate = dynamic_cast<RimFractureTemplate*>(prevValue);
m_fractureTemplate = prevTemplate;
}
setFractureTemplate(m_fractureTemplate);
setDefaultFractureColorResult();
}
@ -223,7 +240,6 @@ void RimFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
proj->reloadCompletionTypeResultsInAllViews();
}
}
}
//--------------------------------------------------------------------------------------------------
@ -278,30 +294,17 @@ cvf::BoundingBox RimFracture::boundingBoxInDomainCoords()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFracture::wellRadius(RiaEclipseUnitTools::UnitSystem unitSystem) const
double RimFracture::wellRadius() const
{
if (m_fractureUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
if (unitSystem == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::meterToFeet(m_wellDiameter / 2);
}
else
{
return m_wellDiameter / 2;
}
return m_wellDiameter / 2.0;
}
else if (m_fractureUnit == RiaEclipseUnitTools::UNITS_FIELD)
{
if (unitSystem == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::inchToMeter(m_wellDiameter / 2);
}
else
{
return RiaEclipseUnitTools::inchToFeet(m_wellDiameter / 2);
}
return RiaEclipseUnitTools::inchToFeet(m_wellDiameter / 2.0);
}
return cvf::UNDEFINED_DOUBLE;
}
@ -347,7 +350,7 @@ void RimFracture::triangleGeometry(std::vector<cvf::uint>* triangleIndices, std:
RimFractureTemplate* fractureDef = fractureTemplate();
if (fractureDef)
{
fractureDef->fractureTriangleGeometry(nodeCoords, triangleIndices, fractureUnit());
fractureDef->fractureTriangleGeometry(nodeCoords, triangleIndices);
}
cvf::Mat4d m = transformMatrix();
@ -384,17 +387,23 @@ QList<caf::PdmOptionItemInfo> RimFracture::calculateValueOptions(const caf::PdmF
RimProject* proj = RiaApplication::instance()->project();
CVF_ASSERT(proj);
RimOilField* oilField = proj->activeOilField();
if (oilField == nullptr) return options;
if (fieldNeedingOptions == &m_fractureTemplate)
{
RimFractureTemplateCollection* fracDefColl = oilField->fractureDefinitionCollection();
if (fracDefColl == nullptr) return options;
for (RimFractureTemplate* fracDef : fracDefColl->fractureDefinitions())
RimOilField* oilField = proj->activeOilField();
if (oilField && oilField->fractureDefinitionCollection)
{
options.push_back(caf::PdmOptionItemInfo(fracDef->name(), fracDef));
RimFractureTemplateCollection* fracDefColl = oilField->fractureDefinitionCollection();
for (RimFractureTemplate* fracDef : fracDefColl->fractureDefinitions())
{
QString displayText = fracDef->nameAndUnit();
if (fracDef->fractureTemplateUnit() != fractureUnit())
{
displayText += " (non-matching unit)";
}
options.push_back(caf::PdmOptionItemInfo(displayText, fracDef));
}
}
}
else if (fieldNeedingOptions == &m_stimPlanTimeIndexToPlot)
@ -613,6 +622,20 @@ size_t RimFracture::findAnchorEclipseCell(const RigMainGrid* mainGrid ) const
//--------------------------------------------------------------------------------------------------
void RimFracture::setFractureTemplate(RimFractureTemplate* fractureTemplate)
{
if (fractureTemplate && fractureTemplate->fractureTemplateUnit() != fractureUnit())
{
QString fractureUnitText = RiaEclipseUnitTools::UnitSystemType::uiText(fractureUnit());
QString warningText =
QString("Using a fracture template defined in a different unit is not supported.\n\nPlease select a "
"fracture template of unit '%1'")
.arg(fractureUnitText);
QMessageBox::warning(nullptr, "Fracture Template Selection", warningText);
return;
}
m_fractureTemplate = fractureTemplate;
if (!fractureTemplate)
@ -634,8 +657,8 @@ void RimFracture::setFractureTemplate(RimFractureTemplate* fractureTemplate)
{
this->updateAzimuthBasedOnWellAzimuthAngle();
}
this->m_wellDiameter = fractureTemplate->wellDiameterInFractureUnit(m_fractureUnit());
this->m_perforationLength = fractureTemplate->perforationLengthInFractureUnit(m_fractureUnit());
this->m_wellDiameter = fractureTemplate->wellDiameter();
this->m_perforationLength = fractureTemplate->perforationLength();
}
//--------------------------------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ public:
void setStimPlanTimeIndexToPlot(int timeIndex);
double wellRadius(RiaEclipseUnitTools::UnitSystem unitSystem) const;
double wellRadius() const;
cvf::Vec3d anchorPosition() const ;
void setAnchorPosition(const cvf::Vec3d& pos);
RiaEclipseUnitTools::UnitSystem fractureUnit() const;

View File

@ -98,6 +98,12 @@ RimFractureTemplate::RimFractureTemplate()
CAF_PDM_InitObject("Fracture Template", ":/FractureTemplate16x16.png", "", "");
CAF_PDM_InitField(&m_name, "UserDescription", QString("Fracture Template"), "Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_nameAndUnit, "NameAndUnit", "NameAndUnit", "", "", "");
m_nameAndUnit.registerGetMethod(this, &RimFractureTemplate::nameAndUnit);
m_nameAndUnit.uiCapability()->setUiHidden(true);
m_nameAndUnit.xmlCapability()->disableIO();
CAF_PDM_InitField(&m_fractureTemplateUnit,"UnitSystem", caf::AppEnum<RiaEclipseUnitTools::UnitSystem>(RiaEclipseUnitTools::UNITS_METRIC), "Units System", "", "", "");
m_fractureTemplateUnit.uiCapability()->setUiReadOnly(true);
@ -138,12 +144,14 @@ RimFractureTemplate::RimFractureTemplate()
m_dFactorDisplayField.registerGetMethod(this, &RimFractureTemplate::dFactor);
m_dFactorDisplayField.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleValueEditor::uiEditorTypeName());
m_dFactorDisplayField.uiCapability()->setUiReadOnly(true);
m_dFactorDisplayField.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault(&m_dFactorSummaryText, "dFactorSummaryText", "D Factor Summary", "", "", "");
m_dFactorSummaryText.registerGetMethod(this, &RimFractureTemplate::dFactorSummary);
m_dFactorSummaryText.uiCapability()->setUiReadOnly(true);
m_dFactorSummaryText.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
m_dFactorSummaryText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::LabelPosType::TOP);
m_dFactorSummaryText.xmlCapability()->disableIO();
}
//--------------------------------------------------------------------------------------------------
@ -198,7 +206,7 @@ RiaEclipseUnitTools::UnitSystemType RimFractureTemplate::fractureTemplateUnit()
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFractureTemplate::userDescriptionField()
{
return &m_name;
return &m_nameAndUnit;
}
//--------------------------------------------------------------------------------------------------
@ -555,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
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -573,47 +600,38 @@ double RimFractureTemplate::fractureWidth() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFractureTemplate::wellDiameterInFractureUnit(RiaEclipseUnitTools::UnitSystemType fractureUnit)
QString RimFractureTemplate::nameAndUnit() const
{
if (fractureUnit == m_fractureTemplateUnit())
QString decoratedName;
if (m_fractureTemplateUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
return m_wellDiameter;
decoratedName += "[M] - ";
}
else if (m_fractureTemplateUnit == RiaEclipseUnitTools::UNITS_METRIC
&& fractureUnit == RiaEclipseUnitTools::UNITS_FIELD)
else if (m_fractureTemplateUnit == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::meterToInch(m_wellDiameter);
}
else if (m_fractureTemplateUnit == RiaEclipseUnitTools::UNITS_FIELD
&& fractureUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::inchToMeter(m_wellDiameter);
decoratedName += "[F] - ";
}
return cvf::UNDEFINED_DOUBLE;
decoratedName += m_name;
return decoratedName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFractureTemplate::perforationLengthInFractureUnit(RiaEclipseUnitTools::UnitSystemType fractureUnit)
double RimFractureTemplate::wellDiameter()
{
if (fractureUnit == m_fractureTemplateUnit())
{
return m_perforationLength;
}
else if (m_fractureTemplateUnit == RiaEclipseUnitTools::UNITS_METRIC
&& fractureUnit == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::meterToFeet(m_perforationLength);
}
else if (m_fractureTemplateUnit == RiaEclipseUnitTools::UNITS_FIELD
&& fractureUnit == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::feetToMeter(m_perforationLength);
}
return m_wellDiameter;
}
return cvf::UNDEFINED_DOUBLE;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFractureTemplate::perforationLength()
{
return m_perforationLength;
}
//--------------------------------------------------------------------------------------------------

View File

@ -108,19 +108,20 @@ public:
virtual ~RimFractureTemplate();
QString name() const;
QString nameAndUnit() const;
RiaEclipseUnitTools::UnitSystemType fractureTemplateUnit() const;
FracOrientationEnum orientationType() const;
float azimuthAngle() const;
float skinFactor() const;
double wellDiameterInFractureUnit(RiaEclipseUnitTools::UnitSystemType fractureUnit);
double wellDiameter();
FracConductivityEnum conductivityType() const;
double perforationLengthInFractureUnit(RiaEclipseUnitTools::UnitSystemType fractureUnit);
double perforationLength();
virtual void fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices,
RiaEclipseUnitTools::UnitSystem neededUnit) = 0;
virtual void fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices) = 0;
virtual std::vector<cvf::Vec3f> fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit) = 0;
virtual std::vector<cvf::Vec3f> fractureBorderPolygon() = 0;
virtual const RigFractureGrid* fractureGrid() const = 0;
const RimFractureContainment* fractureContainment();
@ -139,6 +140,11 @@ public:
double dFactor() const;
double kh() const;
virtual void convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit);
virtual void loadDataAndUpdate() = 0;
protected:
virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
@ -157,6 +163,8 @@ private:
protected:
caf::PdmField<QString> m_name;
caf::PdmProxyValueField<QString> m_nameAndUnit;
caf::PdmField<RiaEclipseUnitTools::UnitSystemType> m_fractureTemplateUnit;
caf::PdmField<caf::AppEnum<FracOrientationEnum>> m_orientationType;
caf::PdmField<float> m_azimuthAngle;

View File

@ -66,6 +66,22 @@ RimFractureTemplateCollection::~RimFractureTemplateCollection()
fractureDefinitions.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFractureTemplate* RimFractureTemplateCollection::firstFractureOfUnit(RiaEclipseUnitTools::UnitSystem unitSet) const
{
for (RimFractureTemplate* f : fractureDefinitions())
{
if (f->fractureTemplateUnit() == unitSet)
{
return f;
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -37,6 +37,8 @@ class RimFractureTemplateCollection : public caf::PdmObject
public:
RimFractureTemplateCollection(void);
virtual ~RimFractureTemplateCollection(void);
RimFractureTemplate* firstFractureOfUnit(RiaEclipseUnitTools::UnitSystem unitSet) const;
caf::PdmChildArrayField<RimFractureTemplate*> fractureDefinitions;
caf::PdmField< RiaEclipseUnitTools::UnitSystemType > defaultUnitsForFracTemplates;

View File

@ -242,12 +242,17 @@ void RimStimPlanFractureTemplate::loadDataAndUpdate()
m_stimPlanFractureDefinitionData = RifStimPlanXmlReader::readStimPlanXMLFile( m_stimPlanFileName(),
m_conductivityScalingFactor(),
RifStimPlanXmlReader::MIRROR_AUTO,
fractureTemplateUnit(),
&errorMessage);
if (errorMessage.size() > 0) RiaLogging::error(errorMessage);
if (m_stimPlanFractureDefinitionData.notNull())
{
setFractureTemplateUnit(m_stimPlanFractureDefinitionData->unitSet());
if (fractureTemplateUnit() == RiaEclipseUnitTools::UNITS_UNKNOWN)
{
setFractureTemplateUnit(m_stimPlanFractureDefinitionData->unitSet());
}
m_readError = false;
}
else
@ -491,6 +496,40 @@ bool RimStimPlanFractureTemplate::showStimPlanMesh() const
return m_showStimPlanMesh_OBSOLETE();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit)
{
setFractureTemplateUnit(neededUnit);
RimFractureTemplate::convertToUnitSystem(neededUnit);
m_readError = false;
loadDataAndUpdate();
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();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -617,9 +656,11 @@ void RimStimPlanFractureTemplate::updateFractureGrid()
if (m_stimPlanFractureDefinitionData.notNull())
{
QString condUnit = RiaDefines::unitStringConductivity(fractureTemplateUnit());
m_fractureGrid = m_stimPlanFractureDefinitionData->createFractureGrid(m_conductivityResultNameOnFile,
m_activeTimeStepIndex,
fractureTemplateUnit(),
condUnit,
m_wellPathDepthAtFracture);
}
}
@ -630,8 +671,7 @@ void RimStimPlanFractureTemplate::updateFractureGrid()
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices,
RiaEclipseUnitTools::UnitSystem neededUnit)
std::vector<cvf::uint>* triangleIndices)
{
if (m_stimPlanFractureDefinitionData.isNull())
@ -641,7 +681,6 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3
else
{
m_stimPlanFractureDefinitionData->createFractureTriangleGeometry(m_wellPathDepthAtFracture,
neededUnit,
name(),
nodeCoords,
triangleIndices);
@ -651,7 +690,7 @@ void RimStimPlanFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit)
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fractureBorderPolygon()
{
if (m_stimPlanFractureDefinitionData.isNull()) return std::vector<cvf::Vec3f>();
@ -664,7 +703,6 @@ std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fractureBorderPolygon(RiaEc
parameterUnit,
m_activeTimeStepIndex,
m_wellPathDepthAtFracture,
neededUnit,
name());
}

View File

@ -54,7 +54,7 @@ public:
int activeTimeStepIndex();
void loadDataAndUpdate();
void loadDataAndUpdate() override;
void setDefaultsBasedOnXMLfile();
void setFileName(const QString& fileName);
@ -69,9 +69,8 @@ public:
const RigFractureGrid* fractureGrid() const override;
void updateFractureGrid();
void fractureTriangleGeometry(std::vector<cvf::Vec3f>* nodeCoords,
std::vector<cvf::uint>* triangleIndices,
RiaEclipseUnitTools::UnitSystem neededUnit) override;
std::vector<cvf::Vec3f> fractureBorderPolygon(RiaEclipseUnitTools::UnitSystem neededUnit) override;
std::vector<cvf::uint>* triangleIndices) override;
std::vector<cvf::Vec3f> fractureBorderPolygon() override;
// Result Access
@ -90,6 +89,9 @@ public:
bool showStimPlanMesh() const;
virtual void convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit) override;
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;

View File

@ -530,17 +530,32 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
{
menuBuilder << "RicNewSimWellFractureFeature";
}
else if (dynamic_cast<RimFractureTemplateCollection*>(uiItem) ||
dynamic_cast<RimStimPlanFractureTemplate*>(uiItem))
else if (dynamic_cast<RimFractureTemplateCollection*>(uiItem))
{
menuBuilder << "RicPasteEllipseFractureFeature";
menuBuilder << "RicPasteStimPlanFractureFeature";
menuBuilder.addSeparator();
menuBuilder << "RicNewEllipseFractureTemplateFeature";
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
menuBuilder << "Separator";
menuBuilder << "RicConvertAllFractureTemplatesToMetricFeature";
menuBuilder << "RicConvertAllFractureTemplatesToFieldFeature";
}
else if (dynamic_cast<RimStimPlanFractureTemplate*>(uiItem))
{
menuBuilder << "RicPasteStimPlanFractureFeature";
menuBuilder << "RicPasteEllipseFractureFeature";
menuBuilder.addSeparator();
menuBuilder << "RicNewEllipseFractureTemplateFeature";
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
menuBuilder << "Separator";
menuBuilder << "RicConvertFractureTemplateUnitFeature";
}
else if (dynamic_cast<RimEllipseFractureTemplate*>(uiItem))
{
menuBuilder << "RicPasteEllipseFractureFeature";
menuBuilder << "RicPasteStimPlanFractureFeature";
menuBuilder.addSeparator();
menuBuilder << "RicNewEllipseFractureTemplateFeature";
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
menuBuilder << "Separator";

View File

@ -133,59 +133,17 @@ double RigStimPlanFractureDefinition::maxY() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::setTvdToTopPerf(double topPerfTvd, RiaDefines::DepthUnitType unit)
void RigStimPlanFractureDefinition::setTvdToTopPerf(double topPerfTvd)
{
if (unit == RiaDefines::UNIT_METER)
{
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
{
m_topPerfTvd = RiaEclipseUnitTools::meterToFeet(topPerfTvd);
}
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
{
m_topPerfTvd = topPerfTvd;
}
}
else if (unit == RiaDefines::UNIT_FEET)
{
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
{
m_topPerfTvd = topPerfTvd;
}
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
{
m_topPerfTvd = RiaEclipseUnitTools::feetToMeter(topPerfTvd);
}
}
m_topPerfTvd = topPerfTvd;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::setTvdToBottomPerf(double bottomPerfTvd, RiaDefines::DepthUnitType unit)
void RigStimPlanFractureDefinition::setTvdToBottomPerf(double bottomPerfTvd)
{
if (unit == RiaDefines::UNIT_METER)
{
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
{
m_bottomPerfTvd = RiaEclipseUnitTools::meterToFeet(bottomPerfTvd);
}
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
{
m_bottomPerfTvd = bottomPerfTvd;
}
}
else if (unit == RiaDefines::UNIT_FEET)
{
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
{
m_bottomPerfTvd = bottomPerfTvd;
}
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
{
m_bottomPerfTvd = RiaEclipseUnitTools::feetToMeter(bottomPerfTvd);
}
}
m_bottomPerfTvd = bottomPerfTvd;
}
//--------------------------------------------------------------------------------------------------
@ -298,7 +256,7 @@ std::vector<std::pair<QString, QString> > RigStimPlanFractureDefinition::getStim
//--------------------------------------------------------------------------------------------------
cvf::ref<RigFractureGrid> RigStimPlanFractureDefinition::createFractureGrid(const QString& resultName,
int activeTimeStepIndex,
RiaEclipseUnitTools::UnitSystemType fractureTemplateUnit,
const QString& conductivityUnitText,
double wellPathIntersectionAtFractureDepth)
{
std::vector<RigFractureCell> stimPlanCells;
@ -306,10 +264,8 @@ cvf::ref<RigFractureGrid> RigStimPlanFractureDefinition::createFractureGrid(cons
bool wellCenterStimPlanCellFound = false;
QString condUnit = RiaDefines::unitStringConductivity(fractureTemplateUnit);
std::vector<std::vector<double>> conductivityValuesAtTimeStep = this->getDataAtTimeIndex(resultName,
condUnit,
conductivityUnitText,
activeTimeStepIndex);
std::vector<double> yCoordsAtNodes = this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth);
@ -407,7 +363,6 @@ std::vector<double> RigStimPlanFractureDefinition::fractureGridResults(const QSt
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName,
std::vector<cvf::Vec3f>* vertices,
std::vector<cvf::uint>* triangleIndices)
@ -417,30 +372,6 @@ void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPa
std::vector<double> adjustedYs = this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth);
if ( neededUnit == m_unitSet )
{
RiaLogging::debug(QString("No conversion necessary for %1").arg(fractureUserName));
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_METRIC && neededUnit == RiaEclipseUnitTools::UNITS_FIELD )
{
RiaLogging::info(QString("Converting StimPlan geometry from metric to field for fracture template %1").arg(fractureUserName));
for ( double& value : adjustedYs ) value = RiaEclipseUnitTools::meterToFeet(value);
for ( double& value : xCoords ) value = RiaEclipseUnitTools::meterToFeet(value);
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_FIELD && neededUnit == RiaEclipseUnitTools::UNITS_METRIC )
{
RiaLogging::info(QString("Converting StimPlan geometry from field to metric for fracture template %1").arg(fractureUserName));
for ( double& value : adjustedYs ) value = RiaEclipseUnitTools::feetToMeter(value);
for ( double& value : xCoords ) value = RiaEclipseUnitTools::feetToMeter(value);
}
else
{
//Should never get here...
RiaLogging::error(QString("Error: Could not convert units for fracture template %1").arg(fractureUserName));
return;
}
for ( cvf::uint k = 0; k < adjustedYs.size(); k++ )
{
for ( cvf::uint i = 0; i < lenXcoords; i++ )
@ -473,7 +404,6 @@ void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPa
triangleIndices->push_back((i + 1) + (k + 1)*lenXcoords);
triangleIndices->push_back((i)+ (k + 1)*lenXcoords);
}
}
}
}
@ -516,7 +446,6 @@ std::vector<cvf::Vec3f> RigStimPlanFractureDefinition::createFractureBorderPolyg
const QString& resultUnit,
int activeTimeStepIndex,
double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName)
{
std::vector<cvf::Vec3f> polygon;
@ -568,41 +497,6 @@ std::vector<cvf::Vec3f> RigStimPlanFractureDefinition::createFractureBorderPolyg
//Adding first point last - to close the polygon
if ( polygon.size()>0 ) polygon.push_back(polygon[0]);
if ( neededUnit == m_unitSet )
{
RiaLogging::debug(QString("No conversion necessary for %1").arg(fractureUserName));
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_METRIC && neededUnit == RiaEclipseUnitTools::UNITS_FIELD )
{
RiaLogging::info(QString("Converting StimPlan geometry from metric to field for fracture template %1").arg(fractureUserName));
for ( cvf::Vec3f& node : polygon )
{
float x = RiaEclipseUnitTools::meterToFeet(node.x());
float y = RiaEclipseUnitTools::meterToFeet(node.y());
float z = RiaEclipseUnitTools::meterToFeet(node.z());
node = cvf::Vec3f(x, y, z);
}
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_FIELD && neededUnit == RiaEclipseUnitTools::UNITS_METRIC )
{
RiaLogging::info(QString("Converting StimPlan geometry from field to metric for fracture template %1").arg(fractureUserName));
for ( cvf::Vec3f& node : polygon )
{
float x = RiaEclipseUnitTools::feetToMeter(node.x());
float y = RiaEclipseUnitTools::feetToMeter(node.y());
float z = RiaEclipseUnitTools::feetToMeter(node.z());
node = cvf::Vec3f(x, y, z);
}
}
else
{
//Should never get here...
RiaLogging::error(QString("Error: Could not convert units for fracture template %1").arg(fractureUserName));
}
return polygon;
}

View File

@ -68,16 +68,15 @@ public:
double maxDepth() const;
double topPerfTvd() const;
double bottomPerfTvd() const;
void setTvdToTopPerf(double topPerfTvd, RiaDefines::DepthUnitType unit);
void setTvdToBottomPerf(double bottomPerfTvd, RiaDefines::DepthUnitType unit);
void setTvdToTopPerf(double topPerfTvd);
void setTvdToBottomPerf(double bottomPerfTvd);
cvf::ref<RigFractureGrid> createFractureGrid(const QString& resultName,
int activeTimeStepIndex,
RiaEclipseUnitTools::UnitSystemType fractureTemplateUnit,
const QString& conductivityUnitText,
double wellPathIntersectionAtFractureDepth);
void createFractureTriangleGeometry(double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName,
std::vector<cvf::Vec3f>* vertices,
std::vector<cvf::uint>* triangleIndices);
@ -86,7 +85,6 @@ public:
const QString& resultUnit,
int activeTimeStepIndex,
double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName);
const std::vector<double>& timeSteps() const;
@ -125,7 +123,7 @@ private:
double maxY() const;
private:
RiaEclipseUnitTools::UnitSystem m_unitSet;
RiaEclipseUnitTools::UnitSystem m_unitSet; // To be deleted
std::vector<double> m_fileXs;
std::vector<double> m_Ys;
std::vector<double> m_timeSteps;