Refactor well path geometry export to ".dev" file.

The code to generate the geometry data is extracted for easier reuse, and
differences between exporting visible and selected well paths removed.
This commit is contained in:
Kristian Bendiksen
2020-09-04 13:46:53 +02:00
parent a2f6a28248
commit 0c275a6d9c
7 changed files with 181 additions and 81 deletions

View File

@@ -65,6 +65,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigFractureGrid.h
${CMAKE_CURRENT_LIST_DIR}/RigFractureCell.h
${CMAKE_CURRENT_LIST_DIR}/RigWellResultPoint.h
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools.h
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter.h
${CMAKE_CURRENT_LIST_DIR}/RigSurface.h
${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.h
${CMAKE_CURRENT_LIST_DIR}/RigGeoMechBoreHoleStressCalculator.h
@@ -143,6 +144,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigFractureGrid.cpp
${CMAKE_CURRENT_LIST_DIR}/RigFractureCell.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellResultPoint.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter.cpp
${CMAKE_CURRENT_LIST_DIR}/RigSurface.cpp
${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.cpp
${CMAKE_CURRENT_LIST_DIR}/RigGeoMechBoreHoleStressCalculator.cpp

View File

@@ -0,0 +1,88 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- 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 "RigWellPathGeometryExporter.h"
#include "RigWellPath.h"
#include "RimModeledWellPath.h"
#include "RimWellPath.h"
#include "RimWellPathGeometryDef.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPathGeometryExporter::exportWellPathGeometry( const RimWellPath* wellPath,
double mdStepSize,
std::vector<double>& xValues,
std::vector<double>& yValues,
std::vector<double>& tvdValues,
std::vector<double>& mdValues,
bool& useMdRkb )
{
auto wellPathGeom = wellPath->wellPathGeometry();
if ( !wellPathGeom ) return;
useMdRkb = false;
double rkbOffset = 0.0;
{
const RimModeledWellPath* modeledWellPath = dynamic_cast<const RimModeledWellPath*>( wellPath );
if ( modeledWellPath )
{
useMdRkb = true;
if ( modeledWellPath->geometryDefinition()->airGap() != 0.0 )
{
rkbOffset = modeledWellPath->geometryDefinition()->airGap();
}
else
{
rkbOffset = modeledWellPath->geometryDefinition()->mdAtFirstTarget();
}
}
}
exportWellPathGeometry( wellPathGeom, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPathGeometryExporter::exportWellPathGeometry( const RigWellPath* wellPathGeom,
double mdStepSize,
double rkbOffset,
std::vector<double>& xValues,
std::vector<double>& yValues,
std::vector<double>& tvdValues,
std::vector<double>& mdValues )
{
double currMd = wellPathGeom->measureDepths().front() - mdStepSize;
double endMd = wellPathGeom->measureDepths().back();
while ( currMd < endMd )
{
currMd += mdStepSize;
if ( currMd > endMd ) currMd = endMd;
auto pt = wellPathGeom->interpolatedPointAlongWellPath( currMd );
double tvd = -pt.z();
xValues.push_back( pt.x() );
yValues.push_back( pt.y() );
tvdValues.push_back( tvd );
mdValues.push_back( currMd + rkbOffset );
}
}

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor 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 <vector>
class RimWellPath;
class RigWellPath;
//==================================================================================================
///
//==================================================================================================
class RigWellPathGeometryExporter
{
public:
static void exportWellPathGeometry( const RimWellPath* wellPath,
double mdStepSize,
std::vector<double>& xValues,
std::vector<double>& yValues,
std::vector<double>& tvdValues,
std::vector<double>& mdValues,
bool& useMdRkb );
static void exportWellPathGeometry( const RigWellPath* wellPath,
double mdStepSize,
double rkbOffset,
std::vector<double>& xValues,
std::vector<double>& yValues,
std::vector<double>& tvdValues,
std::vector<double>& mdValues );
};