Commit 015d4a1e authored by Marcel Koch's avatar Marcel Koch
Browse files

use unordered_map for primitive storage

parent fabdf3a8
......@@ -107,15 +107,16 @@ inline std::ostream& operator<<(std::ostream &os, const MigrationInfo & migratio
return os;
}
class PrimitiveStorage : private walberla::NonCopyable
{
public:
typedef std::map< PrimitiveID::IDType, std::shared_ptr< Primitive > > PrimitiveMap;
typedef std::map< PrimitiveID::IDType, std::shared_ptr< Vertex > > VertexMap;
typedef std::map< PrimitiveID::IDType, std::shared_ptr< Edge > > EdgeMap;
typedef std::map< PrimitiveID::IDType, std::shared_ptr< Face > > FaceMap;
typedef std::map< PrimitiveID::IDType, std::shared_ptr< Cell > > CellMap;
template < typename P >
using GenericPrimitiveMap = std::unordered_map< PrimitiveID::IDType, std::shared_ptr< P > >;
typedef GenericPrimitiveMap< Primitive > PrimitiveMap;
typedef GenericPrimitiveMap< Vertex > VertexMap;
typedef GenericPrimitiveMap< Edge > EdgeMap;
typedef GenericPrimitiveMap< Face > FaceMap;
typedef GenericPrimitiveMap< Cell > CellMap;
explicit PrimitiveStorage( const SetupPrimitiveStorage& setupStorage, const uint_t& additionalHaloDepth = 0 );
PrimitiveStorage( const SetupPrimitiveStorage& setupStorage,
......@@ -570,7 +571,7 @@ class PrimitiveStorage : private walberla::NonCopyable
typename = typename std::enable_if< std::is_base_of< Primitive, PrimitiveType >::value >::type >
inline void addPrimitiveData( const std::shared_ptr< DataHandlingType >& dataHandling,
const std::string& identifier,
const std::map< PrimitiveID::IDType, std::shared_ptr< PrimitiveType > >& primitives,
const GenericPrimitiveMap< PrimitiveType >& primitives,
const PrimitiveDataID< DataType, PrimitiveType >& dataID );
VertexMap vertices_;
......@@ -764,7 +765,7 @@ template < typename DataType, typename PrimitiveType, typename DataHandlingType,
inline void
PrimitiveStorage::addPrimitiveData( const std::shared_ptr< DataHandlingType >& dataHandling,
const std::string& identifier, // TODO remark: identifier not used in this function
const std::map< PrimitiveID::IDType, std::shared_ptr< PrimitiveType > >& primitives,
const GenericPrimitiveMap< PrimitiveType >& primitives,
const PrimitiveDataID< DataType, PrimitiveType >& dataID )
{
#ifndef NDEBUG
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment