Skip to content
Snippets Groups Projects
Commit 858d0a8a authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MeL] Move print bounds lambda to function.

parent aa675315
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,23 @@ ...@@ -17,6 +17,23 @@
#include "Elements/Element.h" #include "Elements/Element.h"
#include "MeshLib/MeshQuality/MeshValidation.h" #include "MeshLib/MeshQuality/MeshValidation.h"
namespace
{
template <typename T>
void printBounds(MeshLib::PropertyVector<T> const& property)
{
auto const bounds = MeshLib::MeshInformation::getValueBounds(property);
if (!bounds.has_value())
{
INFO("\t{:s}: Could not get value bounds for property vector.",
property.getPropertyName());
return;
}
INFO("\t{:s}: ({:d} values) [{}, {}]", property.getPropertyName(),
property.size(), bounds->first, bounds->second);
}
} // namespace
namespace MeshLib namespace MeshLib
{ {
GeoLib::AABB MeshInformation::getBoundingBox(const MeshLib::Mesh& mesh) GeoLib::AABB MeshInformation::getBoundingBox(const MeshLib::Mesh& mesh)
...@@ -58,44 +75,32 @@ void MeshInformation::writePropertyVectorInformation(const MeshLib::Mesh& mesh) ...@@ -58,44 +75,32 @@ void MeshInformation::writePropertyVectorInformation(const MeshLib::Mesh& mesh)
auto const& properties = mesh.getProperties(); auto const& properties = mesh.getProperties();
INFO("There are {:d} properties in the mesh:", properties.size()); INFO("There are {:d} properties in the mesh:", properties.size());
auto print_bounds = [](auto const& property) {
auto const bounds = getValueBounds(property);
if (!bounds.has_value())
{
INFO("\t{:s}: Could not get value bounds for property vector.",
property.getPropertyName());
return;
}
INFO("\t{:s}: ({:d} values) [{}, {}]", property.getPropertyName(),
property.size(), bounds->first, bounds->second);
};
for (auto [name, property] : properties) for (auto [name, property] : properties)
{ {
if (auto p = dynamic_cast<PropertyVector<double>*>(property)) if (auto p = dynamic_cast<PropertyVector<double>*>(property))
{ {
print_bounds(*p); printBounds(*p);
} }
else if (auto p = dynamic_cast<PropertyVector<float>*>(property)) else if (auto p = dynamic_cast<PropertyVector<float>*>(property))
{ {
print_bounds(*p); printBounds(*p);
} }
else if (auto p = dynamic_cast<PropertyVector<int>*>(property)) else if (auto p = dynamic_cast<PropertyVector<int>*>(property))
{ {
print_bounds(*p); printBounds(*p);
} }
else if (auto p = dynamic_cast<PropertyVector<unsigned>*>(property)) else if (auto p = dynamic_cast<PropertyVector<unsigned>*>(property))
{ {
print_bounds(*p); printBounds(*p);
} }
else if (auto p = dynamic_cast<PropertyVector<long>*>(property)) else if (auto p = dynamic_cast<PropertyVector<long>*>(property))
{ {
print_bounds(*p); printBounds(*p);
} }
else if (auto p = else if (auto p =
dynamic_cast<PropertyVector<unsigned long>*>(property)) dynamic_cast<PropertyVector<unsigned long>*>(property))
{ {
print_bounds(*p); printBounds(*p);
} }
else if (auto p = dynamic_cast<PropertyVector<std::size_t>*>(property)) else if (auto p = dynamic_cast<PropertyVector<std::size_t>*>(property))
{ {
...@@ -103,7 +108,7 @@ void MeshInformation::writePropertyVectorInformation(const MeshLib::Mesh& mesh) ...@@ -103,7 +108,7 @@ void MeshInformation::writePropertyVectorInformation(const MeshLib::Mesh& mesh)
} }
else if (auto p = dynamic_cast<PropertyVector<char>*>(property)) else if (auto p = dynamic_cast<PropertyVector<char>*>(property))
{ {
print_bounds(*p); printBounds(*p);
} }
else else
{ {
......
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