mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Moved geo mech related source files to different folder
Moved RivGeoMechVizLogic.h/cpp RivGeoMechPartMgrCache.h/cpp to GeoMech/GeoMechVisualization.
This commit is contained in:
@@ -30,8 +30,7 @@ ${CEE_CURRENT_LIST_DIR}RivTernaryTextureCoordsCreator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapperEffectGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivScalarMapperUtils.h
|
||||
${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.h
|
||||
${CEE_CURRENT_LIST_DIR}RivGeoMechPartMgrCache.h
|
||||
${CEE_CURRENT_LIST_DIR}RivGeoMechVizLogic.h
|
||||
|
||||
|
||||
)
|
||||
|
||||
@@ -59,8 +58,6 @@ ${CEE_CURRENT_LIST_DIR}RivTernaryTextureCoordsCreator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapperEffectGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivScalarMapperUtils.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivGeoMechPartMgrCache.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivGeoMechVizLogic.cpp
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
#include "RivGeoMechPartMgrCache.h"
|
||||
#include "RivGeoMechPartMgr.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGeoMechPartMgrCache::RivGeoMechPartMgrCache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGeoMechPartMgrCache::~RivGeoMechPartMgrCache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivGeoMechPartMgrCache::isNeedingRegeneration(const Key& key) const
|
||||
{
|
||||
std::map<Key, CacheEntry >::const_iterator ceIt = m_partMgrs.find(key);
|
||||
if (ceIt != m_partMgrs.end())
|
||||
{
|
||||
return ceIt->second.needsRegen;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechPartMgrCache::scheduleRegeneration(const Key& key)
|
||||
{
|
||||
std::map<Key, CacheEntry >::iterator ceIt = m_partMgrs.find(key);
|
||||
if (ceIt != m_partMgrs.end())
|
||||
{
|
||||
ceIt->second.needsRegen = true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechPartMgrCache::setGenerationFinished(const Key& key)
|
||||
{
|
||||
m_partMgrs[key].needsRegen = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGeoMechPartMgr* RivGeoMechPartMgrCache::partMgr(const Key& key)
|
||||
{
|
||||
CacheEntry& ce = m_partMgrs[key];
|
||||
if (ce.partMgr.isNull())
|
||||
{
|
||||
ce.partMgr = new RivGeoMechPartMgr;
|
||||
}
|
||||
|
||||
return ce.partMgr.p();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechPartMgrCache::Key::set(RivCellSetEnum 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(RivCellSetEnum aGeometryType, int aFrameIndex)
|
||||
: m_geometryType(aGeometryType), m_frameIndex(aFrameIndex)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
#include "cvfObject.h"
|
||||
#include <map>
|
||||
#include "RivCellSetEnum.h"
|
||||
|
||||
class RivGeoMechPartMgr;
|
||||
class RivGeoMechPartMgrGeneratorInterface;
|
||||
|
||||
class RivGeoMechPartMgrCache : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivGeoMechPartMgrCache();
|
||||
~RivGeoMechPartMgrCache();
|
||||
|
||||
class Key
|
||||
{
|
||||
public:
|
||||
Key() : m_geometryType(-1), m_frameIndex(-1) {}
|
||||
|
||||
Key(RivCellSetEnum aGeometryType, int aFrameIndex);
|
||||
|
||||
void set(RivCellSetEnum 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 isNeedingRegeneration(const Key& key) const;
|
||||
void scheduleRegeneration (const Key& key);
|
||||
void setGenerationFinished(const Key& key);
|
||||
RivGeoMechPartMgr* partMgr (const Key& key);
|
||||
|
||||
private:
|
||||
class CacheEntry
|
||||
{
|
||||
public:
|
||||
CacheEntry() : needsRegen(true) {}
|
||||
|
||||
bool needsRegen;
|
||||
cvf::ref<RivGeoMechPartMgr> partMgr;
|
||||
};
|
||||
|
||||
std::map<Key, CacheEntry > m_partMgrs;
|
||||
};
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivGeoMechVizLogic.h"
|
||||
|
||||
#include "RimGeoMechView.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RivGeoMechPartMgrCache.h"
|
||||
#include "RivGeoMechPartMgr.h"
|
||||
#include "RivReservoirViewPartMgr.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
|
||||
#include "RivCellSetEnum.h"
|
||||
#include "RivFemElmVisibilityCalculator.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGeoMechVizLogic::RivGeoMechVizLogic(RimGeoMechView * geomView)
|
||||
{
|
||||
CVF_ASSERT(geomView);
|
||||
m_geomechView = geomView;
|
||||
m_partMgrCache = new RivGeoMechPartMgrCache;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGeoMechVizLogic::~RivGeoMechVizLogic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::appendNoAnimPartsToModel(cvf::ModelBasicList* model)
|
||||
{
|
||||
this->appendPartsToModel(-1, model);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::appendPartsToModel(int timeStepIndex, cvf::ModelBasicList* model)
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs(timeStepIndex);
|
||||
for (size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx)
|
||||
{
|
||||
RivGeoMechPartMgr* partMgr = getUpdatedPartMgr(visiblePartMgrs[pmIdx]);
|
||||
|
||||
partMgr->appendGridPartsToModel(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::updateCellResultColor(int timeStepIndex, RimGeoMechCellColors* cellResultSlot)
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs(timeStepIndex);
|
||||
for (size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx)
|
||||
{
|
||||
RivGeoMechPartMgr* partMgr = m_partMgrCache->partMgr(visiblePartMgrs[pmIdx]);
|
||||
partMgr->updateCellResultColor(timeStepIndex, cellResultSlot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::updateStaticCellColors(int timeStepIndex)
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs(timeStepIndex);
|
||||
for (size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx)
|
||||
{
|
||||
RivGeoMechPartMgr* partMgr = m_partMgrCache->partMgr(visiblePartMgrs[pmIdx]);
|
||||
partMgr->updateCellColor(cvf::Color4f(cvf::Color3f::ORANGE));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::scheduleGeometryRegen(RivCellSetEnum geometryType)
|
||||
{
|
||||
this->scheduleRegenOfDirectlyDependentGeometry(geometryType);
|
||||
|
||||
int frameCount = m_geomechView->geoMechCase()->geoMechData()->femPartResults()->frameCount();
|
||||
|
||||
for (int fIdx = -1; fIdx < frameCount; ++fIdx)
|
||||
{
|
||||
RivGeoMechPartMgrCache::Key geomToRegen(geometryType, fIdx);
|
||||
m_partMgrCache->scheduleRegeneration(geomToRegen);
|
||||
}
|
||||
}
|
||||
|
||||
void RivGeoMechVizLogic::scheduleRegenOfDirectlyDependentGeometry(RivCellSetEnum geometryType)
|
||||
{
|
||||
if (geometryType == RANGE_FILTERED)
|
||||
{
|
||||
this->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RivGeoMechPartMgrCache::Key> RivGeoMechVizLogic::keysToVisiblePartMgrs(int timeStepIndex)
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs;
|
||||
|
||||
if (timeStepIndex >= 0 && m_geomechView->propertyFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
visiblePartMgrs.push_back(RivGeoMechPartMgrCache::Key(PROPERTY_FILTERED, timeStepIndex));
|
||||
}
|
||||
else if (m_geomechView->rangeFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
visiblePartMgrs.push_back(RivGeoMechPartMgrCache::Key(RANGE_FILTERED, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
visiblePartMgrs.push_back(RivGeoMechPartMgrCache::Key(ALL_CELLS, -1));
|
||||
}
|
||||
|
||||
return visiblePartMgrs;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr(RivGeoMechPartMgrCache::Key pMgrKey)
|
||||
{
|
||||
if (!m_partMgrCache->isNeedingRegeneration(pMgrKey))
|
||||
{
|
||||
return m_partMgrCache->partMgr(pMgrKey);
|
||||
}
|
||||
|
||||
RivGeoMechPartMgr* partMgrToUpdate = m_partMgrCache->partMgr(pMgrKey);
|
||||
RigGeoMechCaseData* caseData = m_geomechView->geoMechCase()->geoMechData();
|
||||
int partCount = caseData->femParts()->partCount();
|
||||
|
||||
if (partMgrToUpdate->initializedFemPartCount() != partCount)
|
||||
{
|
||||
partMgrToUpdate->clearAndSetReservoir(caseData);
|
||||
}
|
||||
|
||||
for (int femPartIdx = 0; femPartIdx < partCount; ++femPartIdx)
|
||||
{
|
||||
cvf::ref<cvf::UByteArray> elmVisibility = partMgrToUpdate->cellVisibility(femPartIdx);
|
||||
partMgrToUpdate->setTransform(m_geomechView->scaleTransform());
|
||||
|
||||
if (pMgrKey.geometryType() == RANGE_FILTERED)
|
||||
{
|
||||
cvf::CellRangeFilter cellRangeFilter;
|
||||
m_geomechView->rangeFilterCollection()->compoundCellRangeFilter(&cellRangeFilter, femPartIdx);
|
||||
RivFemElmVisibilityCalculator::computeRangeVisibility( elmVisibility.p(),
|
||||
caseData->femParts()->part(femPartIdx),
|
||||
cellRangeFilter);
|
||||
}
|
||||
else if (pMgrKey.geometryType() == PROPERTY_FILTERED)
|
||||
{
|
||||
RivGeoMechPartMgr* rangefiltered = NULL;
|
||||
if (m_geomechView->rangeFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
rangefiltered = getUpdatedPartMgr(RivGeoMechPartMgrCache::Key(RANGE_FILTERED, -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
rangefiltered = getUpdatedPartMgr(RivGeoMechPartMgrCache::Key(ALL_CELLS, -1));
|
||||
}
|
||||
cvf::ref<cvf::UByteArray> rangeFiltVisibility = rangefiltered->cellVisibility(femPartIdx);
|
||||
|
||||
RivFemElmVisibilityCalculator::computePropertyVisibility(elmVisibility.p(),
|
||||
caseData->femParts()->part(femPartIdx),
|
||||
pMgrKey.frameIndex(),
|
||||
rangeFiltVisibility.p(),
|
||||
m_geomechView->propertyFilterCollection()
|
||||
);
|
||||
}
|
||||
else if (pMgrKey.geometryType() == ALL_CELLS)
|
||||
{
|
||||
RivFemElmVisibilityCalculator::computeAllVisible(elmVisibility.p(), caseData->femParts()->part(femPartIdx));
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false); // Unsupported CellSet Enum
|
||||
}
|
||||
|
||||
partMgrToUpdate->setCellVisibility(femPartIdx, elmVisibility.p());
|
||||
}
|
||||
|
||||
m_partMgrCache->setGenerationFinished(pMgrKey);
|
||||
|
||||
return partMgrToUpdate;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include "cvfObject.h"
|
||||
#include "cvfColor4.h"
|
||||
#include "RivGeoMechPartMgrCache.h"
|
||||
#include "RivCellSetEnum.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimGeoMechView;
|
||||
class RimGeoMechCellColors;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
}
|
||||
|
||||
class RivGeoMechVizLogic : public cvf::Object
|
||||
{
|
||||
public:
|
||||
|
||||
RivGeoMechVizLogic(RimGeoMechView * geomView);
|
||||
virtual ~RivGeoMechVizLogic();
|
||||
|
||||
void appendNoAnimPartsToModel(cvf::ModelBasicList* model);
|
||||
void appendPartsToModel(int timeStepIndex, cvf::ModelBasicList* model);
|
||||
void updateCellResultColor(int timeStepIndex, RimGeoMechCellColors* cellResultSlot);
|
||||
void updateStaticCellColors(int timeStepIndex);
|
||||
void scheduleGeometryRegen(RivCellSetEnum geometryType);
|
||||
private:
|
||||
|
||||
std::vector<RivGeoMechPartMgrCache::Key> keysToVisiblePartMgrs(int timeStepIndex);
|
||||
RivGeoMechPartMgr* getUpdatedPartMgr(RivGeoMechPartMgrCache::Key partMgrKey);
|
||||
void scheduleRegenOfDirectlyDependentGeometry(RivCellSetEnum geometryType);
|
||||
|
||||
cvf::ref<RivGeoMechPartMgrCache> m_partMgrCache;
|
||||
RimGeoMechView* m_geomechView;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user