Skip to content

Commit

Permalink
Renaming and cleaning as preparations for GeoMech property filters
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobStoren committed Jun 18, 2015
1 parent 2136c1b commit 919f2b6
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 37 deletions.
30 changes: 30 additions & 0 deletions ApplicationCode/ModelVisualization/RivGeoMechPartMgrCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,33 @@ RivGeoMechPartMgr* RivGeoMechPartMgrCache::partMgr(const Key& key)
}



//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivGeoMechPartMgrCache::Key::set(unsigned short aGeometryType, int aFrameIndex)
{
m_frameIndex = aFrameIndex;
m_geometryType = aGeometryType;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivGeoMechPartMgrCache::Key::operator<(const Key& other) const
{
if (m_frameIndex != other.m_frameIndex)
{
return (m_frameIndex < other.m_frameIndex);
}
return (m_geometryType < other.m_geometryType);
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivGeoMechPartMgrCache::Key::Key(unsigned short aGeometryType, int aFrameIndex)
: m_geometryType(aGeometryType), m_frameIndex(aFrameIndex)
{

}
47 changes: 18 additions & 29 deletions ApplicationCode/ModelVisualization/RivGeoMechPartMgrCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,26 @@ class RivGeoMechPartMgrCache : public cvf::Object
class Key
{
public:
Key()
: geometryType(-1), frameIndex(-1)
{}

Key(unsigned short aGeometryType, int aFrameIndex)
: geometryType(aGeometryType), frameIndex(aFrameIndex)
{}

void set(unsigned short aGeometryType, int aFrameIndex)
{
frameIndex = aFrameIndex;
geometryType = aGeometryType;
}

int frameIndex;
unsigned short geometryType;

bool operator< (const Key& other) const
{
if (frameIndex != other.frameIndex)
{
return (frameIndex < other.frameIndex);
}
return (geometryType < other.geometryType);
}
Key() : m_geometryType(-1), m_frameIndex(-1) {}

Key( unsigned short aGeometryType, int aFrameIndex);

void set(unsigned short aGeometryType, int aFrameIndex);

int frameIndex() const { return m_frameIndex;}
unsigned short geometryType() const { return m_geometryType; }

bool operator< (const Key& other) const;

private:
int m_frameIndex;
unsigned short m_geometryType;
};

bool needsRegeneration (const Key& key);
void scheduleRegeneration(const Key& key);
void generationFinished (const Key& key);
RivGeoMechPartMgr* partMgr (const Key& key);
bool needsRegeneration (const Key& key);
void scheduleRegeneration (const Key& key);
void generationFinished (const Key& key);
RivGeoMechPartMgr* partMgr (const Key& key);

private:
class CacheEntry
Expand Down
16 changes: 8 additions & 8 deletions ApplicationCode/ModelVisualization/RivGeoMechVizLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,23 @@ void RivGeoMechVizLogic::appendNoAnimPartsToModel(cvf::ModelBasicList* model)
{
RivGeoMechPartMgrCache::Key pMgrKey = currentPartMgrKey();

RivGeoMechPartMgr* m_geoMechFullModel = m_partMgrCache->partMgr(pMgrKey);
RivGeoMechPartMgr* currentGeoMechPartMgr = m_partMgrCache->partMgr(pMgrKey);
RigGeoMechCaseData* caseData = m_geomechView->geoMechCase()->geoMechData();
int partCount = caseData->femParts()->partCount();

if (m_partMgrCache->needsRegeneration(pMgrKey))
{
if (m_geoMechFullModel->initializedFemPartCount() != partCount)
if (currentGeoMechPartMgr->initializedFemPartCount() != partCount)
{
m_geoMechFullModel->clearAndSetReservoir(caseData);
currentGeoMechPartMgr->clearAndSetReservoir(caseData);
}

for (int femPartIdx = 0; femPartIdx < partCount; ++femPartIdx)
{
cvf::ref<cvf::UByteArray> elmVisibility = m_geoMechFullModel->cellVisibility(femPartIdx);
m_geoMechFullModel->setTransform(m_geomechView->scaleTransform());
cvf::ref<cvf::UByteArray> elmVisibility = currentGeoMechPartMgr->cellVisibility(femPartIdx);
currentGeoMechPartMgr->setTransform(m_geomechView->scaleTransform());

if (pMgrKey.geometryType == RANGE_FILTERED)
if (pMgrKey.geometryType() == RANGE_FILTERED)
{
cvf::CellRangeFilter cellRangeFilter;
m_geomechView->rangeFilterCollection()->compoundCellRangeFilter(&cellRangeFilter, femPartIdx);
Expand All @@ -83,13 +83,13 @@ void RivGeoMechVizLogic::appendNoAnimPartsToModel(cvf::ModelBasicList* model)
RivElmVisibilityCalculator::computeAllVisible(elmVisibility.p(), caseData->femParts()->part(femPartIdx));
}

m_geoMechFullModel->setCellVisibility(femPartIdx, elmVisibility.p());
currentGeoMechPartMgr->setCellVisibility(femPartIdx, elmVisibility.p());
}

m_partMgrCache->generationFinished(pMgrKey);
}

m_geoMechFullModel->appendGridPartsToModel(model);
currentGeoMechPartMgr->appendGridPartsToModel(model);
}

//--------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 919f2b6

Please sign in to comment.