mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1601 Completion Type : Show undefined as gray
This commit is contained in:
parent
84597a992d
commit
c4172d4c19
@ -23,6 +23,8 @@ ${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
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "RivTernaryScalarMapperEffectGenerator.h"
|
||||
#include "RivTernaryTextureCoordsCreator.h"
|
||||
#include "RivTextureCoordsCreator.h"
|
||||
#include "RivCompletionTypeResultToTextureMapper.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
@ -260,18 +261,17 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC
|
||||
return;
|
||||
}
|
||||
|
||||
texturer.createTextureCoords(m_surfaceFacesTextureCoords.p());
|
||||
|
||||
if (cellResultColors->isCompletionTypeSelected())
|
||||
{
|
||||
cvf::Vec2fArray& surfaceCoords = *m_surfaceFacesTextureCoords.p();
|
||||
for (cvf::Vec2f& vec : surfaceCoords)
|
||||
{
|
||||
vec[1] = 0.5;
|
||||
}
|
||||
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();
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(),
|
||||
m_surfaceFacesTextureCoords.p(),
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user