#1645 Load dynamic NNC results from restart file

This commit is contained in:
Bjørnar Grip Fjær
2017-06-26 10:25:08 +02:00
parent 7b7af2b197
commit de414c4277
21 changed files with 423 additions and 47 deletions

View File

@@ -103,7 +103,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
{
CVF_ASSERT(cellResultColors);
updateNNCColors(cellResultColors);
updateNNCColors(timeStepIndex, cellResultColors);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RimEclipseView* eclipseView = cellResultColors->reservoirView();
@@ -182,7 +182,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
//--------------------------------------------------------------------------------------------------
void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
{
updateNNCColors(cellResultColors);
updateNNCColors(timeStepIndex, cellResultColors);
if (m_nativeFaultFaces.notNull())
{
@@ -375,7 +375,7 @@ void RivFaultPartMgr::updatePartEffect()
m_oppositeFaultFaces->setEffect(geometryOnlyEffect.p());
}
updateNNCColors(NULL);
updateNNCColors(0, NULL);
// Update mesh colors as well, in case of change
RiaPreferences* prefs = RiaApplication::instance()->preferences();
@@ -642,7 +642,7 @@ caf::FaceCulling RivFaultPartMgr::faceCullingMode() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFaultPartMgr::updateNNCColors(RimEclipseCellColors* cellResultColors)
void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors* cellResultColors)
{
if (m_NNCFaces.isNull()) return;
@@ -661,10 +661,11 @@ void RivFaultPartMgr::updateNNCColors(RimEclipseCellColors* cellResultColors)
if (showNncsWithScalarMappedColor)
{
size_t scalarSetIndex = cellResultColors->scalarResultIndex();
RimDefines::ResultCatType resultType = cellResultColors->resultType();
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
m_NNCGenerator->textureCoordinates(m_NNCTextureCoords.p(), mapper, scalarSetIndex);
m_NNCGenerator->textureCoordinates(m_NNCTextureCoords.p(), mapper, resultType, scalarSetIndex, timeStepIndex);
cvf::ref<cvf::Effect> nncEffect;

View File

@@ -70,7 +70,7 @@ private:
void generatePartGeometry();
void updatePartEffect();
void updateNNCColors(RimEclipseCellColors* cellResultColors);
void updateNNCColors(size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
caf::FaceCulling faceCullingMode() const;

View File

@@ -145,14 +145,26 @@ void RivNNCGeometryGenerator::computeArrays()
/// Calculates the texture coordinates in a "nearly" one dimensional texture.
/// Undefined values are coded with a y-texture coordinate value of 1.0 instead of the normal 0.5
//--------------------------------------------------------------------------------------------------
void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, size_t scalarResultIndex) const
void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords,
const cvf::ScalarMapper* mapper,
RimDefines::ResultCatType resultType,
size_t scalarResultIndex,
size_t timeStepIndex) const
{
size_t numVertices = m_vertices->size();
textureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = textureCoords->ptr();
const std::vector<double>* nncResultVals = m_nncData->connectionScalarResult(scalarResultIndex);
const std::vector<double>* nncResultVals;
if (resultType == RimDefines::STATIC_NATIVE)
{
nncResultVals = m_nncData->staticConnectionScalarResult(scalarResultIndex);
}
else if (resultType == RimDefines::DYNAMIC_NATIVE)
{
nncResultVals = m_nncData->dynamicConnectionScalarResult(scalarResultIndex, timeStepIndex);
}
if (!nncResultVals)
{
textureCoords->setAll(cvf::Vec2f(0.0f, 1.0f));

View File

@@ -18,6 +18,9 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimDefines.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfArray.h"
@@ -45,7 +48,10 @@ public:
void setCellVisibility( const cvf::UByteArray* cellVisibilities, const RigGridBase * grid);
void textureCoordinates(cvf::Vec2fArray* textureCoords,
const cvf::ScalarMapper* mapper, size_t scalarResultIndex) const;
const cvf::ScalarMapper* mapper,
RimDefines::ResultCatType resultType,
size_t scalarResultIndex,
size_t timeStepIndex) const;
// Mapping between cells and geometry
cvf::ref<cvf::Array<size_t> > triangleToNNCIndex() const;