#1025 Established geometry for all well cell centers

This commit is contained in:
astridkbjorke 2016-12-07 12:01:31 +01:00
parent 1801e49105
commit 600f3da30a
8 changed files with 284 additions and 55 deletions

View File

@ -35,6 +35,7 @@ ${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.h
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h
) )
set (SOURCE_GROUP_SOURCE_FILES 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}RivPipeQuadToSegmentMapper.cpp
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@ -1,8 +1,6 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2011- Statoil ASA // Copyright (C) 2016- Statoil ASA
// Copyright (C) 2013- 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
@ -20,15 +18,10 @@
#include "RivReservoirWellSpheresPartMgr.h" #include "RivReservoirWellSpheresPartMgr.h"
// #include "Rim3dOverlayInfoConfig.h" #include "RivWellSpheresPartMgr.h"
// #include "RimCellEdgeColors.h"
// #include "RimCellRangeFilterCollection.h"
// #include "RimEclipseCellColors.h"
// #include "RimEclipsePropertyFilterCollection.h"
// #include "RimEclipseView.h"
// #include "RimEclipseWell.h"
// #include "RimEclipseWellCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h" #include "cafPdmFieldCvfMat4d.h"
@ -42,9 +35,9 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivReservoirWellSpheresPartMgr::RivReservoirWellSpheresPartMgr(RimEclipseView* reservoirView) RivReservoirWellSpheresPartMgr::RivReservoirWellSpheresPartMgr(RimEclipseView* reservoirView)
{ {
// m_reservoirView = reservoirView; m_reservoirView = reservoirView;
//
// m_scaleTransform = new cvf::Transform(); m_scaleTransform = new cvf::Transform();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -62,15 +55,6 @@ void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTra
{ {
m_scaleTransform = scaleTransform; 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) void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{ {
// if (!m_reservoirView->wellCollection()->isActive()) return; if (!m_reservoirView->wellCollection()->showCellCenterSpheres) return;
//
// if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) return; if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size())
// {
// if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size())
// { for (RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells())
// clearGeometryCache(); {
// RivWellSpheresPartMgr* wppmgr = new RivWellSpheresPartMgr(m_reservoirView, rimWell);
// for (size_t i = 0; i < m_reservoirView->wellCollection()->wells.size(); ++i) m_wellSpheresPartMgrs.push_back(wppmgr);
// { wppmgr->setScaleTransform(m_scaleTransform.p());
// RivWellPipesPartMgr * wppmgr = new RivWellPipesPartMgr(m_reservoirView, m_reservoirView->wellCollection()->wells[i]); }
// m_wellPipesPartMgrs.push_back(wppmgr); }
// wppmgr->setScaleTransform(m_scaleTransform.p());
// for (size_t i = 0; i < m_wellSpheresPartMgrs.size(); i++)
// RivWellHeadPartMgr* wellHeadMgr = new RivWellHeadPartMgr(m_reservoirView, m_reservoirView->wellCollection()->wells[i]); {
// m_wellHeadPartMgrs.push_back(wellHeadMgr); m_wellSpheresPartMgrs.at(i)->appendDynamicGeometryPartsToModel(model, frameIndex);
// 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);
// }
} }

View File

@ -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 // 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
@ -30,6 +30,7 @@ namespace cvf
} }
class RimEclipseView; class RimEclipseView;
class RivWellSpheresPartMgr;
class RivReservoirWellSpheresPartMgr : public cvf::Object class RivReservoirWellSpheresPartMgr : public cvf::Object
{ {
@ -42,9 +43,13 @@ public:
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
private:
private: private:
caf::PdmPointer<RimEclipseView> m_reservoirView; caf::PdmPointer<RimEclipseView> m_reservoirView;
cvf::ref<cvf::Transform> m_scaleTransform; cvf::ref<cvf::Transform> m_scaleTransform;
cvf::Collection< RivWellSpheresPartMgr > m_wellSpheresPartMgrs;
}; };

View 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;
}

View 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;
};

View File

@ -55,6 +55,7 @@
#include "RiuViewer.h" #include "RiuViewer.h"
#include "RivReservoirPipesPartMgr.h" #include "RivReservoirPipesPartMgr.h"
#include "RivReservoirWellSpheresPartMgr.h"
#include "RivSingleCellPartGenerator.h" #include "RivSingleCellPartGenerator.h"
#include "RivTernarySaturationOverlayItem.h" #include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathCollectionPartMgr.h" #include "RivWellPathCollectionPartMgr.h"
@ -129,9 +130,11 @@ RimEclipseView::RimEclipseView()
this->faultResultSettings()->setReservoirView(this); this->faultResultSettings()->setReservoirView(this);
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this); m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
m_pipesPartManager = new RivReservoirPipesPartMgr(this); m_pipesPartManager = new RivReservoirPipesPartMgr(this);
m_reservoir = NULL; m_wellSpheresPartManager = new RivReservoirWellSpheresPartMgr(this);
m_reservoir = NULL;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -267,6 +270,8 @@ void RimEclipseView::updateScaleTransform()
this->scaleTransform()->setLocalTransform(scale); this->scaleTransform()->setLocalTransform(scale);
m_pipesPartManager->setScaleTransform(this->scaleTransform()); m_pipesPartManager->setScaleTransform(this->scaleTransform());
m_wellSpheresPartManager->setScaleTransform(this->scaleTransform());
if (m_viewer) m_viewer->updateCachedValuesInScene(); if (m_viewer) m_viewer->updateCachedValuesInScene();
} }
@ -662,6 +667,8 @@ void RimEclipseView::updateCurrentTimeStep()
wellPipeModelBasicList->setName("SimWellPipeMod"); wellPipeModelBasicList->setName("SimWellPipeMod");
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep); m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
m_wellSpheresPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
wellPipeModelBasicList->updateBoundingBoxesRecursive(); wellPipeModelBasicList->updateBoundingBoxesRecursive();

View File

@ -55,6 +55,7 @@ class RimEclipseCellColors;
class RimEclipseWellCollection; class RimEclipseWellCollection;
class RiuViewer; class RiuViewer;
class RivReservoirPipesPartMgr; class RivReservoirPipesPartMgr;
class RivReservoirWellSpheresPartMgr;
class RivIntersectionPartMgr; class RivIntersectionPartMgr;
namespace cvf namespace cvf
@ -178,7 +179,8 @@ private:
cvf::ref<RivReservoirViewPartMgr> m_reservoirGridPartManager; cvf::ref<RivReservoirViewPartMgr> m_reservoirGridPartManager;
cvf::ref<RivReservoirPipesPartMgr> m_pipesPartManager; cvf::ref<RivReservoirPipesPartMgr> m_pipesPartManager;
cvf::ref<RivReservoirWellSpheresPartMgr> m_wellSpheresPartManager;
std::vector<RivCellSetEnum> m_visibleGridParts; std::vector<RivCellSetEnum> m_visibleGridParts;
}; };

View File

@ -227,6 +227,14 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
m_reservoirView->scheduleCreateDisplayModelAndRedraw(); m_reservoirView->scheduleCreateDisplayModelAndRedraw();
} }
} }
else if (&showCellCenterSpheres == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if (&wellCellFenceType == changedField) else if (&wellCellFenceType == changedField)
{ {
if (m_reservoirView) if (m_reservoirView)