diff --git a/MeshLib/Properties.cpp b/MeshLib/Properties.cpp index a29145acb077a6eb53fc54f8ccf7bbca3405b91b..8d8b5bcfc2b9753e9e082583d77d2618fcec2d50 100644 --- a/MeshLib/Properties.cpp +++ b/MeshLib/Properties.cpp @@ -167,4 +167,12 @@ std::map<std::string, PropertyVectorBase*>::size_type Properties::size() const { return _properties.size(); } + +std::map<std::string, PropertyVectorBase*>::size_type Properties::size( + MeshItemType const mesh_item_type) const +{ + return count_if(begin(), end(), [&](auto const p) { + return p.second->getMeshItemType() == mesh_item_type; + }); +} } // end namespace MeshLib diff --git a/MeshLib/Properties.h b/MeshLib/Properties.h index f6dc79863e5bf7628aac5046952ef2f6a9619c44..693af4d9eda6e8535a6efa74bad3f1f7e52215a7 100644 --- a/MeshLib/Properties.h +++ b/MeshLib/Properties.h @@ -155,6 +155,9 @@ public: std::map<std::string, PropertyVectorBase*>::iterator begin(); std::map<std::string, PropertyVectorBase*>::iterator end(); std::map<std::string, PropertyVectorBase*>::size_type size() const; + // Counts properties of given mesh item type. + std::map<std::string, PropertyVectorBase*>::size_type size( + MeshItemType const mesh_item_type) const; private: /// A mapping from property's name to the stored object of any type.