mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1025 Established geometry for all well cell centers
This commit is contained in:
parent
1801e49105
commit
600f3da30a
@ -35,6 +35,7 @@ ${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}RivWellSpheresPartMgr.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -66,6 +67,7 @@ ${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}RivWellSpheresPartMgr.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -1,8 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -20,15 +18,10 @@
|
||||
|
||||
#include "RivReservoirWellSpheresPartMgr.h"
|
||||
|
||||
// #include "Rim3dOverlayInfoConfig.h"
|
||||
// #include "RimCellEdgeColors.h"
|
||||
// #include "RimCellRangeFilterCollection.h"
|
||||
// #include "RimEclipseCellColors.h"
|
||||
// #include "RimEclipsePropertyFilterCollection.h"
|
||||
// #include "RimEclipseView.h"
|
||||
// #include "RimEclipseWell.h"
|
||||
// #include "RimEclipseWellCollection.h"
|
||||
#include "RivWellSpheresPartMgr.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
@ -42,9 +35,9 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivReservoirWellSpheresPartMgr::RivReservoirWellSpheresPartMgr(RimEclipseView* reservoirView)
|
||||
{
|
||||
// m_reservoirView = reservoirView;
|
||||
//
|
||||
// m_scaleTransform = new cvf::Transform();
|
||||
m_reservoirView = reservoirView;
|
||||
|
||||
m_scaleTransform = new cvf::Transform();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -62,15 +55,6 @@ void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTra
|
||||
{
|
||||
m_scaleTransform = scaleTransform;
|
||||
|
||||
// for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
|
||||
// {
|
||||
// m_wellPipesPartMgrs[wIdx]->setScaleTransform(scaleTransform);
|
||||
// }
|
||||
//
|
||||
// for (size_t wIdx = 0; wIdx != m_wellHeadPartMgrs.size(); ++ wIdx)
|
||||
// {
|
||||
// m_wellHeadPartMgrs[wIdx]->setScaleTransform(scaleTransform);
|
||||
// }
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -78,32 +62,22 @@ void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTra
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
|
||||
{
|
||||
// if (!m_reservoirView->wellCollection()->isActive()) return;
|
||||
//
|
||||
// if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) return;
|
||||
//
|
||||
// if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size())
|
||||
// {
|
||||
// clearGeometryCache();
|
||||
//
|
||||
// for (size_t i = 0; i < m_reservoirView->wellCollection()->wells.size(); ++i)
|
||||
// {
|
||||
// RivWellPipesPartMgr * wppmgr = new RivWellPipesPartMgr(m_reservoirView, m_reservoirView->wellCollection()->wells[i]);
|
||||
// m_wellPipesPartMgrs.push_back(wppmgr);
|
||||
// wppmgr->setScaleTransform(m_scaleTransform.p());
|
||||
//
|
||||
// RivWellHeadPartMgr* wellHeadMgr = new RivWellHeadPartMgr(m_reservoirView, m_reservoirView->wellCollection()->wells[i]);
|
||||
// m_wellHeadPartMgrs.push_back(wellHeadMgr);
|
||||
// wellHeadMgr->setScaleTransform(m_scaleTransform.p());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
|
||||
// {
|
||||
// m_wellPipesPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
|
||||
// m_wellHeadPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
|
||||
// }
|
||||
if (!m_reservoirView->wellCollection()->showCellCenterSpheres) return;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size())
|
||||
{
|
||||
|
||||
for (RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells())
|
||||
{
|
||||
RivWellSpheresPartMgr* wppmgr = new RivWellSpheresPartMgr(m_reservoirView, rimWell);
|
||||
m_wellSpheresPartMgrs.push_back(wppmgr);
|
||||
wppmgr->setScaleTransform(m_scaleTransform.p());
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_wellSpheresPartMgrs.size(); i++)
|
||||
{
|
||||
m_wellSpheresPartMgrs.at(i)->appendDynamicGeometryPartsToModel(model, frameIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -30,6 +30,7 @@ namespace cvf
|
||||
}
|
||||
|
||||
class RimEclipseView;
|
||||
class RivWellSpheresPartMgr;
|
||||
|
||||
class RivReservoirWellSpheresPartMgr : public cvf::Object
|
||||
{
|
||||
@ -42,9 +43,13 @@ public:
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
|
||||
cvf::Collection< RivWellSpheresPartMgr > m_wellSpheresPartMgrs;
|
||||
|
||||
};
|
||||
|
157
ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp
Normal file
157
ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp
Normal file
@ -0,0 +1,157 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivWellSpheresPartMgr.h"
|
||||
|
||||
#include "RigCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfGeometryBuilderFaceList.h"
|
||||
#include "cvfGeometryUtils.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfPart.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivWellSpheresPartMgr::RivWellSpheresPartMgr(RimEclipseView* reservoirView, RimEclipseWell* well)
|
||||
{
|
||||
m_rimReservoirView = reservoirView;
|
||||
m_rimWell = well;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivWellSpheresPartMgr::~RivWellSpheresPartMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
|
||||
{
|
||||
if (m_rimReservoirView.isNull()) return;
|
||||
if (!m_rimReservoirView->eclipseCase()) return;
|
||||
if (!m_rimReservoirView->eclipseCase()->reservoirData()) return;
|
||||
|
||||
const RigMainGrid* mainGrid = m_rimReservoirView->eclipseCase()->reservoirData()->mainGrid();
|
||||
CVF_ASSERT(mainGrid);
|
||||
|
||||
RigSingleWellResultsData* rigWellResult = m_rimWell->wellResults();
|
||||
if (!rigWellResult) return;
|
||||
|
||||
if (!rigWellResult->hasWellResult(frameIndex)) return;
|
||||
|
||||
const RigWellResultFrame& wellResultFrame = rigWellResult->wellResultFrame(frameIndex);
|
||||
|
||||
std::vector<cvf::Vec3d> cellCenters;
|
||||
|
||||
for (const RigWellResultBranch& wellResultBranch : wellResultFrame.m_wellResultBranches)
|
||||
{
|
||||
for (const RigWellResultPoint& wellResultPoint : wellResultBranch.m_branchResultPoints)
|
||||
{
|
||||
size_t gridIndex = wellResultPoint.m_gridIndex;
|
||||
size_t gridCellIndex = wellResultPoint.m_gridCellIndex;
|
||||
|
||||
const RigGridBase* rigGrid = mainGrid->gridByIndex(gridIndex);
|
||||
const RigCell& rigCell = rigGrid->cell(gridCellIndex);
|
||||
|
||||
cvf::Vec3d center = rigCell.center();
|
||||
|
||||
cellCenters.push_back(center);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (cvf::Vec3d c : cellCenters)
|
||||
{
|
||||
cvf::Vec4d transfCoord = m_scaleTransform->worldTransform() * cvf::Vec4d(c - mainGrid->displayModelOffset(), 1);
|
||||
|
||||
cvf::Vec3d displayCoord;
|
||||
displayCoord[0] = transfCoord[0];
|
||||
displayCoord[1] = transfCoord[1];
|
||||
displayCoord[2] = transfCoord[2];
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = createSphere(10, displayCoord);
|
||||
cvf::ref<cvf::Part> part = createPart(geo.p());
|
||||
|
||||
model->addPart(part.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivWellSpheresPartMgr::createSphere(double radius, const cvf::Vec3d& pos)
|
||||
{
|
||||
cvf::Vec3f posFloat(pos);
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
|
||||
cvf::GeometryBuilderFaceList builder;
|
||||
cvf::GeometryUtils::createSphere(radius, 4, 5, &builder);
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vertices = builder.vertices();
|
||||
|
||||
// Move sphere coordinates to the destination location
|
||||
for (size_t i = 0; i < vertices->size(); i++)
|
||||
{
|
||||
vertices->set(i, vertices->val(i) + posFloat);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::UIntArray> faceList = builder.faceList();
|
||||
|
||||
geo->setVertexArray(vertices.p());
|
||||
geo->setFromFaceList(*faceList);
|
||||
geo->computeNormals();
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Part> RivWellSpheresPartMgr::createPart(cvf::DrawableGeo* geo)
|
||||
{
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setDrawable(geo);
|
||||
|
||||
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(cvf::Color3f::GREEN), caf::PO_1);
|
||||
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
|
||||
return part;
|
||||
}
|
||||
|
74
ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h
Normal file
74
ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h
Normal file
@ -0,0 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
#include <list>
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Part;
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class Effect;
|
||||
class DrawableGeo;
|
||||
class ScalarMapper;
|
||||
}
|
||||
|
||||
class RivPipeGeometryGenerator;
|
||||
class RimEclipseView;
|
||||
class RimEclipseWell;
|
||||
|
||||
class RivWellSpheresPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivWellSpheresPartMgr(RimEclipseView* reservoirView, RimEclipseWell* well);
|
||||
~RivWellSpheresPartMgr();
|
||||
|
||||
void setScaleTransform(cvf::Transform * scaleTransform) { m_scaleTransform = scaleTransform; scheduleGeometryRegen();}
|
||||
|
||||
void scheduleGeometryRegen() { m_needsTransformUpdate = true; }
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
|
||||
|
||||
|
||||
private:
|
||||
static cvf::ref<cvf::DrawableGeo> createSphere(double radius, const cvf::Vec3d& pos);
|
||||
cvf::ref<cvf::Part> createPart(cvf::DrawableGeo* geo);
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimEclipseView> m_rimReservoirView;
|
||||
caf::PdmPointer<RimEclipseWell> m_rimWell;
|
||||
|
||||
|
||||
struct RivPipeBranchData
|
||||
{
|
||||
cvf::ref<cvf::Part> m_surfacePart;
|
||||
cvf::ref<cvf::DrawableGeo> m_surfaceDrawable;
|
||||
};
|
||||
|
||||
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
bool m_needsTransformUpdate;
|
||||
};
|
@ -55,6 +55,7 @@
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivReservoirPipesPartMgr.h"
|
||||
#include "RivReservoirWellSpheresPartMgr.h"
|
||||
#include "RivSingleCellPartGenerator.h"
|
||||
#include "RivTernarySaturationOverlayItem.h"
|
||||
#include "RivWellPathCollectionPartMgr.h"
|
||||
@ -129,8 +130,10 @@ RimEclipseView::RimEclipseView()
|
||||
this->faultResultSettings()->setReservoirView(this);
|
||||
|
||||
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
|
||||
|
||||
m_pipesPartManager = new RivReservoirPipesPartMgr(this);
|
||||
m_wellSpheresPartManager = new RivReservoirWellSpheresPartMgr(this);
|
||||
|
||||
|
||||
m_reservoir = NULL;
|
||||
}
|
||||
|
||||
@ -267,6 +270,8 @@ void RimEclipseView::updateScaleTransform()
|
||||
|
||||
this->scaleTransform()->setLocalTransform(scale);
|
||||
m_pipesPartManager->setScaleTransform(this->scaleTransform());
|
||||
m_wellSpheresPartManager->setScaleTransform(this->scaleTransform());
|
||||
|
||||
|
||||
if (m_viewer) m_viewer->updateCachedValuesInScene();
|
||||
}
|
||||
@ -662,6 +667,8 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
wellPipeModelBasicList->setName("SimWellPipeMod");
|
||||
|
||||
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
|
||||
m_wellSpheresPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
|
||||
|
||||
|
||||
wellPipeModelBasicList->updateBoundingBoxesRecursive();
|
||||
|
||||
|
@ -55,6 +55,7 @@ class RimEclipseCellColors;
|
||||
class RimEclipseWellCollection;
|
||||
class RiuViewer;
|
||||
class RivReservoirPipesPartMgr;
|
||||
class RivReservoirWellSpheresPartMgr;
|
||||
class RivIntersectionPartMgr;
|
||||
|
||||
namespace cvf
|
||||
@ -178,6 +179,7 @@ private:
|
||||
|
||||
cvf::ref<RivReservoirViewPartMgr> m_reservoirGridPartManager;
|
||||
cvf::ref<RivReservoirPipesPartMgr> m_pipesPartManager;
|
||||
cvf::ref<RivReservoirWellSpheresPartMgr> m_wellSpheresPartManager;
|
||||
|
||||
std::vector<RivCellSetEnum> m_visibleGridParts;
|
||||
};
|
||||
|
@ -227,6 +227,14 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
else if (&showCellCenterSpheres == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
else if (&wellCellFenceType == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
|
Loading…
Reference in New Issue
Block a user