2017-01-04 01:10:02 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
#include "RivWellFracturePartMgr.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
2017-05-26 09:27:48 -05:00
|
|
|
#include "RigFractureGrid.h"
|
2017-06-27 06:19:21 -05:00
|
|
|
#include "RigMainGrid.h"
|
|
|
|
#include "RigHexIntersectionTools.h"
|
|
|
|
#include "RigCellGeometryTools.h"
|
2017-05-26 09:27:48 -05:00
|
|
|
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RigFractureCell.h"
|
2017-01-06 03:26:57 -06:00
|
|
|
#include "RimEclipseView.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
#include "RimFracture.h"
|
2017-06-27 06:19:21 -05:00
|
|
|
#include "RimFractureContainment.h"
|
2017-02-28 07:28:14 -06:00
|
|
|
#include "RimFractureTemplate.h"
|
2017-02-20 02:31:24 -06:00
|
|
|
#include "RimLegendConfig.h"
|
|
|
|
#include "RimStimPlanColors.h"
|
|
|
|
#include "RimStimPlanFractureTemplate.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-03-27 07:19:21 -05:00
|
|
|
#include "RivFaultGeometryGenerator.h"
|
2017-02-20 04:10:03 -06:00
|
|
|
#include "RivPartPriority.h"
|
2017-02-23 04:53:26 -06:00
|
|
|
#include "RivObjectSourceInfo.h"
|
2017-02-20 04:10:03 -06:00
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
#include "cafDisplayCoordTransform.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
#include "cafEffectGenerator.h"
|
|
|
|
|
|
|
|
#include "cvfDrawableGeo.h"
|
2017-06-27 06:19:21 -05:00
|
|
|
#include "cvfGeometryTools.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
#include "cvfModelBasicList.h"
|
|
|
|
#include "cvfPart.h"
|
|
|
|
#include "cvfPrimitiveSet.h"
|
2017-06-27 06:19:21 -05:00
|
|
|
#include "cvfPrimitiveSetDirect.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
#include "cvfPrimitiveSetIndexedUInt.h"
|
2017-02-14 03:29:25 -06:00
|
|
|
#include "cvfScalarMapperContinuousLinear.h"
|
2017-02-28 07:28:14 -06:00
|
|
|
#include "cvfRenderStateDepth.h"
|
2018-01-03 04:00:05 -06:00
|
|
|
#include "cvfAssert.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-06-27 06:19:21 -05:00
|
|
|
#include <array>
|
2017-01-04 01:10:02 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-19 00:28:04 -06:00
|
|
|
RivWellFracturePartMgr::RivWellFracturePartMgr(RimFracture* fracture)
|
|
|
|
: m_rimFracture(fracture)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-19 00:28:04 -06:00
|
|
|
RivWellFracturePartMgr::~RivWellFracturePartMgr()
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::Part> RivWellFracturePartMgr::createEllipseSurfacePart(const RimEclipseView& activeView)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
auto displayCoordTransform = activeView.displayCoordTransform();
|
|
|
|
if (displayCoordTransform.isNull()) return nullptr;
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
if (m_rimFracture)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2017-06-12 05:45:09 -05:00
|
|
|
std::vector<cvf::Vec3f> nodeCoords;
|
|
|
|
std::vector<cvf::uint> triangleIndices;
|
|
|
|
m_rimFracture->triangleGeometry(&triangleIndices, &nodeCoords);
|
2017-01-06 03:26:57 -06:00
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
std::vector<cvf::Vec3f> displayCoords;
|
|
|
|
|
2017-02-03 03:14:02 -06:00
|
|
|
for (size_t i = 0; i < nodeCoords.size(); i++)
|
2017-01-19 00:28:04 -06:00
|
|
|
{
|
|
|
|
cvf::Vec3d nodeCoordsDouble = static_cast<cvf::Vec3d>(nodeCoords[i]);
|
|
|
|
cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble);
|
|
|
|
displayCoords.push_back(static_cast<cvf::Vec3f>(displayCoordsDouble));
|
|
|
|
}
|
2017-01-06 03:26:57 -06:00
|
|
|
|
2018-01-12 05:40:45 -06:00
|
|
|
if (triangleIndices.empty() || displayCoords.empty())
|
2017-06-07 07:46:54 -05:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
return nullptr;
|
2017-06-07 07:46:54 -05:00
|
|
|
}
|
2017-01-06 03:26:57 -06:00
|
|
|
|
2017-06-22 07:55:16 -05:00
|
|
|
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triangleIndices, displayCoords);
|
2017-06-07 07:46:54 -05:00
|
|
|
CVF_ASSERT(geo.notNull());
|
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::Part> surfacePart = new cvf::Part(0, "FractureSurfacePart_ellipse");
|
|
|
|
surfacePart->setDrawable(geo.p());
|
|
|
|
surfacePart->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
|
|
|
|
|
|
|
cvf::Color4f fractureColor = cvf::Color4f(activeView.stimPlanColors->defaultColor());
|
|
|
|
caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1);
|
|
|
|
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
|
|
|
surfacePart->setEffect(eff.p());
|
|
|
|
|
|
|
|
return surfacePart;
|
2017-06-22 07:55:16 -05:00
|
|
|
}
|
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
return nullptr;
|
2017-06-22 07:55:16 -05:00
|
|
|
}
|
2017-01-19 00:28:04 -06:00
|
|
|
|
2017-06-27 06:19:21 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-12 10:21:28 -06:00
|
|
|
cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanColorInterpolatedSurfacePart(const RimEclipseView& activeView)
|
2017-06-27 06:19:21 -05:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
CVF_ASSERT(m_rimFracture);
|
|
|
|
RimStimPlanFractureTemplate* stimPlanFracTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->fractureTemplate());
|
|
|
|
CVF_ASSERT(stimPlanFracTemplate);
|
2017-06-27 06:19:21 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
auto displayCoordTransform = activeView.displayCoordTransform();
|
|
|
|
if (displayCoordTransform.isNull()) return nullptr;
|
|
|
|
|
|
|
|
// Note that the filtering and result mapping code below couples closely to the triangulation and vertex layout returned by triangleGeometry()
|
|
|
|
// If this ever changes, the entire code must be revisited
|
|
|
|
std::vector<cvf::Vec3f> nodeCoords;
|
|
|
|
std::vector<cvf::uint> triangleIndices;
|
|
|
|
m_rimFracture->triangleGeometry(&triangleIndices, &nodeCoords);
|
|
|
|
|
2018-01-12 05:40:45 -06:00
|
|
|
if (triangleIndices.empty() || nodeCoords.empty())
|
2018-01-03 04:00:05 -06:00
|
|
|
{
|
2018-01-12 05:40:45 -06:00
|
|
|
return nullptr;
|
2018-01-03 04:00:05 -06:00
|
|
|
}
|
2018-01-02 05:53:52 -06:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
// Transforms the node coordinates for display
|
|
|
|
for (size_t i = 0; i < nodeCoords.size(); i++)
|
2018-01-02 05:53:52 -06:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::Vec3d doubleCoord(nodeCoords[i]);
|
|
|
|
doubleCoord = displayCoordTransform->transformToDisplayCoord(doubleCoord);
|
|
|
|
nodeCoords[i] = cvf::Vec3f(doubleCoord);
|
2018-01-02 05:53:52 -06:00
|
|
|
}
|
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
|
|
|
|
RimLegendConfig* legendConfig = nullptr;
|
|
|
|
if (activeView.stimPlanColors() && activeView.stimPlanColors()->isChecked())
|
|
|
|
{
|
|
|
|
legendConfig = activeView.stimPlanColors()->activeLegend();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show selected result on the surface geometry and filter out triangles that have result values near 0
|
|
|
|
if (legendConfig)
|
|
|
|
{
|
|
|
|
// Construct array with per node result values that correspond to the node coordinates of the triangle mesh
|
|
|
|
// Since some time steps don't have result vales, we initialize the array to well known values before populating it
|
|
|
|
std::vector<double> perNodeResultValues(nodeCoords.size(), HUGE_VAL);
|
|
|
|
{
|
|
|
|
size_t idx = 0;
|
|
|
|
const std::vector<std::vector<double> > dataToPlot = stimPlanFracTemplate->resultValues(activeView.stimPlanColors->resultName(), activeView.stimPlanColors->unit(), stimPlanFracTemplate->activeTimeStepIndex());
|
|
|
|
for (const std::vector<double>& unmirroredDataAtDepth : dataToPlot)
|
|
|
|
{
|
|
|
|
const std::vector<double> mirroredValuesAtDepth = mirrorDataAtSingleDepth(unmirroredDataAtDepth);
|
|
|
|
for (double val : mirroredValuesAtDepth)
|
|
|
|
{
|
|
|
|
perNodeResultValues[idx++] = val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CVF_ASSERT(perNodeResultValues.size() == nodeCoords.size());
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<cvf::uint> triIndicesToInclude;
|
|
|
|
for (size_t i = 0; i < triangleIndices.size(); i += 6)
|
|
|
|
{
|
|
|
|
// Include all triangles where at least one of the vertices in the triangle pair has a value above threshold
|
|
|
|
bool includeThisTrianglePair = false;
|
|
|
|
for (size_t j = 0; j < 6; j++)
|
|
|
|
{
|
|
|
|
if (perNodeResultValues[triangleIndices[i + j]] > 1e-7)
|
|
|
|
{
|
|
|
|
includeThisTrianglePair = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (includeThisTrianglePair)
|
|
|
|
{
|
|
|
|
for (size_t j = 0; j < 6; j++)
|
|
|
|
{
|
|
|
|
triIndicesToInclude.push_back(triangleIndices[i + j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-12 05:40:45 -06:00
|
|
|
if (triIndicesToInclude.empty())
|
2018-01-03 04:00:05 -06:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triIndicesToInclude, nodeCoords);
|
|
|
|
cvf::ref<cvf::Part> surfacePart = new cvf::Part(0, "FractureSurfacePart_stimPlan");
|
|
|
|
surfacePart->setDrawable(geo.p());
|
|
|
|
surfacePart->setPriority(RivPartPriority::PartType::BaseLevel);
|
|
|
|
surfacePart->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
|
|
|
|
|
|
|
const cvf::ScalarMapper* scalarMapper = legendConfig->scalarMapper();
|
|
|
|
CVF_ASSERT(scalarMapper);
|
|
|
|
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray(nodeCoords.size());
|
|
|
|
textureCoords->setAll(cvf::Vec2f(0.5f, 1.0f));
|
|
|
|
for (size_t i = 0; i < perNodeResultValues.size(); i++)
|
|
|
|
{
|
|
|
|
const double val = perNodeResultValues[i];
|
|
|
|
if (val < HUGE_VAL && val == val)
|
|
|
|
{
|
|
|
|
textureCoords->set(i, scalarMapper->mapToTextureCoord(val));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
geo->setTextureCoordArray(textureCoords.p());
|
|
|
|
|
|
|
|
caf::ScalarMapperEffectGenerator effGen(scalarMapper, caf::PO_1);
|
|
|
|
effGen.disableLighting(activeView.isLightingDisabled());
|
|
|
|
cvf::ref<cvf::Effect> eff = effGen.generateCachedEffect();
|
|
|
|
surfacePart->setEffect(eff.p());
|
|
|
|
|
|
|
|
return surfacePart;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-12 10:21:28 -06:00
|
|
|
// No result is mapped, show the entire StimPlan surface with default color
|
|
|
|
|
|
|
|
return createSingleColorSurfacePart(triangleIndices, nodeCoords, activeView.stimPlanColors->defaultColor());
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
cvf::ref<cvf::Part> RivWellFracturePartMgr::createSingleColorSurfacePart(const std::vector<cvf::uint>& triangleIndices, const std::vector<cvf::Vec3f>& nodeCoords, const cvf::Color3f& color)
|
|
|
|
{
|
|
|
|
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triangleIndices, nodeCoords);
|
|
|
|
|
|
|
|
cvf::ref<cvf::Part> surfacePart = new cvf::Part(0, "FractureSurfacePart_stimPlan");
|
|
|
|
surfacePart->setDrawable(geo.p());
|
|
|
|
surfacePart->setPriority(RivPartPriority::PartType::BaseLevel);
|
|
|
|
surfacePart->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
|
|
|
|
|
|
|
cvf::Color4f fractureColor = cvf::Color4f(color);
|
|
|
|
caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1);
|
|
|
|
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
|
|
|
surfacePart->setEffect(eff.p());
|
|
|
|
|
|
|
|
return surfacePart;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanElementColorSurfacePart(const RimEclipseView& activeView)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(m_rimFracture);
|
|
|
|
RimStimPlanFractureTemplate* stimPlanFracTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->fractureTemplate());
|
|
|
|
CVF_ASSERT(stimPlanFracTemplate);
|
|
|
|
|
2018-01-15 01:58:51 -06:00
|
|
|
if (!stimPlanFracTemplate->fractureGrid()) return nullptr;
|
|
|
|
|
2018-01-12 10:21:28 -06:00
|
|
|
auto displayCoordTransform = activeView.displayCoordTransform();
|
|
|
|
if (displayCoordTransform.isNull()) return nullptr;
|
|
|
|
|
|
|
|
std::vector<cvf::Vec3f> stimPlanMeshVertices;
|
|
|
|
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray;
|
|
|
|
const cvf::ScalarMapper* scalarMapper = nullptr;
|
|
|
|
|
|
|
|
{
|
|
|
|
std::vector<RigFractureCell> stimPlanCells = stimPlanFracTemplate->fractureGrid()->fractureCells();
|
|
|
|
|
|
|
|
RimLegendConfig* legendConfig = nullptr;
|
|
|
|
if (activeView.stimPlanColors() &&
|
|
|
|
activeView.stimPlanColors()->isChecked() &&
|
|
|
|
activeView.stimPlanColors()->activeLegend())
|
|
|
|
{
|
|
|
|
legendConfig = activeView.stimPlanColors()->activeLegend();
|
|
|
|
|
|
|
|
scalarMapper = legendConfig->scalarMapper();
|
|
|
|
|
|
|
|
QString resultNameFromColors = activeView.stimPlanColors->resultName();
|
|
|
|
QString resultUnitFromColors = activeView.stimPlanColors->unit();
|
|
|
|
|
|
|
|
std::vector<double> prCellResults = stimPlanFracTemplate->fractureGridResults(resultNameFromColors,
|
|
|
|
resultUnitFromColors,
|
|
|
|
stimPlanFracTemplate->activeTimeStepIndex());
|
|
|
|
|
|
|
|
textureCoords->reserve(prCellResults.size() * 4);
|
|
|
|
|
|
|
|
for (size_t cIdx = 0; cIdx < stimPlanCells.size(); ++cIdx)
|
|
|
|
{
|
|
|
|
if (prCellResults[cIdx] > 1e-7)
|
|
|
|
{
|
|
|
|
const RigFractureCell& stimPlanCell = stimPlanCells[cIdx];
|
|
|
|
std::vector<cvf::Vec3d> stimPlanCellPolygon = stimPlanCell.getPolygon();
|
|
|
|
for (const cvf::Vec3d& cellCorner : stimPlanCellPolygon)
|
|
|
|
{
|
|
|
|
stimPlanMeshVertices.push_back(static_cast<cvf::Vec3f>(cellCorner));
|
|
|
|
textureCoords->add(scalarMapper->mapToTextureCoord(prCellResults[cIdx]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-01-03 04:00:05 -06:00
|
|
|
|
2018-01-12 10:21:28 -06:00
|
|
|
textureCoords->squeeze();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (const auto& stimPlanCell : stimPlanCells)
|
|
|
|
{
|
|
|
|
for (const auto& cellCorner : stimPlanCell.getPolygon())
|
|
|
|
{
|
|
|
|
stimPlanMeshVertices.push_back(static_cast<cvf::Vec3f>(cellCorner));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stimPlanMeshVertices.empty())
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
cvf::Mat4d fractureXf = m_rimFracture->transformMatrix();
|
|
|
|
std::vector<cvf::Vec3f> nodeDisplayCoords =
|
|
|
|
transformToFractureDisplayCoords(stimPlanMeshVertices, fractureXf, *displayCoordTransform);
|
|
|
|
|
|
|
|
std::vector<cvf::uint> triIndicesToInclude;
|
|
|
|
|
|
|
|
size_t cellCount = stimPlanMeshVertices.size() / 4;
|
|
|
|
for (cvf::uint i = 0; i < cellCount; i++)
|
|
|
|
{
|
|
|
|
triIndicesToInclude.push_back(i * 4 + 0);
|
|
|
|
triIndicesToInclude.push_back(i * 4 + 1);
|
|
|
|
triIndicesToInclude.push_back(i * 4 + 2);
|
|
|
|
|
|
|
|
triIndicesToInclude.push_back(i * 4 + 0);
|
|
|
|
triIndicesToInclude.push_back(i * 4 + 2);
|
|
|
|
triIndicesToInclude.push_back(i * 4 + 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show selected result on the surface geometry and filter out triangles that have result values near 0
|
|
|
|
if (scalarMapper)
|
|
|
|
{
|
|
|
|
if (triIndicesToInclude.empty())
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
cvf::ref<cvf::DrawableGeo> geo = buildDrawableGeoFromTriangles(triIndicesToInclude, nodeDisplayCoords);
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::Part> surfacePart = new cvf::Part(0, "FractureSurfacePart_stimPlan");
|
|
|
|
surfacePart->setDrawable(geo.p());
|
|
|
|
surfacePart->setPriority(RivPartPriority::PartType::BaseLevel);
|
|
|
|
surfacePart->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
|
|
|
|
2018-01-12 10:21:28 -06:00
|
|
|
geo->setTextureCoordArray(textureCoords.p());
|
|
|
|
|
|
|
|
caf::ScalarMapperEffectGenerator effGen(scalarMapper, caf::PO_1);
|
|
|
|
effGen.disableLighting(activeView.isLightingDisabled());
|
|
|
|
cvf::ref<cvf::Effect> eff = effGen.generateCachedEffect();
|
2018-01-03 04:00:05 -06:00
|
|
|
surfacePart->setEffect(eff.p());
|
|
|
|
|
|
|
|
return surfacePart;
|
|
|
|
}
|
2018-01-12 10:21:28 -06:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// No result is mapped, show the entire StimPlan surface with default color
|
2018-01-03 04:00:05 -06:00
|
|
|
|
2018-01-12 10:21:28 -06:00
|
|
|
return createSingleColorSurfacePart(triIndicesToInclude, nodeDisplayCoords, activeView.stimPlanColors->defaultColor());
|
|
|
|
}
|
|
|
|
}
|
2018-01-03 04:00:05 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
cvf::ref<cvf::Part> RivWellFracturePartMgr::createContainmentMaskPart(const RimEclipseView& activeView)
|
|
|
|
{
|
|
|
|
std::vector<cvf::Vec3f> borderPolygonLocalCS = m_rimFracture->fractureTemplate()->fractureBorderPolygon(m_rimFracture->fractureUnit());
|
|
|
|
cvf::Mat4d frMx = m_rimFracture->transformMatrix();
|
|
|
|
|
|
|
|
cvf::BoundingBox frBBox;
|
|
|
|
std::vector<cvf::Vec3d> borderPolygonGlobCs;
|
|
|
|
std::vector<cvf::Vec3d> borderPolygonLocalCsd;
|
2017-06-27 06:19:21 -05:00
|
|
|
for (const auto& pv: borderPolygonLocalCS)
|
|
|
|
{
|
|
|
|
cvf::Vec3d pvd(pv);
|
|
|
|
borderPolygonLocalCsd.push_back(pvd);
|
|
|
|
pvd.transformPoint(frMx);
|
|
|
|
borderPolygonGlobCs.push_back(pvd);
|
|
|
|
frBBox.add(pvd);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<size_t> cellCandidates;
|
2018-01-03 04:00:05 -06:00
|
|
|
activeView.mainGrid()->findIntersectingCells(frBBox, &cellCandidates);
|
2017-06-27 06:19:21 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
auto displCoordTrans = activeView.displayCoordTransform();
|
2017-06-27 06:19:21 -05:00
|
|
|
|
|
|
|
std::vector<cvf::Vec3f> maskTriangles;
|
|
|
|
|
|
|
|
for (size_t resCellIdx : cellCandidates)
|
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
if (!m_rimFracture->isEclipseCellWithinContainment(activeView.mainGrid(), resCellIdx))
|
2017-06-27 06:19:21 -05:00
|
|
|
{
|
2017-08-08 03:27:45 -05:00
|
|
|
// Calculate Eclipse cell intersection with fracture plane
|
2017-06-27 06:19:21 -05:00
|
|
|
|
|
|
|
std::array<cvf::Vec3d,8> corners;
|
2018-01-03 04:00:05 -06:00
|
|
|
activeView.mainGrid()->cellCornerVertices(resCellIdx, corners.data());
|
2017-06-27 06:19:21 -05:00
|
|
|
|
|
|
|
std::vector<std::vector<cvf::Vec3d> > eclCellPolygons;
|
|
|
|
bool hasIntersection = RigHexIntersectionTools::planeHexIntersectionPolygons(corners, frMx, eclCellPolygons);
|
|
|
|
|
|
|
|
if (!hasIntersection || eclCellPolygons.empty()) continue;
|
|
|
|
|
|
|
|
// Transform eclCell - plane intersection onto fracture
|
|
|
|
|
|
|
|
cvf::Mat4d invertedTransformMatrix = frMx.getInverted();
|
|
|
|
for ( std::vector<cvf::Vec3d>& eclCellPolygon : eclCellPolygons )
|
|
|
|
{
|
|
|
|
for ( cvf::Vec3d& v : eclCellPolygon )
|
|
|
|
{
|
|
|
|
v.transformPoint(invertedTransformMatrix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cvf::Vec3d fractureNormal = cvf::Vec3d(frMx.col(2));
|
|
|
|
cvf::Vec3d maskOffset = fractureNormal * 0.01 * frBBox.radius();
|
|
|
|
for (const std::vector<cvf::Vec3d>& eclCellPolygon : eclCellPolygons)
|
|
|
|
{
|
|
|
|
// Clip Eclipse cell polygon with fracture border
|
|
|
|
|
|
|
|
std::vector< std::vector<cvf::Vec3d> > clippedPolygons = RigCellGeometryTools::intersectPolygons(eclCellPolygon,
|
|
|
|
borderPolygonLocalCsd);
|
|
|
|
for (auto& clippedPolygon : clippedPolygons)
|
|
|
|
{
|
|
|
|
for (auto& v: clippedPolygon)
|
|
|
|
{
|
|
|
|
v.transformPoint(frMx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create triangles from the clipped polygons
|
|
|
|
|
|
|
|
for (auto& clippedPolygon : clippedPolygons)
|
|
|
|
{
|
|
|
|
cvf::EarClipTesselator tess;
|
|
|
|
tess.setNormal(fractureNormal);
|
|
|
|
cvf::Vec3dArray cvfNodes(clippedPolygon);
|
|
|
|
tess.setGlobalNodeArray(cvfNodes);
|
|
|
|
std::vector<size_t> polyIndexes;
|
|
|
|
for (size_t idx = 0; idx < clippedPolygon.size(); ++idx) polyIndexes.push_back(idx);
|
|
|
|
tess.setPolygonIndices(polyIndexes);
|
|
|
|
|
|
|
|
std::vector<size_t> triangleIndices;
|
|
|
|
tess.calculateTriangles(&triangleIndices);
|
|
|
|
|
|
|
|
for (size_t idx: triangleIndices)
|
|
|
|
{
|
|
|
|
maskTriangles.push_back( cvf::Vec3f( displCoordTrans->transformToDisplayCoord(clippedPolygon[idx] + maskOffset)) );
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t idx: triangleIndices)
|
|
|
|
{
|
|
|
|
maskTriangles.push_back( cvf::Vec3f( displCoordTrans->transformToDisplayCoord(clippedPolygon[idx] - maskOffset)) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( maskTriangles.size() >= 3 )
|
|
|
|
{
|
|
|
|
cvf::ref<cvf::DrawableGeo> maskTriangleGeo = new cvf::DrawableGeo;
|
|
|
|
maskTriangleGeo->setVertexArray(new cvf::Vec3fArray(maskTriangles));
|
|
|
|
|
|
|
|
cvf::ref<cvf::PrimitiveSetDirect> primitives = new cvf::PrimitiveSetDirect(cvf::PT_TRIANGLES);
|
|
|
|
primitives->setIndexCount(maskTriangles.size());
|
|
|
|
maskTriangleGeo->addPrimitiveSet(primitives.p());
|
|
|
|
maskTriangleGeo->computeNormals();
|
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::Part> containmentMaskPart = new cvf::Part(0, "FractureContainmentMaskPart");
|
|
|
|
containmentMaskPart->setDrawable(maskTriangleGeo.p());
|
|
|
|
containmentMaskPart->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
2017-06-27 06:19:21 -05:00
|
|
|
|
|
|
|
cvf::Color4f maskColor = cvf::Color4f(cvf::Color3f(cvf::Color3::GRAY));
|
|
|
|
|
|
|
|
caf::SurfaceEffectGenerator surfaceGen(maskColor, caf::PO_NONE);
|
|
|
|
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
2018-01-03 04:00:05 -06:00
|
|
|
containmentMaskPart->setEffect(eff.p());
|
2017-02-23 03:15:56 -06:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
return containmentMaskPart;
|
2017-01-06 03:26:57 -06:00
|
|
|
}
|
2017-02-15 08:49:53 -06:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
return nullptr;
|
2017-02-28 07:28:14 -06:00
|
|
|
}
|
|
|
|
|
2017-03-16 06:02:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::Part> RivWellFracturePartMgr::createStimPlanMeshPart(const RimEclipseView& activeView)
|
2017-03-16 06:02:07 -05:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
if (!m_rimFracture->fractureTemplate()) return nullptr;
|
2017-03-16 06:02:07 -05:00
|
|
|
|
2017-06-09 10:21:59 -05:00
|
|
|
RimStimPlanFractureTemplate* stimPlanFracTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->fractureTemplate());
|
2018-01-03 04:00:05 -06:00
|
|
|
if (!stimPlanFracTemplate) return nullptr;
|
2017-03-16 06:02:07 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::DrawableGeo> stimPlanMeshGeo = createStimPlanMeshDrawable(stimPlanFracTemplate, activeView);
|
2017-06-07 07:46:54 -05:00
|
|
|
if (stimPlanMeshGeo.notNull())
|
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::Part> stimPlanMeshPart = new cvf::Part(0, "StimPlanMesh");
|
|
|
|
stimPlanMeshPart->setDrawable(stimPlanMeshGeo.p());
|
2017-03-16 06:02:07 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
stimPlanMeshPart->updateBoundingBox();
|
|
|
|
stimPlanMeshPart->setPriority(RivPartPriority::PartType::TransparentMeshLines);
|
2017-03-16 06:02:07 -05:00
|
|
|
|
2017-06-07 07:46:54 -05:00
|
|
|
caf::MeshEffectGenerator lineEffGen(cvf::Color3::BLACK);
|
|
|
|
lineEffGen.setLineWidth(1.0f);
|
|
|
|
cvf::ref<cvf::Effect> eff = lineEffGen.generateCachedEffect();
|
2017-03-16 06:02:07 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
stimPlanMeshPart->setEffect(eff.p());
|
|
|
|
|
|
|
|
return stimPlanMeshPart;
|
2017-06-07 07:46:54 -05:00
|
|
|
}
|
2018-01-03 04:00:05 -06:00
|
|
|
|
|
|
|
return nullptr;
|
2017-03-16 06:02:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, const RimEclipseView& activeView) const
|
2017-03-16 06:02:07 -05:00
|
|
|
{
|
2017-04-07 05:41:06 -05:00
|
|
|
//TODO: This is needed to avoid errors when loading project with stimPlan fractures with multipled timesteps.
|
|
|
|
//Should probably be moved, since it now is called twice in some cases...
|
2017-06-13 04:38:22 -05:00
|
|
|
stimPlanFracTemplate->updateFractureGrid();
|
2017-04-07 03:17:17 -05:00
|
|
|
|
2018-01-15 01:58:51 -06:00
|
|
|
if (!stimPlanFracTemplate->fractureGrid()) return nullptr;
|
2018-01-03 04:00:05 -06:00
|
|
|
|
|
|
|
auto displayCoordTransform = activeView.displayCoordTransform();
|
|
|
|
if (displayCoordTransform.isNull()) return nullptr;
|
|
|
|
|
2017-05-30 07:57:21 -05:00
|
|
|
std::vector<RigFractureCell> stimPlanCells = stimPlanFracTemplate->fractureGrid()->fractureCells();
|
2017-03-16 06:02:07 -05:00
|
|
|
std::vector<cvf::Vec3f> stimPlanMeshVertices;
|
2017-03-20 04:38:58 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
QString resultNameFromColors = activeView.stimPlanColors->resultName();
|
|
|
|
QString resultUnitFromColors = activeView.stimPlanColors->unit();
|
2017-06-26 03:28:23 -05:00
|
|
|
|
|
|
|
std::vector<double> prCellResults = stimPlanFracTemplate->fractureGridResults(resultNameFromColors,
|
|
|
|
resultUnitFromColors,
|
|
|
|
stimPlanFracTemplate->activeTimeStepIndex());
|
|
|
|
|
|
|
|
for ( size_t cIdx = 0; cIdx < stimPlanCells.size() ; ++cIdx)
|
2017-03-16 06:02:07 -05:00
|
|
|
{
|
2017-06-26 03:28:23 -05:00
|
|
|
if (prCellResults[cIdx] > 1e-7)
|
2017-03-16 06:02:07 -05:00
|
|
|
{
|
2017-06-26 03:28:23 -05:00
|
|
|
const RigFractureCell& stimPlanCell = stimPlanCells[cIdx];
|
2017-04-06 02:34:38 -05:00
|
|
|
std::vector<cvf::Vec3d> stimPlanCellPolygon = stimPlanCell.getPolygon();
|
2018-01-12 05:40:45 -06:00
|
|
|
for (const cvf::Vec3d& cellCorner : stimPlanCellPolygon)
|
2017-03-16 06:02:07 -05:00
|
|
|
{
|
2017-03-20 04:38:58 -05:00
|
|
|
stimPlanMeshVertices.push_back(static_cast<cvf::Vec3f>(cellCorner));
|
2017-03-16 06:02:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-12 05:40:45 -06:00
|
|
|
if (stimPlanMeshVertices.empty())
|
2017-06-07 07:46:54 -05:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-06-25 03:36:15 -05:00
|
|
|
cvf::Mat4d fractureXf = m_rimFracture->transformMatrix();
|
2018-01-03 04:00:05 -06:00
|
|
|
std::vector<cvf::Vec3f> stimPlanMeshVerticesDisplayCoords = transformToFractureDisplayCoords(stimPlanMeshVertices,
|
2017-06-25 03:36:15 -05:00
|
|
|
fractureXf,
|
2018-01-03 04:00:05 -06:00
|
|
|
*displayCoordTransform);
|
2017-03-16 06:02:07 -05:00
|
|
|
|
|
|
|
cvf::Vec3fArray* stimPlanMeshVertexList;
|
|
|
|
stimPlanMeshVertexList = new cvf::Vec3fArray;
|
|
|
|
stimPlanMeshVertexList->assign(stimPlanMeshVerticesDisplayCoords);
|
|
|
|
|
|
|
|
cvf::ref<cvf::DrawableGeo> stimPlanMeshGeo = new cvf::DrawableGeo;
|
|
|
|
stimPlanMeshGeo->setVertexArray(stimPlanMeshVertexList);
|
|
|
|
cvf::ref<cvf::UIntArray> indices = RivFaultGeometryGenerator::lineIndicesFromQuadVertexArray(stimPlanMeshVertexList);
|
|
|
|
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt(cvf::PT_LINES);
|
|
|
|
prim->setIndices(indices.p());
|
|
|
|
|
|
|
|
stimPlanMeshGeo->addPrimitiveSet(prim.p());
|
|
|
|
|
|
|
|
return stimPlanMeshGeo;
|
|
|
|
}
|
|
|
|
|
2017-03-16 08:53:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-03 04:00:05 -06:00
|
|
|
std::vector<cvf::Vec3f> RivWellFracturePartMgr::transformToFractureDisplayCoords(const std::vector<cvf::Vec3f>& coordinatesVector,
|
2017-06-23 03:16:39 -05:00
|
|
|
cvf::Mat4d m,
|
2018-01-03 04:00:05 -06:00
|
|
|
const caf::DisplayCoordTransform& displayCoordTransform)
|
2017-03-16 06:02:07 -05:00
|
|
|
{
|
|
|
|
std::vector<cvf::Vec3f> polygonInDisplayCoords;
|
2017-06-23 03:16:39 -05:00
|
|
|
polygonInDisplayCoords.reserve(coordinatesVector.size());
|
|
|
|
|
|
|
|
for (const cvf::Vec3f& v : coordinatesVector)
|
2017-03-16 06:02:07 -05:00
|
|
|
{
|
2017-06-23 03:16:39 -05:00
|
|
|
cvf::Vec3d vd(v);
|
|
|
|
vd.transformPoint(m);
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::Vec3d displayCoordsDouble = displayCoordTransform.transformToDisplayCoord(vd);
|
2017-06-23 03:16:39 -05:00
|
|
|
polygonInDisplayCoords.push_back(cvf::Vec3f(displayCoordsDouble));
|
2017-03-16 06:02:07 -05:00
|
|
|
}
|
2017-06-07 07:46:54 -05:00
|
|
|
|
2017-03-16 06:02:07 -05:00
|
|
|
return polygonInDisplayCoords;
|
|
|
|
}
|
|
|
|
|
2017-02-15 08:14:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<double> RivWellFracturePartMgr::mirrorDataAtSingleDepth(std::vector<double> depthData)
|
|
|
|
{
|
|
|
|
std::vector<double> mirroredValuesAtGivenDepth;
|
|
|
|
mirroredValuesAtGivenDepth.push_back(depthData[0]);
|
2017-06-09 08:55:47 -05:00
|
|
|
for (size_t i = 1; i < (depthData.size()); i++) //starting at 1 since we don't want center value twice
|
2017-02-15 08:14:16 -06:00
|
|
|
{
|
|
|
|
double valueAtGivenX = depthData[i];
|
|
|
|
mirroredValuesAtGivenDepth.insert(mirroredValuesAtGivenDepth.begin(), valueAtGivenX);
|
|
|
|
mirroredValuesAtGivenDepth.push_back(valueAtGivenX);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mirroredValuesAtGivenDepth;
|
|
|
|
}
|
|
|
|
|
2017-01-04 01:10:02 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-03 04:00:05 -06:00
|
|
|
void RivWellFracturePartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, const RimEclipseView& eclView)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2018-01-15 02:23:20 -06:00
|
|
|
if (!m_rimFracture->isChecked() || !eclView.stimPlanColors->isChecked()) return;
|
2017-02-22 06:29:20 -06:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::Part> surfacePart;
|
|
|
|
cvf::ref<cvf::Part> stimPlanMeshPart;
|
|
|
|
cvf::ref<cvf::Part> containmentMaskPart;
|
|
|
|
|
|
|
|
|
2017-06-22 07:55:16 -05:00
|
|
|
RimStimPlanFractureTemplate* stimPlanFracTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->fractureTemplate());
|
2018-01-03 04:00:05 -06:00
|
|
|
if (m_rimFracture->fractureTemplate())
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
// StimPlan
|
|
|
|
if (stimPlanFracTemplate)
|
2017-02-15 08:14:16 -06:00
|
|
|
{
|
2018-01-12 10:21:28 -06:00
|
|
|
if (m_rimFracture->stimPlanResultColorType() == RimFracture::SINGLE_ELEMENT_COLOR)
|
|
|
|
{
|
|
|
|
surfacePart = createStimPlanElementColorSurfacePart(eclView);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
surfacePart = createStimPlanColorInterpolatedSurfacePart(eclView);
|
|
|
|
}
|
2017-03-16 06:02:07 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
if (stimPlanFracTemplate->showStimPlanMesh())
|
2017-02-15 08:14:16 -06:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
stimPlanMeshPart = createStimPlanMeshPart(eclView);
|
2017-02-15 08:14:16 -06:00
|
|
|
}
|
2018-01-03 04:00:05 -06:00
|
|
|
}
|
|
|
|
// Ellipse
|
|
|
|
else
|
|
|
|
{
|
|
|
|
surfacePart = createEllipseSurfacePart(eclView);
|
|
|
|
}
|
2017-06-27 06:19:21 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
if (m_rimFracture->fractureTemplate()->fractureContainment()->isEnabled())
|
|
|
|
{
|
|
|
|
containmentMaskPart = createContainmentMaskPart(eclView);
|
2017-02-15 08:14:16 -06:00
|
|
|
}
|
2017-01-19 00:28:04 -06:00
|
|
|
}
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-06-07 04:17:56 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
if (surfacePart.notNull())
|
2017-06-22 07:55:16 -05:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
model->addPart(surfacePart.p());
|
2017-06-22 07:55:16 -05:00
|
|
|
}
|
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
if (stimPlanMeshPart.notNull())
|
2017-02-28 07:28:14 -06:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
model->addPart(stimPlanMeshPart.p());
|
2017-02-28 07:28:14 -06:00
|
|
|
}
|
2017-06-27 06:19:21 -05:00
|
|
|
|
2018-01-03 04:00:05 -06:00
|
|
|
if (containmentMaskPart.notNull())
|
2017-06-27 06:19:21 -05:00
|
|
|
{
|
2018-01-03 04:00:05 -06:00
|
|
|
model->addPart(containmentMaskPart.p());
|
2017-06-27 06:19:21 -05:00
|
|
|
}
|
2017-01-04 01:10:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-03 04:00:05 -06:00
|
|
|
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::buildDrawableGeoFromTriangles(const std::vector<cvf::uint>& triangleIndices, const std::vector<cvf::Vec3f>& nodeCoords)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2017-06-07 07:46:54 -05:00
|
|
|
CVF_ASSERT(triangleIndices.size() > 0);
|
|
|
|
CVF_ASSERT(nodeCoords.size() > 0);
|
|
|
|
|
2017-01-04 01:10:02 -06:00
|
|
|
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
|
|
|
|
2017-02-14 03:29:25 -06:00
|
|
|
cvf::ref<cvf::UIntArray> indices = new cvf::UIntArray(triangleIndices);
|
2017-01-04 01:10:02 -06:00
|
|
|
cvf::ref<cvf::Vec3fArray> vertices = new cvf::Vec3fArray(nodeCoords);
|
|
|
|
|
|
|
|
geo->setVertexArray(vertices.p());
|
|
|
|
geo->addPrimitiveSet(new cvf::PrimitiveSetIndexedUInt(cvf::PT_TRIANGLES, indices.p()));
|
2017-01-11 01:02:23 -06:00
|
|
|
geo->computeNormals();
|
2017-01-04 01:10:02 -06:00
|
|
|
|
|
|
|
return geo;
|
|
|
|
}
|
|
|
|
|
2017-03-16 06:02:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-06-25 03:36:15 -05:00
|
|
|
bool RivWellFracturePartMgr::stimPlanCellTouchesPolygon(const std::vector<cvf::Vec3f>& polygon,
|
|
|
|
double xMin, double xMax, double yMin, double yMax,
|
|
|
|
float polygonXmin, float polygonXmax, float polygonYmin, float polygonYmax)
|
2017-03-16 06:02:07 -05:00
|
|
|
{
|
2017-03-16 08:53:44 -05:00
|
|
|
|
|
|
|
if (static_cast<float>(xMin) > polygonXmin && static_cast<float>(xMax) < polygonXmax)
|
|
|
|
{
|
|
|
|
if (static_cast<float>(yMin) > polygonYmin && static_cast<float>(yMax) < polygonYmax)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-16 06:02:07 -05:00
|
|
|
for (cvf::Vec3f v : polygon)
|
|
|
|
{
|
|
|
|
if (v.x() > xMin && v.x() < xMax)
|
|
|
|
{
|
|
|
|
if (v.y() > yMin && v.y() < yMax)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|