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
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@
* Class for inspecting the negative elements of a SurfaceMesh
*/
template < index_t dimension >
class opengeode_inspector_inspector_api SurfaceMeshNegativeElements

Check warning on line 42 in include/geode/inspector/criterion/negative_elements/surface_negative_elements.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/inspector/criterion/negative_elements/surface_negative_elements.hpp:42:45 [cppcoreguidelines-special-member-functions]

class 'SurfaceMeshNegativeElements' defines a destructor, a copy constructor and a copy assignment operator but does not define a move constructor or a move assignment operator
{
OPENGEODE_DISABLE_COPY( SurfaceMeshNegativeElements );
OPENGEODE_TEMPLATE_ASSERT_2D( dimension );

public:
explicit SurfaceMeshNegativeElements(
Expand Down
9 changes: 8 additions & 1 deletion include/geode/inspector/surface_inspector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <geode/inspector/criterion/intersections/surface_intersections.hpp>
#include <geode/inspector/criterion/manifold/surface_edge_manifold.hpp>
#include <geode/inspector/criterion/manifold/surface_vertex_manifold.hpp>
#include <geode/inspector/criterion/negative_elements/surface_negative_elements.hpp>
#include <geode/inspector/mixin/add_inspectors.hpp>

namespace geode
Expand Down Expand Up @@ -57,6 +58,9 @@
InspectionIssues< std::pair< index_t, index_t > > intersecting_elements{
"Intersection between mesh elements not tested"
};
InspectionIssues< index_t > negative_polygons{
"Negative polygons not tested"
};

[[nodiscard]] index_t nb_issues() const;

Expand All @@ -71,20 +75,23 @@
* @extends SurfaceMeshDegeneration
* @extends SurfaceMeshEdgeManifold
* @extends SurfaceMeshVertexManifold
* @extends SurfaceMeshIntersections
* @extends SurfaceMeshNegativeElements
*/
template < index_t dimension >
class SurfaceMeshInspector : public AddInspectors< SurfaceMesh< dimension >,

Check warning on line 82 in include/geode/inspector/surface_inspector.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/inspector/surface_inspector.hpp:82:11 [cppcoreguidelines-special-member-functions]

class 'SurfaceMeshInspector' defines a default destructor, a copy constructor and a copy assignment operator but does not define a move constructor or a move assignment operator
SurfaceMeshAdjacency< dimension >,
SurfaceMeshColocation< dimension >,
SurfaceMeshDegeneration< dimension >,
SurfaceMeshEdgeManifold< dimension >,
SurfaceMeshVertexManifold< dimension >,
SurfaceMeshIntersections< dimension > >
SurfaceMeshIntersections< dimension >,
SurfaceMeshNegativeElements< dimension > >
{
OPENGEODE_DISABLE_COPY( SurfaceMeshInspector );

public:
SurfaceMeshInspector( const SurfaceMesh< dimension >& mesh );

Check warning on line 94 in include/geode/inspector/surface_inspector.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/inspector/surface_inspector.hpp:94:9 [google-explicit-constructor]

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

virtual ~SurfaceMeshInspector() = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,43 +40,44 @@
class SurfaceMeshNegativeElements< dimension >::Impl
{
public:
Impl( const SurfaceMesh< dimension >& mesh ) : mesh_( mesh ) {}

Check warning on line 43 in src/geode/inspector/criterion/negative_elements/surface_negative_elements.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/criterion/negative_elements/surface_negative_elements.cpp:43:9 [google-explicit-constructor]

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

bool mesh_has_negative_elements() const

Check warning on line 45 in src/geode/inspector/criterion/negative_elements/surface_negative_elements.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/criterion/negative_elements/surface_negative_elements.cpp:45:9 [modernize-use-nodiscard]

function 'mesh_has_negative_elements' should be marked [[nodiscard]]
{
for( const auto polygon_id : Range{ mesh_.nb_polygons() } )
if constexpr( dimension == 2 )
{
if( polygon_has_negative_area( polygon_id ) )
for( const auto polygon_id : Range{ mesh_.nb_polygons() } )
{
return true;
if( polygon_area_sign( mesh_.polygon( polygon_id ) )
== Sign::negative )
{
return true;
}
}
}
return false;
}

InspectionIssues< index_t > negative_polygons() const

Check warning on line 61 in src/geode/inspector/criterion/negative_elements/surface_negative_elements.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/inspector/criterion/negative_elements/surface_negative_elements.cpp:61:9 [modernize-use-nodiscard]

function 'negative_polygons' should be marked [[nodiscard]]
{
InspectionIssues< index_t > wrong_polygons{
"negative area polygons"
};
for( const auto polygon_id : Range{ mesh_.nb_polygons() } )
if constexpr( dimension == 2 )
{
if( polygon_has_negative_area( polygon_id ) )
for( const auto polygon_id : Range{ mesh_.nb_polygons() } )
{
wrong_polygons.add_issue( polygon_id,
absl::StrCat( "negative polygon ", polygon_id ) );
if( polygon_area_sign( mesh_.polygon( polygon_id ) )
== Sign::negative )
{
wrong_polygons.add_issue( polygon_id,
absl::StrCat( "negative polygon ", polygon_id ) );
}
}
}
return wrong_polygons;
}

private:
bool polygon_has_negative_area( index_t polygon_id ) const
{
return polygon_area_sign( mesh_.polygon( polygon_id ) )
== Sign::negative;
}

private:
const SurfaceMesh< dimension >& mesh_;
};
Expand Down Expand Up @@ -108,4 +109,6 @@

template class opengeode_inspector_inspector_api
SurfaceMeshNegativeElements< 2 >;
template class opengeode_inspector_inspector_api
SurfaceMeshNegativeElements< 3 >;
} // namespace geode
12 changes: 9 additions & 3 deletions src/geode/inspector/surface_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ namespace geode
+ degenerated_polygons.nb_issues()
+ non_manifold_edges.nb_issues()
+ non_manifold_vertices.nb_issues()
+ intersecting_elements.nb_issues();
+ intersecting_elements.nb_issues()
+ negative_polygons.nb_issues();
}

std::string SurfaceInspectionResult::string() const
{
return absl::StrCat( polygon_edges_with_wrong_adjacency.string(),
colocated_points_groups.string(), degenerated_edges.string(),
degenerated_polygons.string(), non_manifold_edges.string(),
non_manifold_vertices.string(), intersecting_elements.string() );
non_manifold_vertices.string(), intersecting_elements.string(),
negative_polygons.string() );
}

std::string SurfaceInspectionResult::inspection_type() const
Expand All @@ -62,7 +64,8 @@ namespace geode
SurfaceMeshDegeneration< dimension >,
SurfaceMeshEdgeManifold< dimension >,
SurfaceMeshVertexManifold< dimension >,
SurfaceMeshIntersections< dimension > >{ mesh }
SurfaceMeshIntersections< dimension >,
SurfaceMeshNegativeElements< dimension > >{ mesh }
{
}

Expand Down Expand Up @@ -94,6 +97,9 @@ namespace geode
},
[&result, this] {
result.intersecting_elements = this->intersecting_elements();
},
[&result, this] {
result.negative_polygons = this->negative_polygons();
} );
return result;
}
Expand Down
Loading