Refactored visualization : One part manager for each fracture

This commit is contained in:
Magne Sjaastad 2017-01-19 07:28:04 +01:00
parent 07b9eba3a8
commit 74fc8458ed
10 changed files with 109 additions and 222 deletions

View File

@ -17,7 +17,6 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.h
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.h
${CEE_CURRENT_LIST_DIR}RivReservoirFaultsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirFracturesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h
@ -37,7 +36,7 @@ ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellFracturesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellFracturePartMgr.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -53,7 +52,6 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirFracturesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp
@ -71,7 +69,7 @@ ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellFracturesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellFracturePartMgr.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -1,83 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 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 "RivReservoirFracturesPartMgr.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimEclipseWell.h"
#include "RivWellFracturesPartMgr.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirFracturesPartMgr::RivReservoirFracturesPartMgr(RimEclipseView* reservoirView)
{
m_reservoirView = reservoirView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirFracturesPartMgr::~RivReservoirFracturesPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirFracturesPartMgr::clearGeometryCache()
{
m_wellFracturesPartMgrs.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirFracturesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
// if (m_reservoirView->wellCollection()->wellSphereVisibility == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) return;
if (!m_reservoirView->wellCollection()->isActive()) return;
if (m_reservoirView->wellCollection()->wells.size() != m_wellFracturesPartMgrs.size())
{
clearGeometryCache();
for (RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells())
{
RivWellFracturesPartMgr* wppmgr = new RivWellFracturesPartMgr(rimWell);
m_wellFracturesPartMgrs.push_back(wppmgr);
}
}
for (size_t i = 0; i < m_wellFracturesPartMgrs.size(); i++)
{
// if (m_reservoirView->wellCollection()->wells[i]->isWellSpheresVisible(frameIndex))
{
m_wellFracturesPartMgrs.at(i)->appendDynamicGeometryPartsToModel(model, frameIndex);
}
}
// Well path fractures
}

View File

@ -1,48 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 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 "cvfCollection.h"
#include "cafPdmPointer.h"
namespace cvf
{
class ModelBasicList;
}
class RimEclipseView;
class RivWellFracturesPartMgr;
class RivReservoirFracturesPartMgr : public cvf::Object
{
public:
RivReservoirFracturesPartMgr(RimEclipseView* reservoirView);
~RivReservoirFracturesPartMgr();
void clearGeometryCache();
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
private:
caf::PdmPointer<RimEclipseView> m_reservoirView;
cvf::Collection< RivWellFracturesPartMgr > m_wellFracturesPartMgrs;
};

View File

@ -16,7 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivWellFracturesPartMgr.h"
#include "RivWellFracturePartMgr.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
@ -35,15 +35,15 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellFracturesPartMgr::RivWellFracturesPartMgr(RimEclipseWell* well)
RivWellFracturePartMgr::RivWellFracturePartMgr(RimFracture* fracture)
: m_rimFracture(fracture)
{
m_rimWell = well;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellFracturesPartMgr::~RivWellFracturesPartMgr()
RivWellFracturePartMgr::~RivWellFracturePartMgr()
{
}
@ -51,75 +51,71 @@ RivWellFracturesPartMgr::~RivWellFracturesPartMgr()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
void RivWellFracturePartMgr::updatePartGeometry(caf::DisplayCoordTransform* displayCoordTransform)
{
if (!m_rimWell) return;
if (m_part.notNull()) return;
if (!displayCoordTransform) return;
std::vector<RimFracture*> fractures;
m_rimWell->descendantsIncludingThisOfType(fractures);
for (RimFracture* fracture : fractures)
if (m_rimFracture)
{
if (!fracture->hasValidGeometry())
if (!m_rimFracture->hasValidGeometry())
{
fracture->computeGeometry();
m_rimFracture->computeGeometry();
}
}
if (fractures.size() > 0)
{
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(fractures.at(0));
if (!objHandle) return;
if (!m_rimFracture->hasValidGeometry()) return;
RimEclipseView* mainView = nullptr;
objHandle->firstAncestorOrThisOfType(mainView);
if (!mainView) return;
const std::vector<cvf::Vec3f>& nodeCoords = m_rimFracture->nodeCoords();
const std::vector<cvf::uint>& triangleIndices = m_rimFracture->triangleIndices();
std::vector<cvf::Vec3f> displayCoords;
cvf::ref<caf::DisplayCoordTransform> transForm = mainView->displayCoordTransform();
appendFracturePartsToModel(fractures, model, transForm.p());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturesPartMgr::appendFracturePartsToModel(std::vector<RimFracture*> fractures, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform)
{
for (RimFracture* fracture : fractures)
{
if (fracture->hasValidGeometry())
for (int i = 0; i < nodeCoords.size(); i++)
{
const std::vector<cvf::Vec3f>& nodeCoords = fracture->nodeCoords();
const std::vector<cvf::uint>& triangleIndices = fracture->triangleIndices();
std::vector<cvf::Vec3f> displayCoords;
for (int i = 0; i < nodeCoords.size(); i++)
{
cvf::Vec3d nodeCoordsDouble = static_cast<cvf::Vec3d>(nodeCoords[i]);
cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble);
displayCoords.push_back(static_cast<cvf::Vec3f>(displayCoordsDouble));
}
cvf::ref<cvf::DrawableGeo> geo = createGeo(triangleIndices, displayCoords);
cvf::ref<cvf::Part> part = new cvf::Part;
part->setDrawable(geo.p());
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN)), caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
part->setEffect(eff.p());
model->addPart(part.p());
cvf::Vec3d nodeCoordsDouble = static_cast<cvf::Vec3d>(nodeCoords[i]);
cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble);
displayCoords.push_back(static_cast<cvf::Vec3f>(displayCoordsDouble));
}
cvf::ref<cvf::DrawableGeo> geo = createGeo(triangleIndices, displayCoords);
m_part = new cvf::Part;
m_part->setDrawable(geo.p());
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN)), caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
m_part->setEffect(eff.p());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivWellFracturesPartMgr::createGeo(const std::vector<cvf::uint>& polygonIndices, const std::vector<cvf::Vec3f>& nodeCoords)
void RivWellFracturePartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform)
{
if (m_part.isNull())
{
updatePartGeometry(displayCoordTransform);
}
if (m_part.notNull())
{
model->addPart(m_part.p());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturePartMgr::clearGeometryCache()
{
m_part = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createGeo(const std::vector<cvf::uint>& polygonIndices, const std::vector<cvf::Vec3f>& nodeCoords)
{
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;

View File

@ -30,33 +30,36 @@ namespace cvf
{
class ModelBasicList;
class DrawableGeo;
class Part;
}
namespace caf
{
class DisplayCoordTransform;
}
class RimEclipseWell;
class RimFracture;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RivWellFracturesPartMgr : public cvf::Object
class RivWellFracturePartMgr : public cvf::Object
{
public:
RivWellFracturesPartMgr(RimEclipseWell* well);
~RivWellFracturesPartMgr();
RivWellFracturePartMgr(RimFracture* well);
~RivWellFracturePartMgr();
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
static void appendFracturePartsToModel(std::vector<RimFracture*> fractures, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform);
void appendGeometryPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform);
void clearGeometryCache();
private:
void updatePartGeometry(caf::DisplayCoordTransform* displayCoordTransform);
static cvf::ref<cvf::DrawableGeo> createGeo(const std::vector<cvf::uint>& polygonIndices, const std::vector<cvf::Vec3f>& nodeCoords);
private:
caf::PdmPointer<RimEclipseWell> m_rimWell;
caf::PdmPointer<RimFracture> m_rimFracture;
cvf::ref<cvf::Part> m_part;
};

View File

@ -30,7 +30,7 @@
#include "RimWellPathFractureCollection.h"
#include "RivPipeGeometryGenerator.h"
#include "RivWellFracturesPartMgr.h"
#include "RivWellFracturePartMgr.h"
#include "RivWellPathPartMgr.h"
#include "RivWellPathSourceInfo.h"
@ -90,19 +90,14 @@ RivWellPathPartMgr::~RivWellPathPartMgr()
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform)
{
// Append well path fractures
std::vector<RimFracture*> fractures;
for (RimWellPathFracture* f : m_rimWellPath->fractureCollection->fractures)
if (!m_rimWellPath) return;
for (RimWellPathFracture* f : m_rimWellPath->fractureCollection()->fractures())
{
if (!f->hasValidGeometry())
{
f->computeGeometry();
}
CVF_ASSERT(f);
fractures.push_back(f);
f->fracturePartManager()->appendGeometryPartsToModel(model, displayCoordTransform);
}
RivWellFracturesPartMgr::appendFracturePartsToModel(fractures, model, displayCoordTransform);
}
//--------------------------------------------------------------------------------------------------
@ -111,6 +106,8 @@ void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model,
void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox)
{
if (!m_rimWellPath) return;
RimWellPathCollection* wellPathCollection = NULL;
m_rimWellPath->firstAncestorOrThisOfType(wellPathCollection);
if (!wellPathCollection) return;
@ -257,12 +254,12 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform)
{
RimWellPathCollection* wellPathCollection = NULL;
if (!m_rimWellPath) return;
RimWellPathCollection* wellPathCollection = nullptr;
m_rimWellPath->firstAncestorOrThisOfType(wellPathCollection);
if (!wellPathCollection) return;
if (m_rimWellPath.isNull()) return;
if (wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF)
return;

View File

@ -45,6 +45,7 @@
#include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h"
#include "RimFlowDiagSolution.h"
#include "RimFracture.h"
#include "RimGridCollection.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
@ -60,15 +61,16 @@
#include "RiuSelectionManager.h"
#include "RiuViewer.h"
#include "RivReservoirFracturesPartMgr.h"
#include "RivReservoirPipesPartMgr.h"
#include "RivReservoirWellSpheresPartMgr.h"
#include "RivSingleCellPartGenerator.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathCollectionPartMgr.h"
#include "RivWellFracturePartMgr.h"
#include "cafCadNavigation.h"
#include "cafCeetronPlusNavigation.h"
#include "cafDisplayCoordTransform.h"
#include "cafFrameAnimationControl.h"
#include "cafPdmUiTreeOrdering.h"
@ -138,7 +140,6 @@ RimEclipseView::RimEclipseView()
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
m_pipesPartManager = new RivReservoirPipesPartMgr(this);
m_wellSpheresPartManager = new RivReservoirWellSpheresPartMgr(this);
m_simWellFracturesPartManager = new RivReservoirFracturesPartMgr(this);
m_reservoir = NULL;
}
@ -671,7 +672,15 @@ void RimEclipseView::updateCurrentTimeStep()
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
m_wellSpheresPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
m_simWellFracturesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
std::vector<RimFracture*> fractures;
this->descendantsIncludingThisOfType(fractures);
for (RimFracture* f : fractures)
{
f->fracturePartManager()->appendGeometryPartsToModel(wellPipeModelBasicList.p(), transForm.p());
}
wellPipeModelBasicList->updateBoundingBoxesRecursive();
@ -906,7 +915,6 @@ void RimEclipseView::schedulePipeGeometryRegen()
{
m_pipesPartManager->scheduleGeometryRegen();
m_wellSpheresPartManager->clearGeometryCache();
m_simWellFracturesPartManager->clearGeometryCache();
}
@ -1281,7 +1289,6 @@ void RimEclipseView::updateDisplayModelForWellResults()
m_reservoirGridPartManager->clearGeometryCache();
m_pipesPartManager->clearGeometryCache();
m_wellSpheresPartManager->clearGeometryCache();
m_simWellFracturesPartManager->clearGeometryCache();
syncronizeWellsWithResults();

View File

@ -59,7 +59,6 @@ class RiuViewer;
class RivReservoirPipesPartMgr;
class RivReservoirWellSpheresPartMgr;
class RivIntersectionPartMgr;
class RivReservoirFracturesPartMgr;
namespace cvf
{
@ -187,7 +186,6 @@ private:
cvf::ref<RivReservoirViewPartMgr> m_reservoirGridPartManager;
cvf::ref<RivReservoirPipesPartMgr> m_pipesPartManager;
cvf::ref<RivReservoirWellSpheresPartMgr> m_wellSpheresPartManager;
cvf::ref<RivReservoirFracturesPartMgr> m_simWellFracturesPartManager;
std::vector<RivCellSetEnum> m_visibleGridParts;
};

View File

@ -38,6 +38,8 @@
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
#include "custom-clipper/clipper/clipper.hpp"
#include "RivWellFracturePartMgr.h"
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimFracture, "Fracture");
@ -53,6 +55,8 @@ RimFracture::RimFracture(void)
m_rigFracture = new RigFracture;
m_recomputeGeometry = true;
m_rivFracture = new RivWellFracturePartMgr(this);
}
//--------------------------------------------------------------------------------------------------
@ -434,6 +438,8 @@ void RimFracture::calculateFracturePlaneCellPolygonOverlap(std::vector<std::vect
void RimFracture::setRecomputeGeometryFlag()
{
m_recomputeGeometry = true;
m_rivFracture->clearGeometryCache();
}
//--------------------------------------------------------------------------------------------------
@ -477,6 +483,16 @@ cvf::ref<RigFracture> RimFracture::attachedRigFracture() const
return m_rigFracture;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellFracturePartMgr* RimFracture::fracturePartManager()
{
CVF_ASSERT(m_rivFracture.notNull());
return m_rivFracture.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -30,6 +30,7 @@
class RimEllipseFractureTemplate;
class RigFracture;
class RivWellFracturePartMgr;
//==================================================================================================
///
@ -51,6 +52,8 @@ public:
virtual RimEllipseFractureTemplate* attachedFractureDefinition() = 0;
cvf::ref<RigFracture> attachedRigFracture() const;
RivWellFracturePartMgr* fracturePartManager();
bool hasValidGeometry() const;
void computeGeometry();
void setRecomputeGeometryFlag();
@ -78,8 +81,8 @@ private:
private:
cvf::ref<RigFracture> m_rigFracture;
bool m_recomputeGeometry;
cvf::ref<RivWellFracturePartMgr> m_rivFracture;
};