Skip to content

Commit

Permalink
what on earth is the problem, here?
Browse files Browse the repository at this point in the history
  • Loading branch information
fxjung committed Aug 14, 2024
1 parent 82a9588 commit 8ccf323
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ridepy/util/spaces_cython/spaces.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from ridepy.data_structures_cython.data_structures cimport LocType, R2loc, uiloc

cdef union USpace:
CTransportSpace[R2loc] *space_r2loc_ptr
CTransportSpace[uiloc] *space_int_ptr
CGraphSpace[uiloc] *space_int_ptr


cdef class TransportSpace:
Expand Down
9 changes: 5 additions & 4 deletions src/ridepy/util/spaces_cython/spaces.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -475,20 +475,21 @@ cdef class Graph(TransportSpace):
self.loc_type = LocType.INT

if weights is None:
self.u_space.space_int_ptr = self.derived_ptr = new CGraphSpace[uiloc](
velocity, <vector[uiloc]>vertices, <vector[pair[uiloc, uiloc]]>edges
self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[uiloc](
velocity,
<vector[uiloc]>vertices,
<vector[pair[uiloc, uiloc]]>edges
)
else:
if isinstance(weights, (int, float)):
weights = it.repeat(float(weights), len(edges))

self.u_space.space_int_ptr = self.derived_ptr = new CGraphSpace[uiloc](
self.derived_ptr = self.u_space.space_int_ptr = new CGraphSpace[uiloc](
velocity,
<vector[uiloc]>vertices,
<vector[pair[uiloc, uiloc]]>edges,
<vector[double]>weights
)
self.u_space.space_int_ptr = self.derived_ptr

def __init__(self, *args, **kwargs): # remember both __cinit__ and __init__ gets the same arguments passed
"""
Expand Down

0 comments on commit 8ccf323

Please sign in to comment.