Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions analysator/vlsvfile/vlsvreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3387,7 +3387,6 @@ def build_cell_neighborhoods(self, cids):
return cell_neighbor_sets



def build_dual_from_vertices(self, vertices):

vertices = list(set(vertices))
Expand Down Expand Up @@ -3418,19 +3417,20 @@ def build_dual_from_vertices(self, vertices):
eps = 1
v_cells = np.zeros((len_todo, 8),dtype=int)
v_cellcoords = np.zeros((len_todo, 8,3))
ii = 0
vcoords = self.get_vertex_coordinates_from_indices(todo)

# TODO get rid of the loop
offsets = []
for x in [-1,1]:
for y in [-1,1]:
for z in [-1,1]:
offsets.append([x,y,z])
v_cellcoords[:,ii,:] = eps*np.array((x,y,z))[np.newaxis,:] + vcoords
v_cells[:,ii] = self.get_cellid(v_cellcoords[:,ii])
ii += 1

offsets=np.array([
[-1.,-1.,-1.],
[-1.,-1.,1.],
[-1.,1.,-1.],
[-1.,1.,1.],
[1.,-1.,-1.],
[1.,-1.,1.],
[1.,1.,-1.],
[1.,1.,1.],
])
v_cellcoords=np.swapaxes(vcoords+eps*offsets[:,np.newaxis],0,1)
v_cells=self.get_cellid(v_cellcoords.reshape((-1,3))).reshape((-1,8))
v_cellcoords = self.get_cell_coordinates(v_cells.reshape((-1))).reshape((-1,8,3))

dual_sets.update({vinds: tuple(v_cells[i,:]) for i,vinds in enumerate(todo)})
Expand Down
Loading