Skip to content

Commit

Permalink
Remove implicit calling to tobytes (speedup)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucduron committed Feb 26, 2024
1 parent 5139f17 commit 012d2bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyteltools/slf/Serafin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,12 +1120,12 @@ def write_header(self, header):

# X coordinates
self.file.write(header.pack_int(header.float_size * header.nb_nodes))
self.file.write(np.array(header.x_stored, dtype=header.np_type))
self.file.write(np.array(header.x_stored, dtype=header.np_type).tobytes())
self.file.write(header.pack_int(header.float_size * header.nb_nodes))

# Y coordinates
self.file.write(header.pack_int(header.float_size * header.nb_nodes))
self.file.write(np.array(header.y_stored, dtype=header.np_type))
self.file.write(np.array(header.y_stored, dtype=header.np_type).tobytes())
self.file.write(header.pack_int(header.float_size * header.nb_nodes))

def write_entire_frame(self, header, time_to_write, values):
Expand All @@ -1144,5 +1144,5 @@ def write_entire_frame(self, header, time_to_write, values):

for i in range(header.nb_var):
self.file.write(header.pack_int(header.float_size * header.nb_nodes))
self.file.write(np.array(values[i, :], dtype=header.np_type))
self.file.write(np.array(values[i, :], dtype=header.np_type).tobytes())
self.file.write(header.pack_int(header.float_size * header.nb_nodes))

0 comments on commit 012d2bf

Please sign in to comment.