mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added support for cell edge on faults
This commit is contained in:
parent
2c903a0d18
commit
7e5c46cf59
@ -20,6 +20,7 @@
|
||||
|
||||
#include "RivCellEdgeEffectGenerator.h"
|
||||
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RigCellEdgeResultAccessor.h"
|
||||
@ -31,14 +32,14 @@
|
||||
#include "RimCellEdgeResultSlot.h"
|
||||
#include "RimReservoirView.h"
|
||||
#include "RimResultSlot.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
#include "RimWellCollection.h"
|
||||
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
#include "RivTernaryTextureCoordsCreator.h"
|
||||
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
#include "cvfqtUtils.h"
|
||||
#include "RivTernaryTextureCoordsCreator.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -48,26 +49,20 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
cvf::StructGridGeometryGenerator* generator,
|
||||
cvf::DrawableGeo* geo,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel)
|
||||
{
|
||||
RigCaseData* eclipseCase = cellResultSlot->reservoirView()->eclipseCase()->reservoirData();
|
||||
CVF_ASSERT(eclipseCase != NULL);
|
||||
|
||||
const RigGridBase* grid = dynamic_cast<const RigGridBase*>(generator->activeGrid());
|
||||
CVF_ASSERT(grid != NULL);
|
||||
|
||||
// Create result access objects
|
||||
|
||||
cvf::ref<RigResultAccessor> cellCenterDataAccessObject = createCellCenterResultAccessor(cellResultSlot, timeStepIndex, eclipseCase, grid);
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultSlot, cellEdgeResultSlot, timeStepIndex, eclipseCase, grid);
|
||||
cvf::ref<RigResultAccessor> cellCenterDataAccessObject = createCellCenterResultAccessor(cellResultSlot, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultSlot, cellEdgeResultSlot, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
|
||||
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFace = generator->quadToCellFaceMapper();
|
||||
|
||||
size_t vertexCount = geo->vertexArray()->size();
|
||||
size_t vertexCount = geo->vertexArray()->size();
|
||||
size_t quadCount = vertexCount / 4;
|
||||
|
||||
cvf::ref<cvf::Vec2fArray> localCoords = new cvf::Vec2fArray;
|
||||
@ -111,14 +106,14 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
localCoords->set(quadIdx * 4 + 2, cvf::Vec2f(1, 1));
|
||||
localCoords->set(quadIdx * 4 + 3, cvf::Vec2f(0, 1));
|
||||
|
||||
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFace->cellFace(quadIdx) );
|
||||
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFace->cellFace(quadIdx) );
|
||||
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFace->cellFace(quadIdx) );
|
||||
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFace->cellFace(quadIdx) );
|
||||
faceIndexArray->set(quadIdx * 4 + 0, quadToCellFaceMapper->cellFace(quadIdx) );
|
||||
faceIndexArray->set(quadIdx * 4 + 1, quadToCellFaceMapper->cellFace(quadIdx) );
|
||||
faceIndexArray->set(quadIdx * 4 + 2, quadToCellFaceMapper->cellFace(quadIdx) );
|
||||
faceIndexArray->set(quadIdx * 4 + 3, quadToCellFaceMapper->cellFace(quadIdx) );
|
||||
|
||||
size_t cellIndex = quadToCellFace->cellIndex(quadIdx);
|
||||
size_t cellIndex = quadToCellFaceMapper->cellIndex(quadIdx);
|
||||
{
|
||||
cvf::StructGridInterface::FaceType cellFace = quadToCellFace->cellFace(quadIdx);
|
||||
cvf::StructGridInterface::FaceType cellFace = quadToCellFaceMapper->cellFace(quadIdx);
|
||||
double scalarValue = cellCenterDataAccessObject->cellFaceScalar(cellIndex, cellFace);
|
||||
|
||||
{
|
||||
@ -192,45 +187,14 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RivCellEdgeGeometryGenerator::createCellEdgeCenterResultAccessor(
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
size_t timeStepIndex,
|
||||
RigCaseData* eclipseCase,
|
||||
const RigGridBase* grid)
|
||||
{
|
||||
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
cellEdgeResultSlot->gridScalarIndices(resultIndices);
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultSlot->porosityModel());
|
||||
|
||||
size_t cubeFaceIdx;
|
||||
for (cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
// Assuming static values to be mapped onto cell edge, always using time step zero
|
||||
cvf::ref<RigResultAccessor> daObj = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, 0, resultIndices[cubeFaceIdx]);
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
|
||||
}
|
||||
}
|
||||
|
||||
return cellEdgeResultAccessor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCellEdgeGeometryGenerator::addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot, cvf::StructGridGeometryGenerator* generator, cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
|
||||
void RivCellEdgeGeometryGenerator::addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
|
||||
{
|
||||
RigCaseData* eclipseCase = cellResultSlot->reservoirView()->eclipseCase()->reservoirData();
|
||||
CVF_ASSERT(eclipseCase != NULL);
|
||||
|
||||
const RigGridBase* grid = dynamic_cast<const RigGridBase*>(generator->activeGrid());
|
||||
CVF_ASSERT(grid != NULL);
|
||||
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultSlot, cellEdgeResultSlot, timeStepIndex, eclipseCase, grid);
|
||||
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper = generator->quadToCellFaceMapper();
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeCenterResultAccessor(cellResultSlot, cellEdgeResultSlot, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
|
||||
size_t vertexCount = geo->vertexArray()->size();
|
||||
size_t quadCount = vertexCount / 4;
|
||||
@ -261,7 +225,7 @@ void RivCellEdgeGeometryGenerator::addTernaryCellEdgeResultsToDrawableGeo(size_t
|
||||
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultSlot, cellResultSlot->ternaryLegendConfig(),
|
||||
timeStepIndex,
|
||||
grid->gridIndex(),
|
||||
gridIndex,
|
||||
quadToCellFaceMapper);
|
||||
|
||||
texturer.createTextureCoords(vCellColorTextureCoordArray.p());
|
||||
@ -317,6 +281,34 @@ void RivCellEdgeGeometryGenerator::addTernaryCellEdgeResultsToDrawableGeo(size_t
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RivCellEdgeGeometryGenerator::createCellEdgeCenterResultAccessor(
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
size_t timeStepIndex,
|
||||
RigCaseData* eclipseCase,
|
||||
const RigGridBase* grid)
|
||||
{
|
||||
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
cellEdgeResultSlot->gridScalarIndices(resultIndices);
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultSlot->porosityModel());
|
||||
|
||||
size_t cubeFaceIdx;
|
||||
for (cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
// Assuming static values to be mapped onto cell edge, always using time step zero
|
||||
cvf::ref<RigResultAccessor> daObj = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, 0, resultIndices[cubeFaceIdx]);
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
|
||||
}
|
||||
}
|
||||
|
||||
return cellEdgeResultAccessor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class StructGridGeometryGenerator;
|
||||
class DrawableGeo;
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
}
|
||||
|
||||
class RimCellEdgeResultSlot;
|
||||
@ -33,21 +33,22 @@ class RigResultAccessor;
|
||||
class RigCaseData;
|
||||
class RivTernaryScalarMapper;
|
||||
|
||||
|
||||
class RivCellEdgeGeometryGenerator
|
||||
{
|
||||
public:
|
||||
static void addCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
cvf::StructGridGeometryGenerator* generator,
|
||||
cvf::DrawableGeo* geo,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel);
|
||||
|
||||
static void addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
cvf::StructGridGeometryGenerator* generator,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel);
|
||||
|
@ -182,7 +182,30 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot)
|
||||
{
|
||||
if (m_nativeFaultFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_nativeFaultFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_nativeFaultGenerator->quadToCellFaceMapper(),
|
||||
m_grid->gridIndex(),
|
||||
timeStepIndex, cellResultSlot, cellEdgeResultSlot, m_opacityLevel, m_defaultColor);
|
||||
|
||||
m_nativeFaultFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
|
||||
if (m_oppositeFaultFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_oppositeFaultFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_oppositeFaultGenerator->quadToCellFaceMapper(), m_grid->gridIndex(),
|
||||
timeStepIndex, cellResultSlot, cellEdgeResultSlot, m_opacityLevel, m_defaultColor);
|
||||
|
||||
m_oppositeFaultFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int priFaultGeo = 1;
|
||||
|
@ -268,56 +268,17 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGridPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot)
|
||||
{
|
||||
updateCellEdgeResultColorOnPart(
|
||||
m_surfaceFaces.p(),
|
||||
&m_surfaceGenerator,
|
||||
timeStepIndex, cellResultSlot, cellEdgeResultSlot);
|
||||
if (m_surfaceFaces.notNull())
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff = RivScalarMapperUtils::createCellEdgeEffect(dg, m_surfaceGenerator.quadToCellFaceMapper(), m_grid->gridIndex(),
|
||||
timeStepIndex, cellResultSlot, cellEdgeResultSlot, m_opacityLevel, m_defaultColor);
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGridPartMgr::updateCellEdgeResultColorOnPart( cvf::Part* facePart,
|
||||
cvf::StructGridGeometryGenerator* surfaceGenerator,
|
||||
size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot)
|
||||
{
|
||||
if (facePart)
|
||||
{
|
||||
CellEdgeEffectGenerator cellFaceEffectGen(cellEdgeResultSlot->legendConfig()->scalarMapper());
|
||||
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(facePart->drawable());
|
||||
if (dg)
|
||||
{
|
||||
if (cellResultSlot->isTernarySaturationSelected())
|
||||
{
|
||||
RivCellEdgeGeometryGenerator::addTernaryCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultSlot, cellEdgeResultSlot,
|
||||
surfaceGenerator, dg, m_grid->gridIndex(), m_opacityLevel);
|
||||
|
||||
RivTernaryScalarMapper* ternaryCellScalarMapper = cellResultSlot->ternaryLegendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setTernaryScalarMapper(ternaryCellScalarMapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cellResultSlot->hasResult())
|
||||
{
|
||||
RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultSlot, cellEdgeResultSlot,
|
||||
surfaceGenerator, dg, m_grid->gridIndex(), m_opacityLevel);
|
||||
|
||||
cvf::ScalarMapper* cellScalarMapper = cellResultSlot->legendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setScalarMapper(cellScalarMapper);
|
||||
}
|
||||
}
|
||||
|
||||
cellFaceEffectGen.setOpacityLevel(m_opacityLevel);
|
||||
cellFaceEffectGen.setDefaultCellColor(m_defaultColor);
|
||||
|
||||
cvf::ref<cvf::Effect> eff = cellFaceEffectGen.generateEffect();
|
||||
|
||||
facePart->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
m_surfaceFaces->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -64,11 +64,7 @@ public:
|
||||
|
||||
private:
|
||||
void generatePartGeometry(cvf::StructGridGeometryGenerator& geoBuilder);
|
||||
void updateCellEdgeResultColorOnPart(cvf::Part* facePart,
|
||||
cvf::StructGridGeometryGenerator* surfaceGenerator,
|
||||
size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot);
|
||||
|
||||
private:
|
||||
size_t m_gridIdx;
|
||||
cvf::cref<RigGridBase> m_grid;
|
||||
|
@ -197,3 +197,15 @@ void RivReservoirPartMgr::setFaultForceVisibility(bool isGeneratedByFilter)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirPartMgr::updateFaultCellEdgeResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot)
|
||||
{
|
||||
if (m_faultsPartMgr.notNull())
|
||||
{
|
||||
m_faultsPartMgr->updateCellEdgeResultColor(timeStepIndex, cellResultSlot, cellEdgeResultSlot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,9 @@ public:
|
||||
|
||||
// Faults
|
||||
void updateFaultColors(size_t timeStepIndex, RimResultSlot* cellResultSlot);
|
||||
void appendFaultPartsToModel(cvf::ModelBasicList* model);
|
||||
void updateFaultCellEdgeResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot);
|
||||
void appendFaultPartsToModel(cvf::ModelBasicList* model);
|
||||
void appendFaultLabelPartsToModel(cvf::ModelBasicList* model);
|
||||
private:
|
||||
|
||||
|
@ -795,7 +795,16 @@ void RivReservoirViewPartMgr::updateCellResultColor(ReservoirGeometryCacheType g
|
||||
void RivReservoirViewPartMgr::updateCellEdgeResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot)
|
||||
{
|
||||
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
|
||||
pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultSlot, cellEdgeResultSlot );
|
||||
pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultSlot, cellEdgeResultSlot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::updateFaultCellEdgeResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot)
|
||||
{
|
||||
RivReservoirPartMgr * pmgr = reservoirPartManager(geometryType, timeStepIndex);
|
||||
pmgr->updateFaultCellEdgeResultColor(timeStepIndex, cellResultSlot, cellEdgeResultSlot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -66,12 +66,16 @@ public:
|
||||
void updateCellResultColor (ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot);
|
||||
void updateCellEdgeResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot);
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot);
|
||||
|
||||
// Faults
|
||||
void appendFaultsStaticGeometryPartsToModel(cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType);
|
||||
void appendFaultsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType, size_t frameIndex);
|
||||
void updateFaultColors(ReservoirGeometryCacheType geometryType, size_t timeStepIndex, RimResultSlot* cellResultSlot);
|
||||
void updateFaultCellEdgeResultColor( ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot);
|
||||
|
||||
// Fault labels
|
||||
ReservoirGeometryCacheType geometryTypeForFaultLabels(const std::vector<ReservoirGeometryCacheType>& geometryTypes) const;
|
||||
|
@ -18,8 +18,15 @@
|
||||
|
||||
#include "RivScalarMapperUtils.h"
|
||||
|
||||
#include "RivTernaryScalarMapperEffectGenerator.h"
|
||||
#include "RimCellEdgeResultSlot.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimReservoirView.h"
|
||||
#include "RimResultSlot.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RivCellEdgeEffectGenerator.h"
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
#include "RivTernaryScalarMapperEffectGenerator.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
@ -55,6 +62,47 @@ void RivScalarMapperUtils::applyTernaryTextureResultsToPart(cvf::Part* part, cvf
|
||||
part->setEffect(scalarEffect.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Effect> RivScalarMapperUtils::createCellEdgeEffect(cvf::DrawableGeo* dg,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
float opacityLevel,
|
||||
cvf::Color3f defaultColor)
|
||||
{
|
||||
CellEdgeEffectGenerator cellFaceEffectGen(cellEdgeResultSlot->legendConfig()->scalarMapper());
|
||||
|
||||
if (cellResultSlot->isTernarySaturationSelected())
|
||||
{
|
||||
RivCellEdgeGeometryGenerator::addTernaryCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultSlot, cellEdgeResultSlot,
|
||||
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
|
||||
|
||||
RivTernaryScalarMapper* ternaryCellScalarMapper = cellResultSlot->ternaryLegendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setTernaryScalarMapper(ternaryCellScalarMapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cellResultSlot->hasResult())
|
||||
{
|
||||
RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultSlot, cellEdgeResultSlot,
|
||||
quadToCellFaceMapper, dg, gridIndex, opacityLevel);
|
||||
|
||||
cvf::ScalarMapper* cellScalarMapper = cellResultSlot->legendConfig()->scalarMapper();
|
||||
cellFaceEffectGen.setScalarMapper(cellScalarMapper);
|
||||
}
|
||||
}
|
||||
|
||||
cellFaceEffectGen.setOpacityLevel(opacityLevel);
|
||||
cellFaceEffectGen.setDefaultCellColor(defaultColor);
|
||||
|
||||
cvf::ref<cvf::Effect> eff = cellFaceEffectGen.generateEffect();
|
||||
return eff;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -84,3 +132,4 @@ cvf::ref<cvf::Effect> RivScalarMapperUtils::createTernaryScalarMapperEffect(cons
|
||||
|
||||
return scalarEffect;
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,13 @@ namespace cvf
|
||||
class ScalarMapper;
|
||||
class Part;
|
||||
class Effect;
|
||||
class StructGridQuadToCellFaceMapper;
|
||||
class DrawableGeo;
|
||||
}
|
||||
|
||||
class RivTernaryScalarMapper;
|
||||
class RimResultSlot;
|
||||
class RimCellEdgeResultSlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -39,6 +43,15 @@ public:
|
||||
static void applyTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, float opacityLevel);
|
||||
static void applyTernaryTextureResultsToPart(cvf::Part* part, cvf::Vec2fArray* textureCoords, const RivTernaryScalarMapper* mapper, float opacityLevel);
|
||||
|
||||
static cvf::ref<cvf::Effect> createCellEdgeEffect(cvf::DrawableGeo* dg,
|
||||
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
|
||||
size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
float opacityLevel,
|
||||
cvf::Color3f defaultColor);
|
||||
|
||||
private:
|
||||
static cvf::ref<cvf::Effect> createScalarMapperEffect(const cvf::ScalarMapper* mapper, float opacityLevel);
|
||||
static cvf::ref<cvf::Effect> createTernaryScalarMapperEffect(const RivTernaryScalarMapper* mapper, float opacityLevel);
|
||||
|
@ -805,7 +805,7 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
{
|
||||
if (this->animationMode() && this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
m_reservoirGridPartManager->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
|
||||
m_reservoirGridPartManager->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
|
||||
}
|
||||
else if ((this->animationMode() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected())
|
||||
{
|
||||
@ -2057,15 +2057,23 @@ void RimReservoirView::updateFaultColors()
|
||||
// Update all fault geometry
|
||||
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> faultGeometriesToRecolor = visibleFaultGeometryTypes();
|
||||
|
||||
RimResultSlot* resultSlot = this->cellResult();
|
||||
RimResultSlot* faultResultSlot = this->cellResult();
|
||||
if (this->faultResultSettings()->customFaultResult())
|
||||
{
|
||||
resultSlot = this->faultResultSettings()->customFaultResult();
|
||||
faultResultSlot = this->faultResultSettings()->customFaultResult();
|
||||
}
|
||||
|
||||
|
||||
for (size_t i = 0; i < faultGeometriesToRecolor.size(); ++i)
|
||||
{
|
||||
m_reservoirGridPartManager->updateFaultColors(faultGeometriesToRecolor[i], m_currentTimeStep, resultSlot);
|
||||
if (this->animationMode() && this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
m_reservoirGridPartManager->updateFaultCellEdgeResultColor(faultGeometriesToRecolor[i], m_currentTimeStep, faultResultSlot, this->cellEdgeResult());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_reservoirGridPartManager->updateFaultColors(faultGeometriesToRecolor[i], m_currentTimeStep, faultResultSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user