write error message only once

This commit is contained in:
Guillaume Damiand 2025-10-11 14:57:17 +02:00
parent 2ca338068b
commit f6425d7773
1 changed files with 7 additions and 1 deletions

View File

@ -22,6 +22,7 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <set>
namespace CGAL { namespace CGAL {
namespace IO { namespace IO {
@ -361,6 +362,7 @@ bool read_lcc_from_vtk_ascii(std::istream& is, LCC& alcc,
// Create cells based on types // Create cells based on types
std::size_t cell_type; std::size_t cell_type;
std::set<std::size_t> error_types;
for(std::size_t i = 0; i<ncells; ++i) for(std::size_t i = 0; i<ncells; ++i)
{ {
if(!(is>>cell_type)) if(!(is>>cell_type))
@ -408,7 +410,11 @@ bool read_lcc_from_vtk_ascii(std::istream& is, LCC& alcc,
make_generic_cell_with_builder(ib, v); make_generic_cell_with_builder(ib, v);
break; break;
default: default:
std::cerr<<"[ERROR] read_VTK: type "<<cell_type<<" unknown."<<std::endl; if(error_types.count(cell_type)==0)
{
std::cerr<<"[ERROR] read_VTK: type "<<cell_type<<" unknown."<<std::endl;
error_types.insert(cell_type);
}
} }
} }