Merge dev into pre-proto

This commit is contained in:
Jacob Støren 2017-06-14 23:25:55 +02:00
commit 1911092cb7
46 changed files with 1123 additions and 306 deletions

View File

@ -21,6 +21,7 @@
#include "cafAppEnum.h" #include "cafAppEnum.h"
#include "cvfAssert.h" #include "cvfAssert.h"
#include <cmath>
namespace caf namespace caf
{ {
@ -57,3 +58,27 @@ double RiaEclipseUnitTools::darcysConstant(UnitSystem unitSystem)
return 0.0; return 0.0;
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaEclipseUnitTools::convertConductivtyValue(double Kw, UnitSystem fromUnit, UnitSystem toUnit)
{
if (fromUnit == toUnit) return Kw;
else if (fromUnit == UNITS_METRIC && toUnit == UNITS_FIELD)
{
return meterToFeet(Kw);
}
else if (fromUnit == UNITS_METRIC && toUnit == UNITS_FIELD)
{
return feetToMeter(Kw);
}
CVF_ASSERT(false);
return HUGE_VAL;
}

View File

@ -44,5 +44,8 @@ public:
static double inchToFeet (double inch) { return (inch / 12.0); } static double inchToFeet (double inch) { return (inch / 12.0); }
static double darcysConstant(UnitSystem unitSystem); static double darcysConstant(UnitSystem unitSystem);
static double convertConductivtyValue(double Kw, UnitSystem fromUnit, UnitSystem toUnit);
}; };

View File

@ -19,6 +19,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.h
${CEE_CURRENT_LIST_DIR}RicFishbonesTransmissibilityCalculationFeatureImp.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@ -36,6 +37,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicFishbonesTransmissibilityCalculationFeatureImp.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,285 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicFishbonesTransmissibilityCalculationFeatureImp.h"
#include "RigEclipseCaseData.h"
#include "RicExportCompletionDataSettingsUi.h"
#include "RicWellPathExportCompletionDataFeature.h"
#include "RimWellPath.h"
#include "RigWellPath.h"
#include "RimFishboneWellPath.h"
#include "RimFishbonesCollection.h"
#include "RigActiveCellInfo.h"
#include "RigMainGrid.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishboneWellPathCollection.h"
#include "RimWellPathCompletions.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
// Generate data
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
std::vector<WellSegmentLocation> locations = RicWellPathExportCompletionDataFeature::findWellSegmentLocations(settings.caseToApply, wellPath);
// Filter out cells where main bore is present
if (settings.removeLateralsInMainBoreCells())
{
std::vector<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints);
RicWellPathExportCompletionDataFeature::markWellPathCells(wellPathCells, &locations);
}
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
std::vector<RigCompletionData> completionData;
for (const WellSegmentLocation& location : locations)
{
for (const WellSegmentLateral& lateral : location.laterals)
{
for (const WellSegmentLateralIntersection& intersection : lateral.intersections)
{
if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue;
size_t i, j, k;
grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
completion.addMetadata(location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
double diameter = location.fishbonesSubs->holeDiameter() / 1000;
if (settings.computeTransmissibility())
{
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
wellPath,
intersection.lengthsInCell,
location.fishbonesSubs->skinFactor(),
diameter / 2,
intersection.cellIndex);
completion.setFromFishbone(transmissibility, location.fishbonesSubs->skinFactor());
}
else {
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, intersection.cellIndex, intersection.lengthsInCell);
completion.setFromFishbone(diameter, direction);
}
completionData.push_back(completion);
}
}
}
return completionData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc> >& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
// Generate data
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
std::vector<WellSegmentLocation> locations = RicWellPathExportCompletionDataFeature::findWellSegmentLocations(settings.caseToApply, wellPath);
// Filter out cells where main bore is present
if (settings.removeLateralsInMainBoreCells())
{
std::vector<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints);
RicWellPathExportCompletionDataFeature::markWellPathCells(wellPathCells, &locations);
}
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
std::vector<RigCompletionData> completionData;
for (const WellSegmentLocation& location : locations)
{
for (const WellSegmentLateral& lateral : location.laterals)
{
for (const WellSegmentLateralIntersection& intersection : lateral.intersections)
{
if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue;
double diameter = location.fishbonesSubs->holeDiameter() / 1000;
QString completionMetaData = (location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(intersection.lengthsInCell,
diameter / 2,
location.fishbonesSubs->skinFactor(),
completionMetaData);
wellBorePartsInCells[intersection.cellIndex].push_back(wellBorePart);
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings)
{
std::map<size_t, std::vector<WellBorePartForTransCalc> > wellBorePartsInCells; //wellBore = main bore or fishbone lateral
findFishboneLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings);
findFishboneImportedLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings);
findMainWellBoreParts(wellBorePartsInCells, wellPath, settings);
std::vector<RigCompletionData> completionData;
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
for (auto cellAndWellBoreParts : wellBorePartsInCells)
{
size_t cellIndex = cellAndWellBoreParts.first;
std::vector<WellBorePartForTransCalc> wellBoreParts = cellAndWellBoreParts.second;
size_t i, j, k;
grid->ijkFromCellIndex(cellIndex, &i, &j, &k);
bool cellIsActive = activeCellInfo->isActive(cellIndex);
if (!cellIsActive) continue;
size_t NumberOfCellContributions = wellBoreParts.size();
//Simplest implementation possible, this can be improved later
QString directionToSplitCellVolume = "DX";
for (WellBorePartForTransCalc wellBorePart : wellBoreParts)
{
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
completion.addMetadata(wellBorePart.metaData, "");
if (settings.computeTransmissibility())
{
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
wellPath,
wellBorePart.lengthsInCell,
wellBorePart.skinFactor,
wellBorePart.wellRadius,
cellIndex,
NumberOfCellContributions,
directionToSplitCellVolume);
completion.setFromFishbone(transmissibility, wellBorePart.skinFactor);
}
else
{
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, cellIndex, wellBorePart.lengthsInCell);
completion.setFromFishbone(wellBorePart.wellRadius*2, direction);
}
completionData.push_back(completion);
}
}
return completionData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings)
{
std::vector<RigCompletionData> completionData;
std::vector<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints);
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter() / 1000;
for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths())
{
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates());
for (auto& cell : intersectedCells)
{
if (settings.removeLateralsInMainBoreCells && std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue;
size_t i, j, k;
settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
completion.addMetadata(fishbonesPath->name(), "");
if (settings.computeTransmissibility())
{
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply(),
wellPath,
cell.internalCellLengths,
skinFactor,
diameter / 2,
cell.cellIndex);
completion.setFromFishbone(transmissibility, skinFactor);
}
else {
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths);
completion.setFromFishbone(diameter, direction);
}
completionData.push_back(completion);
}
}
return completionData;
}
void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLateralsWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc> >& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
std::vector<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints);
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter() / 1000;
for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths())
{
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates());
for (auto& cell : intersectedCells)
{
if (std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue;
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
QString completionMetaData = fishbonesPath->name();
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths,
diameter / 2,
skinFactor,
completionMetaData);
wellBorePartsInCells[cell.cellIndex].push_back(wellBorePart);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
double holeDiameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter();
double FishboneStartMD = wellPath->fishbonesCollection()->startMD();
std::vector<double> wellPathMD = wellPath->wellPathGeometry()->m_measuredDepths;
double wellPathEndMD = 0.0;
if (wellPathMD.size() > 1) wellPathEndMD = wellPathMD.back();
std::vector<cvf::Vec3d> fishbonePerfWellPathCoords = wellPath->wellPathGeometry()->clippedPointSubset(wellPath->fishbonesCollection()->startMD(),
wellPathEndMD);
std::vector<WellPathCellIntersectionInfo> intersectedCellsIntersectionInfo = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
fishbonePerfWellPathCoords);
for (auto& cell : intersectedCellsIntersectionInfo)
{
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
QString completionMetaData = wellPath->name() + " main bore";
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths,
holeDiameter / 2,
skinFactor,
completionMetaData);
wellBorePartsInCells[cell.cellIndex].push_back(wellBorePart);
}
}

View File

@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfVector3.h"
#include <vector>
#include <map>
#include <QString>
class RigCompletionData;
class RimWellPath;
class RicExportCompletionDataSettingsUi;
//==================================================================================================
///
//==================================================================================================
struct WellBorePartForTransCalc {
WellBorePartForTransCalc(cvf::Vec3d lengthsInCell,
double wellRadius,
double skinFactor,
QString metaData)
: lengthsInCell(lengthsInCell),
wellRadius(wellRadius),
skinFactor(skinFactor),
metaData(metaData)
{}
cvf::Vec3d lengthsInCell;
double wellRadius;
double skinFactor;
QString metaData;
};
//==================================================================================================
///
//==================================================================================================
class RicFishbonesTransmissibilityCalculationFeatureImp
{
public:
static std::vector<RigCompletionData> generateFishboneLateralsCompdatValues(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static std::vector<RigCompletionData> generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static std::vector<RigCompletionData> generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
private:
static void findFishboneLateralsWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc> >& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static void findFishboneImportedLateralsWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc> >& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static void findMainWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
};

View File

@ -33,6 +33,7 @@
#include "RimReservoirCellResultsStorage.h" #include "RimReservoirCellResultsStorage.h"
#include "RimEclipseWell.h" #include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h" #include "RimEclipseWellCollection.h"
#include "RimWellPathCompletions.h"
#include "RicExportCompletionDataSettingsUi.h" #include "RicExportCompletionDataSettingsUi.h"
@ -54,6 +55,7 @@
#include <QAction> #include <QAction>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include "RicFishbonesTransmissibilityCalculationFeatureImp.h"
#include "RicExportFractureCompletionsImpl.h" #include "RicExportFractureCompletionsImpl.h"
CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature"); CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature");
@ -264,10 +266,14 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
} }
if (exportSettings.includeFishbones) if (exportSettings.includeFishbones)
{ {
std::vector<RigCompletionData> fishbonesCompletionData = generateFishboneLateralsCompdatValues(wellPath, exportSettings); // std::vector<RigCompletionData> fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValues(wellPath, exportSettings);
// appendCompletionData(&completionData, fishbonesCompletionData);
// std::vector<RigCompletionData> fishbonesWellPathCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(wellPath, exportSettings);
// appendCompletionData(&completionData, fishbonesWellPathCompletionData);
std::vector<RigCompletionData> fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume(wellPath, exportSettings);
appendCompletionData(&completionData, fishbonesCompletionData); appendCompletionData(&completionData, fishbonesCompletionData);
std::vector<RigCompletionData> fishbonesWellPathCompletionData = generateFishbonesImportedLateralsCompdatValues(wellPath, exportSettings);
appendCompletionData(&completionData, fishbonesWellPathCompletionData);
} }
if (exportSettings.includeFractures()) if (exportSettings.includeFractures())
@ -409,104 +415,6 @@ void RicWellPathExportCompletionDataFeature::generateWpimultTable(RifEclipseData
formatter.tableCompleted(); formatter.tableCompleted();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
// Generate data
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
std::vector<WellSegmentLocation> locations = findWellSegmentLocations(settings.caseToApply, wellPath);
// Filter out cells where main bore is present
if (settings.removeLateralsInMainBoreCells())
{
std::vector<size_t> wellPathCells = findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints);
markWellPathCells(wellPathCells, &locations);
}
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
std::vector<RigCompletionData> completionData;
for (const WellSegmentLocation& location : locations)
{
for (const WellSegmentLateral& lateral : location.laterals)
{
for (const WellSegmentLateralIntersection& intersection : lateral.intersections)
{
if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue;
size_t i, j, k;
grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k));
completion.addMetadata(location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
double diameter = location.fishbonesSubs->holeDiameter() / 1000;
if (settings.computeTransmissibility())
{
double transmissibility = calculateTransmissibility(settings.caseToApply,
wellPath,
intersection.lengthsInCell,
location.fishbonesSubs->skinFactor(),
diameter / 2,
intersection.cellIndex);
completion.setFromFishbone(transmissibility, location.fishbonesSubs->skinFactor());
}
else {
CellDirection direction = calculateDirectionInCell(settings.caseToApply, intersection.cellIndex, intersection.lengthsInCell);
completion.setFromFishbone(diameter, direction);
}
completionData.push_back(completion);
}
}
}
return completionData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
std::vector<RigCompletionData> completionData;
std::vector<size_t> wellPathCells = findIntersectingCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints);
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter() / 1000;
for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths())
{
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates());
for (auto& cell : intersectedCells)
{
if (std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue;
size_t i, j, k;
settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k));
completion.addMetadata(fishbonesPath->name(), "");
if (settings.computeTransmissibility())
{
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
double transmissibility = calculateTransmissibility(settings.caseToApply(),
wellPath,
cell.internalCellLengths,
skinFactor,
diameter / 2,
cell.cellIndex);
completion.setFromFishbone(transmissibility, skinFactor);
}
else {
CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths);
completion.setFromFishbone(diameter, direction);
}
completionData.push_back(completion);
}
}
return completionData;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -524,7 +432,7 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
{ {
size_t i, j, k; size_t i, j, k;
settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k); settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
completion.addMetadata("Perforation", QString("StartMD: %1 - EndMD: %2").arg(interval->startMD()).arg(interval->endMD())); completion.addMetadata("Perforation", QString("StartMD: %1 - EndMD: %2").arg(interval->startMD()).arg(interval->endMD()));
double diameter = interval->diameter(); double diameter = interval->diameter();
CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths); CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths);
@ -589,11 +497,11 @@ bool RicWellPathExportCompletionDataFeature::wellSegmentLocationOrdering(const W
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicWellPathExportCompletionDataFeature::isPointBetween(const cvf::Vec3d& pointA, const cvf::Vec3d& pointB, const cvf::Vec3d& needle) bool RicWellPathExportCompletionDataFeature::isPointBetween(const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint, const cvf::Vec3d& pointToCheck)
{ {
cvf::Plane plane; cvf::Plane plane;
plane.setFromPointAndNormal(needle, pointB - pointA); plane.setFromPointAndNormal(pointToCheck, endPoint - startPoint);
return plane.side(pointA) != plane.side(pointB); return plane.side(startPoint) != plane.side(endPoint);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -644,18 +552,18 @@ void RicWellPathExportCompletionDataFeature::calculateLateralIntersections(const
for (WellSegmentLateral& lateral : location->laterals) for (WellSegmentLateral& lateral : location->laterals)
{ {
lateral.branchNumber = ++(*branchNum); lateral.branchNumber = ++(*branchNum);
std::vector<cvf::Vec3d> coords = location->fishbonesSubs->coordsForLateral(location->subIndex, lateral.lateralIndex); std::vector<cvf::Vec3d> lateralCoords = location->fishbonesSubs->coordsForLateral(location->subIndex, lateral.lateralIndex);
std::vector<WellPathCellIntersectionInfo> intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(), coords); std::vector<WellPathCellIntersectionInfo> intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(), lateralCoords);
auto intersection = intersections.cbegin(); auto intersection = intersections.cbegin();
double length = 0; double length = 0;
double depth = 0; double depth = 0;
cvf::Vec3d startPoint = coords[0]; cvf::Vec3d startPoint = lateralCoords[0];
int attachedSegmentNumber = location->icdSegmentNumber; int attachedSegmentNumber = location->icdSegmentNumber;
for (size_t i = 1; i < coords.size() && intersection != intersections.cend(); ++i) for (size_t i = 1; i < lateralCoords.size() && intersection != intersections.cend(); ++i)
{ {
if (isPointBetween(startPoint, coords[i], intersection->endPoint)) if (isPointBetween(startPoint, lateralCoords[i], intersection->endPoint))
{ {
length += (intersection->endPoint - startPoint).length(); length += (intersection->endPoint - startPoint).length();
depth += intersection->endPoint.z() - startPoint.z(); depth += intersection->endPoint.z() - startPoint.z();
@ -672,9 +580,9 @@ void RicWellPathExportCompletionDataFeature::calculateLateralIntersections(const
} }
else else
{ {
length += (coords[i] - startPoint).length(); length += (lateralCoords[i] - startPoint).length();
depth += coords[i].z() - startPoint.z(); depth += lateralCoords[i].z() - startPoint.z();
startPoint = coords[i]; startPoint = lateralCoords[i];
} }
} }
} }
@ -755,7 +663,14 @@ CellDirection RicWellPathExportCompletionDataFeature::calculateDirectionInCell(R
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex) double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
const cvf::Vec3d& internalCellLengths,
double skinFactor,
double wellRadius,
size_t cellIndex,
size_t volumeScaleConstant,
QString directionForVolumeScaling)
{ {
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
@ -782,6 +697,13 @@ double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEcli
double darcy = RiaEclipseUnitTools::darcysConstant(wellPath->unitSystem()); double darcy = RiaEclipseUnitTools::darcysConstant(wellPath->unitSystem());
if (volumeScaleConstant != 1)
{
if (directionForVolumeScaling == "DX") dx = dx / volumeScaleConstant;
if (directionForVolumeScaling == "DY") dy = dy / volumeScaleConstant;
if (directionForVolumeScaling == "DZ") dz = dz / volumeScaleConstant;
}
double transx = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.x(), permy, permz, dy, dz, wellRadius, skinFactor, darcy); double transx = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.x(), permy, permz, dy, dz, wellRadius, skinFactor, darcy);
double transy = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.y(), permx, permz, dx, dz, wellRadius, skinFactor, darcy); double transy = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.y(), permx, permz, dx, dz, wellRadius, skinFactor, darcy);
double transz = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.z(), permy, permx, dy, dx, wellRadius, skinFactor, darcy); double transz = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.z(), permy, permx, dy, dx, wellRadius, skinFactor, darcy);

View File

@ -133,19 +133,20 @@ public:
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath); static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath);
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs); static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs);
//functions also used by RicFishbonesTransmissibilityCalculationFeatureImp
static std::vector<size_t> findIntersectingCells(const RigEclipseCaseData* grid, const std::vector<cvf::Vec3d>& coords);
static void markWellPathCells(const std::vector<size_t>& wellPathCells, std::vector<WellSegmentLocation>* locations);
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell);
static double calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex, size_t volumeScaleConstant = 1, QString directionForVolumeScaling = "DX");
private: private:
static void exportCompletions(const std::vector<RimWellPath*>& wellPaths, const std::vector<RimEclipseWell*>& simWells, const RicExportCompletionDataSettingsUi& exportSettings); static void exportCompletions(const std::vector<RimWellPath*>& wellPaths, const std::vector<RimEclipseWell*>& simWells, const RicExportCompletionDataSettingsUi& exportSettings);
static void generateCompdatTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData); static void generateCompdatTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
static void generateWpimultTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData); static void generateWpimultTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
static std::vector<RigCompletionData> generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings);
static std::vector<RigCompletionData> generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings);
static std::vector<RigCompletionData> generatePerforationsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); static std::vector<RigCompletionData> generatePerforationsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings);
static std::vector<size_t> findIntersectingCells(const RigEclipseCaseData* grid, const std::vector<cvf::Vec3d>& coords);
static void markWellPathCells(const std::vector<size_t>& wellPathCells, std::vector<WellSegmentLocation>* locations);
static bool wellSegmentLocationOrdering(const WellSegmentLocation& first, const WellSegmentLocation& second); static bool wellSegmentLocationOrdering(const WellSegmentLocation& first, const WellSegmentLocation& second);
static bool isPointBetween(const cvf::Vec3d& pointA, const cvf::Vec3d& pointB, const cvf::Vec3d& needle); static bool isPointBetween(const cvf::Vec3d& pointA, const cvf::Vec3d& pointB, const cvf::Vec3d& needle);
static void calculateLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum); static void calculateLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum);
@ -153,7 +154,5 @@ private:
static void appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data); static void appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data);
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell);
static double calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex);
}; };

View File

@ -112,7 +112,7 @@ void RicNewWellPathIntersectionFeatureCmd::redo()
CVF_ASSERT(m_wellPath); CVF_ASSERT(m_wellPath);
RimIntersection* intersection = new RimIntersection(); RimIntersection* intersection = new RimIntersection();
intersection->name = m_wellPath->name; intersection->name = m_wellPath->name();
intersection->type = RimIntersection::CS_WELL_PATH; intersection->type = RimIntersection::CS_WELL_PATH;
intersection->wellPath = m_wellPath; intersection->wellPath = m_wellPath;

View File

@ -1,3 +1,21 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2013- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
//
// 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 "RicBoxManipulatorEventHandler.h" #include "RicBoxManipulatorEventHandler.h"

View File

@ -1,3 +1,21 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2013- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
//
// 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 #pragma once

View File

@ -70,7 +70,7 @@ bool RicWellPathViewerEventHandler::handleEvent(cvf::Object* eventObject)
cvf::Vec3d trueVerticalDepth = wellPathSourceInfo->trueVerticalDepth(uiEvent->firstPartTriangleIndex, domainCoord); cvf::Vec3d trueVerticalDepth = wellPathSourceInfo->trueVerticalDepth(uiEvent->firstPartTriangleIndex, domainCoord);
QString wellPathText; QString wellPathText;
wellPathText += QString("Well path name : %1\n").arg(wellPathSourceInfo->wellPath()->name); wellPathText += QString("Well path name : %1\n").arg(wellPathSourceInfo->wellPath()->name());
wellPathText += QString("Measured depth : %1\n").arg(measuredDepth); wellPathText += QString("Measured depth : %1\n").arg(measuredDepth);
QString formattedText; QString formattedText;

View File

@ -1,3 +1,22 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 #pragma once
enum RigFemResultPosEnum { enum RigFemResultPosEnum {

View File

@ -1,3 +1,21 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RivFemPartGeometryGenerator.h" #include "RivFemPartGeometryGenerator.h"

View File

@ -1,3 +1,21 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 #pragma once
@ -18,6 +36,11 @@ class ScalarMapper;
class RigFemPartScalarDataAccess; class RigFemPartScalarDataAccess;
//==================================================================================================
//
//
//
//==================================================================================================
class RivFemPartTriangleToElmMapper : public cvf::Object class RivFemPartTriangleToElmMapper : public cvf::Object
{ {
public: public:

View File

@ -1,3 +1,22 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RivGeoMechPartMgrCache.h" #include "RivGeoMechPartMgrCache.h"
#include "RivGeoMechPartMgr.h" #include "RivGeoMechPartMgr.h"

View File

@ -1,9 +1,32 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 #pragma once
#include <cstddef>
#include "cvfObject.h"
#include <map>
#include "RivCellSetEnum.h" #include "RivCellSetEnum.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include <cstddef>
#include <map>
class RivGeoMechPartMgr; class RivGeoMechPartMgr;
class RivGeoMechPartMgrGeneratorInterface; class RivGeoMechPartMgrGeneratorInterface;

View File

@ -23,6 +23,8 @@ ${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h ${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h ${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h
${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h ${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivCompletionTypeResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivDefaultResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivTernaryResultToTextureMapper.h ${CEE_CURRENT_LIST_DIR}RivTernaryResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.h ${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.h
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper.h ${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper.h

View File

@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// 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 "RivResultToTextureMapper.h"
#include "RigPipeInCellEvaluator.h"
#include "cvfVector2.h"
#include "cvfScalarMapper.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfStructGrid.h"
#include <cmath>
class RivCompletionTypeResultToTextureMapper : public RivResultToTextureMapper
{
public:
using RivResultToTextureMapper::RivResultToTextureMapper;
cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const
{
cvf::Vec2f texCoord(0, 0);
if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's
{
if (m_pipeInCellEvaluator->isWellPipeInCell(cellIndex))
{
texCoord[1] = 0.5f;
}
else
{
texCoord[1] = 1.0f;
}
return texCoord;
}
texCoord = m_scalarMapper->mapToTextureCoord(resultValue);
texCoord[1] = 0.5f;
return texCoord;
}
};

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// 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 "RigPipeInCellEvaluator.h"
#include "RivResultToTextureMapper.h"
#include "cvfVector2.h"
#include "cvfScalarMapper.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfStructGrid.h"
#include <cmath>
class RivDefaultResultToTextureMapper : public RivResultToTextureMapper
{
public:
using RivResultToTextureMapper::RivResultToTextureMapper;
cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const
{
cvf::Vec2f texCoord(0,0);
if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's
{
texCoord[1] = 1.0f;
return texCoord;
}
texCoord = m_scalarMapper->mapToTextureCoord(resultValue);
if (!m_pipeInCellEvaluator->isWellPipeInCell(cellIndex))
{
texCoord[1] = 0; // Set the Y texture coordinate to the opaque line in the texture
}
return texCoord;
}
};

View File

@ -44,6 +44,7 @@
#include "RivTernaryScalarMapperEffectGenerator.h" #include "RivTernaryScalarMapperEffectGenerator.h"
#include "RivTernaryTextureCoordsCreator.h" #include "RivTernaryTextureCoordsCreator.h"
#include "RivTextureCoordsCreator.h" #include "RivTextureCoordsCreator.h"
#include "RivCompletionTypeResultToTextureMapper.h"
#include "cafEffectGenerator.h" #include "cafEffectGenerator.h"
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
@ -260,18 +261,17 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
return; return;
} }
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
if (cellResultColors->isCompletionTypeSelected()) if (cellResultColors->isCompletionTypeSelected())
{ {
cvf::Vec2fArray& surfaceCoords = *m_surfaceFacesTextureCoords.p(); cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = RivTextureCoordsCreator::createPipeInCellEvaluator(cellResultColors, timeStepIndex, m_grid->gridIndex());
for (cvf::Vec2f& vec : surfaceCoords) const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
{
vec[1] = 0.5; texturer.setResultToTextureMapper(new RivCompletionTypeResultToTextureMapper(mapper, pipeInCellEval.p()));
}
m_opacityLevel = 0.5; m_opacityLevel = 0.5;
} }
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(), RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(),
m_surfaceFacesTextureCoords.p(), m_surfaceFacesTextureCoords.p(),

View File

@ -32,32 +32,14 @@
class RivResultToTextureMapper : public cvf::Object class RivResultToTextureMapper : public cvf::Object
{ {
public: public:
RivResultToTextureMapper(const cvf::ScalarMapper* scalarMapper, explicit RivResultToTextureMapper(const cvf::ScalarMapper* scalarMapper,
const RigPipeInCellEvaluator* pipeInCellEvaluator) const RigPipeInCellEvaluator* pipeInCellEvaluator)
: m_scalarMapper(scalarMapper), m_pipeInCellEvaluator(pipeInCellEvaluator) : m_scalarMapper(scalarMapper), m_pipeInCellEvaluator(pipeInCellEvaluator)
{} {}
cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const virtual cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const = 0;
{
cvf::Vec2f texCoord(0,0);
if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's protected:
{
texCoord[1] = 1.0f;
return texCoord;
}
texCoord = m_scalarMapper->mapToTextureCoord(resultValue);
if (!m_pipeInCellEvaluator->isWellPipeInCell(cellIndex))
{
texCoord[1] = 0; // Set the Y texture coordinate to the opaque line in the texture
}
return texCoord;
}
private:
cvf::cref<cvf::ScalarMapper> m_scalarMapper; cvf::cref<cvf::ScalarMapper> m_scalarMapper;
cvf::cref<RigPipeInCellEvaluator> m_pipeInCellEvaluator; cvf::cref<RigPipeInCellEvaluator> m_pipeInCellEvaluator;
}; };

View File

@ -31,6 +31,7 @@
#include "RimLegendConfig.h" #include "RimLegendConfig.h"
#include "RivResultToTextureMapper.h" #include "RivResultToTextureMapper.h"
#include "RivDefaultResultToTextureMapper.h"
#include "cvfStructGridGeometryGenerator.h" #include "cvfStructGridGeometryGenerator.h"
@ -47,13 +48,11 @@ RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResul
m_resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, cellResultColors); m_resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, cellResultColors);
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = createPipeInCellEvaluator(cellResultColors, timeStepIndex, gridIndex);
new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStepIndex),
eclipseCase->gridCellToResultWellIndex(gridIndex));
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
m_texMapper = new RivResultToTextureMapper(mapper, pipeInCellEval.p()); m_texMapper = new RivDefaultResultToTextureMapper(mapper, pipeInCellEval.p());
CVF_ASSERT(m_texMapper.notNull()); CVF_ASSERT(m_texMapper.notNull());
} }
@ -78,6 +77,23 @@ void RivTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* quadTextureCo
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p()); createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTextureCoordsCreator::setResultToTextureMapper(RivResultToTextureMapper* textureMapper)
{
m_texMapper = textureMapper;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigPipeInCellEvaluator * RivTextureCoordsCreator::createPipeInCellEvaluator(RimEclipseCellColors* cellColors, size_t timeStep, size_t gridIndex)
{
return new RigPipeInCellEvaluator(cellColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStep),
cellColors->reservoirView()->eclipseCase()->eclipseCaseData()->gridCellToResultWellIndex(gridIndex));
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -26,6 +26,7 @@
class RimEclipseCellColors; class RimEclipseCellColors;
class RigResultAccessor; class RigResultAccessor;
class RivResultToTextureMapper; class RivResultToTextureMapper;
class RigPipeInCellEvaluator;
namespace cvf namespace cvf
{ {
@ -44,6 +45,9 @@ public:
bool isValid(); bool isValid();
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords); void createTextureCoords(cvf::Vec2fArray* quadTextureCoords);
void setResultToTextureMapper(RivResultToTextureMapper* textureMapper);
static RigPipeInCellEvaluator* createPipeInCellEvaluator(RimEclipseCellColors* cellColors, size_t timeStep, size_t gridIndex);
private: private:

View File

@ -45,6 +45,8 @@ RimWellPathCompletions::RimWellPathCompletions()
CAF_PDM_InitFieldNoDefault(&m_fractureCollection, "Fractures", "Fractures", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_fractureCollection, "Fractures", "Fractures", "", "", "");
m_fractureCollection = new RimWellPathFractureCollection; m_fractureCollection = new RimWellPathFractureCollection;
m_fractureCollection.uiCapability()->setUiHidden(true); m_fractureCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_wellNameForExport, "WellNameForExport", QString(), "Well Name for Completion Export", "", "", "");
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -67,6 +69,22 @@ RimPerforationCollection* RimWellPathCompletions::perforationCollection() const
return m_perforationCollection; return m_perforationCollection;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::setWellNameForExport(const QString& name)
{
m_wellNameForExport = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellNameForExport() const
{
return m_wellNameForExport();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -19,6 +19,7 @@
#pragma once #pragma once
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cafPdmChildField.h" #include "cafPdmChildField.h"
class RimFishbonesCollection; class RimFishbonesCollection;
@ -40,8 +41,13 @@ public:
RimPerforationCollection* perforationCollection() const; RimPerforationCollection* perforationCollection() const;
RimWellPathFractureCollection* fractureCollection() const; RimWellPathFractureCollection* fractureCollection() const;
void setWellNameForExport(const QString& name);
QString wellNameForExport() const;
private: private:
caf::PdmChildField<RimFishbonesCollection*> m_fishbonesCollection; caf::PdmChildField<RimFishbonesCollection*> m_fishbonesCollection;
caf::PdmChildField<RimPerforationCollection*> m_perforationCollection; caf::PdmChildField<RimPerforationCollection*> m_perforationCollection;
caf::PdmChildField<RimWellPathFractureCollection*> m_fractureCollection; caf::PdmChildField<RimWellPathFractureCollection*> m_fractureCollection;
caf::PdmField<QString> m_wellNameForExport;
}; };

View File

@ -1,4 +1,23 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimTreeViewStateSerializer.h" #include "RimTreeViewStateSerializer.h"
#include <QTreeView> #include <QTreeView>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -125,5 +144,3 @@ void RimTreeViewStateSerializer::encodeStringFromModelIndex(const QModelIndex mi
} }
} }

View File

@ -1,3 +1,21 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include <QModelIndex> #include <QModelIndex>

View File

@ -1,3 +1,22 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimView.h" #include "RimView.h"
#include "RiaApplication.h" #include "RiaApplication.h"

View File

@ -148,7 +148,7 @@ bool RimWellLogFile::readFile(QString* errorMessage)
{ {
if (wellPath->filepath().isEmpty()) if (wellPath->filepath().isEmpty())
{ {
wellPath->name = m_wellName; wellPath->setName(m_wellName);
} }
} }

View File

@ -57,11 +57,11 @@ RimWellPath::RimWellPath()
{ {
CAF_PDM_InitObject("WellPath", ":/Well.png", "", ""); CAF_PDM_InitObject("WellPath", ":/Well.png", "", "");
CAF_PDM_InitFieldNoDefault(&name, "WellPathName", "Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_name, "WellPathName", "Name", "", "", "");
name.uiCapability()->setUiReadOnly(true); m_name.uiCapability()->setUiReadOnly(true);
name.xmlCapability()->setIOWritable(false); m_name.xmlCapability()->setIOWritable(false);
name.xmlCapability()->setIOReadable(false); m_name.xmlCapability()->setIOReadable(false);
name.uiCapability()->setUiHidden(true); m_name.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&id, "WellPathId", "Id", "", "", ""); CAF_PDM_InitFieldNoDefault(&id, "WellPathId", "Id", "", "", "");
id.uiCapability()->setUiReadOnly(true); id.uiCapability()->setUiReadOnly(true);
id.xmlCapability()->setIOWritable(false); id.xmlCapability()->setIOWritable(false);
@ -150,7 +150,7 @@ RimWellPath::~RimWellPath()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellPath::userDescriptionField() caf::PdmFieldHandle* RimWellPath::userDescriptionField()
{ {
return &name; return &m_name;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -205,6 +205,14 @@ const RimPerforationCollection* RimWellPath::perforationIntervalCollection() con
return m_completions->perforationCollection(); return m_completions->perforationCollection();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPathCompletions* RimWellPath::completions() const
{
return m_completions();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -265,6 +273,23 @@ void RimWellPath::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPath::name() const
{
return m_name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::setName(const QString& name)
{
m_name = name;
m_completions->setWellNameForExport(name);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -284,7 +309,7 @@ bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathImporter* w
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData(filepath(), wellPathIndexInFile()); RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData(filepath(), wellPathIndexInFile());
// General well info // General well info
name = wellData.m_name; setName(wellData.m_name);
id = wellMetaData.m_id; id = wellMetaData.m_id;
sourceSystem = wellMetaData.m_sourceSystem; sourceSystem = wellMetaData.m_sourceSystem;
utmZone = wellMetaData.m_utmZone; utmZone = wellMetaData.m_utmZone;
@ -488,5 +513,5 @@ void RimWellPath::setLogFileInfo(RimWellLogFile* logFileInfo)
m_wellLogFile = logFileInfo; m_wellLogFile = logFileInfo;
m_wellLogFile->uiCapability()->setUiHidden(true); m_wellLogFile->uiCapability()->setUiHidden(true);
this->name = m_wellLogFile->wellName(); setName(m_wellLogFile->wellName());
} }

View File

@ -66,7 +66,8 @@ public:
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ); virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
caf::PdmField<QString> name; QString name() const;
void setName(const QString& name);
caf::PdmField<QString> filepath; caf::PdmField<QString> filepath;
caf::PdmField<int> wellPathIndexInFile; // -1 means none. caf::PdmField<int> wellPathIndexInFile; // -1 means none.
@ -83,6 +84,7 @@ public:
const RimFishbonesCollection* fishbonesCollection() const; const RimFishbonesCollection* fishbonesCollection() const;
RimPerforationCollection* perforationIntervalCollection(); RimPerforationCollection* perforationIntervalCollection();
const RimPerforationCollection* perforationIntervalCollection() const; const RimPerforationCollection* perforationIntervalCollection() const;
const RimWellPathCompletions* completions() const;
RimWellPathFractureCollection* fractureCollection(); RimWellPathFractureCollection* fractureCollection();
RigWellPath* wellPathGeometry(); RigWellPath* wellPathGeometry();
@ -127,5 +129,5 @@ private:
cvf::ref<RigWellPath> m_wellPath; cvf::ref<RigWellPath> m_wellPath;
cvf::ref<RivWellPathPartMgr> m_wellPathPartMgr; cvf::ref<RivWellPathPartMgr> m_wellPathPartMgr;
caf::PdmField<QString> m_name;
}; };

View File

@ -159,7 +159,7 @@ void RimWellPathCollection::readWellPathFiles()
} }
} }
progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name)); progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name()));
progress.incrementProgress(); progress.incrementProgress();
} }
@ -248,10 +248,10 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellP
RimWellPath* wellPath = wellPathArray[wpIdx]; RimWellPath* wellPath = wellPathArray[wpIdx];
wellPath->readWellPathFile(NULL, m_wellPathImporter); wellPath->readWellPathFile(NULL, m_wellPathImporter);
progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name)); progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name()));
// If a well path with this name exists already, make it read the well path file // If a well path with this name exists already, make it read the well path file
RimWellPath* existingWellPath = wellPathByName(wellPath->name); RimWellPath* existingWellPath = wellPathByName(wellPath->name());
if (existingWellPath) if (existingWellPath)
{ {
existingWellPath->filepath = wellPath->filepath; existingWellPath->filepath = wellPath->filepath;

View File

@ -51,6 +51,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h
${CEE_CURRENT_LIST_DIR}RigEclipseToStimPlanCellTransmissibilityCalculator.h ${CEE_CURRENT_LIST_DIR}RigEclipseToStimPlanCellTransmissibilityCalculator.h
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h
${CEE_CURRENT_LIST_DIR}RigWellLogExtractionTools.h ${CEE_CURRENT_LIST_DIR}RigWellLogExtractionTools.h
${CEE_CURRENT_LIST_DIR}RigHexIntersectionTools.h
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h ${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.h ${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.h
@ -111,6 +112,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseNativeVisibleCellsStatCalc.cpp
${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp
${CEE_CURRENT_LIST_DIR}RigEclipseToStimPlanCellTransmissibilityCalculator.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseToStimPlanCellTransmissibilityCalculator.cpp
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp
${CEE_CURRENT_LIST_DIR}RigHexIntersectionTools.cpp
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp ${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.cpp ${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.cpp

View File

@ -85,7 +85,7 @@ void RigEclipseWellLogExtractor::calculateIntersection()
hexCorners[7] = nodeCoords[cornerIndices[7]]; hexCorners[7] = nodeCoords[cornerIndices[7]];
//int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[cIdx], &intersections); //int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[cIdx], &intersections);
RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[cIdx], &intersections); RigHexIntersectionTools::lineHexCellIntersection(p1, p2, hexCorners, closeCells[cIdx], &intersections);
} }
if (!isCellFaceNormalsOut) if (!isCellFaceNormalsOut)

View File

@ -1,3 +1,20 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once

View File

@ -28,6 +28,7 @@
#include "RigWellLogExtractionTools.h" #include "RigWellLogExtractionTools.h"
#include "RigWellPath.h" #include "RigWellPath.h"
#include "cvfGeometryTools.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -155,7 +156,7 @@ void RigGeoMechWellLogExtractor::calculateIntersection()
hexCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]); hexCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]);
//int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx], &intersections); //int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx], &intersections);
RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx], &intersections); RigHexIntersectionTools::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx], &intersections);
} }
// Now, with all the intersections of this piece of line, we need to // Now, with all the intersections of this piece of line, we need to

View File

@ -0,0 +1,91 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigHexIntersectionTools.h"
#include "cvfBoundingBox.h"
#include "cvfGeometryTools.h"
#include "cvfRay.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RigHexIntersectionTools::lineHexCellIntersection(const cvf::Vec3d p1, const cvf::Vec3d p2, const cvf::Vec3d hexCorners[8], const size_t hexIndex, std::vector<HexIntersectionInfo>* intersections)
{
CVF_ASSERT(intersections != NULL);
int intersectionCount = 0;
for ( int face = 0; face < 6 ; ++face )
{
cvf::ubyte faceVertexIndices[4];
cvf::StructGridInterface::cellFaceVertexIndices(static_cast<cvf::StructGridInterface::FaceType>(face), faceVertexIndices);
cvf::Vec3d intersection;
bool isEntering = false;
cvf::Vec3d faceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]);
for ( int i = 0; i < 4; ++i )
{
int next = i < 3 ? i+1 : 0;
int intsStatus = cvf::GeometryTools::intersectLineSegmentTriangle(p1, p2,
hexCorners[faceVertexIndices[i]],
hexCorners[faceVertexIndices[next]],
faceCenter,
&intersection,
&isEntering);
if ( intsStatus == 1 )
{
intersectionCount++;
intersections->push_back(HexIntersectionInfo(intersection,
isEntering,
static_cast<cvf::StructGridInterface::FaceType>(face), hexIndex));
}
}
}
return intersectionCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigHexIntersectionTools::isPointInCell(const cvf::Vec3d point, const cvf::Vec3d hexCorners[8])
{
cvf::Ray ray;
ray.setOrigin(point);
size_t intersections = 0;
for ( int face = 0; face < 6; ++face )
{
cvf::ubyte faceVertexIndices[4];
cvf::StructGridInterface::cellFaceVertexIndices(static_cast<cvf::StructGridInterface::FaceType>(face), faceVertexIndices);
cvf::Vec3d faceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]);
for ( int i = 0; i < 4; ++i )
{
int next = i < 3 ? i + 1 : 0;
if ( ray.triangleIntersect(hexCorners[faceVertexIndices[i]], hexCorners[faceVertexIndices[next]], faceCenter) )
{
++intersections;
}
}
}
return intersections % 2 == 1;
}

View File

@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfVector3.h"
#include "cvfStructGrid.h"
//==================================================================================================
/// Internal class for intersection point info
//==================================================================================================
struct HexIntersectionInfo
{
public:
HexIntersectionInfo( cvf::Vec3d intersectionPoint,
bool isIntersectionEntering,
cvf::StructGridInterface::FaceType face,
size_t hexIndex)
: m_intersectionPoint(intersectionPoint),
m_isIntersectionEntering(isIntersectionEntering),
m_face(face),
m_hexIndex(hexIndex) {}
cvf::Vec3d m_intersectionPoint;
bool m_isIntersectionEntering;
cvf::StructGridInterface::FaceType m_face;
size_t m_hexIndex;
};
//--------------------------------------------------------------------------------------------------
/// Specialized Line - Hex intersection
//--------------------------------------------------------------------------------------------------
struct RigHexIntersectionTools
{
static int lineHexCellIntersection(const cvf::Vec3d p1,
const cvf::Vec3d p2,
const cvf::Vec3d hexCorners[8],
const size_t hexIndex,
std::vector<HexIntersectionInfo>* intersections);
static bool isPointInCell(const cvf::Vec3d point, const cvf::Vec3d hexCorners[8]);
};

View File

@ -18,103 +18,15 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include "cvfBoundingBox.h" #include <cmath>
#include "cvfGeometryTools.h"
#include "cvfStructGrid.h"
#include "cvfRay.h"
//================================================================================================== //==================================================================================================
/// Internal class for intersection point info ///
///
//================================================================================================== //==================================================================================================
struct HexIntersectionInfo struct RigWellLogExtractionTools
{ {
public:
HexIntersectionInfo( cvf::Vec3d intersectionPoint,
bool isIntersectionEntering,
cvf::StructGridInterface::FaceType face,
size_t hexIndex)
: m_intersectionPoint(intersectionPoint),
m_isIntersectionEntering(isIntersectionEntering),
m_face(face),
m_hexIndex(hexIndex) {}
cvf::Vec3d m_intersectionPoint;
bool m_isIntersectionEntering;
cvf::StructGridInterface::FaceType m_face;
size_t m_hexIndex;
};
//--------------------------------------------------------------------------------------------------
/// Specialized Line - Hex intersection
//--------------------------------------------------------------------------------------------------
struct RigHexIntersector
{
static int lineHexCellIntersection(const cvf::Vec3d p1, const cvf::Vec3d p2, const cvf::Vec3d hexCorners[8], const size_t hexIndex,
std::vector<HexIntersectionInfo>* intersections)
{
CVF_ASSERT(intersections != NULL);
int intersectionCount = 0;
for (int face = 0; face < 6 ; ++face)
{
cvf::ubyte faceVertexIndices[4];
cvf::StructGridInterface::cellFaceVertexIndices(static_cast<cvf::StructGridInterface::FaceType>(face), faceVertexIndices);
cvf::Vec3d intersection;
bool isEntering = false;
cvf::Vec3d faceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]);
for (int i = 0; i < 4; ++i)
{
int next = i < 3 ? i+1 : 0;
int intsStatus = cvf::GeometryTools::intersectLineSegmentTriangle(p1, p2,
hexCorners[faceVertexIndices[i]],
hexCorners[faceVertexIndices[next]],
faceCenter,
&intersection,
&isEntering);
if (intsStatus == 1)
{
intersectionCount++;
intersections->push_back(HexIntersectionInfo(intersection,
isEntering,
static_cast<cvf::StructGridInterface::FaceType>(face), hexIndex));
}
}
}
return intersectionCount;
}
static bool isPointInCell(const cvf::Vec3d point, const cvf::Vec3d hexCorners[8])
{
cvf::Ray ray;
ray.setOrigin(point);
size_t intersections = 0;
for (int face = 0; face < 6; ++face)
{
cvf::ubyte faceVertexIndices[4];
cvf::StructGridInterface::cellFaceVertexIndices(static_cast<cvf::StructGridInterface::FaceType>(face), faceVertexIndices);
cvf::Vec3d faceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]);
for (int i = 0; i < 4; ++i)
{
int next = i < 3 ? i + 1 : 0;
if (ray.triangleIntersect(hexCorners[faceVertexIndices[i]], hexCorners[faceVertexIndices[next]], faceCenter))
{
++intersections;
}
}
}
return intersections % 2 == 1;
}
static bool isEqualDepth(double d1, double d2) static bool isEqualDepth(double d1, double d2)
{ {
double depthDiff = d1 - d2; double depthDiff = d1 - d2;
@ -142,7 +54,7 @@ struct RigMDCellIdxEnterLeaveKey
bool operator < (const RigMDCellIdxEnterLeaveKey& other) const bool operator < (const RigMDCellIdxEnterLeaveKey& other) const
{ {
if (RigHexIntersector::isEqualDepth(measuredDepth, other.measuredDepth)) if (RigWellLogExtractionTools::isEqualDepth(measuredDepth, other.measuredDepth))
{ {
if (hexIndex == other.hexIndex) if (hexIndex == other.hexIndex)
{ {
@ -182,7 +94,7 @@ struct RigMDEnterLeaveCellIdxKey
bool operator < (const RigMDEnterLeaveCellIdxKey& other) const bool operator < (const RigMDEnterLeaveCellIdxKey& other) const
{ {
if (RigHexIntersector::isEqualDepth(measuredDepth, other.measuredDepth)) if (RigWellLogExtractionTools::isEqualDepth(measuredDepth, other.measuredDepth))
{ {
if (isEnteringCell == other.isEnteringCell) if (isEnteringCell == other.isEnteringCell)
{ {
@ -207,7 +119,7 @@ struct RigMDEnterLeaveCellIdxKey
{ {
return ( key1.hexIndex == key2.hexIndex return ( key1.hexIndex == key2.hexIndex
&& key1.isEnteringCell && key2.isLeavingCell() && key1.isEnteringCell && key2.isLeavingCell()
&& !RigHexIntersector::isEqualDepth(key1.measuredDepth, key2.measuredDepth)); && !RigWellLogExtractionTools::isEqualDepth(key1.measuredDepth, key2.measuredDepth));
} }
}; };

View File

@ -85,7 +85,7 @@ void RigWellLogExtractor::populateReturnArrays(std::map<RigMDCellIdxEnterLeaveKe
++it2; ++it2;
if (it2 != uniqueIntersections.end()) if (it2 != uniqueIntersections.end())
{ {
if (RigHexIntersector::isEqualDepth(it1->first.measuredDepth, it2->first.measuredDepth)) if (RigWellLogExtractionTools::isEqualDepth(it1->first.measuredDepth, it2->first.measuredDepth))
{ {
if (it1->first.hexIndex == it2->first.hexIndex) if (it1->first.hexIndex == it2->first.hexIndex)
{ {

View File

@ -25,9 +25,12 @@
#include "cvfVector3.h" #include "cvfVector3.h"
#include <vector> #include <vector>
#include <map>
#include "cvfStructGrid.h" #include "cvfStructGrid.h"
#include "RigWellLogExtractionTools.h" #include "RigWellLogExtractionTools.h"
#include "RigHexIntersectionTools.h"
class RigWellPath; class RigWellPath;

View File

@ -32,14 +32,14 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector<cvf::Vec3d>& coords, bool includeStartCell, bool includeEndCell) std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector<cvf::Vec3d>& pathCoords)
{ {
std::vector<WellPathCellIntersectionInfo> intersectionInfo; std::vector<WellPathCellIntersectionInfo> intersectionInfo;
const RigMainGrid* grid = caseData->mainGrid(); const RigMainGrid* grid = caseData->mainGrid();
if (coords.size() < 2) return intersectionInfo; if (pathCoords.size() < 2) return intersectionInfo;
std::vector<HexIntersectionInfo> intersections = getIntersectedCells(grid, coords); std::vector<HexIntersectionInfo> intersections = getIntersectedCells(grid, pathCoords);
removeEnteringIntersections(&intersections); removeEnteringIntersections(&intersections);
if (intersections.empty()) return intersectionInfo; if (intersections.empty()) return intersectionInfo;
@ -51,10 +51,9 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
auto intersection = intersections.cbegin(); auto intersection = intersections.cbegin();
if (includeStartCell) //start cell
{
bool foundCell; bool foundCell;
startPoint = coords[0]; startPoint = pathCoords[0];
cellIndex = findCellFromCoords(grid, startPoint, &foundCell); cellIndex = findCellFromCoords(grid, startPoint, &foundCell);
if (foundCell) if (foundCell)
{ {
@ -66,8 +65,8 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
{ {
RiaLogging::debug("Path starts outside valid cell"); RiaLogging::debug("Path starts outside valid cell");
} }
}
//center cells
startPoint = intersection->m_intersectionPoint; startPoint = intersection->m_intersectionPoint;
cellIndex = intersection->m_hexIndex; cellIndex = intersection->m_hexIndex;
@ -84,12 +83,10 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
++intersection; ++intersection;
} }
if (includeEndCell) //end cell
{ endPoint = pathCoords[pathCoords.size() - 1];
endPoint = coords[coords.size() - 1];
internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint); internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint);
intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths)); intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths));
}
return intersectionInfo; return intersectionInfo;
} }
@ -118,7 +115,7 @@ std::vector<HexIntersectionInfo> RigWellPathIntersectionTools::getIntersectedCel
grid->cellCornerVertices(closeCell, hexCorners.data()); grid->cellCornerVertices(closeCell, hexCorners.data());
RigHexIntersector::lineHexCellIntersection(coords[i], coords[i + 1], hexCorners.data(), closeCell, &intersections); RigHexIntersectionTools::lineHexCellIntersection(coords[i], coords[i + 1], hexCorners.data(), closeCell, &intersections);
} }
} }
@ -184,7 +181,7 @@ size_t RigWellPathIntersectionTools::findCellFromCoords(const RigMainGrid* grid,
grid->cellCornerVertices(closeCell, hexCorners.data()); grid->cellCornerVertices(closeCell, hexCorners.data());
if (RigHexIntersector::isPointInCell(coords, hexCorners.data())) if (RigHexIntersectionTools::isPointInCell(coords, hexCorners.data()))
{ {
*foundCell = true; *foundCell = true;
return closeCell; return closeCell;

View File

@ -20,7 +20,7 @@
#include "RigCell.h" #include "RigCell.h"
#include "RigWellLogExtractionTools.h" #include "RigHexIntersectionTools.h"
#include "cvfVector3.h" #include "cvfVector3.h"
@ -44,7 +44,7 @@ struct WellPathCellIntersectionInfo {
size_t cellIndex; size_t cellIndex;
cvf::Vec3d startPoint; cvf::Vec3d startPoint;
cvf::Vec3d endPoint; cvf::Vec3d endPoint;
cvf::Vec3d internalCellLengths; cvf::Vec3d internalCellLengths; // intersectionLengthsInCellCS
}; };
//================================================================================================== //==================================================================================================
@ -53,7 +53,7 @@ struct WellPathCellIntersectionInfo {
class RigWellPathIntersectionTools class RigWellPathIntersectionTools
{ {
public: public:
static std::vector<WellPathCellIntersectionInfo> findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector<cvf::Vec3d>& coords, bool includeStartCell = true, bool includeEndCell = true); static std::vector<WellPathCellIntersectionInfo> findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector<cvf::Vec3d>& pathCoords);
static std::vector<HexIntersectionInfo> getIntersectedCells(const RigMainGrid* grid, const std::vector<cvf::Vec3d>& coords); static std::vector<HexIntersectionInfo> getIntersectedCells(const RigMainGrid* grid, const std::vector<cvf::Vec3d>& coords);

View File

@ -1,3 +1,21 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuInterfaceToViewWindow.h" #include "RiuInterfaceToViewWindow.h"
#include <QWidget> #include <QWidget>

View File

@ -1,5 +1,27 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// 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 "RiuSimpleHistogramWidget.h" #include "RiuSimpleHistogramWidget.h"
#include <QPainter> #include <QPainter>
#include <cmath> #include <cmath>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,5 @@
This regexp will identify all files not starting with the character '/'
Useful to detect files with missing copyright header
^(?!/).*$