Renaming and cleaning as preparations for GeoMech property filters

#314
This commit is contained in:
Jacob Støren 2015-06-18 09:13:45 +02:00
parent 2136c1b64c
commit 919f2b61f3
3 changed files with 52 additions and 33 deletions

View File

@ -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)
{
}

View File

@ -14,31 +14,20 @@ public:
class Key class Key
{ {
public: public:
Key() Key() : m_geometryType(-1), m_frameIndex(-1) {}
: geometryType(-1), frameIndex(-1)
{}
Key(unsigned short aGeometryType, int aFrameIndex) Key( unsigned short aGeometryType, int aFrameIndex);
: geometryType(aGeometryType), frameIndex(aFrameIndex)
{}
void set(unsigned short aGeometryType, int aFrameIndex) void set(unsigned short aGeometryType, int aFrameIndex);
{
frameIndex = aFrameIndex;
geometryType = aGeometryType;
}
int frameIndex; int frameIndex() const { return m_frameIndex;}
unsigned short geometryType; unsigned short geometryType() const { return m_geometryType; }
bool operator< (const Key& other) const bool operator< (const Key& other) const;
{
if (frameIndex != other.frameIndex) private:
{ int m_frameIndex;
return (frameIndex < other.frameIndex); unsigned short m_geometryType;
}
return (geometryType < other.geometryType);
}
}; };
bool needsRegeneration (const Key& key); bool needsRegeneration (const Key& key);

View File

@ -56,23 +56,23 @@ void RivGeoMechVizLogic::appendNoAnimPartsToModel(cvf::ModelBasicList* model)
{ {
RivGeoMechPartMgrCache::Key pMgrKey = currentPartMgrKey(); RivGeoMechPartMgrCache::Key pMgrKey = currentPartMgrKey();
RivGeoMechPartMgr* m_geoMechFullModel = m_partMgrCache->partMgr(pMgrKey); RivGeoMechPartMgr* currentGeoMechPartMgr = m_partMgrCache->partMgr(pMgrKey);
RigGeoMechCaseData* caseData = m_geomechView->geoMechCase()->geoMechData(); RigGeoMechCaseData* caseData = m_geomechView->geoMechCase()->geoMechData();
int partCount = caseData->femParts()->partCount(); int partCount = caseData->femParts()->partCount();
if (m_partMgrCache->needsRegeneration(pMgrKey)) 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) for (int femPartIdx = 0; femPartIdx < partCount; ++femPartIdx)
{ {
cvf::ref<cvf::UByteArray> elmVisibility = m_geoMechFullModel->cellVisibility(femPartIdx); cvf::ref<cvf::UByteArray> elmVisibility = currentGeoMechPartMgr->cellVisibility(femPartIdx);
m_geoMechFullModel->setTransform(m_geomechView->scaleTransform()); currentGeoMechPartMgr->setTransform(m_geomechView->scaleTransform());
if (pMgrKey.geometryType == RANGE_FILTERED) if (pMgrKey.geometryType() == RANGE_FILTERED)
{ {
cvf::CellRangeFilter cellRangeFilter; cvf::CellRangeFilter cellRangeFilter;
m_geomechView->rangeFilterCollection()->compoundCellRangeFilter(&cellRangeFilter, femPartIdx); m_geomechView->rangeFilterCollection()->compoundCellRangeFilter(&cellRangeFilter, femPartIdx);
@ -83,13 +83,13 @@ void RivGeoMechVizLogic::appendNoAnimPartsToModel(cvf::ModelBasicList* model)
RivElmVisibilityCalculator::computeAllVisible(elmVisibility.p(), caseData->femParts()->part(femPartIdx)); RivElmVisibilityCalculator::computeAllVisible(elmVisibility.p(), caseData->femParts()->part(femPartIdx));
} }
m_geoMechFullModel->setCellVisibility(femPartIdx, elmVisibility.p()); currentGeoMechPartMgr->setCellVisibility(femPartIdx, elmVisibility.p());
} }
m_partMgrCache->generationFinished(pMgrKey); m_partMgrCache->generationFinished(pMgrKey);
} }
m_geoMechFullModel->appendGridPartsToModel(model); currentGeoMechPartMgr->appendGridPartsToModel(model);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------