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

use unordered_map for primitive storage

parent fabdf3a8
......@@ -107,17 +107,18 @@ 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;
explicit PrimitiveStorage( const SetupPrimitiveStorage& setupStorage, const uint_t& additionalHaloDepth = 0 );
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,
const std::shared_ptr< walberla::WcTimingTree >& timingTree,
const uint_t& additionalHaloDepth = 0 );
......@@ -568,10 +569,10 @@ class PrimitiveStorage : private walberla::NonCopyable
typename PrimitiveType,
typename DataHandlingType,
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 PrimitiveDataID< DataType, PrimitiveType >& dataID );
inline void addPrimitiveData( const std::shared_ptr< DataHandlingType >& dataHandling,
const std::string& identifier,
const GenericPrimitiveMap< PrimitiveType >& primitives,
const PrimitiveDataID< DataType, PrimitiveType >& dataID );
VertexMap vertices_;
EdgeMap edges_;
......@@ -764,8 +765,8 @@ 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 PrimitiveDataID< DataType, PrimitiveType >& dataID )
const GenericPrimitiveMap< PrimitiveType >& primitives,
const PrimitiveDataID< DataType, PrimitiveType >& dataID )
{
#ifndef NDEBUG
for ( auto it = primitives.begin(); it != primitives.end(); it++ )
......
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