Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenMesh
openmesh-python
Commits
bdf547ac
Commit
bdf547ac
authored
Jan 30, 2018
by
Alexander Dielen
Browse files
init using arrays
parent
93d37257
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Vector.hh
View file @
bdf547ac
...
...
@@ -2,6 +2,8 @@
#define OPENMESH_PYTHON_VECTOR_HH
#include
<pybind11/pybind11.h>
#include
<pybind11/numpy.h>
namespace
py
=
pybind11
;
...
...
@@ -192,6 +194,13 @@ void expose_vec(py::module& m, const char *_name) {
.
def_static
(
"size"
,
&
Vector
::
size
)
.
def_static
(
"vectorized"
,
&
Vector
::
vectorized
)
.
def
(
"__init__"
,
[](
Vector
&
_self
,
py
::
array_t
<
Scalar
,
py
::
array
::
c_style
|
py
::
array
::
forcecast
>
_arr
)
{
if
(
_arr
.
size
()
!=
N
)
{
throw
std
::
runtime_error
(
"Incompatible array size!"
);
}
new
(
&
_self
)
Vector
(
_arr
.
data
());
});
;
defInitMod
<
Scalar
,
Vector
>
(
m
,
classVector
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment