#2600 Well CF Visualization: Make sure all connections are visualized

This commit is contained in:
Magne Sjaastad 2018-03-19 14:41:46 +01:00
parent 0e8dff00ca
commit 241bf0364c
6 changed files with 75 additions and 34 deletions

View File

@ -28,7 +28,7 @@
RivWellConnectionFactorGeometryGenerator::RivWellConnectionFactorGeometryGenerator(
std::vector<CompletionVizData>& centerColorPairs,
float radius)
: m_centerColorPairs(centerColorPairs)
: m_completionVizData(centerColorPairs)
, m_radius(radius)
, m_trianglesPerConnection(0)
{
@ -55,12 +55,12 @@ cvf::ref<cvf::DrawableGeo> RivWellConnectionFactorGeometryGenerator::createSurfa
cvf::ref<cvf::Vec3fArray> vertices = new cvf::Vec3fArray;
cvf::ref<cvf::UIntArray> indices = new cvf::UIntArray;
auto indexCount = m_centerColorPairs.size() * indicesForOneObject.size();
auto vertexCount = m_centerColorPairs.size() * verticesForOneObject.size();
auto indexCount = m_completionVizData.size() * indicesForOneObject.size();
auto vertexCount = m_completionVizData.size() * verticesForOneObject.size();
indices->reserve(indexCount);
vertices->reserve(vertexCount);
for (const auto& item : m_centerColorPairs)
for (const auto& item : m_completionVizData)
{
auto rotMatrix = rotationMatrixBetweenVectors(cvf::Vec3d::Y_AXIS, item.m_direction);
@ -88,16 +88,36 @@ cvf::ref<cvf::DrawableGeo> RivWellConnectionFactorGeometryGenerator::createSurfa
return drawable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RivWellConnectionFactorGeometryGenerator::connectionFactor(cvf::uint triangleIndex) const
{
size_t connectionIndex = mapFromTriangleToConnectionIndex(triangleIndex);
return m_completionVizData[connectionIndex].m_connectionFactor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RivWellConnectionFactorGeometryGenerator::globalCellIndexFromTriangleIndex(cvf::uint triangleIndex) const
{
size_t connectionIndex = mapFromTriangleToConnectionIndex(triangleIndex);
return m_completionVizData[connectionIndex].m_globalCellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RivWellConnectionFactorGeometryGenerator::mapFromTriangleToConnectionIndex(cvf::uint triangleIndex) const
{
if (m_trianglesPerConnection == 0) return 0;
size_t connectionIndex = triangleIndex / m_trianglesPerConnection;
return m_centerColorPairs[connectionIndex].m_globalCellIndex;
return connectionIndex;
}
//--------------------------------------------------------------------------------------------------

View File

@ -60,9 +60,11 @@ public:
cvf::ref<cvf::DrawableGeo> createSurfaceGeometry();
double connectionFactor(cvf::uint triangleIndex) const;
size_t globalCellIndexFromTriangleIndex(cvf::uint triangleIndex) const;
private:
size_t mapFromTriangleToConnectionIndex(cvf::uint triangleIndex) const;
static cvf::Mat4f rotationMatrixBetweenVectors(const cvf::Vec3d& v1, const cvf::Vec3d& v2);
static void
createStarGeometry(std::vector<cvf::Vec3f>* vertices, std::vector<cvf::uint>* indices, float radius, float thickness);
@ -73,7 +75,7 @@ private:
float thickness);
private:
std::vector<CompletionVizData> m_centerColorPairs;
std::vector<CompletionVizData> m_completionVizData;
float m_radius;
size_t m_trianglesPerConnection;
};

View File

@ -91,8 +91,6 @@ void RivWellConnectionFactorPartMgr::appendDynamicGeometryPartsToModel(cvf::Mode
}
}
std::vector<size_t> mapFromConnectionIndexToGlobalCellIndex;
std::vector<CompletionVizData> completionVizDataItems;
for (const auto& cell : conn)
{
@ -100,44 +98,53 @@ void RivWellConnectionFactorPartMgr::appendDynamicGeometryPartsToModel(cvf::Mode
const RigCell& rigCell = mainGrid->cell(gridIndex);
cvf::Vec3d locationInDomainCoord = rigCell.center();
cvf::Vec3d wellPathDirection = cvf::Vec3d::X_AXIS;
std::vector<std::pair<cvf::Vec3d, cvf::Vec3d>> locationAndDirection;
if (!wellPathCellIntersections.empty())
for (const auto& intersectionInfo : wellPathCellIntersections)
{
for (const auto& intersectionInfo : wellPathCellIntersections)
if (intersectionInfo.globCellIndex == cell.first.globalCellIndex())
{
if (intersectionInfo.globCellIndex == cell.first.globalCellIndex())
{
double startMD = intersectionInfo.startMD;
double endMD = intersectionInfo.endMD;
double startMD = intersectionInfo.startMD;
double endMD = intersectionInfo.endMD;
double middleMD = (startMD + endMD) / 2.0;
double middleMD = (startMD + endMD) / 2.0;
locationInDomainCoord = m_rimWell->wellPathGeometry()->interpolatedPointAlongWellPath(middleMD);
cvf::Vec3d defaultLocationInDomainCoord = m_rimWell->wellPathGeometry()->interpolatedPointAlongWellPath(middleMD);
cvf::Vec3d p1;
cvf::Vec3d p2;
m_rimWell->wellPathGeometry()->twoClosestPoints(locationInDomainCoord, &p1, &p2);
cvf::Vec3d p1;
cvf::Vec3d p2;
m_rimWell->wellPathGeometry()->twoClosestPoints(defaultLocationInDomainCoord, &p1, &p2);
wellPathDirection = (p2 - p1).getNormalized();
cvf::Vec3d defaultWellPathDirection = (p2 - p1).getNormalized();
continue;
}
locationAndDirection.push_back(std::make_pair(defaultLocationInDomainCoord, defaultWellPathDirection));
}
else if (!locationAndDirection.empty())
{
continue;
}
}
cvf::Vec3d displayCoord = coordTransform->transformToDisplayCoord(locationInDomainCoord);
double transmissibility = HUGE_VAL;
if (!cell.second.empty())
for (size_t i = 0; i < cell.second.size(); i++)
{
transmissibility = cell.second.front().transmissibility();
}
const RigCompletionData& completionData = cell.second[i];
completionVizDataItems.push_back(
CompletionVizData(displayCoord, wellPathDirection, transmissibility, cell.first.globalCellIndex()));
mapFromConnectionIndexToGlobalCellIndex.push_back(cell.first.globalCellIndex());
double transmissibility = completionData.transmissibility();
cvf::Vec3d locationInDomainCoord = rigCell.center();
cvf::Vec3d wellPathDirection = cvf::Vec3d::X_AXIS;
if (i < locationAndDirection.size())
{
locationInDomainCoord = locationAndDirection[i].first;
wellPathDirection = locationAndDirection[i].second;
}
cvf::Vec3d displayCoord = coordTransform->transformToDisplayCoord(locationInDomainCoord);
completionVizDataItems.push_back(
CompletionVizData(displayCoord, wellPathDirection, transmissibility, cell.first.globalCellIndex()));
}
}
if (!completionVizDataItems.empty())

View File

@ -48,3 +48,13 @@ size_t RivWellConnectionSourceInfo::globalCellIndexFromTriangleIndex(cvf::uint t
return m_geometryGenerator->globalCellIndexFromTriangleIndex(triangleIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RivWellConnectionSourceInfo::connectionFactorFromTriangleIndex(cvf::uint triangleIndex) const
{
if (m_geometryGenerator.isNull()) return 0.0;
return m_geometryGenerator->connectionFactor(triangleIndex);
}

View File

@ -39,6 +39,7 @@ public:
RimWellPath* wellPath() const;
size_t globalCellIndexFromTriangleIndex(cvf::uint triangleIndex) const;
double connectionFactorFromTriangleIndex(cvf::uint triangleIndex) const;
private:
caf::PdmPointer<RimWellPath> m_wellPath;

View File

@ -633,6 +633,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
bool allowActiveViewChange = dynamic_cast<Rim2dIntersectionView*>(m_viewer->ownerViewWindow()) == nullptr;
size_t globalCellIndex = wellConnectionSourceInfo->globalCellIndexFromTriangleIndex(firstPartTriangleIndex);
double connectionFactor = wellConnectionSourceInfo->connectionFactorFromTriangleIndex(firstPartTriangleIndex);
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
if (eclipseView)
@ -660,7 +661,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
// For now, only report the fist completion and not the combined completion if more than one
// completion contributes into a cell
resultInfoText += QString("Well Connection Factor : %1").arg(completionDataItems[0].transmissibility());
resultInfoText += QString("Well Connection Factor : %1").arg(connectionFactor);
resultInfoText += "<br><br>Details : <br>";
for (const auto& completionData : completionDataItems)