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
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -35,6 +37,7 @@ RivPipeGeometryGenerator::RivPipeGeometryGenerator()
|
|||||||
m_crossSectionNodeCount = 8;
|
m_crossSectionNodeCount = 8;
|
||||||
m_minimumBendAngle = 80.0;
|
m_minimumBendAngle = 80.0;
|
||||||
m_bendScalingFactor = 0.00001;
|
m_bendScalingFactor = 0.00001;
|
||||||
|
m_firstSegmentIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -582,3 +585,21 @@ void RivPipeGeometryGenerator::clearComputedData()
|
|||||||
m_filteredPipeSegmentToResult.clear();
|
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
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -18,8 +20,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//class RivPipeQuadToSegmentMapper;
|
|
||||||
|
|
||||||
class RivPipeGeometryGenerator : public cvf::Object
|
class RivPipeGeometryGenerator : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -31,6 +31,7 @@ public:
|
|||||||
|
|
||||||
// Pipe bends with a opening angle below given angle is modified with extra bend coordinates
|
// Pipe bends with a opening angle below given angle is modified with extra bend coordinates
|
||||||
void setMinimumBendAngle(double degrees);
|
void setMinimumBendAngle(double degrees);
|
||||||
|
|
||||||
// Scaling factor used to control how far from original pipe position the extra bend coordinates are located
|
// 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
|
// This will affect how sharp or smooth bend will appear
|
||||||
void setBendScalingFactor(double scaleFactor);
|
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 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 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:
|
private:
|
||||||
void clearComputedData();
|
void clearComputedData();
|
||||||
void updateFilteredPipeCenterCoords();
|
void updateFilteredPipeCenterCoords();
|
||||||
@ -72,8 +76,7 @@ private:
|
|||||||
// Map from generated cylinder segments to pipe result indices
|
// Map from generated cylinder segments to pipe result indices
|
||||||
std::vector<size_t> m_filteredPipeSegmentToResult;
|
std::vector<size_t> m_filteredPipeSegmentToResult;
|
||||||
|
|
||||||
// TODO: implement
|
size_t m_firstSegmentIndex;
|
||||||
//RivPipeQuadToSegmentMapper* m_quadToSegmentMapper;
|
|
||||||
|
|
||||||
double m_radius;
|
double m_radius;
|
||||||
double m_minimumBendAngle;
|
double m_minimumBendAngle;
|
||||||
|
@ -114,13 +114,29 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
|
|||||||
cvf::ref<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray;
|
cvf::ref<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray;
|
||||||
if (wellPathCollection->wellPathClip)
|
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++)
|
for (size_t idx = 0; idx < wellPathGeometry->m_wellPathPoints.size(); idx++)
|
||||||
{
|
{
|
||||||
cvf::Vec3d point = wellPathGeometry->m_wellPathPoints[idx];
|
cvf::Vec3d point = wellPathGeometry->m_wellPathPoints[idx];
|
||||||
if (point.z() < (wellPathClipBoundingBox.max().z() + wellPathCollection->wellPathClipZDistance))
|
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;
|
if (clippedPoints.size() < 2) return;
|
||||||
|
|
||||||
textPosition = clippedPoints[0];
|
textPosition = clippedPoints[0];
|
||||||
@ -274,3 +290,11 @@ void RivWellPathPartMgr::clearAllBranchData()
|
|||||||
m_pipeBranchData.m_centerLinePart = NULL;
|
m_pipeBranchData.m_centerLinePart = NULL;
|
||||||
m_pipeBranchData.m_centerLineDrawable = 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,
|
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
|
||||||
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
|
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
|
||||||
|
|
||||||
|
size_t segmentIndexFromTriangleIndex(size_t triangleIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPointer<RimWellPath> m_rimWellPath;
|
caf::PdmPointer<RimWellPath> m_rimWellPath;
|
||||||
|
|
||||||
@ -58,7 +60,6 @@ private:
|
|||||||
|
|
||||||
void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
|
void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
|
||||||
void clearAllBranchData();
|
void clearAllBranchData();
|
||||||
|
|
||||||
struct RivPipeBranchData
|
struct RivPipeBranchData
|
||||||
{
|
{
|
||||||
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
|
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
|
||||||
|
Loading…
Reference in New Issue
Block a user