mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2347 Elm props: Evaluate result type ELEMENT in property visibility
This commit is contained in:
@@ -107,8 +107,8 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
if (cellVisibility != rangeFilterVisibility ) (*cellVisibility) = *rangeFilterVisibility;
|
||||
const int elementCount = grid->elementCount();
|
||||
|
||||
if (propFilterColl->hasActiveFilters())
|
||||
{
|
||||
if (!propFilterColl->hasActiveFilters()) return;
|
||||
|
||||
for (size_t i = 0; i < propFilterColl->propertyFilters().size(); i++)
|
||||
{
|
||||
RimGeoMechPropertyFilter* propertyFilter = propFilterColl->propertyFilters()[i];
|
||||
@@ -127,8 +127,12 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
grid->elementPartId(),
|
||||
timeStepIndex);
|
||||
|
||||
if (propertyFilter->isActive() && propertyFilter->resultDefinition->hasResult())
|
||||
{
|
||||
if (!propertyFilter->isActive()) continue;
|
||||
if (!propertyFilter->resultDefinition->hasResult()) continue;
|
||||
|
||||
const double lowerBound = propertyFilter->lowerBound();
|
||||
const double upperBound = propertyFilter->upperBound();
|
||||
|
||||
if (propertyFilter->resultDefinition->resultAddress().resultPosType == RIG_FORMATION_NAMES)
|
||||
{
|
||||
std::vector<int> integerVector = propertyFilter->selectedCategoryValues();
|
||||
@@ -140,8 +144,8 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
|
||||
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||
{
|
||||
if ((*cellVisibility)[cellIndex])
|
||||
{
|
||||
if (!(*cellVisibility)[cellIndex]) continue;
|
||||
|
||||
size_t resultValueIndex = grid->elementNodeResultIdx(cellIndex, 0);
|
||||
double scalarValue = resVals[resultValueIndex];
|
||||
int intValue = nearbyint(scalarValue);
|
||||
@@ -161,20 +165,38 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const double lowerBound = propertyFilter->lowerBound();
|
||||
const double upperBound = propertyFilter->upperBound();
|
||||
|
||||
|
||||
if (resVarAddress.resultPosType != RIG_ELEMENT_NODAL_FACE)
|
||||
else if (resVarAddress.resultPosType == RIG_ELEMENT)
|
||||
{
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||
{
|
||||
if ( (*cellVisibility)[cellIndex] )
|
||||
if (!(*cellVisibility)[cellIndex]) continue;
|
||||
|
||||
double scalarValue = resVals[cellIndex];
|
||||
evaluateAndSetCellVisibiliy(scalarValue, lowerBound, upperBound, filterType, cellVisibility, cellIndex);
|
||||
}
|
||||
}
|
||||
else if (resVarAddress.resultPosType == RIG_ELEMENT_NODAL_FACE)
|
||||
{
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||
{
|
||||
if (!(*cellVisibility)[cellIndex]) continue;
|
||||
|
||||
for (int fpIdx = 0; fpIdx < 24; ++fpIdx)
|
||||
{
|
||||
double scalarValue = resVals[cellIndex * 24 + fpIdx];
|
||||
evaluateAndSetCellVisibiliy(scalarValue, lowerBound, upperBound, filterType, cellVisibility, cellIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||
{
|
||||
if (!(*cellVisibility)[cellIndex]) continue;
|
||||
|
||||
RigElementType eType = grid->elementType(cellIndex);
|
||||
int elmNodeCount = RigFemTypes::elmentNodeCount(eType);
|
||||
|
||||
@@ -192,6 +214,18 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
}
|
||||
|
||||
double scalarValue = resVals[resultValueIndex];
|
||||
evaluateAndSetCellVisibiliy(scalarValue, lowerBound, upperBound, filterType, cellVisibility, cellIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemElmVisibilityCalculator::evaluateAndSetCellVisibiliy(double scalarValue, double lowerBound, double upperBound, const RimCellFilter::FilterModeType filterType, cvf::UByteArray* cellVisibility, int cellIndex)
|
||||
{
|
||||
if (lowerBound <= scalarValue && scalarValue <= upperBound)
|
||||
{
|
||||
if (filterType == RimCellFilter::EXCLUDE)
|
||||
@@ -207,42 +241,6 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for(int cellIndex = 0; cellIndex < elementCount; cellIndex++)
|
||||
{
|
||||
if((*cellVisibility)[cellIndex])
|
||||
{
|
||||
for(int fpIdx = 0; fpIdx < 24; ++fpIdx)
|
||||
{
|
||||
double scalarValue = resVals[cellIndex*24 + fpIdx];
|
||||
if(lowerBound <= scalarValue && scalarValue <= upperBound)
|
||||
{
|
||||
if(filterType == RimCellFilter::EXCLUDE)
|
||||
{
|
||||
(*cellVisibility)[cellIndex] = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(filterType == RimCellFilter::INCLUDE)
|
||||
{
|
||||
(*cellVisibility)[cellIndex] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
||||
@@ -18,9 +18,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
#include "RimCellFilter.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class CellRangeFilter;
|
||||
@@ -43,6 +46,11 @@ public:
|
||||
const cvf::UByteArray* rangeFilterVisibility,
|
||||
RimGeoMechPropertyFilterCollection* propFilterColl);
|
||||
|
||||
static void evaluateAndSetCellVisibiliy(double scalarValue, double lowerBound, double upperBound,
|
||||
const RimCellFilter::FilterModeType filterType,
|
||||
cvf::UByteArray* cellVisibility, int cellIndex);
|
||||
|
||||
|
||||
static void computeOverriddenCellVisibility(cvf::UByteArray* elmVisibilities,
|
||||
const RigFemPart* femPart ,
|
||||
RimViewController* masterViewLink);
|
||||
|
||||
Reference in New Issue
Block a user