Files
ResInsight/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h
T

81 lines
2.1 KiB
C++
Raw Normal View History

2017-06-14 07:53:28 +02:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
2017-06-14 07:53:28 +02:00
// 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.
//
2017-06-14 07:53:28 +02:00
// 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>
2017-06-14 07:53:28 +02:00
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
2015-05-22 17:01:59 +02:00
#pragma once
2017-06-14 07:53:28 +02:00
#include "RivCellSetEnum.h"
#include "RivGeoMechPartMgr.h"
2017-06-14 07:53:28 +02:00
2015-05-22 17:01:59 +02:00
#include "cvfObject.h"
2017-06-14 07:53:28 +02:00
#include <cstddef>
2015-05-22 17:01:59 +02:00
#include <map>
2015-06-22 08:16:46 +02:00
class RivGeoMechPartMgrGeneratorInterface;
2015-05-22 17:01:59 +02:00
class RivGeoMechPartMgrCache : public cvf::Object
{
public:
RivGeoMechPartMgrCache();
~RivGeoMechPartMgrCache() override;
2015-05-22 17:01:59 +02:00
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;
2015-05-22 17:01:59 +02:00
};
bool isNeedingRegeneration( const Key& key ) const;
void scheduleRegeneration( const Key& key );
void setGenerationFinished( const Key& key );
RivGeoMechPartMgr* partMgr( const Key& key );
2015-05-22 17:01:59 +02:00
private:
class CacheEntry
{
public:
CacheEntry()
: needsRegen( true )
{
}
2015-05-22 17:01:59 +02:00
bool needsRegen;
cvf::ref<RivGeoMechPartMgr> partMgr;
};
std::map<Key, CacheEntry> m_partMgrs;
2015-05-22 17:01:59 +02:00
};