Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bindings/python/src/inspection/inspection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#include "solid_inspector.hpp"
#include "surface_inspector.hpp"

namespace pybind11

Check warning on line 72 in bindings/python/src/inspection/inspection.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/inspection/inspection.cpp:72:1 [modernize-concat-nested-namespaces]

nested namespaces can be concatenated
{
namespace detail
{
Expand All @@ -79,6 +79,12 @@
{
};

template < typename Key, typename Value >
struct type_caster< absl::linked_hash_map< Key, Value > >
: map_caster< absl::linked_hash_map< Key, Value >, Key, Value >
{
};

template < typename Type, size_t dimension >
struct type_caster< absl::InlinedVector< Type, dimension > >
: list_caster< absl::InlinedVector< Type, dimension >, Type >
Expand Down
11 changes: 6 additions & 5 deletions include/geode/inspector/inspection/information.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <string>
#include <vector>

#include <absl/container/flat_hash_map.h>
#include <absl/container/linked_hash_map.h>

#include <geode/basic/logger.hpp>
#include <geode/basic/types.hpp>
Expand Down Expand Up @@ -94,8 +94,8 @@ namespace geode
"Default inspection issue message. This message "
"should have been overriden."
};
std::vector< IssueType > issues_{};
std::vector< std::string > messages_{};
std::vector< IssueType > issues_;
std::vector< std::string > messages_;
};

template < typename IssueType >
Expand Down Expand Up @@ -150,7 +150,7 @@ namespace geode
return message;
}

[[nodiscard]] const absl::flat_hash_map< uuid,
[[nodiscard]] const absl::linked_hash_map< uuid,
InspectionIssues< IssueType > >&
issues_map() const
{
Expand All @@ -162,6 +162,7 @@ namespace geode
"Default inspection issue message. This message "
"should have been overriden."
};
absl::flat_hash_map< uuid, InspectionIssues< IssueType > > issues_map_;
absl::linked_hash_map< uuid, InspectionIssues< IssueType > >
issues_map_;
};
} // namespace geode
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
: public internal::ComponentMeshesManifold< BRep >
{
public:
Impl( const BRep& brep )
explicit Impl( const BRep& brep )
: internal::ComponentMeshesManifold< BRep >( brep )
{
}
Expand Down Expand Up @@ -152,11 +152,11 @@
}
}

void add_model_non_manifold_edges(

Check warning on line 155 in src/geode/inspector/inspection/criterion/manifold/brep_meshes_manifold.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/inspection/criterion/manifold/brep_meshes_manifold.cpp:155:14 [readability-function-cognitive-complexity]

function 'add_model_non_manifold_edges' has cognitive complexity of 32 (threshold 10)
InspectionIssues< BRepNonManifoldEdge >& issues ) const
{
using Edge = detail::VertexCycle< std::array< index_t, 2 > >;
absl::flat_hash_map< Edge, std::vector< uuid > > edges;
absl::linked_hash_map< Edge, std::vector< uuid > > edges;
for( const auto& surface : model().active_surfaces() )
{
const auto& mesh = surface.mesh();
Expand All @@ -171,16 +171,16 @@
{
continue;
}
const auto v0 = model().unique_vertex(
const auto vertex0 = model().unique_vertex(
{ surface.component_id(), vertices[edge_id] } );
const auto v1 =
const auto vertex1 =
model().unique_vertex( { surface.component_id(),
vertices[edge_id == vertices.size() - 1
? 0
: edge_id + 1] } );
const auto info = edges.try_emplace(
Edge{ std::array< index_t, 2 >{ v0, v1 } },
std::vector< uuid >{ surface.id() } );
Edge{ std::array{ vertex0, vertex1 } },
std::vector{ surface.id() } );
if( !info.second )
{
info.first->second.push_back( surface.id() );
Expand Down Expand Up @@ -220,7 +220,7 @@
{
continue;
}
std::array< index_t, 2 > edge_unique_vertices;
std::array< index_t, 2 > edge_unique_vertices{ NO_ID, NO_ID };
for( const auto edge_vertex : LRange{ 2 } )
{
edge_unique_vertices[edge_vertex] =
Expand Down Expand Up @@ -276,7 +276,7 @@
}

private:
bool several_cmvs_on_one_vertex(
[[nodiscard]] bool several_cmvs_on_one_vertex(
absl::Span< const index_t > unique_vertices ) const
{
std::vector< uuid > surfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

#include <geode/inspector/inspection/criterion/manifold/solid_facet_manifold.hpp>

#include <absl/container/flat_hash_map.h>
#include <absl/container/flat_hash_set.h>
#include <absl/container/linked_hash_map.h>

#include <geode/basic/logger.hpp>
#include <geode/basic/pimpl_impl.hpp>
Expand All @@ -37,11 +37,11 @@ namespace
using Facet = geode::detail::VertexCycle< geode::PolyhedronFacetVertices >;

template < geode::index_t dimension >
absl::flat_hash_map< Facet, geode::index_t >
[[nodiscard]] absl::linked_hash_map< Facet, geode::index_t >
facets_to_nb_adjacent_polyhedra(
const geode::SolidMesh< dimension >& mesh )
{
absl::flat_hash_map< Facet, geode::index_t >
absl::linked_hash_map< Facet, geode::index_t >
nb_polyhedra_adjacent_to_facets;
for( const auto polyhedron_id : geode::Range{ mesh.nb_polyhedra() } )
{
Expand All @@ -67,9 +67,9 @@ namespace geode
class SolidMeshFacetManifold< dimension >::Impl
{
public:
Impl( const SolidMesh< dimension >& mesh ) : mesh_( mesh ) {}
explicit Impl( const SolidMesh< dimension >& mesh ) : mesh_( mesh ) {}

bool mesh_facets_are_manifold() const
[[nodiscard]] bool mesh_facets_are_manifold() const
{
const auto nb_polyhedra_adjacent_to_facets =
facets_to_nb_adjacent_polyhedra( mesh_ );
Expand All @@ -84,7 +84,8 @@ namespace geode
return true;
}

InspectionIssues< PolyhedronFacetVertices > non_manifold_facets() const
[[nodiscard]] InspectionIssues< PolyhedronFacetVertices >
non_manifold_facets() const
{
const auto nb_polyhedra_adjacent_to_facets =
facets_to_nb_adjacent_polyhedra( mesh_ );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ namespace
using Edge = geode::detail::VertexCycle< std::array< geode::index_t, 2 > >;

template < geode::index_t dimension >
absl::flat_hash_map< Edge, std::pair< geode::local_index_t, bool > >
[[nodiscard]] absl::linked_hash_map< Edge,
std::pair< geode::local_index_t, bool > >
edge_to_polygons_around( const geode::SurfaceMesh< dimension >& mesh )
{
absl::flat_hash_map< Edge, std::pair< geode::local_index_t, bool > >
absl::linked_hash_map< Edge, std::pair< geode::local_index_t, bool > >
polygons_around_edges;
for( const auto polygon_id : geode::Range{ mesh.nb_polygons() } )
{
Expand Down Expand Up @@ -76,9 +77,9 @@ namespace geode
class SurfaceMeshEdgeManifold< dimension >::Impl
{
public:
Impl( const SurfaceMesh< dimension >& mesh ) : mesh_( mesh ) {}
explicit Impl( const SurfaceMesh< dimension >& mesh ) : mesh_( mesh ) {}

bool mesh_edges_are_manifold() const
[[nodiscard]] bool mesh_edges_are_manifold() const
{
for( const auto& edge : edge_to_polygons_around( mesh_ ) )
{
Expand All @@ -95,7 +96,8 @@ namespace geode
return true;
}

InspectionIssues< std::array< index_t, 2 > > non_manifold_edges() const
[[nodiscard]] InspectionIssues< std::array< index_t, 2 > >
non_manifold_edges() const
{
InspectionIssues< std::array< index_t, 2 > > non_manifold_edges{
"non manifold edges"
Expand Down
Loading