Merge branch 'dev' into hdf-prototype

This commit is contained in:
Magne Sjaastad
2017-08-14 10:47:44 +02:00
443 changed files with 20467 additions and 3429 deletions

View File

@@ -19,10 +19,11 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h
${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivCompletionTypeResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivDefaultResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivTernaryResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.h
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper.h
@@ -35,8 +36,9 @@ ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h
${CEE_CURRENT_LIST_DIR}RivPartPriority.h
${CEE_CURRENT_LIST_DIR}RivObjectSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivFishbonesSubsPartMgr.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -54,7 +56,6 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.cpp
@@ -67,7 +68,9 @@ ${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}RivObjectSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivFishbonesSubsPartMgr.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -94,7 +94,6 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
RimEclipseCellColors* cellResultColors = eclipseView->cellResult();
CVF_ASSERT(cellResultColors);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
// CrossSections
@@ -121,7 +120,7 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
cvf::ref<RigResultAccessor> resultAccessor;
if (RimDefines::isPerCellFaceResult(cellResultColors->resultVariable()))
if (RiaDefines::isPerCellFaceResult(cellResultColors->resultVariable()))
{
resultAccessor = new RigHugeValResultAccessor;
}

View File

@@ -102,7 +102,6 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
RimEclipseCellColors* cellResultColors = eclipseView->cellResult();
CVF_ASSERT(cellResultColors);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
// CrossSections
@@ -129,7 +128,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
cvf::ref<RigResultAccessor> resultAccessor;
if (RimDefines::isPerCellFaceResult(cellResultColors->resultVariable()))
if (RiaDefines::isPerCellFaceResult(cellResultColors->resultVariable()))
{
resultAccessor = new RigHugeValResultAccessor;
}

View File

@@ -299,8 +299,6 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeResultAccess
{
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
if (cellEdgeResultColors->propertyType() == RimCellEdgeColors::ANY_SINGLE_PROPERTY)
{
cvf::ref<RigResultAccessor> daObj = RivCellEdgeGeometryUtils::createCellCenterResultAccessor(cellEdgeResultColors->singleVarEdgeResultColors(), timeStepIndex, eclipseCase, grid);
@@ -327,6 +325,7 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeResultAccess
adjustedTimeStep = 0;
}
RiaDefines::PorosityModelType porosityModel = cellResultColors->porosityModel();
cvf::ref<RigResultAccessor> daObj = RigResultAccessorFactory::createFromResultIdx(eclipseCase, grid->gridIndex(), porosityModel, adjustedTimeStep, resultIndices[cubeFaceIdx]);
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
}

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// 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 "RivResultToTextureMapper.h"
#include "RigPipeInCellEvaluator.h"
#include "cvfVector2.h"
#include "cvfScalarMapper.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfStructGrid.h"
#include <cmath>
class RivCompletionTypeResultToTextureMapper : public RivResultToTextureMapper
{
public:
using RivResultToTextureMapper::RivResultToTextureMapper;
cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const
{
cvf::Vec2f texCoord(0, 0);
if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's
{
if (m_pipeInCellEvaluator->isWellPipeInCell(cellIndex))
{
texCoord[1] = 0.5f;
}
else
{
texCoord[1] = 1.0f;
}
return texCoord;
}
texCoord = m_scalarMapper->mapToTextureCoord(resultValue);
texCoord[1] = 0.5f;
return texCoord;
}
};

View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// 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 "RigPipeInCellEvaluator.h"
#include "RivResultToTextureMapper.h"
#include "cvfVector2.h"
#include "cvfScalarMapper.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfStructGrid.h"
#include <cmath>
class RivDefaultResultToTextureMapper : public RivResultToTextureMapper
{
public:
using RivResultToTextureMapper::RivResultToTextureMapper;
cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const
{
cvf::Vec2f texCoord(0,0);
if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's
{
texCoord[1] = 1.0f;
return texCoord;
}
texCoord = m_scalarMapper->mapToTextureCoord(resultValue);
if (!m_pipeInCellEvaluator->isWellPipeInCell(cellIndex))
{
texCoord[1] = 0; // Set the Y texture coordinate to the opaque line in the texture
}
return texCoord;
}
};

View File

@@ -105,7 +105,6 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
updateNNCColors(timeStepIndex, cellResultColors);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RimEclipseView* eclipseView = cellResultColors->reservoirView();
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
@@ -664,7 +663,7 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors
if (showNncsWithScalarMappedColor)
{
size_t scalarSetIndex = cellResultColors->scalarResultIndex();
RimDefines::ResultCatType resultType = cellResultColors->resultType();
RiaDefines::ResultCatType resultType = cellResultColors->resultType();
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();

View File

@@ -0,0 +1,114 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RivFishbonesSubsPartMgr.h"
#include "RigWellPath.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimWellPath.h"
#include "RivObjectSourceInfo.h"
#include "RivPipeGeometryGenerator.h"
#include "cafDisplayCoordTransform.h"
#include "cafEffectGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfTransform.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivFishbonesSubsPartMgr::RivFishbonesSubsPartMgr(RimFishbonesMultipleSubs* subs)
: m_rimFishbonesSubs(subs)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivFishbonesSubsPartMgr::~RivFishbonesSubsPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFishbonesSubsPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize)
{
clearGeometryCache();
if (!m_rimFishbonesSubs->isChecked()) return;
if (m_parts.size() == 0)
{
buildParts(displayCoordTransform, characteristicCellSize);
}
for (auto part : m_parts)
{
model->addPart(part.p());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFishbonesSubsPartMgr::clearGeometryCache()
{
m_parts.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFishbonesSubsPartMgr::buildParts(const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize)
{
RimWellPath* wellPath = nullptr;
m_rimFishbonesSubs->firstAncestorOrThisOfTypeAsserted(wellPath);
RivPipeGeometryGenerator geoGenerator;
for (auto& sub : m_rimFishbonesSubs->installedLateralIndices())
{
for (size_t lateralIndex : sub.lateralIndices)
{
std::vector<cvf::Vec3d> lateralDomainCoords = m_rimFishbonesSubs->coordsForLateral(sub.subIndex, lateralIndex);
std::vector<cvf::Vec3d> displayCoords;
for (auto domainCoord : lateralDomainCoords)
{
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(domainCoord));
}
geoGenerator.cylinderWithCenterLineParts(&m_parts, displayCoords, m_rimFishbonesSubs->fishbonesColor(), wellPath->combinedScaleFactor() * characteristicCellSize * 0.5);
}
}
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(m_rimFishbonesSubs);
for (auto part : m_parts)
{
part->setSourceInfo(objectSourceInfo.p());
}
}

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmPointer.h"
#include "cvfBase.h"
#include "cvfMatrix4.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cvfCollection.h"
#include "cvfColor3.h"
namespace cvf
{
class ModelBasicList;
class DrawableGeo;
class Part;
class Transform;
}
namespace caf
{
class DisplayCoordTransform;
}
class RimFishbonesMultipleSubs;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RivFishbonesSubsPartMgr : public cvf::Object
{
public:
RivFishbonesSubsPartMgr(RimFishbonesMultipleSubs* subs);
~RivFishbonesSubsPartMgr();
void appendGeometryPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize);
void clearGeometryCache();
private:
void buildParts(const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize);
private:
caf::PdmPointer<RimFishbonesMultipleSubs> m_rimFishbonesSubs;
cvf::Collection<cvf::Part> m_parts;
};

View File

@@ -44,6 +44,7 @@
#include "RivTernaryScalarMapperEffectGenerator.h"
#include "RivTernaryTextureCoordsCreator.h"
#include "RivTextureCoordsCreator.h"
#include "RivCompletionTypeResultToTextureMapper.h"
#include "cafEffectGenerator.h"
#include "cafPdmFieldCvfColor.h"
@@ -260,6 +261,15 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
return;
}
if (cellResultColors->isCompletionTypeSelected())
{
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = RivTextureCoordsCreator::createPipeInCellEvaluator(cellResultColors, timeStepIndex, m_grid->gridIndex());
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
texturer.setResultToTextureMapper(new RivCompletionTypeResultToTextureMapper(mapper, pipeInCellEval.p()));
m_opacityLevel = 0.5;
}
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();

View File

@@ -147,7 +147,7 @@ void RivNNCGeometryGenerator::computeArrays()
//--------------------------------------------------------------------------------------------------
void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords,
const cvf::ScalarMapper* mapper,
RimDefines::ResultCatType resultType,
RiaDefines::ResultCatType resultType,
size_t scalarResultIndex,
size_t timeStepIndex) const
{
@@ -156,15 +156,15 @@ void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords,
textureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = textureCoords->ptr();
const std::vector<double>* nncResultVals;
if (resultType == RimDefines::STATIC_NATIVE)
if (resultType == RiaDefines::STATIC_NATIVE)
{
nncResultVals = m_nncData->staticConnectionScalarResult(scalarResultIndex);
}
else if (resultType == RimDefines::DYNAMIC_NATIVE)
else if (resultType == RiaDefines::DYNAMIC_NATIVE)
{
nncResultVals = m_nncData->dynamicConnectionScalarResult(scalarResultIndex, timeStepIndex);
}
else if (resultType == RimDefines::GENERATED)
else if (resultType == RiaDefines::GENERATED)
{
nncResultVals = m_nncData->generatedConnectionScalarResult(scalarResultIndex, timeStepIndex);
}

View File

@@ -19,7 +19,7 @@
#pragma once
#include "RimDefines.h"
#include "RiaDefines.h"
#include "cvfBase.h"
#include "cvfObject.h"
@@ -49,7 +49,7 @@ public:
void textureCoordinates(cvf::Vec2fArray* textureCoords,
const cvf::ScalarMapper* mapper,
RimDefines::ResultCatType resultType,
RiaDefines::ResultCatType resultType,
size_t scalarResultIndex,
size_t timeStepIndex) const;

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RivObjectSourceInfo.h"
#include "cafPdmObject.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivObjectSourceInfo::RivObjectSourceInfo(caf::PdmObject* object)
: m_object(object)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RivObjectSourceInfo::object() const
{
return m_object;
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmPointer.h"
#include "cvfBase.h"
#include "cvfObject.h"
namespace caf {
class PdmObject;
}
//==================================================================================================
///
///
//==================================================================================================
class RivObjectSourceInfo : public cvf::Object
{
public:
RivObjectSourceInfo(caf::PdmObject* object);
caf::PdmObject* object() const;
private:
caf::PdmPointer<caf::PdmObject> m_object;
};

View File

@@ -21,6 +21,8 @@
#include "RivPipeGeometryGenerator.h"
#include "RivObjectSourceInfo.h"
#include "cafEffectGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfPlane.h"
@@ -36,7 +38,7 @@ RivPipeGeometryGenerator::RivPipeGeometryGenerator()
m_crossSectionNodeCount = 8;
m_minimumBendAngle = 80.0;
m_bendScalingFactor = 0.00001;
m_firstSegmentIndex = 0;
m_firstVisibleSegmentIndex = 0;
}
//--------------------------------------------------------------------------------------------------
@@ -590,16 +592,59 @@ void RivPipeGeometryGenerator::clearComputedData()
//--------------------------------------------------------------------------------------------------
size_t RivPipeGeometryGenerator::segmentIndexFromTriangleIndex(size_t triangleIndex) const
{
size_t filteredIndex = triangleIndex / (m_crossSectionNodeCount * 2);
size_t segIndex = triangleIndex / (m_crossSectionNodeCount * 2);
return filteredIndex + m_firstSegmentIndex;
CVF_ASSERT(segIndex < m_filteredPipeSegmentToResult.size());
size_t resultIndex = m_filteredPipeSegmentToResult[segIndex];
return resultIndex + m_firstVisibleSegmentIndex;
}
//--------------------------------------------------------------------------------------------------
/// Well pipes are clipped, set index to first segment in visible well path
//--------------------------------------------------------------------------------------------------
void RivPipeGeometryGenerator::setFirstSegmentIndex(size_t segmentIndex)
void RivPipeGeometryGenerator::setFirstVisibleSegmentIndex(size_t segmentIndex)
{
m_firstSegmentIndex = segmentIndex;
m_firstVisibleSegmentIndex = segmentIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivPipeGeometryGenerator::cylinderWithCenterLineParts(cvf::Collection<cvf::Part>* destinationParts, const std::vector<cvf::Vec3d>& centerCoords, const cvf::Color3f& color, double radius)
{
setRadius(radius);
setCrossSectionVertexCount(12);
cvf::ref<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray(centerCoords);
setPipeCenterCoords(cvfCoords.p());
cvf::ref<cvf::DrawableGeo> surfaceGeo = createPipeSurface();
if (surfaceGeo.notNull())
{
cvf::Part* part = new cvf::Part;
part->setDrawable(surfaceGeo.p());
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(color), caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
part->setEffect(eff.p());
destinationParts->push_back(part);
}
cvf::ref<cvf::DrawableGeo> centerLineGeo = createCenterLine();
if (centerLineGeo.notNull())
{
cvf::Part* part = new cvf::Part;
part->setDrawable(centerLineGeo.p());
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(color), caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
part->setEffect(eff.p());
destinationParts->push_back(part);
}
}

View File

@@ -23,12 +23,15 @@
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfArray.h"
#include "cvfPart.h"
namespace cvf {
class DrawableGeo;
class ScalarMapper;
}
class RivObjectSourceInfo;
class RivPipeGeometryGenerator : public cvf::Object
{
public:
@@ -56,9 +59,10 @@ public:
void pipeSurfaceTextureCoords(cvf::Vec2fArray* textureCoords, const std::vector<double>& segmentResults, const cvf::ScalarMapper* mapper) const;
void centerlineTextureCoords(cvf::Vec2fArray* textureCoords, const std::vector<double>& segmentResults, const cvf::ScalarMapper* mapper) const;
void setFirstSegmentIndex(size_t segmentIndex);
void setFirstVisibleSegmentIndex(size_t segmentIndex);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex) const;
void cylinderWithCenterLineParts(cvf::Collection<cvf::Part>* destinationParts, const std::vector<cvf::Vec3d>& centerCoords, const cvf::Color3f& color, double radius);
private:
void clearComputedData();
void updateFilteredPipeCenterCoords();
@@ -87,7 +91,7 @@ private:
// Map from generated cylinder segments to pipe result indices
std::vector<size_t> m_filteredPipeSegmentToResult;
size_t m_firstSegmentIndex;
size_t m_firstVisibleSegmentIndex;
double m_radius;
double m_minimumBendAngle;

View File

@@ -32,32 +32,14 @@
class RivResultToTextureMapper : public cvf::Object
{
public:
RivResultToTextureMapper(const cvf::ScalarMapper* scalarMapper,
explicit RivResultToTextureMapper(const cvf::ScalarMapper* scalarMapper,
const RigPipeInCellEvaluator* pipeInCellEvaluator)
: m_scalarMapper(scalarMapper), m_pipeInCellEvaluator(pipeInCellEvaluator)
{}
cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const
{
cvf::Vec2f texCoord(0,0);
if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's
{
texCoord[1] = 1.0f;
return texCoord;
}
texCoord = m_scalarMapper->mapToTextureCoord(resultValue);
virtual cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const = 0;
if (!m_pipeInCellEvaluator->isWellPipeInCell(cellIndex))
{
texCoord[1] = 0; // Set the Y texture coordinate to the opaque line in the texture
}
return texCoord;
}
private:
protected:
cvf::cref<cvf::ScalarMapper> m_scalarMapper;
cvf::cref<RigPipeInCellEvaluator> m_pipeInCellEvaluator;
};

View File

@@ -359,25 +359,3 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivSimWellPipesPartMgr::findGridIndexAndCellIndex(size_t branchIndex, size_t triangleIndex, size_t* gridIndex, size_t* cellIndex)
{
CVF_ASSERT(branchIndex < m_wellBranches.size());
RivPipeBranchData* branchData = pipeBranchData(branchIndex);
if (branchData)
{
size_t segmentIndex = branchData->m_pipeGeomGenerator->segmentIndexFromTriangleIndex(triangleIndex);
*gridIndex = branchData->m_cellIds[segmentIndex].m_gridIndex;
*cellIndex = branchData->m_cellIds[segmentIndex].m_gridCellIndex;
}
else
{
*gridIndex = cvf::UNDEFINED_SIZE_T;
*cellIndex = cvf::UNDEFINED_SIZE_T;
}
}

View File

@@ -54,8 +54,6 @@ public:
const std::vector< std::vector <cvf::Vec3d> >& centerLineOfWellBranches() { return m_pipeBranchesCLCoords;}
void findGridIndexAndCellIndex(size_t branchIndex, size_t triangleIndex, size_t* gridIndex, size_t* cellIndex);
private:
caf::PdmPointer<RimEclipseView> m_rimReservoirView;
caf::PdmPointer<RimEclipseWell> m_rimWell;

View File

@@ -55,7 +55,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
if (cellResultColors->hasStaticResult()) resTimeStepIdx = 0;
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RiaDefines::PorosityModelType porosityModel = cellResultColors->porosityModel();
cvf::ref<RigResultAccessor> soil = RigResultAccessorFactory::createFromUiResultName(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SOIL");
cvf::ref<RigResultAccessor> sgas = RigResultAccessorFactory::createFromUiResultName(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SGAS");
@@ -89,7 +89,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
if (cellResultColors->hasStaticResult()) resTimeStepIdx = 0;
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RiaDefines::PorosityModelType porosityModel = cellResultColors->porosityModel();
size_t gridIndex = 0;
cvf::ref<RigResultAccessor> soil = RigResultAccessorFactory::createFromUiResultName(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SOIL");

View File

@@ -31,6 +31,7 @@
#include "RimLegendConfig.h"
#include "RivResultToTextureMapper.h"
#include "RivDefaultResultToTextureMapper.h"
#include "cvfStructGridGeometryGenerator.h"
@@ -47,13 +48,11 @@ RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResul
m_resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, cellResultColors);
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval =
new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStepIndex),
eclipseCase->gridCellToResultWellIndex(gridIndex));
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = createPipeInCellEvaluator(cellResultColors, timeStepIndex, gridIndex);
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
m_texMapper = new RivResultToTextureMapper(mapper, pipeInCellEval.p());
m_texMapper = new RivDefaultResultToTextureMapper(mapper, pipeInCellEval.p());
CVF_ASSERT(m_texMapper.notNull());
}
@@ -78,6 +77,23 @@ void RivTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* quadTextureCo
createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTextureCoordsCreator::setResultToTextureMapper(RivResultToTextureMapper* textureMapper)
{
m_texMapper = textureMapper;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigPipeInCellEvaluator * RivTextureCoordsCreator::createPipeInCellEvaluator(RimEclipseCellColors* cellColors, size_t timeStep, size_t gridIndex)
{
return new RigPipeInCellEvaluator(cellColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStep),
cellColors->reservoirView()->eclipseCase()->eclipseCaseData()->gridCellToResultWellIndex(gridIndex));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -26,6 +26,7 @@
class RimEclipseCellColors;
class RigResultAccessor;
class RivResultToTextureMapper;
class RigPipeInCellEvaluator;
namespace cvf
{
@@ -44,6 +45,9 @@ public:
bool isValid();
void createTextureCoords(cvf::Vec2fArray* quadTextureCoords);
void setResultToTextureMapper(RivResultToTextureMapper* textureMapper);
static RigPipeInCellEvaluator* createPipeInCellEvaluator(RimEclipseCellColors* cellColors, size_t timeStep, size_t gridIndex);
private:
@@ -52,7 +56,7 @@ private:
const RigResultAccessor* resultAccessor,
const RivResultToTextureMapper* texMapper);
cvf::cref<cvf::StructGridQuadToCellFaceMapper> m_quadMapper;
cvf::ref<RigResultAccessor> m_resultAccessor;
cvf::ref<RigResultAccessor> m_resultAccessor;
cvf::ref<RivResultToTextureMapper> m_texMapper;
};

View File

@@ -351,4 +351,4 @@ cvf::ref< cvf::DrawableGeo> RivWellConnectionsPartMgr::createArrowGeometry(const
geo->computeNormals();
return geo;
}
}

View File

@@ -1,84 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- 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
// 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 "RivWellPathCollectionPartMgr.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RivWellPathPartMgr.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathCollectionPartMgr::RivWellPathCollectionPartMgr(RimWellPathCollection* wellPathCollection)
{
m_wellPathCollection = wellPathCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathCollectionPartMgr::~RivWellPathCollectionPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathCollectionPartMgr::scheduleGeometryRegen()
{
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
{
m_wellPathCollection->wellPaths[wIdx]->partMgr()->scheduleGeometryRegen();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathCollectionPartMgr::setScaleTransform(cvf::Transform * scaleTransform)
{
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
{
m_wellPathCollection->wellPaths[wIdx]->partMgr()->setScaleTransform(scaleTransform);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox)
{
setScaleTransform(scaleTransform);
if (!m_wellPathCollection->isActive()) return;
if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
{
RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
partMgr->setScaleTransform(scaleTransform);
partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
}
}

View File

@@ -1,61 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- 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
// 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 "cvfCollection.h"
#include "cafPdmPointer.h"
#include "cvfVector3.h"
#include "cvfBoundingBox.h"
#include "cvfTransform.h"
#include "cafPdmPointer.h"
class RimWellPathCollection;
class RimProject;
class RivWellPathPartMgr;
namespace cvf
{
class ModelBasicList;
}
class RivWellPathCollectionPartMgr : public cvf::Object
{
public:
explicit RivWellPathCollectionPartMgr(RimWellPathCollection* wellPathCollection);
~RivWellPathCollectionPartMgr();
void scheduleGeometryRegen();
void setScaleTransform(cvf::Transform * scaleTransform);
void appendStaticGeometryPartsToModel(
cvf::ModelBasicList* model,
cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform,
double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox);
private:
caf::PdmPointer<RimWellPathCollection> m_wellPathCollection;
};

View File

@@ -23,17 +23,28 @@
#include "RiaApplication.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimFishboneWellPath.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RivPipeGeometryGenerator.h"
#include "RivFishbonesSubsPartMgr.h"
#include "RivObjectSourceInfo.h"
#include "RivPartPriority.h"
#include "RivPipeGeometryGenerator.h"
#include "RivWellPathSourceInfo.h"
#include "cafDisplayCoordTransform.h"
#include "cafEffectGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfFont.h"
@@ -49,9 +60,7 @@
//--------------------------------------------------------------------------------------------------
RivWellPathPartMgr::RivWellPathPartMgr(RimWellPath* wellPath)
{
m_rimWellPath = wellPath;
m_needsTransformUpdate = true;
m_rimWellPath = wellPath;
// Setup a scalar mapper
cvf::ref<cvf::ScalarMapperDiscreteLinear> scalarMapper = new cvf::ScalarMapperDiscreteLinear;
@@ -82,14 +91,125 @@ RivWellPathPartMgr::~RivWellPathPartMgr()
clearAllBranchData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendFishboneSubsPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize)
{
if ( !m_rimWellPath || !m_rimWellPath->fishbonesCollection()->isChecked() ) return;
for ( auto rimFishboneSubs : m_rimWellPath->fishbonesCollection()->fishbonesSubs() )
{
cvf::ref<RivFishbonesSubsPartMgr> fishbSubPartMgr = new RivFishbonesSubsPartMgr(rimFishboneSubs);
fishbSubPartMgr->appendGeometryPartsToModel(model, displayCoordTransform, characteristicCellSize);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendImportedFishbonesToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize)
{
if (!m_rimWellPath || !m_rimWellPath->fishbonesCollection()->wellPathCollection()->isChecked()) return;
RivPipeGeometryGenerator geoGenerator;
std::vector<RimFishboneWellPath*> fishbonesWellPaths;
m_rimWellPath->descendantsIncludingThisOfType(fishbonesWellPaths);
for (RimFishboneWellPath* fbWellPath : fishbonesWellPaths)
{
if (!fbWellPath->isChecked()) continue;
std::vector<cvf::Vec3d> displayCoords;
for (auto lateralDomainCoords : fbWellPath->coordinates())
{
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(lateralDomainCoords));
}
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(fbWellPath);
cvf::Collection<cvf::Part> parts;
geoGenerator.cylinderWithCenterLineParts(&parts,
displayCoords,
m_rimWellPath->wellPathColor(),
m_rimWellPath->combinedScaleFactor() * characteristicCellSize * 0.5);
for (auto part : parts)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewDate,
cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize)
{
if (!m_rimWellPath || !m_rimWellPath->perforationIntervalCollection()->isChecked()) return;
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
if (!wellPathCollection) return;
RigWellPath* wellPathGeometry = m_rimWellPath->wellPathGeometry();
if (!wellPathGeometry) return;
// Since we're using the index of measured depths to find the index of a point, ensure they're equal
CVF_ASSERT(wellPathGeometry->m_measuredDepths.size() == wellPathGeometry->m_wellPathPoints.size());
double wellPathRadius = this->wellPathRadius(characteristicCellSize, wellPathCollection);
double perforationRadius = wellPathRadius * 1.1;
RivPipeGeometryGenerator geoGenerator;
std::vector<RimPerforationInterval*> perforations;
m_rimWellPath->descendantsIncludingThisOfType(perforations);
for (RimPerforationInterval* perforation : perforations)
{
if (!perforation->isChecked()) continue;
if (perforation->startMD() > perforation->endMD()) continue;
if (currentViewDate.isValid() && !perforation->isActiveOnDate(currentViewDate)) continue;
std::vector<cvf::Vec3d> displayCoords;
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(wellPathGeometry->interpolatedPointAlongWellPath(perforation->startMD())));
for (size_t i = 0; i < wellPathGeometry->m_measuredDepths.size(); ++i)
{
double measuredDepth = wellPathGeometry->m_measuredDepths[i];
if (measuredDepth > perforation->startMD() && measuredDepth < perforation->endMD())
{
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(wellPathGeometry->m_wellPathPoints[i]));
}
}
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(wellPathGeometry->interpolatedPointAlongWellPath(perforation->endMD())));
if (displayCoords.size() < 2) continue;
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(perforation);
cvf::Collection<cvf::Part> parts;
geoGenerator.cylinderWithCenterLineParts(&parts, displayCoords, cvf::Color3f::GREEN, perforationRadius);
for (auto part : parts)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
}
}
}
//--------------------------------------------------------------------------------------------------
/// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox)
void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox)
{
RimWellPathCollection* wellPathCollection = NULL;
m_rimWellPath->firstAncestorOrThisOfType(wellPathCollection);
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
if (!wellPathCollection) return;
RigWellPath* wellPathGeometry = m_rimWellPath->wellPathGeometry();
@@ -98,9 +218,9 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
if (wellPathGeometry->m_wellPathPoints.size() < 2) return;
clearAllBranchData();
double wellPathRadius = wellPathCollection->wellPathRadiusScaleFactor() * m_rimWellPath->wellPathRadiusScaleFactor() * characteristicCellSize;
double wellPathRadius = this->wellPathRadius(characteristicCellSize, wellPathCollection);
cvf::Vec3d textPosition = wellPathGeometry->m_wellPathPoints[0];
cvf::Vec3d textPosition;
// Generate the well path geometry as a line and pipe structure
{
@@ -130,17 +250,32 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
if (firstVisibleSegmentIndex != cvf::UNDEFINED_SIZE_T)
{
if (firstVisibleSegmentIndex > 0)
{
double wellPathStartPoint = wellPathClipBoundingBox.max().z() + wellPathCollection->wellPathClipZDistance;
double stepsize = (wellPathStartPoint - wellPathGeometry->m_wellPathPoints[firstVisibleSegmentIndex - 1].z()) /
(wellPathGeometry->m_wellPathPoints[firstVisibleSegmentIndex].z() - wellPathGeometry->m_wellPathPoints[firstVisibleSegmentIndex - 1].z());
cvf::Vec3d newPoint = wellPathGeometry->m_wellPathPoints[firstVisibleSegmentIndex - 1] +
stepsize * (wellPathGeometry->m_wellPathPoints[firstVisibleSegmentIndex] - wellPathGeometry->m_wellPathPoints[firstVisibleSegmentIndex - 1]);
clippedPoints.push_back(newPoint);
pbd.m_pipeGeomGenerator->setFirstVisibleSegmentIndex(firstVisibleSegmentIndex - 1);
}
else
{
pbd.m_pipeGeomGenerator->setFirstVisibleSegmentIndex(firstVisibleSegmentIndex);
}
for (size_t idx = firstVisibleSegmentIndex; idx < wellPathGeometry->m_wellPathPoints.size(); idx++)
{
clippedPoints.push_back(wellPathGeometry->m_wellPathPoints[idx]);
}
pbd.m_pipeGeomGenerator->setFirstSegmentIndex(firstVisibleSegmentIndex);
}
if (clippedPoints.size() < 2) return;
textPosition = clippedPoints[0];
cvfCoords->assign(clippedPoints);
}
else
@@ -151,12 +286,11 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
// Scale the centerline coordinates using the Z-scale transform of the grid and correct for the display offset.
for (size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx)
{
cvf::Vec4d transfCoord = m_scaleTransform->worldTransform() * cvf::Vec4d((*cvfCoords)[cIdx] - displayModelOffset, 1);
(*cvfCoords)[cIdx][0] = transfCoord[0];
(*cvfCoords)[cIdx][1] = transfCoord[1];
(*cvfCoords)[cIdx][2] = transfCoord[2];
(*cvfCoords)[cIdx] = displayCoordTransform->transformToDisplayCoord((*cvfCoords)[cIdx]);
}
textPosition = cvfCoords->get(0);
pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p());
pbd.m_surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface();
pbd.m_centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine();
@@ -189,10 +323,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
// Generate label with well-path name
textPosition -= displayModelOffset;
textPosition.transformPoint(m_scaleTransform->worldTransform());
textPosition.z() += characteristicCellSize; // * m_rimReservoirView->wellCollection()->wellHeadScaleFactor();
textPosition.z() += 1.2 * characteristicCellSize;
textPosition.z() += 2.2 * characteristicCellSize;
m_wellLabelPart = NULL;
if (wellPathCollection->showWellPathLabel() && m_rimWellPath->showWellPathLabel() && !m_rimWellPath->name().isEmpty())
@@ -224,18 +355,18 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
m_wellLabelPart = part;
}
m_needsTransformUpdate = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox)
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform)
{
RimWellPathCollection* wellPathCollection = NULL;
m_rimWellPath->firstAncestorOrThisOfType(wellPathCollection);
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
if (!wellPathCollection) return;
if (m_rimWellPath.isNull()) return;
@@ -246,11 +377,8 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false )
return;
if (m_needsTransformUpdate)
{
// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
buildWellPathParts(displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
}
// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
buildWellPathParts(displayCoordTransform, characteristicCellSize, wellPathClipBoundingBox);
if (m_pipeBranchData.m_surfacePart.notNull())
{
@@ -266,18 +394,34 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
{
model->addPart(m_wellLabelPart.p());
}
appendFishboneSubsPartsToModel(model, displayCoordTransform, characteristicCellSize);
appendImportedFishbonesToModel(model, displayCoordTransform, characteristicCellSize);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::setScaleTransform( cvf::Transform * scaleTransform )
void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const QDateTime& timeStamp,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform)
{
if (m_scaleTransform.isNull() || m_scaleTransform.p() != scaleTransform)
{
m_scaleTransform = scaleTransform;
scheduleGeometryRegen();
}
CVF_ASSERT(model);
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
if (!wellPathCollection) return;
if (m_rimWellPath.isNull()) return;
if (wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF)
return;
if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false)
return;
appendPerforationsToModel(timeStamp, model, displayCoordTransform, characteristicCellSize);
}
//--------------------------------------------------------------------------------------------------
@@ -299,3 +443,24 @@ size_t RivWellPathPartMgr::segmentIndexFromTriangleIndex(size_t triangleIndex)
{
return m_pipeBranchData.m_pipeGeomGenerator->segmentIndexFromTriangleIndex(triangleIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCollection* RivWellPathPartMgr::wellPathCollection()
{
if (!m_rimWellPath) return nullptr;
RimWellPathCollection* wellPathCollection = nullptr;
m_rimWellPath->firstAncestorOrThisOfType(wellPathCollection);
return wellPathCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RivWellPathPartMgr::wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection)
{
return wellPathCollection->wellPathRadiusScaleFactor() * m_rimWellPath->wellPathRadiusScaleFactor() * characteristicCellSize;
}

View File

@@ -22,6 +22,7 @@
#include "cafPdmPointer.h"
#include "cvfBoundingBox.h"
#include "cvfCollection.h"
namespace cvf
{
@@ -33,9 +34,17 @@ namespace cvf
class ScalarMapper;
}
namespace caf {
class DisplayCoordTransform;
}
class RivPipeGeometryGenerator;
class RimProject;
class RimWellPath;
class RivFishbonesSubsPartMgr;
class RimWellPathCollection;
class QDateTime;
class RivWellPathPartMgr : public cvf::Object
{
@@ -43,23 +52,44 @@ public:
explicit RivWellPathPartMgr(RimWellPath* wellPath);
~RivWellPathPartMgr();
void setScaleTransform(cvf::Transform * scaleTransform);
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform);
void scheduleGeometryRegen() { m_needsTransformUpdate = true; }//printf("R"); }
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const QDateTime& timeStamp,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform);
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex);
private:
void appendFishboneSubsPartsToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize);
void appendImportedFishbonesToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize);
void appendPerforationsToModel(const QDateTime& currentViewDate,
cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize);
void buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox);
void clearAllBranchData();
inline RimWellPathCollection* wellPathCollection();
inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection);
private:
caf::PdmPointer<RimWellPath> m_rimWellPath;
cvf::ref<cvf::Transform> m_scaleTransform;
bool m_needsTransformUpdate;
void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
void clearAllBranchData();
struct RivPipeBranchData
{
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
@@ -75,4 +105,5 @@ private:
cvf::ref<cvf::ScalarMapper> m_scalarMapper;
cvf::ref<cvf::Effect> m_scalarMapperSurfaceEffect;
cvf::ref<cvf::Effect> m_scalarMapperMeshEffect;
};