Removed use of cvfStructGridScalarDataAccess

This commit is contained in:
Magne Sjaastad 2014-08-19 14:56:20 +02:00
parent 2fe63ece50
commit cdf2b07118
7 changed files with 0 additions and 271 deletions

View File

@ -23,7 +23,6 @@
#include "cvfDrawableGeo.h"
#include "cvfPrimitiveSetIndexedUInt.h"
#include "cvfOutlineEdgeExtractor.h"
#include "cvfStructGridScalarDataAccess.h"
#include "cvfStructGridGeometryGenerator.h"
#include "cvfScalarMapper.h"
@ -201,40 +200,6 @@ void RivFaultGeometryGenerator::computeArrays()
m_vertices->assign(vertices);
}
//--------------------------------------------------------------------------------------------------
/// 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 RivFaultGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords, const cvf::StructGridScalarDataAccess* resultAccessor, const cvf::ScalarMapper* mapper) const
{
if (!resultAccessor) return;
size_t numVertices = m_quadMapper->quadCount()*4;
textureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = textureCoords->ptr();
double cellScalarValue;
cvf::Vec2f texCoord;
#pragma omp parallel for private(texCoord, cellScalarValue)
for (int i = 0; i < static_cast<int>(m_quadMapper->quadCount()); i++)
{
cellScalarValue = resultAccessor->cellScalar(m_quadMapper->cellIndex(i));
texCoord = mapper->mapToTextureCoord(cellScalarValue);
if (cellScalarValue == HUGE_VAL || cellScalarValue != cellScalarValue) // a != a is true for NAN's
{
texCoord[1] = 1.0f;
}
size_t j;
for (j = 0; j < 4; j++)
{
rawPtr[i*4 + j] = texCoord;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -47,10 +47,6 @@ public:
void setCellVisibility(const cvf::UByteArray* cellVisibilities );
void textureCoordinates(cvf::Vec2fArray* textureCoords,
const cvf::StructGridScalarDataAccess* resultAccessor,
const cvf::ScalarMapper* mapper) const;
// Mapping between cells and geometry
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper() { return m_quadMapper.p(); }

View File

@ -58,7 +58,6 @@
#include "cvfShaderSourceProvider.h"
#include "cvfShaderSourceRepository.h"
#include "cvfStructGrid.h"
#include "cvfStructGridGeometryGenerator.h"
#include "cvfUniform.h"
@ -295,20 +294,3 @@ RivGridPartMgr::~RivGridPartMgr()
}
//--------------------------------------------------------------------------------------------------
/// Helper class used to provide zero for all cells
/// This way we can avoid to test if a StructGridScalarDataAccess object is valid before reading out the value.
//--------------------------------------------------------------------------------------------------
class ScalarDataAccessZeroForAllCells : public cvf::StructGridScalarDataAccess
{
public:
virtual double cellScalar(size_t cellIndex) const
{
return 0.0;
}
virtual void setCellScalar(size_t cellIndex, double value)
{
}
};

View File

@ -485,26 +485,6 @@ const RigCaseCellResultsData* RigCaseData::results(RifReaderInterface::PorosityM
return m_fractureModelResults.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::StructGridScalarDataAccess> RigCaseData::TO_BE_DELETED_resultAccessor(const RigGridBase* grid,
RifReaderInterface::PorosityModelResultType porosityModel,
size_t timeStepIndex,
size_t scalarSetIndex)
{
if (timeStepIndex != cvf::UNDEFINED_SIZE_T &&
scalarSetIndex != cvf::UNDEFINED_SIZE_T)
{
cvf::ref<cvf::StructGridScalarDataAccess> dataAccess = RigResultAccessorFactory::TO_BE_DELETED_createNativeDataAccessObject(this, grid->gridIndex(), porosityModel, timeStepIndex, scalarSetIndex);
return dataAccess;
}
return NULL;
}
/*
//--------------------------------------------------------------------------------------------------
///

View File

@ -53,12 +53,6 @@ public:
const RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const;
void setActiveCellInfo(RifReaderInterface::PorosityModelResultType porosityModel, RigActiveCellInfo* activeCellInfo);
cvf::ref<cvf::StructGridScalarDataAccess> TO_BE_DELETED_resultAccessor(const RigGridBase* grid,
RifReaderInterface::PorosityModelResultType porosityModel,
size_t timeStepIndex,
size_t scalarSetIndex);
void setWellResults(const cvf::Collection<RigSingleWellResultsData>& data);
const cvf::Collection<RigSingleWellResultsData>& wellResults() { return m_wellResults; }

View File

@ -194,181 +194,3 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
}
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Rest of this file is to be deleted
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RigGridAllCellsScalarDataAccess : public cvf::StructGridScalarDataAccess
{
public:
RigGridAllCellsScalarDataAccess(const RigGridBase* grid, std::vector<double>* reservoirResultValues);
virtual double cellScalar(size_t gridLocalCellIndex) const;
virtual void setCellScalar(size_t cellIndex, double value);
private:
const RigGridBase* m_grid;
std::vector<double>* m_reservoirResultValues;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGridAllCellsScalarDataAccess::RigGridAllCellsScalarDataAccess(const RigGridBase* grid, std::vector<double>* reservoirResultValues)
: m_grid(grid),
m_reservoirResultValues(reservoirResultValues)
{
CVF_ASSERT(reservoirResultValues != NULL);
CVF_ASSERT(grid != NULL);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigGridAllCellsScalarDataAccess::cellScalar(size_t gridLocalCellIndex) const
{
if (m_reservoirResultValues->size() == 0 ) return HUGE_VAL;
size_t reservoirCellIndex = m_grid->reservoirCellIndex(gridLocalCellIndex);
CVF_TIGHT_ASSERT(reservoirCellIndex < m_reservoirResultValues->size());
return m_reservoirResultValues->at(reservoirCellIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGridAllCellsScalarDataAccess::setCellScalar(size_t gridLocalCellIndex, double scalarValue)
{
size_t reservoirCellIndex = m_grid->reservoirCellIndex(gridLocalCellIndex);
CVF_TIGHT_ASSERT(reservoirCellIndex < m_reservoirResultValues->size());
(*m_reservoirResultValues)[reservoirCellIndex] = scalarValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RigGridActiveCellsScalarDataAccess : public cvf::StructGridScalarDataAccess
{
public:
RigGridActiveCellsScalarDataAccess(const RigGridBase* grid, std::vector<double>* reservoirResultValues, const RigActiveCellInfo* activeCellInfo)
: m_grid(grid),
m_reservoirResultValues(reservoirResultValues),
m_activeCellInfo(activeCellInfo)
{
CVF_ASSERT(grid != NULL);
}
virtual double cellScalar(size_t gridLocalCellIndex) const
{
if (m_reservoirResultValues == NULL || m_reservoirResultValues->size() == 0 ) return HUGE_VAL;
size_t reservoirCellIndex = m_grid->reservoirCellIndex(gridLocalCellIndex);
size_t resultValueIndex = m_activeCellInfo->cellResultIndex(reservoirCellIndex);
if (resultValueIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL;
CVF_TIGHT_ASSERT(resultValueIndex < m_reservoirResultValues->size());
return m_reservoirResultValues->at(resultValueIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
virtual void setCellScalar(size_t gridLocalCellIndex, double scalarValue)
{
size_t reservoirCellIndex = m_grid->reservoirCellIndex(gridLocalCellIndex);
size_t resultValueIndex = m_activeCellInfo->cellResultIndex(reservoirCellIndex);
CVF_TIGHT_ASSERT(m_reservoirResultValues != NULL && resultValueIndex < m_reservoirResultValues->size());
(*m_reservoirResultValues)[resultValueIndex] = scalarValue;
}
private:
const RigActiveCellInfo* m_activeCellInfo;
const RigGridBase* m_grid;
std::vector<double>* m_reservoirResultValues;
};
class StructGridScalarDataAccessHugeVal : public cvf::StructGridScalarDataAccess
{
public:
virtual double cellScalar(size_t cellIndex) const
{
return HUGE_VAL;
}
virtual void setCellScalar(size_t cellIndex, double value)
{
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::StructGridScalarDataAccess> RigResultAccessorFactory::TO_BE_DELETED_createNativeDataAccessObject(RigCaseData* eclipseCase,
size_t gridIndex,
RifReaderInterface::PorosityModelResultType porosityModel,
size_t timeStepIndex,
size_t scalarSetIndex)
{
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
CVF_ASSERT(eclipseCase);
CVF_ASSERT(eclipseCase->results(porosityModel));
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
RigGridBase *grid = eclipseCase->grid(gridIndex);
if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
{
return NULL;
}
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarSetIndex);
// A generated result with a generated results for a subset of time steps, will end up with a result container with less entries than time steps
// See RiaSetGridProperty command in RiaPropertyDataCommands
//
// Some functions requires a valid data access object to be present, these might be rewritten to avoid this dummy object always returning HUGE_VAL
if (timeStepIndex >= scalarSetResults.size())
{
cvf::ref<cvf::StructGridScalarDataAccess> object = new StructGridScalarDataAccessHugeVal;
return object;
}
std::vector<double>* resultValues = NULL;
if (timeStepIndex < scalarSetResults.size())
{
resultValues = &(scalarSetResults[timeStepIndex]);
}
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex);
if (useGlobalActiveIndex)
{
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridActiveCellsScalarDataAccess(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));
return object;
}
else
{
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridAllCellsScalarDataAccess(grid, resultValues);
return object;
}
}

View File

@ -22,8 +22,6 @@
#include "RigResultAccessor.h"
#include "RimDefines.h"
#include "cvfStructGridScalarDataAccess.h"
class RigActiveCellInfo;
class RigGridBase;
@ -53,14 +51,6 @@ public:
size_t resultIndex);
// TO BE DELETED
static cvf::ref<cvf::StructGridScalarDataAccess>
TO_BE_DELETED_createNativeDataAccessObject(RigCaseData* eclipseCase,
size_t gridIndex,
RifReaderInterface::PorosityModelResultType porosityModel,
size_t timeStepIndex,
size_t scalarSetIndex);
private:
static cvf::ref<RigResultAccessor>