Added branch index to source info as basis for more work on #1044

This commit is contained in:
Magne Sjaastad 2017-01-03 11:11:36 +01:00
parent 276eaf0f33
commit 51e8cae11b
6 changed files with 63 additions and 14 deletions

View File

@ -34,7 +34,7 @@ ${CEE_CURRENT_LIST_DIR}RivScalarMapperUtils.h
${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.h
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h
)
@ -66,7 +66,7 @@ ${CEE_CURRENT_LIST_DIR}RivScalarMapperUtils.cpp
${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.cpp
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.cpp
)

View File

@ -17,7 +17,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivWellPipeSourceInfo.h"
#include "RivSimWellPipeSourceInfo.h"
#include "RimEclipseWell.h"
@ -25,15 +25,16 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivEclipseWellSourceInfo::RivEclipseWellSourceInfo(RimEclipseWell* eclipseWell)
: m_eclipseWell(eclipseWell)
RivSimWellPipeSourceInfo::RivSimWellPipeSourceInfo(RimEclipseWell* eclipseWell, size_t branchIndex)
: m_eclipseWell(eclipseWell),
m_branchIndex(branchIndex)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWell* RivEclipseWellSourceInfo::well() const
RimEclipseWell* RivSimWellPipeSourceInfo::well() const
{
return m_eclipseWell.p();
}

View File

@ -25,13 +25,14 @@
class RimEclipseWell;
class RivEclipseWellSourceInfo : public cvf::Object
class RivSimWellPipeSourceInfo : public cvf::Object
{
public:
RivEclipseWellSourceInfo(RimEclipseWell* eclipseWell);
RivSimWellPipeSourceInfo(RimEclipseWell* eclipseWell, size_t branchIndex);
RimEclipseWell* well() const;
private:
caf::PdmPointer<RimEclipseWell> m_eclipseWell;
size_t m_branchIndex;
};

View File

@ -36,7 +36,7 @@
#include "RivPipeGeometryGenerator.h"
#include "RivWellPathSourceInfo.h"
#include "RivWellPipeSourceInfo.h"
#include "RivSimWellPipeSourceInfo.h"
#include "cafEffectGenerator.h"
#include "cafPdmFieldCvfColor.h"
@ -107,10 +107,11 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
double characteristicCellSize = m_rimReservoirView->eclipseCase()->reservoirData()->mainGrid()->characteristicIJCellSize();
double pipeRadius = m_rimReservoirView->wellCollection()->pipeRadiusScaleFactor() *m_rimWell->pipeRadiusScaleFactor() * characteristicCellSize;
cvf::ref<RivEclipseWellSourceInfo> sourceInfo = new RivEclipseWellSourceInfo(m_rimWell);
for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx)
{
cvf::ref<RivSimWellPipeSourceInfo> sourceInfo = new RivSimWellPipeSourceInfo(m_rimWell, brIdx);
m_wellBranches.push_back(RivPipeBranchData());
RivPipeBranchData& pbd = m_wellBranches.back();
@ -168,6 +169,27 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
m_needsTransformUpdate = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivSimWellPipesPartMgr::RivPipeBranchData* RivSimWellPipesPartMgr::pipeBranchData(size_t branchIndex)
{
if (branchIndex < m_wellBranches.size())
{
size_t i = 0;
auto brIt = m_wellBranches.begin();
while (i < branchIndex)
{
brIt++;
}
return &(*brIt);
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -305,3 +327,25 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivSimWellPipesPartMgr::findGridIndexAndCellIndex(size_t branchIndex, size_t triangleIndex, size_t* gridIndex, size_t* cellIndex)
{
CVF_ASSERT(branchIndex < m_wellBranches.size());
RivPipeBranchData* branchData = pipeBranchData(branchIndex);
if (branchData)
{
size_t segmentIndex = branchData->m_pipeGeomGenerator->segmentIndexFromTriangleIndex(triangleIndex);
*gridIndex = branchData->m_cellIds[segmentIndex].m_gridIndex;
*cellIndex = branchData->m_cellIds[segmentIndex].m_gridCellIndex;
}
else
{
*gridIndex = cvf::UNDEFINED_SIZE_T;
*cellIndex = cvf::UNDEFINED_SIZE_T;
}
}

View File

@ -55,6 +55,8 @@ public:
const std::vector< std::vector <cvf::Vec3d> >& centerLineOfWellBranches() { return m_pipeBranchesCLCoords;}
void findGridIndexAndCellIndex(size_t branchIndex, size_t triangleIndex, size_t* gridIndex, size_t* cellIndex);
private:
caf::PdmPointer<RimEclipseView> m_rimReservoirView;
caf::PdmPointer<RimEclipseWell> m_rimWell;
@ -63,7 +65,6 @@ private:
bool m_needsTransformUpdate;
void buildWellPipeParts();
struct RivPipeBranchData
{
@ -78,6 +79,8 @@ private:
};
RivPipeBranchData* pipeBranchData(size_t branchIndex);
std::list<RivPipeBranchData> m_wellBranches;
cvf::ref<cvf::ScalarMapper> m_scalarMapper;

View File

@ -65,7 +65,7 @@
#include "RivSourceInfo.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathSourceInfo.h"
#include "RivWellPipeSourceInfo.h"
#include "RivSimWellPipeSourceInfo.h"
#include "cafCmdExecCommandManager.h"
#include "cafCmdFeatureManager.h"
@ -299,7 +299,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
}
}
const RivEclipseWellSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivEclipseWellSourceInfo*>(firstHitPart->sourceInfo());
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>(firstHitPart->sourceInfo());
if (eclipseWellSourceInfo)
{
RimEclipseWell* well = eclipseWellSourceInfo->well();
@ -510,7 +510,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
const RivEclipseWellSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivEclipseWellSourceInfo*>(firstHitPart->sourceInfo());
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>(firstHitPart->sourceInfo());
if (rivSourceInfo)
{