Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}
} // namespace

namespace geode

Check warning on line 66 in src/geode/inspector/inspection/criterion/internal/component_meshes_adjacency.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/internal/component_meshes_adjacency.cpp:66:1 [modernize-concat-nested-namespaces]

nested namespaces can be concatenated
{
namespace internal
{
Expand All @@ -76,7 +76,7 @@

template < typename Model >
void ComponentMeshesAdjacency< Model >::
add_surfaces_edges_with_wrong_adjacencies(

Check warning on line 79 in src/geode/inspector/inspection/criterion/internal/component_meshes_adjacency.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/internal/component_meshes_adjacency.cpp:79:13 [readability-function-cognitive-complexity]

function 'add_surfaces_edges_with_wrong_adjacencies' has cognitive complexity of 15 (threshold 10)
InspectionIssuesMap< PolygonEdge >&
components_wrong_adjacencies ) const
{
Expand Down Expand Up @@ -112,7 +112,7 @@
}
catch( const OpenGeodeException& e )
{
Logger::warn( e.what() );
Logger::warning( e.what() );
issues.add_issue( polygon_edge,
absl::StrCat( "edge ", edge_id, " of polygon ",
polygon_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <geode/inspector/inspection/criterion/degeneration/edgedcurve_degeneration.hpp>
#include <geode/inspector/inspection/criterion/degeneration/surface_degeneration.hpp>

namespace geode

Check warning on line 40 in src/geode/inspector/inspection/criterion/internal/component_meshes_degeneration.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/internal/component_meshes_degeneration.cpp:40:1 [modernize-concat-nested-namespaces]

nested namespaces can be concatenated
{
namespace internal
{
Expand Down Expand Up @@ -71,11 +71,14 @@
const EdgedCurveDegeneration< Model::dim > inspector{
line.mesh()
};
auto issues = inspector.small_edges( threshold );
std::pair< uuid, InspectionIssues< index_t > > result;
auto& [line_id, issues] = result;
line_id = line.id();
issues = inspector.small_edges( threshold );
issues.set_description( absl::StrCat( "Line ",
line.name().value_or( line.id().string() ), " (",
line.id().string(), ") small edges" ) );
return std::make_pair( line.id(), std::move( issues ) );
return result;
} ) );
}
for( auto& task :
Expand All @@ -102,13 +105,15 @@
}
const geode::SurfaceMeshDegeneration< Model::dim >
inspector{ surface.mesh() };
auto issues = inspector.small_edges( threshold );
std::pair< uuid, InspectionIssues< index_t > > result;
auto& [surface_id, issues] = result;
surface_id = surface.id();
issues = inspector.small_edges( threshold );
issues.set_description( absl::StrCat( "Surface ",
surface.name().value_or( surface.id().string() ),
" (", surface.id().string(),
") small facet edges" ) );
return std::make_pair(
surface.id(), std::move( issues ) );
return result;
} ) );
}
for( auto& task :
Expand Down Expand Up @@ -142,11 +147,14 @@
tasks.emplace_back( async::spawn( [&threshold, &surface] {
const geode::SurfaceMeshDegeneration< Model::dim >
inspector{ surface.mesh() };
auto issues = inspector.small_height_polygons( threshold );
std::pair< uuid, InspectionIssues< index_t > > result;
auto& [surface_id, issues] = result;
surface_id = surface.id();
issues = inspector.small_height_polygons( threshold );
issues.set_description( absl::StrCat( "Surface ",
surface.name().value_or( surface.id().string() ), " (",
surface.id().string(), ") small height polygons" ) );
return std::make_pair( surface.id(), std::move( issues ) );
return result;
} ) );
}
for( auto& task :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{
public:
BRepLineSurfacesIntersection( const geode::BRep& model,
const geode::uuid& surface_id,

Check warning on line 85 in src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp:85:13 [bugprone-easily-swappable-parameters]

2 adjacent parameters of 'BRepLineSurfacesIntersection' of similar type ('const geode::uuid &') are easily swapped by mistake
const geode::uuid& line_id )
: surface_( model.surface( surface_id ) ),
line_( model.line( line_id ) ),
Expand Down Expand Up @@ -164,7 +164,7 @@
class ModelIntersectionBase
{
public:
ModelIntersectionBase( const Model& model ) : model_( model ) {}

Check warning on line 167 in src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp:167:9 [google-explicit-constructor]

single-argument constructors must be marked explicit to avoid unintentional implicit conversions

[[nodiscard]] std::vector< std::pair< geode::index_t, geode::index_t > >
intersecting_elements()
Expand Down Expand Up @@ -207,7 +207,7 @@

protected:
[[nodiscard]] bool polygons_intersect(
geode::index_t p1_id, geode::index_t p2_id ) const

Check warning on line 210 in src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp:210:13 [bugprone-easily-swappable-parameters]

2 adjacent parameters of 'polygons_intersect' of similar type ('geode::index_t') are easily swapped by mistake
{
const auto p1_vertices = this->mesh1().polygon_vertices( p1_id );
const auto p2_vertices = this->mesh2().polygon_vertices( p2_id );
Expand Down Expand Up @@ -249,7 +249,7 @@

[[nodiscard]] absl::InlinedVector< std::array< geode::index_t, 2 >, 3 >
triangles_common_vertices(
const geode::PolygonVertices& t1_vertices,

Check warning on line 252 in src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp:252:17 [bugprone-easily-swappable-parameters]

2 adjacent parameters of 'triangles_common_vertices' of similar type ('const geode::PolygonVertices &') are easily swapped by mistake
const geode::PolygonVertices& t2_vertices ) const
{
absl::InlinedVector< std::array< geode::index_t, 2 >, 3 >
Expand Down Expand Up @@ -425,7 +425,7 @@

template <>
[[nodiscard]] bool
ModelSurfacesIntersectionBase< geode::Section >::triangles_intersect(

Check warning on line 428 in src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp:428:58 [readability-function-cognitive-complexity]

function 'triangles_intersect' has cognitive complexity of 28 (threshold 10)
const geode::PolygonVertices& t1_vertices,
const geode::PolygonVertices& t2_vertices,
absl::Span< const std::array< geode::index_t, 2 > >
Expand Down Expand Up @@ -505,7 +505,7 @@
return false;
}

[[nodiscard]] bool triangle_intersects_other(

Check warning on line 508 in src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp:508:24 [readability-function-size]

function 'triangle_intersects_other' exceeds recommended size/complexity thresholds

Check warning on line 508 in src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/intersections/model_intersections.cpp:508:24 [readability-function-cognitive-complexity]

function 'triangle_intersects_other' has cognitive complexity of 22 (threshold 10)
const geode::Triangle3D& triangle1,
const geode::Triangle3D& triangle2,
const geode::PolygonVertices& t1_vertices,
Expand Down Expand Up @@ -772,7 +772,7 @@
{
if( surface.mesh().nb_polygons() == 0 )
{
geode::Logger::warn(
geode::Logger::warning(
"One of the surface meshes has an empty mesh, cannot "
"compute the AABBTree used for detecting the mesh "
"intersections, no intersections will be "
Expand Down Expand Up @@ -854,7 +854,7 @@
{
if( line.mesh().nb_edges() == 0 )
{
geode::Logger::warn(
geode::Logger::warning(
"One of the line meshes has an empty mesh, "
"skipping line-surface intersection detection." );
return component_intersections;
Expand Down Expand Up @@ -934,7 +934,7 @@
{
if( surface.mesh().nb_polygons() == 0 )
{
geode::Logger::warn(
geode::Logger::warning(
"One of the surface meshes has an empty mesh, "
"skipping line-surface intersection detection." );
return component_intersections;
Expand All @@ -944,7 +944,7 @@
{
if( line.mesh().nb_edges() == 0 )
{
geode::Logger::warn(
geode::Logger::warning(
"One of the line meshes has an empty mesh, "
"skipping line-surface intersection detection." );
return component_intersections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ namespace
};
if( !polygons_around_edges
.try_emplace( polygon_edge_vertex_cycle,
std::make_pair( 1, false ) )
std::pair< geode::local_index_t, bool >{
1, false } )
.second )
{
polygons_around_edges[polygon_edge_vertex_cycle].first += 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace geode
mesh_.polyhedron_vertex( { polyhedron_id, 2 } ) ),
mesh_.point(
mesh_.polyhedron_vertex( { polyhedron_id, 3 } ) ) };
return tetrahedron_volume_sign( tetrahedron ) == Sign::negative;
return tetrahedron_volume_sign( tetrahedron ) == SIGN::negative;
}
return mesh_.polyhedron_volume( polyhedron_id ) < 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace geode
for( const auto polygon_id : Range{ mesh_.nb_polygons() } )
{
if( polygon_area_sign( mesh_.polygon( polygon_id ) )
== Sign::negative )
== SIGN::negative )
{
return true;
}
Expand All @@ -68,7 +68,7 @@ namespace geode
for( const auto polygon_id : Range{ mesh_.nb_polygons() } )
{
if( polygon_area_sign( mesh_.polygon( polygon_id ) )
== Sign::negative )
== SIGN::negative )
{
wrong_polygons.add_issue( polygon_id,
absl::StrCat( "negative polygon ", polygon_id ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ namespace
/// On one side of a topological non-manifold => 2 cases possible,
/// depending on wether the topological non-manifold is on the
/// interior or exterior of the block
geode::Logger::warn( absl::StrCat(
geode::Logger::warning( absl::StrCat(
"[expected_block_cmvs_and_error] Unique vertex ",
unique_vertex_id, " at position [",
brep.block( unique_vertex_cmvs.block_cmvs[0].component_id.id() )
Expand All @@ -197,10 +197,10 @@ namespace
if( nb_block_cmvs
== predicted_nb_block_cmvs + nb_lines_on_several_boundaries )
{
return std::make_pair( nb_block_cmvs, std::nullopt );
return { nb_block_cmvs, std::nullopt };
}
}
return std::make_pair( predicted_nb_block_cmvs,
return { predicted_nb_block_cmvs,
nb_block_cmvs == predicted_nb_block_cmvs
? std::nullopt
: std::make_optional( absl::StrCat( "unique vertex ",
Expand All @@ -227,7 +227,7 @@ namespace
nb_line_on_boundary_cmvs,
" cmvs counted for lines on the boundary, with ",
nb_block_cmvs, " Block CMVs (expected ",
predicted_nb_block_cmvs, " with valid topology)." ) ) );
predicted_nb_block_cmvs, " with valid topology)." ) ) };
}
} // namespace

Expand Down
15 changes: 10 additions & 5 deletions tests/inspection/test-surface-intersections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,20 @@ void check_intersections2D()
"2D Surface should have 3 intersecting elements pair." );
bool right_intersections{ true };
const auto &triangles_inter = inspection.issues();
if( absl::c_find( triangles_inter, std::make_pair( 2u, 0u ) )
if( absl::c_find( triangles_inter,
std::pair< geode::index_t, geode::index_t >{ 2u, 0u } )
== triangles_inter.end() )
{
right_intersections = false;
}
if( absl::c_find( triangles_inter, std::make_pair( 2u, 1u ) )
if( absl::c_find( triangles_inter,
std::pair< geode::index_t, geode::index_t >{ 2u, 1u } )
== triangles_inter.end() )
{
right_intersections = false;
}
if( absl::c_find( triangles_inter, std::make_pair( 0u, 1u ) )
if( absl::c_find( triangles_inter,
std::pair< geode::index_t, geode::index_t >{ 0u, 1u } )
== triangles_inter.end() )
{
right_intersections = false;
Expand Down Expand Up @@ -112,12 +115,14 @@ void check_intersections3D()
inspection.nb_issues(), "." );
bool right_intersections{ true };
const auto &triangles_inter = inspection.issues();
if( absl::c_find( triangles_inter, std::make_pair( 0u, 4u ) )
if( absl::c_find( triangles_inter,
std::pair< geode::index_t, geode::index_t >{ 0u, 4u } )
== triangles_inter.end() )
{
right_intersections = false;
}
if( absl::c_find( triangles_inter, std::make_pair( 2u, 4u ) )
if( absl::c_find( triangles_inter,
std::pair< geode::index_t, geode::index_t >{ 2u, 4u } )
== triangles_inter.end() )
{
right_intersections = false;
Expand Down
Loading