mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#404) Compute well segment index from triangle index
This commit is contained in:
parent
6d60088a5b
commit
622e49fe69
@ -1,6 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) 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
|
||||
@ -35,6 +37,7 @@ RivPipeGeometryGenerator::RivPipeGeometryGenerator()
|
||||
m_crossSectionNodeCount = 8;
|
||||
m_minimumBendAngle = 80.0;
|
||||
m_bendScalingFactor = 0.00001;
|
||||
m_firstSegmentIndex = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -582,3 +585,21 @@ void RivPipeGeometryGenerator::clearComputedData()
|
||||
m_filteredPipeSegmentToResult.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RivPipeGeometryGenerator::segmentIndexFromTriangleIndex(size_t triangleIndex) const
|
||||
{
|
||||
size_t filteredIndex = triangleIndex / (m_crossSectionNodeCount * 2);
|
||||
|
||||
return filteredIndex + m_firstSegmentIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Well pipes are clipped, set index to first segment in visible well path
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivPipeGeometryGenerator::setFirstSegmentIndex(size_t segmentIndex)
|
||||
{
|
||||
m_firstSegmentIndex = segmentIndex;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) 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
|
||||
@ -18,8 +20,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//class RivPipeQuadToSegmentMapper;
|
||||
|
||||
class RivPipeGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
@ -31,6 +31,7 @@ public:
|
||||
|
||||
// Pipe bends with a opening angle below given angle is modified with extra bend coordinates
|
||||
void setMinimumBendAngle(double degrees);
|
||||
|
||||
// Scaling factor used to control how far from original pipe position the extra bend coordinates are located
|
||||
// This will affect how sharp or smooth bend will appear
|
||||
void setBendScalingFactor(double scaleFactor);
|
||||
@ -46,6 +47,9 @@ public:
|
||||
void pipeSurfaceTextureCoords(cvf::Vec2fArray* textureCoords, const std::vector<double>& segmentResults, const cvf::ScalarMapper* mapper) const;
|
||||
void centerlineTextureCoords(cvf::Vec2fArray* textureCoords, const std::vector<double>& segmentResults, const cvf::ScalarMapper* mapper) const;
|
||||
|
||||
void setFirstSegmentIndex(size_t segmentIndex);
|
||||
size_t segmentIndexFromTriangleIndex(size_t triangleIndex) const;
|
||||
|
||||
private:
|
||||
void clearComputedData();
|
||||
void updateFilteredPipeCenterCoords();
|
||||
@ -72,8 +76,7 @@ private:
|
||||
// Map from generated cylinder segments to pipe result indices
|
||||
std::vector<size_t> m_filteredPipeSegmentToResult;
|
||||
|
||||
// TODO: implement
|
||||
//RivPipeQuadToSegmentMapper* m_quadToSegmentMapper;
|
||||
size_t m_firstSegmentIndex;
|
||||
|
||||
double m_radius;
|
||||
double m_minimumBendAngle;
|
||||
|
@ -114,13 +114,29 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
|
||||
cvf::ref<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray;
|
||||
if (wellPathCollection->wellPathClip)
|
||||
{
|
||||
std::vector<cvf::Vec3d> clippedPoints;
|
||||
size_t firstVisibleSegmentIndex = cvf::UNDEFINED_SIZE_T;
|
||||
for (size_t idx = 0; idx < wellPathGeometry->m_wellPathPoints.size(); idx++)
|
||||
{
|
||||
cvf::Vec3d point = wellPathGeometry->m_wellPathPoints[idx];
|
||||
if (point.z() < (wellPathClipBoundingBox.max().z() + wellPathCollection->wellPathClipZDistance))
|
||||
clippedPoints.push_back(point);
|
||||
{
|
||||
firstVisibleSegmentIndex = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<cvf::Vec3d> clippedPoints;
|
||||
|
||||
if (firstVisibleSegmentIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
for (size_t idx = firstVisibleSegmentIndex; idx < wellPathGeometry->m_wellPathPoints.size(); idx++)
|
||||
{
|
||||
clippedPoints.push_back(wellPathGeometry->m_wellPathPoints[idx]);
|
||||
}
|
||||
|
||||
pbd.m_pipeGeomGenerator->setFirstSegmentIndex(firstVisibleSegmentIndex);
|
||||
}
|
||||
|
||||
if (clippedPoints.size() < 2) return;
|
||||
|
||||
textPosition = clippedPoints[0];
|
||||
@ -274,3 +290,11 @@ void RivWellPathPartMgr::clearAllBranchData()
|
||||
m_pipeBranchData.m_centerLinePart = NULL;
|
||||
m_pipeBranchData.m_centerLineDrawable = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RivWellPathPartMgr::segmentIndexFromTriangleIndex(size_t triangleIndex)
|
||||
{
|
||||
return m_pipeBranchData.m_pipeGeomGenerator->segmentIndexFromTriangleIndex(triangleIndex);
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
|
||||
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
|
||||
|
||||
size_t segmentIndexFromTriangleIndex(size_t triangleIndex);
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimWellPath> m_rimWellPath;
|
||||
|
||||
@ -58,7 +60,6 @@ private:
|
||||
|
||||
void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
|
||||
void clearAllBranchData();
|
||||
|
||||
struct RivPipeBranchData
|
||||
{
|
||||
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
|
||||
|
Loading…
Reference in New Issue
Block a user