From 247d4b8e3a7ef53f897561ab31417779c5040ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Wed, 13 Apr 2022 16:27:27 +0200 Subject: [PATCH] Improve error messages to display available item sets --- src/mesh/MeshCellZone.cpp | 7 ++----- src/mesh/MeshFlatFaceBoundary.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mesh/MeshCellZone.cpp b/src/mesh/MeshCellZone.cpp index 240d8ea4f..5b9128155 100644 --- a/src/mesh/MeshCellZone.cpp +++ b/src/mesh/MeshCellZone.cpp @@ -9,9 +9,6 @@ MeshCellZone<Dimension>::MeshCellZone(const Mesh<Connectivity<Dimension>>&, cons : m_cell_list(ref_cell_list.list()), m_zone_name(ref_cell_list.refId().tagName()) {} -template MeshCellZone<2>::MeshCellZone(const Mesh<Connectivity<2>>&, const RefCellList&); -template MeshCellZone<3>::MeshCellZone(const Mesh<Connectivity<3>>&, const RefCellList&); - template <size_t Dimension> MeshCellZone<Dimension> getMeshCellZone(const Mesh<Connectivity<Dimension>>& mesh, const IZoneDescriptor& zone_descriptor) @@ -26,8 +23,8 @@ getMeshCellZone(const Mesh<Connectivity<Dimension>>& mesh, const IZoneDescriptor } std::ostringstream ost; - ost << "cannot find zone with name " << rang::fgB::red << zone_descriptor << rang::style::reset << '\n'; - ost << "The mesh contains " << mesh.connectivity().template numberOfRefItemList<ItemType::cell>() << " zones: "; + ost << "cannot find cell set with name " << rang::fgB::red << zone_descriptor << rang::style::reset << '\n'; + ost << "The mesh contains " << mesh.connectivity().template numberOfRefItemList<ItemType::cell>() << " cell sets: "; for (size_t i_ref_cell_list = 0; i_ref_cell_list < mesh.connectivity().template numberOfRefItemList<ItemType::cell>(); ++i_ref_cell_list) { const auto& ref_cell_list = mesh.connectivity().template refItemList<ItemType::cell>(i_ref_cell_list); diff --git a/src/mesh/MeshFlatFaceBoundary.cpp b/src/mesh/MeshFlatFaceBoundary.cpp index 0deefac0a..5759fe9e5 100644 --- a/src/mesh/MeshFlatFaceBoundary.cpp +++ b/src/mesh/MeshFlatFaceBoundary.cpp @@ -20,10 +20,22 @@ getMeshFlatFaceBoundary(const Mesh<Connectivity<Dimension>>& mesh, const IBounda } std::ostringstream ost; - ost << "cannot find surface with name " << rang::fgB::red << boundary_descriptor << rang::style::reset; + ost << "cannot find face list with name " << rang::fgB::red << boundary_descriptor << rang::style::reset << '\n'; + ost << "The mesh contains " << mesh.connectivity().template numberOfRefItemList<ItemType::face>() + << " referenced face lists: "; + for (size_t i_ref_face_list = 0; i_ref_face_list < mesh.connectivity().template numberOfRefItemList<ItemType::face>(); + ++i_ref_face_list) { + const auto& ref_face_list = mesh.connectivity().template refItemList<ItemType::face>(i_ref_face_list); + const RefId& ref = ref_face_list.refId(); + if (i_ref_face_list > 0) { + ost << ", "; + } + ost << rang::fgB::yellow << ref << rang::style::reset; + } throw NormalError(ost.str()); } +template MeshFlatFaceBoundary<1> getMeshFlatFaceBoundary(const Mesh<Connectivity<1>>&, const IBoundaryDescriptor&); template MeshFlatFaceBoundary<2> getMeshFlatFaceBoundary(const Mesh<Connectivity<2>>&, const IBoundaryDescriptor&); template MeshFlatFaceBoundary<3> getMeshFlatFaceBoundary(const Mesh<Connectivity<3>>&, const IBoundaryDescriptor&); -- GitLab