mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2552 Fix visualization of branch-depth, both wells and intersection geoemetry.
This commit is contained in:
@@ -96,6 +96,7 @@ void RivIntersectionGeometryGenerator::calculateSegementTransformPrLinePoint()
|
||||
for ( size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx )
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& polyLine = m_polyLines[pLineIdx];
|
||||
startOffset.z() = polyLine[0].z();
|
||||
m_segementTransformPrLinePoint.emplace_back(RivSectionFlattner::calculateFlatteningCSsForPolyline(polyLine,
|
||||
m_extrusionDirection,
|
||||
startOffset,
|
||||
|
||||
@@ -98,7 +98,7 @@ void RivReservoirSimWellsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBa
|
||||
|
||||
for (size_t i = 0; i < m_reservoirView->wellCollection()->wells.size(); ++i)
|
||||
{
|
||||
RivSimWellPipesPartMgr * wppmgr = new RivSimWellPipesPartMgr( m_reservoirView->wellCollection()->wells[i], false);
|
||||
RivSimWellPipesPartMgr * wppmgr = new RivSimWellPipesPartMgr( m_reservoirView->wellCollection()->wells[i]);
|
||||
m_wellPipesPartMgrs.push_back(wppmgr);
|
||||
|
||||
RivWellHeadPartMgr* wellHeadMgr = new RivWellHeadPartMgr(m_reservoirView->wellCollection()->wells[i]);
|
||||
|
||||
@@ -58,9 +58,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivSimWellPipesPartMgr::RivSimWellPipesPartMgr(RimSimWellInView* well, Rim2dIntersectionView * intersectionView)
|
||||
RivSimWellPipesPartMgr::RivSimWellPipesPartMgr(RimSimWellInView* well)
|
||||
: m_rimWell(well)
|
||||
, m_intersectionView(intersectionView)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -86,7 +85,68 @@ Rim3dView* RivSimWellPipesPartMgr::viewWithSettings()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivSimWellPipesPartMgr::buildWellPipeParts(const caf::DisplayCoordTransform* displayXf)
|
||||
void RivSimWellPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
size_t frameIndex,
|
||||
const caf::DisplayCoordTransform* displayXf)
|
||||
{
|
||||
if (!viewWithSettings()) return;
|
||||
|
||||
if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
|
||||
|
||||
buildWellPipeParts(displayXf, false, 0.0, -1);
|
||||
|
||||
std::list<RivPipeBranchData>::iterator it;
|
||||
for (it = m_wellBranches.begin(); it != m_wellBranches.end(); ++it)
|
||||
{
|
||||
if (it->m_surfacePart.notNull())
|
||||
{
|
||||
model->addPart(it->m_surfacePart.p());
|
||||
}
|
||||
|
||||
if (it->m_centerLinePart.notNull())
|
||||
{
|
||||
model->addPart(it->m_centerLinePart.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivSimWellPipesPartMgr::appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
size_t frameIndex,
|
||||
const caf::DisplayCoordTransform* displayXf,
|
||||
double flattenedIntersectionExtentLength,
|
||||
int branchIndex)
|
||||
{
|
||||
if (!viewWithSettings()) return;
|
||||
|
||||
if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
|
||||
|
||||
buildWellPipeParts(displayXf, true, flattenedIntersectionExtentLength, branchIndex);
|
||||
|
||||
std::list<RivPipeBranchData>::iterator it;
|
||||
for (it = m_wellBranches.begin(); it != m_wellBranches.end(); ++it)
|
||||
{
|
||||
if (it->m_surfacePart.notNull())
|
||||
{
|
||||
model->addPart(it->m_surfacePart.p());
|
||||
}
|
||||
|
||||
if (it->m_centerLinePart.notNull())
|
||||
{
|
||||
model->addPart(it->m_centerLinePart.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivSimWellPipesPartMgr::buildWellPipeParts(const caf::DisplayCoordTransform* displayXf,
|
||||
bool doFlatten,
|
||||
double flattenedIntersectionExtentLength,
|
||||
int branchIndex)
|
||||
{
|
||||
if (!this->viewWithSettings()) return;
|
||||
|
||||
@@ -100,13 +160,25 @@ void RivSimWellPipesPartMgr::buildWellPipeParts(const caf::DisplayCoordTransform
|
||||
double pipeRadius = m_rimWell->pipeRadius();
|
||||
int crossSectionVertexCount = m_rimWell->pipeCrossSectionVertexCount();
|
||||
|
||||
cvf::Vec3d flattenedStartOffset = cvf::Vec3d::ZERO;
|
||||
if ( m_pipeBranchesCLCoords.size() && m_pipeBranchesCLCoords[0].size() )
|
||||
// Take branch selection into account
|
||||
size_t branchIdxStart = 0;
|
||||
size_t branchIdxStop = pipeBranchesCellIds.size();
|
||||
if (m_pipeBranchesCLCoords.size() > 1)
|
||||
{
|
||||
flattenedStartOffset = { 0.0, 0.0, m_pipeBranchesCLCoords[0][0].z() };
|
||||
if (branchIndex >= 0 && branchIndex < branchIdxStop)
|
||||
{
|
||||
branchIdxStart = branchIndex;
|
||||
branchIdxStop = branchIdxStart + 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx)
|
||||
cvf::Vec3d flattenedStartOffset = cvf::Vec3d::ZERO;
|
||||
if ( m_pipeBranchesCLCoords.size() > branchIdxStart && m_pipeBranchesCLCoords[branchIdxStart].size() )
|
||||
{
|
||||
flattenedStartOffset = { 0.0, 0.0, m_pipeBranchesCLCoords[branchIdxStart][0].z() };
|
||||
}
|
||||
|
||||
for (size_t brIdx = branchIdxStart; brIdx <branchIdxStop; ++brIdx)
|
||||
{
|
||||
cvf::ref<RivSimWellPipeSourceInfo> sourceInfo = new RivSimWellPipeSourceInfo(m_rimWell, brIdx);
|
||||
|
||||
@@ -123,7 +195,9 @@ void RivSimWellPipesPartMgr::buildWellPipeParts(const caf::DisplayCoordTransform
|
||||
cvf::ref<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray;
|
||||
cvfCoords->assign(m_pipeBranchesCLCoords[brIdx]);
|
||||
|
||||
if (m_intersectionView)
|
||||
flattenedStartOffset.z() = m_pipeBranchesCLCoords[brIdx][0].z();
|
||||
|
||||
if (doFlatten)
|
||||
{
|
||||
std::vector<cvf::Mat4d> flatningCSs = RivSectionFlattner::calculateFlatteningCSsForPolyline(m_pipeBranchesCLCoords[brIdx],
|
||||
cvf::Vec3d::Z_AXIS,
|
||||
@@ -180,39 +254,11 @@ void RivSimWellPipesPartMgr::buildWellPipeParts(const caf::DisplayCoordTransform
|
||||
pbd.m_largeSurfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface();
|
||||
}
|
||||
|
||||
if (m_intersectionView) flattenedStartOffset += { 2*m_intersectionView->intersection()->extentLength(), 0.0, 0.0};
|
||||
if (doFlatten) flattenedStartOffset += { 2*flattenedIntersectionExtentLength, 0.0, 0.0};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivSimWellPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
size_t frameIndex,
|
||||
const caf::DisplayCoordTransform* displayXf)
|
||||
{
|
||||
if (!viewWithSettings()) return;
|
||||
|
||||
if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
|
||||
|
||||
buildWellPipeParts(displayXf);
|
||||
|
||||
std::list<RivPipeBranchData>::iterator it;
|
||||
for (it = m_wellBranches.begin(); it != m_wellBranches.end(); ++it)
|
||||
{
|
||||
if (it->m_surfacePart.notNull())
|
||||
{
|
||||
model->addPart(it->m_surfacePart.p());
|
||||
}
|
||||
|
||||
if (it->m_centerLinePart.notNull())
|
||||
{
|
||||
model->addPart(it->m_centerLinePart.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -50,21 +50,29 @@ class Rim2dIntersectionView;
|
||||
class RivSimWellPipesPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivSimWellPipesPartMgr(RimSimWellInView* well, Rim2dIntersectionView * intersectionView = nullptr);
|
||||
RivSimWellPipesPartMgr(RimSimWellInView* well);
|
||||
|
||||
~RivSimWellPipesPartMgr();
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
size_t frameIndex,
|
||||
const caf::DisplayCoordTransform* displayXf);
|
||||
void appendFlattenedDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
size_t frameIndex,
|
||||
const caf::DisplayCoordTransform* displayXf,
|
||||
double flattenedIntersectionExtentLength,
|
||||
int branchIndex);
|
||||
|
||||
void updatePipeResultColor(size_t frameIndex);
|
||||
|
||||
private:
|
||||
Rim3dView* viewWithSettings();
|
||||
void buildWellPipeParts(const caf::DisplayCoordTransform* displayXf);
|
||||
void buildWellPipeParts(const caf::DisplayCoordTransform* displayXf,
|
||||
bool doFlatten,
|
||||
double flattenedIntersectionExtentLength,
|
||||
int branchIndex);
|
||||
|
||||
caf::PdmPointer<RimSimWellInView> m_rimWell;
|
||||
caf::PdmPointer<Rim2dIntersectionView> m_intersectionView;
|
||||
|
||||
struct RivPipeBranchData
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <QDateTime>
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "RivSimWellPipesPartMgr.h"
|
||||
#include "RivWellHeadPartMgr.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(Rim2dIntersectionView, "Intersection2dView");
|
||||
|
||||
@@ -404,6 +405,7 @@ void Rim2dIntersectionView::createDisplayModel()
|
||||
m_flatIntersectionPartMgr->applySingleColorEffect();
|
||||
|
||||
m_flatSimWellPipePartMgr = nullptr;
|
||||
m_flatWellHeadPartMgr = nullptr;
|
||||
|
||||
if ( m_intersection->type() == RimIntersection::CS_SIMULATION_WELL
|
||||
&& m_intersection->simulationWell() )
|
||||
@@ -413,7 +415,8 @@ void Rim2dIntersectionView::createDisplayModel()
|
||||
|
||||
if ( eclipseView )
|
||||
{
|
||||
m_flatSimWellPipePartMgr = new RivSimWellPipesPartMgr(m_intersection->simulationWell(), this);
|
||||
m_flatSimWellPipePartMgr = new RivSimWellPipesPartMgr(m_intersection->simulationWell());
|
||||
m_flatWellHeadPartMgr = new RivWellHeadPartMgr(m_intersection->simulationWell());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,20 +469,29 @@ void Rim2dIntersectionView::updateCurrentTimeStep()
|
||||
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
||||
if (frameScene)
|
||||
{
|
||||
cvf::String name = "SimWellPipeMod";
|
||||
Rim3dView::removeModelByName(frameScene, name);
|
||||
{
|
||||
cvf::String name = "SimWellPipeMod";
|
||||
Rim3dView::removeModelByName(frameScene, name);
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> simWellModelBasicList = new cvf::ModelBasicList;
|
||||
simWellModelBasicList->setName(name);
|
||||
cvf::ref<cvf::ModelBasicList> simWellModelBasicList = new cvf::ModelBasicList;
|
||||
simWellModelBasicList->setName(name);
|
||||
|
||||
m_flatSimWellPipePartMgr->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(),
|
||||
m_currentTimeStep,
|
||||
this->displayCoordTransform().p());
|
||||
m_flatSimWellPipePartMgr->appendFlattenedDynamicGeometryPartsToModel(simWellModelBasicList.p(),
|
||||
m_currentTimeStep,
|
||||
this->displayCoordTransform().p(),
|
||||
m_intersection->extentLength(),
|
||||
m_intersection->branchIndex());
|
||||
|
||||
simWellModelBasicList->updateBoundingBoxesRecursive();
|
||||
frameScene->addModel(simWellModelBasicList.p());
|
||||
simWellModelBasicList->updateBoundingBoxesRecursive();
|
||||
frameScene->addModel(simWellModelBasicList.p());
|
||||
|
||||
m_flatSimWellPipePartMgr->updatePipeResultColor(m_currentTimeStep);
|
||||
m_flatSimWellPipePartMgr->updatePipeResultColor(m_currentTimeStep);
|
||||
|
||||
//m_flatWellHeadPartMgr->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(),
|
||||
// m_currentTimeStep,
|
||||
// this->displayCoordTransform().p());
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class RimIntersection;
|
||||
class RimLegendConfig;
|
||||
class RimTernaryLegendConfig;
|
||||
class RivSimWellPipesPartMgr;
|
||||
class RivWellHeadPartMgr;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@@ -97,6 +98,7 @@ protected:
|
||||
|
||||
cvf::ref<RivIntersectionPartMgr> m_flatIntersectionPartMgr;
|
||||
cvf::ref<RivSimWellPipesPartMgr> m_flatSimWellPipePartMgr;
|
||||
cvf::ref<RivWellHeadPartMgr> m_flatWellHeadPartMgr;
|
||||
cvf::ref<cvf::ModelBasicList> m_intersectionVizModel;
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ public:
|
||||
void recomputeSimulationWellBranchData();
|
||||
bool hasDefiningPoints() const;
|
||||
|
||||
int branchIndex() const;
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
@@ -117,7 +118,6 @@ protected:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
private:
|
||||
int branchIndex() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_branchIndex;
|
||||
|
||||
Reference in New Issue
Block a user