diff --git a/MeshLib/MeshInformation.h b/MeshLib/MeshInformation.h index b68968597c51663289daa63c7e1d6ba025771227..bba51e35f2862ff7feea007d7cb7c09f68b4445f 100644 --- a/MeshLib/MeshInformation.h +++ b/MeshLib/MeshInformation.h @@ -17,6 +17,7 @@ #include <array> #include <limits> #include <map> +#include <optional> #include <string> #include "GeoLib/AABB.h" @@ -35,24 +36,18 @@ public: /// Returns the smallest and largest value of a scalar array with the given /// name. template <typename T> - static boost::optional<std::pair<T, T>> const getValueBounds( - MeshLib::Mesh const& mesh, std::string const& name) + static std::optional<std::pair<T, T>> const getValueBounds( + PropertyVector<T> const& property) { - if (!mesh.getProperties().existsPropertyVector<T>(name)) + if (property.empty()) { - return {}; - } - - auto const* const data_vec = - mesh.getProperties().getPropertyVector<T>(name); - if (data_vec->empty()) - { - INFO("Mesh does not contain values for the property '{:s}'.", name); + INFO("Mesh property vector '{:s}' is empty.", + property.getPropertyName()); return {}; } auto const [min, max] = - std::minmax_element(begin(*data_vec), end(*data_vec)); + std::minmax_element(begin(property), end(property)); return {{*min, *max}}; }