Skip to content
Snippets Groups Projects
Commit 17b0db37 authored by wenqing's avatar wenqing Committed by Dmitri Naumov
Browse files

[PropertyVector] Added an overload function hasPropertyVector

parent aef09045
No related branches found
No related tags found
No related merge requests found
...@@ -147,6 +147,23 @@ PropertyVector<T>* Properties::getPropertyVector(std::string_view name) ...@@ -147,6 +147,23 @@ PropertyVector<T>* Properties::getPropertyVector(std::string_view name)
return dynamic_cast<PropertyVector<T>*>(it->second); return dynamic_cast<PropertyVector<T>*>(it->second);
} }
template <typename T>
bool Properties::hasPropertyVector(std::string const& name,
MeshItemType const item_type) const
{
auto const it = _properties.find(name);
if (it == _properties.end())
{
return false;
}
auto property = dynamic_cast<PropertyVector<T>*>(it->second);
return (property == nullptr) ? false
: property->getMeshItemType() == item_type;
}
template <typename T> template <typename T>
PropertyVector<T> const* Properties::getPropertyVector( PropertyVector<T> const* Properties::getPropertyVector(
std::string_view name, MeshItemType const item_type, std::string_view name, MeshItemType const item_type,
......
...@@ -123,6 +123,14 @@ public: ...@@ -123,6 +123,14 @@ public:
/// @param name the name of the property (for instance porosity) /// @param name the name of the property (for instance porosity)
bool hasPropertyVector(std::string_view name) const; bool hasPropertyVector(std::string_view name) const;
/// Check if a PropertyVector accessible by the name and by the item type
/// is already stored within the Properties object.
/// @param name the name of the property, e.g. porosity.
/// @param item_type the type of mesh entity, e.g. CELL.
template <typename T>
bool hasPropertyVector(std::string const& name,
MeshItemType const item_type) const;
std::vector<std::string> getPropertyVectorNames() const; std::vector<std::string> getPropertyVectorNames() const;
std::vector<std::string> getPropertyVectorNames( std::vector<std::string> getPropertyVectorNames(
MeshLib::MeshItemType t) const; MeshLib::MeshItemType t) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment