mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#401) WIP: Prototyped total cell visibility calculation and
calculation of overridden cell visibility.
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RimViewLink.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -166,3 +168,38 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemElmVisibilityCalculator::computeOverriddenCellVisibility(cvf::UByteArray* elmVisibilities,
|
||||
const RigFemPart* femPart,
|
||||
RimViewLink* masterViewLink)
|
||||
{
|
||||
#if 0
|
||||
CVF_ASSERT(elmVisibilities != NULL);
|
||||
CVF_ASSERT(femPart != NULL);
|
||||
|
||||
RimView* masterView = masterViewLink->ownerViewLinker()->mainView();
|
||||
cvf::ref<cvf::UByteArray> totCellVisibility = masterView->currentTotalCellVisibility();
|
||||
|
||||
int elmCount = femPart->elementCount();
|
||||
elmVisibilities->resize(elmCount);
|
||||
elmVisibilities->setAll(false);
|
||||
|
||||
RigCaseCellMapper* cellMapper = masterViewLink->cellMapper();
|
||||
|
||||
for (size_t elmIdx = 0; elmIdx < elmCount; ++elmIdx)
|
||||
{
|
||||
// We are assuming that there is only one part.
|
||||
int cellCount = 0;
|
||||
const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndex(elmIdx, &cellCount);
|
||||
|
||||
for (int mcIdx = 0; mcIdx < cellCount; ++mcIdx)
|
||||
{
|
||||
(*elmVisibilities)[elmIdx] |= (*totCellVisibility)[cellIndicesInMasterCase[mcIdx]]; // If any is visible, show
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace cvf
|
||||
|
||||
class RigFemPart;
|
||||
class RimGeoMechPropertyFilterCollection;
|
||||
class RimViewLink;
|
||||
|
||||
class RivFemElmVisibilityCalculator
|
||||
{
|
||||
@@ -41,6 +42,11 @@ public:
|
||||
int timeStepIndex,
|
||||
const cvf::UByteArray* rangeFilterVisibility,
|
||||
RimGeoMechPropertyFilterCollection* propFilterColl);
|
||||
|
||||
static void computeOverriddenCellVisibility(cvf::UByteArray* elmVisibilities,
|
||||
const RigFemPart* femPart ,
|
||||
RimViewLink* masterViewLink);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -207,6 +207,13 @@ RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr(RivGeoMechPartMgrCache:
|
||||
m_geomechView->propertyFilterCollection()
|
||||
);
|
||||
}
|
||||
else if (pMgrKey.geometryType() == OVERRIDDEN_CELL_VISIBILITY)
|
||||
{
|
||||
RivFemElmVisibilityCalculator::computeOverriddenCellVisibility(elmVisibility.p(),
|
||||
caseData->femParts()->part(femPartIdx),
|
||||
m_geomechView->controllingViewLink());
|
||||
}
|
||||
|
||||
else if (pMgrKey.geometryType() == ALL_CELLS)
|
||||
{
|
||||
RivFemElmVisibilityCalculator::computeAllVisible(elmVisibility.p(), caseData->femParts()->part(femPartIdx));
|
||||
@@ -224,4 +231,32 @@ RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr(RivGeoMechPartMgrCache:
|
||||
return partMgrToUpdate;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStepIndex)
|
||||
{
|
||||
size_t gridCount = m_geomechView->geoMechCase()->geoMechData()->femParts()->partCount();
|
||||
|
||||
if (gridCount == 0) return;
|
||||
|
||||
RigFemPart* part = m_geomechView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||
size_t elmCount = part->elementCount();
|
||||
|
||||
totalVisibility->resize(elmCount);
|
||||
totalVisibility->setAll(false);
|
||||
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs(timeStepIndex);
|
||||
for (size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx)
|
||||
{
|
||||
RivGeoMechPartMgr* partMgr = m_partMgrCache->partMgr(visiblePartMgrs[pmIdx]);
|
||||
|
||||
cvf::ref<cvf::UByteArray> visibility = partMgr->cellVisibility(0);
|
||||
for (int elmIdx = 0; elmIdx < elmCount; ++ elmIdx)
|
||||
{
|
||||
(*totalVisibility)[elmIdx] |= (*visibility)[elmIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include "cvfArray.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfColor4.h"
|
||||
#include "RivGeoMechPartMgrCache.h"
|
||||
@@ -47,6 +48,7 @@ public:
|
||||
void updateCellResultColor(int timeStepIndex, RimGeoMechCellColors* cellResultColors);
|
||||
void updateStaticCellColors(int timeStepIndex);
|
||||
void scheduleGeometryRegen(RivCellSetEnum geometryType);
|
||||
void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStepIndex);
|
||||
private:
|
||||
|
||||
std::vector<RivGeoMechPartMgrCache::Key> keysToVisiblePartMgrs(int timeStepIndex);
|
||||
|
||||
Reference in New Issue
Block a user