-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathface_vertex.cpp
More file actions
43 lines (39 loc) · 1.65 KB
/
face_vertex.cpp
File metadata and controls
43 lines (39 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <common.hpp>
#include <ipc/candidates/face_vertex.hpp>
namespace py = pybind11;
using namespace ipc;
void define_face_vertex_candidate(py::module_& m)
{
py::class_<FaceVertexCandidate, CollisionStencil>(m, "FaceVertexCandidate")
.def(py::init<long, long>(), py::arg("face_id"), py::arg("vertex_id"))
.def(
py::init([](std::tuple<long, long> face_and_vertex_id) {
return std::make_unique<FaceVertexCandidate>(
std::get<0>(face_and_vertex_id),
std::get<1>(face_and_vertex_id));
}),
py::arg("face_and_vertex_id"))
.def("known_dtype", &FaceVertexCandidate::known_dtype)
.def(
"__str__",
[](const FaceVertexCandidate& ev) {
return fmt::format("[{:d}, {:d}]", ev.face_id, ev.vertex_id);
})
.def(
"__repr__",
[](const FaceVertexCandidate& ev) {
return fmt::format(
"FaceVertexCandidate({:d}, {:d})", ev.face_id,
ev.vertex_id);
})
.def("__eq__", &FaceVertexCandidate::operator==, py::arg("other"))
.def("__ne__", &FaceVertexCandidate::operator!=, py::arg("other"))
.def(
"__lt__", &FaceVertexCandidate::operator<,
"Compare FaceVertexCandidate for sorting.", py::arg("other"))
.def_readwrite(
"face_id", &FaceVertexCandidate::face_id, "ID of the face")
.def_readwrite(
"vertex_id", &FaceVertexCandidate::vertex_id, "ID of the vertex");
py::implicitly_convertible<std::tuple<long, long>, FaceVertexCandidate>();
}