-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b55deaf
commit f59ce23
Showing
4 changed files
with
80 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2010-2024 The Regents of the University of Michigan | ||
// This file is from the freud project, released under the BSD 3-Clause License. | ||
|
||
#include <memory> | ||
#include <nanobind/nanobind.h> | ||
#include <nanobind/ndarray.h> | ||
// #include <nanobind/stl/shared_ptr.h> // NOLINT(misc-include-cleaner): used implicitly | ||
// #include <nanobind/stl/tuple.h> // NOLINT(misc-include-cleaner): used implicitly | ||
#include <utility> | ||
|
||
#include "Cubatic.h" | ||
#include "VectorMath.h" | ||
|
||
namespace freud { namespace order { | ||
|
||
template<typename T, typename shape> | ||
using nb_array = nanobind::ndarray<T, shape, nanobind::device::cpu, nanobind::c_contig>; | ||
|
||
namespace wrap { | ||
|
||
void computeCubatic(const std::shared_ptr<Cubatic>& self, | ||
const nb_array<float, nanobind::shape<-1, 4>>& orientations) | ||
{ | ||
unsigned int const num_orientations = orientations.shape(0); | ||
auto* orientations_data = reinterpret_cast<quat<float>*>(orientations.data()); | ||
|
||
self->compute(orientations_data, num_orientations); | ||
} | ||
|
||
// nanobind::tuple getNematicDirector(const std::shared_ptr<Cubatic>& self) | ||
// { | ||
// vec3<float> nem_d_cpp = self->getNematicDirector(); | ||
// return nanobind::make_tuple(nem_d_cpp.x, nem_d_cpp.y, nem_d_cpp.z); | ||
// } | ||
}; // namespace wrap | ||
|
||
namespace detail { | ||
|
||
void export_Nematic(nanobind::module_& m) | ||
{ | ||
nanobind::class_<Cubatic>(m, "Cubatic") | ||
.def(nanobind::init<float, float, float, unsigned int, unsigned int>()) | ||
.def("compute", &wrap::computeCubatic, nanobind::arg("orientations")) | ||
// .def("getNematicOrderParameter", &Nematic::getNematicOrderParameter) | ||
// .def("getNematicDirector", &wrap::getNematicDirector) | ||
// .def("getParticleTensor", &Nematic::getParticleTensor) | ||
// .def("getNematicTensor", &Nematic::getNematicTensor); | ||
} | ||
|
||
} // namespace detail | ||
|
||
}; }; // namespace freud::order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters