Skip to content

Commit

Permalink
#1040 Established basis for fracture visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Jan 4, 2017
1 parent f8ef9bd commit d1bf189
Show file tree
Hide file tree
Showing 17 changed files with 491 additions and 12 deletions.
4 changes: 4 additions & 0 deletions ApplicationCode/ModelVisualization/CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ${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
Expand All @@ -36,6 +37,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
)

set (SOURCE_GROUP_SOURCE_FILES
Expand All @@ -51,6 +53,7 @@ ${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
Expand All @@ -68,6 +71,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
)

list(APPEND CODE_HEADER_FILES
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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

}

48 changes: 48 additions & 0 deletions ApplicationCode/ModelVisualization/RivReservoirFracturesPartMgr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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;
};
112 changes: 112 additions & 0 deletions ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RivWellFracturesPartMgr.h"

#include "RimEclipseWell.h"
#include "RimFracture.h"

#include "cafEffectGenerator.h"

#include "cvfDrawableGeo.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfPrimitiveSet.h"
#include "cvfPrimitiveSetIndexedUInt.h"


//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellFracturesPartMgr::RivWellFracturesPartMgr(RimEclipseWell* well)
{
m_rimWell = well;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellFracturesPartMgr::~RivWellFracturesPartMgr()
{

}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
if (!m_rimWell) return;

std::vector<RimFracture*> fractures;
m_rimWell->descendantsIncludingThisOfType(fractures);

for (RimFracture* fracture : fractures)
{
if (!fracture->hasValidGeometry())
{
fracture->computeGeometry();
}
}

appendFracturePartsToModel(fractures, model);
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturesPartMgr::appendFracturePartsToModel(std::vector<RimFracture*> fractures, cvf::ModelBasicList* model)
{
for (RimFracture* fracture : fractures)
{
if (fracture->hasValidGeometry())
{
const std::vector<cvf::Vec3f>& nodeCoords = fracture->nodeCoords();
const std::vector<cvf::uint>& polygonIndices = fracture->polygonIndices();

cvf::ref<cvf::DrawableGeo> geo = createGeo(polygonIndices, nodeCoords);

cvf::ref<cvf::Part> part = new cvf::Part;
part->setDrawable(geo.p());

caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), 0.5), caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();

part->setEffect(eff.p());

model->addPart(part.p());
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivWellFracturesPartMgr::createGeo(const std::vector<cvf::uint>& polygonIndices, const std::vector<cvf::Vec3f>& nodeCoords)
{
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;

cvf::ref<cvf::UIntArray> indices = new cvf::UIntArray(polygonIndices);
cvf::ref<cvf::Vec3fArray> vertices = new cvf::Vec3fArray(nodeCoords);

geo->setVertexArray(vertices.p());
geo->addPrimitiveSet(new cvf::PrimitiveSetIndexedUInt(cvf::PT_TRIANGLES, indices.p()));

return geo;
}

57 changes: 57 additions & 0 deletions ApplicationCode/ModelVisualization/RivWellFracturesPartMgr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cvfVector3.h"

#include "cafPdmPointer.h"

#include <vector>

namespace cvf
{
class ModelBasicList;
class DrawableGeo;
}

class RimEclipseWell;
class RimFracture;


//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RivWellFracturesPartMgr : public cvf::Object
{
public:
RivWellFracturesPartMgr(RimEclipseWell* well);
~RivWellFracturesPartMgr();

void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);

static void appendFracturePartsToModel(std::vector<RimFracture*> fractures, cvf::ModelBasicList* model);

private:
static cvf::ref<cvf::DrawableGeo> createGeo(const std::vector<cvf::uint>& polygonIndices, const std::vector<cvf::Vec3f>& nodeCoords);

private:
caf::PdmPointer<RimEclipseWell> m_rimWell;
};
29 changes: 27 additions & 2 deletions ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@
/////////////////////////////////////////////////////////////////////////////////


#include "RivWellPathPartMgr.h"

#include "RiaApplication.h"

#include "RigWellPath.h"

#include "RimFracture.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"

#include "RivPipeGeometryGenerator.h"
#include "RivWellFracturesPartMgr.h"
#include "RivWellPathPartMgr.h"
#include "RivWellPathSourceInfo.h"

#include "cafEffectGenerator.h"
Expand Down Expand Up @@ -81,6 +84,26 @@ RivWellPathPartMgr::~RivWellPathPartMgr()
clearAllBranchData();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendFracturePartsToModel(cvf::ModelBasicList* model)
{
// Append well path fractures
std::vector<RimFracture*> fractures;
for (RimWellPathFracture* f : m_rimWellPath->fractureCollection->fractures)
{
if (!f->hasValidGeometry())
{
f->computeGeometry();
}

fractures.push_back(f);
}

RivWellFracturesPartMgr::appendFracturePartsToModel(fractures, model);
}

//--------------------------------------------------------------------------------------------------
/// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -265,6 +288,8 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
{
model->addPart(m_wellLabelPart.p());
}

appendFracturePartsToModel(model);
}

//--------------------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit d1bf189

Please sign in to comment.