riTRANSXYZ: nnc calculations in place

Making this feaure complete.
Had to add the concept of several results sets to the nnc data
This commit is contained in:
Jacob Støren
2014-08-26 12:16:22 +02:00
parent 56b1f78f2f
commit 670ca4ced5
10 changed files with 255 additions and 33 deletions
@@ -647,11 +647,15 @@ void RivFaultPartMgr::updateNNCColors(RimResultSlot* cellResultSlot)
{
if (m_NNCFaces.isNull()) return;
if (cellResultSlot && cellResultSlot->resultVariable() == RimDefines::combinedTransmissibilityResultName())
if (cellResultSlot
&& ( cellResultSlot->resultVariable() == RimDefines::combinedTransmissibilityResultName()
|| cellResultSlot->resultVariable() == RimDefines::combinedRiTransResultName()))
{
size_t scalarSetIndex = cellResultSlot->gridScalarIndex();
const cvf::ScalarMapper* mapper = cellResultSlot->legendConfig()->scalarMapper();
m_NNCGenerator->textureCoordinates(m_NNCTextureCoords.p(), mapper);
m_NNCGenerator->textureCoordinates(m_NNCTextureCoords.p(), mapper, scalarSetIndex);
cvf::ref<cvf::Effect> nncEffect;
@@ -144,12 +144,19 @@ 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) const
void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords, const cvf::ScalarMapper* mapper, size_t scalarResultIndex) const
{
size_t numVertices = m_vertices->size();
textureCoords->resize(numVertices);
cvf::Vec2f* rawPtr = textureCoords->ptr();
const std::vector<double>* nncResultVals = m_nncData->connectionScalarResult(scalarResultIndex);
if (!nncResultVals)
{
textureCoords->setAll(cvf::Vec2f(0.0f, 1.0f));
return;
}
double cellScalarValue;
cvf::Vec2f texCoord;
@@ -157,7 +164,7 @@ void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords,
#pragma omp parallel for private(texCoord, cellScalarValue)
for (int tIdx = 0; tIdx < static_cast<int>(m_triangleIndexToNNCIndex->size()); tIdx++)
{
cellScalarValue = m_nncData->connections()[(*m_triangleIndexToNNCIndex)[tIdx]].m_transmissibility;
cellScalarValue = (*nncResultVals)[(*m_triangleIndexToNNCIndex)[tIdx]];
texCoord = mapper->mapToTextureCoord(cellScalarValue);
if (cellScalarValue == HUGE_VAL || cellScalarValue != cellScalarValue) // a != a is true for NAN's
{
@@ -44,7 +44,7 @@ public:
void setCellVisibility( const cvf::UByteArray* cellVisibilities, const RigGridBase * grid);
void textureCoordinates(cvf::Vec2fArray* textureCoords,
const cvf::ScalarMapper* mapper) const;
const cvf::ScalarMapper* mapper, size_t scalarResultIndex) const;
// Mapping between cells and geometry
cvf::ref<cvf::Array<size_t> > triangleToNNCIndex() const;