Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
openmesh-python
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenMesh
openmesh-python
Commits
9fb07507
Commit
9fb07507
authored
Jan 31, 2018
by
Alexander Dielen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use free_when_done helper function everywhere
parent
564419a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
20 deletions
+8
-20
src/Mesh.hh
src/Mesh.hh
+8
-20
No files found.
src/Mesh.hh
View file @
9fb07507
...
...
@@ -270,11 +270,8 @@ py::array_t<int> face_vertex_indices_trimesh(TriMesh& _self) {
}
const
auto
shape
=
{
_self
.
n_faces
(),
size_t
(
3
)};
const
auto
strides
=
{
3
*
sizeof
(
int
),
sizeof
(
int
)};
py
::
capsule
free_when_done
(
indices
,
[](
void
*
f
)
{
int
*
ptr
=
reinterpret_cast
<
int
*>
(
f
);
delete
[]
ptr
;
});
return
py
::
array_t
<
int
>
(
shape
,
strides
,
indices
,
free_when_done
);
py
::
capsule
base
=
free_when_done
(
indices
);
return
py
::
array_t
<
int
>
(
shape
,
strides
,
indices
,
base
);
}
/**
...
...
@@ -308,11 +305,8 @@ py::array_t<int> face_vertex_indices_polymesh(PolyMesh& _self) {
}
const
auto
shape
=
{
_self
.
n_faces
(),
size_t
(
max_valence
)};
const
auto
strides
=
{
max_valence
*
sizeof
(
int
),
sizeof
(
int
)};
py
::
capsule
free_when_done
(
indices
,
[](
void
*
f
)
{
int
*
ptr
=
reinterpret_cast
<
int
*>
(
f
);
delete
[]
ptr
;
});
return
py
::
array_t
<
int
>
(
shape
,
strides
,
indices
,
free_when_done
);
py
::
capsule
base
=
free_when_done
(
indices
);
return
py
::
array_t
<
int
>
(
shape
,
strides
,
indices
,
base
);
}
/**
...
...
@@ -415,11 +409,8 @@ py::array_t<double> property_array(Mesh& _self, PropHandle _ph, size_t _n) {
// make numpy array
const
auto
shape
=
{
_n
,
size
};
const
auto
strides
=
{
size
*
sizeof
(
double
),
sizeof
(
double
)};
py
::
capsule
free_when_done
(
data
,
[](
void
*
f
)
{
double
*
ptr
=
reinterpret_cast
<
double
*>
(
f
);
delete
[]
ptr
;
});
return
py
::
array_t
<
double
>
(
shape
,
strides
,
data
,
free_when_done
);
py
::
capsule
base
=
free_when_done
(
data
);
return
py
::
array_t
<
double
>
(
shape
,
strides
,
data
,
base
);
}
/**
...
...
@@ -442,11 +433,8 @@ void set_property_array(Mesh& _self, PropHandle _ph, py::array_t<double> _arr, s
std
::
copy
(
_arr
.
data
(
i
),
_arr
.
data
(
i
)
+
size
,
data
);
const
auto
shape
=
{
size
};
const
auto
strides
=
{
sizeof
(
double
)};
py
::
capsule
free_when_done
(
data
,
[](
void
*
f
)
{
double
*
ptr
=
reinterpret_cast
<
double
*>
(
f
);
delete
[]
ptr
;
});
py
::
array_t
<
double
>
tmp
(
shape
,
strides
,
data
,
free_when_done
);
py
::
capsule
base
=
free_when_done
(
data
);
py
::
array_t
<
double
>
tmp
(
shape
,
strides
,
data
,
base
);
_self
.
property
(
_ph
,
IndexHandle
(
i
))
=
tmp
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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