@@ -8,8 +8,9 @@ class FileBase(object):
88
99 Parameters
1010 ----------
11- T : PFFT
12- Instance of a :class:`.PFFT` class.
11+ global
12+ u : Distributed array, optional
13+ Instance of :class:`.DistArray`
1314 domain : sequence, optional
1415 The spatial domain. Sequence of either
1516
@@ -18,11 +19,15 @@ class FileBase(object):
1819 - Arrays of coordinates, e.g., np.linspace(0, 2*pi, N). One
1920 array per dimension.
2021 """
21- def __init__ (self , T , domain = None , ** kw ):
22+ def __init__ (self , global_shape = None , u = None , rank = None , domain = None , ** kw ):
2223 self .f = None
2324 self .filename = None
24- self .T = T
25- self .domain = domain if domain is not None else ((0 , 2 * np .pi ),)* T .dimensions ()
25+ if u is not None :
26+ assert isinstance (u , DistArray )
27+ self .global_shape = global_shape if global_shape is not None else u .global_shape
28+ self .rank = rank if rank is not None else u .rank
29+ self .dimensions = len (self .global_shape [self .rank :])
30+ self .domain = domain if domain is not None else ((0 , 2 * np .pi ),)* self .dimensions
2631
2732 def write (self , step , fields , ** kw ):
2833 """Write snapshot ``step`` of ``fields`` to file
0 commit comments