diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index f3f0a9df5480a9a9835485fe108504cc8904ffb1..18fda3eabf11e3af28f21e83cfc19d7c85da944e 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -16,6 +16,9 @@ #include <algorithm> #include <boost/algorithm/string/predicate.hpp> #include <cctype> +#include <range/v3/action/sort.hpp> +#include <range/v3/action/unique.hpp> +#include <range/v3/range/conversion.hpp> #include <set> #ifdef OGS_USE_PYTHON @@ -223,6 +226,20 @@ std::vector<std::unique_ptr<MeshLib::Mesh>> readMeshes( std::back_inserter(meshes)); } + auto mesh_names = MeshLib::views::names | ranges::to<std::vector>() | + ranges::actions::sort; + auto const sorted_names = meshes | mesh_names; + auto const unique_names = meshes | mesh_names | ranges::actions::unique; + if (unique_names.size() < sorted_names.size()) + { + WARN( + "Mesh names aren't unique. From project file read mesh names are:"); + for (auto const& name : meshes | MeshLib::views::names) + { + INFO("- {}", name); + } + } + MeshLib::setMeshSpaceDimension(meshes); return meshes;