Skip to content

Commit 2a287df

Browse files
committed
Fix modern example
1 parent 06bedfc commit 2a287df

1 file changed

Lines changed: 2 additions & 26 deletions

File tree

examples/use_modernised.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,11 @@ def __init__(self, symbols):
6161
raise Exception("Symbols must be a Mapping, for example a \
6262
dictionary.")
6363

64-
def save(self, ptr, compressor):
65-
"""Overwrite live-data in this Checkpoint object with data found at
66-
the ptr location."""
67-
i_ptr_lo = 0
68-
i_ptr_hi = 0
69-
for i in self.symbols:
70-
i_ptr_hi = i_ptr_hi + self.symbols[i].size
71-
ptr[i_ptr_lo:i_ptr_hi] = compressor(self.symbols[i].data[:])
72-
i_ptr_lo = i_ptr_hi
73-
74-
def load(self, ptr, decompressor):
75-
"""Copy live-data from this Checkpoint object into the memory given by
76-
the ptr."""
77-
i_ptr_lo = 0
78-
i_ptr_hi = 0
79-
for i in self.symbols:
80-
i_ptr_hi = i_ptr_hi + self.symbols[i].size
81-
self.symbols[i].data[:] = decompressor(ptr[i_ptr_lo:i_ptr_hi])
82-
i_ptr_lo = i_ptr_hi
83-
8464
def get_data_location(self, timestep):
85-
return next(iter(self.symbols.values())).data
65+
return [x.data for x in list(self.symbols.values())]
8666

8767
def get_data(self, timestep):
88-
return next(iter(self.symbols.values())).data
68+
return [x.data for x in self.symbols.values()]
8969

9070
@property
9171
def size(self):
@@ -99,10 +79,6 @@ def size(self):
9979
def dtype(self):
10080
return np.float32
10181

102-
@property
103-
def nbytes(self):
104-
return self.size * np.dtype(self.dtype).itemsize
105-
10682

10783
nSteps = 30
10884
u = Symbol((4))

0 commit comments

Comments
 (0)