File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
bindings/python/src/mesh/core Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 105105 .def( " polyhedron_attribute_manager" , \
106106 &SolidMesh##dimension##D::polyhedron_attribute_manager, \
107107 pybind11::return_value_policy::reference ) \
108- .def( " bounding_box" , &SolidMesh##dimension##D::bounding_box )
108+ .def( " bounding_box" , &SolidMesh##dimension##D::bounding_box ) \
109+ .def( " edge_vertices_in_polyhedron" , \
110+ &SolidMesh##dimension##D::edge_vertices_in_polyhedron )
109111
110112namespace geode
111113{
Original file line number Diff line number Diff line change @@ -492,6 +492,17 @@ namespace geode
492492 PolyhedraAroundFacet polyhedra_from_facet_vertices (
493493 PolyhedronFacetVertices facet_vertices ) const ;
494494
495+ /* !
496+ * Get the local indices in the polyhedra of both edge vertices.
497+ * @param[in] polyhedron_id Index of polyhedron.
498+ * @param[in] edge_vertices Global indices of the two edge vertices.
499+ * @details If the vertices are not in the polyhedron, NO_LID is
500+ * returned.
501+ */
502+ std::array< local_index_t , 2 > edge_vertices_in_polyhedron (
503+ index_t polyhedron_id,
504+ const std::array< index_t , 2 >& edge_vertices ) const ;
505+
495506 bool are_edges_enabled () const ;
496507
497508 void enable_edges () const ;
Original file line number Diff line number Diff line change @@ -1244,6 +1244,29 @@ namespace geode
12441244 return borders;
12451245 }
12461246
1247+ template < index_t dimension >
1248+ std::array< local_index_t , 2 >
1249+ SolidMesh< dimension >::edge_vertices_in_polyhedron(
1250+ index_t polyhedron_id,
1251+ const std::array< index_t , 2 >& edge_vertices ) const
1252+ {
1253+ std::array< local_index_t , 2 > result{ { NO_LID, NO_LID } };
1254+
1255+ const auto vertices = polyhedron_vertices ( polyhedron_id );
1256+ for ( const auto v : LRange{ nb_polyhedron_vertices ( polyhedron_id ) } )
1257+ {
1258+ if ( vertices[v] == edge_vertices[0 ] && result[0 ] == NO_LID )
1259+ {
1260+ result[0 ] = v;
1261+ }
1262+ else if ( vertices[v] == edge_vertices[1 ] && result[1 ] == NO_LID )
1263+ {
1264+ result[1 ] = v;
1265+ }
1266+ }
1267+ return result;
1268+ }
1269+
12471270 template < index_t dimension >
12481271 AttributeManager&
12491272 SolidMesh< dimension >::polyhedron_attribute_manager() const
You can’t perform that action at this time.
0 commit comments