@@ -75,7 +75,10 @@ def shape(self):
75
75
def dtype (self ):
76
76
return self .values .dtype
77
77
78
- def indexed (self , multiindex , layer = None , permute = lambda x : x ):
78
+ def _permute (self , x ):
79
+ return x
80
+
81
+ def indexed (self , multiindex , layer = None ):
79
82
n , i , f = multiindex
80
83
if layer is not None and self .offset is not None :
81
84
# For extruded mesh, prefetch the indirections for each map, so that they don't
@@ -84,7 +87,7 @@ def indexed(self, multiindex, layer=None, permute=lambda x: x):
84
87
base_key = None
85
88
if base_key not in self .prefetch :
86
89
j = Index ()
87
- base = Indexed (self .values , (n , permute (j )))
90
+ base = Indexed (self .values , (n , self . _permute (j )))
88
91
self .prefetch [base_key ] = Materialise (PackInst (), base , MultiIndex (j ))
89
92
90
93
base = self .prefetch [base_key ]
@@ -122,17 +125,17 @@ def indexed(self, multiindex, layer=None, permute=lambda x: x):
122
125
return Indexed (self .prefetch [key ], (f , i )), (f , i )
123
126
else :
124
127
assert f .extent == 1 or f .extent is None
125
- base = Indexed (self .values , (n , permute (i )))
128
+ base = Indexed (self .values , (n , self . _permute (i )))
126
129
return base , (f , i )
127
130
128
- def indexed_vector (self , n , shape , layer = None , permute = lambda x : x ):
131
+ def indexed_vector (self , n , shape , layer = None ):
129
132
shape = self .shape [1 :] + shape
130
133
if self .interior_horizontal :
131
134
shape = (2 , ) + shape
132
135
else :
133
136
shape = (1 , ) + shape
134
137
f , i , j = (Index (e ) for e in shape )
135
- base , (f , i ) = self .indexed ((n , i , f ), layer = layer , permute = permute )
138
+ base , (f , i ) = self .indexed ((n , i , f ), layer = layer )
136
139
init = Sum (Product (base , Literal (numpy .int32 (j .extent ))), j )
137
140
pack = Materialise (PackInst (), init , MultiIndex (f , i , j ))
138
141
multiindex = tuple (Index (e ) for e in pack .shape )
@@ -168,13 +171,8 @@ def __init__(self, map_, permutation):
168
171
self .offset_quotient = map_ .offset_quotient
169
172
self .permutation = NamedLiteral (permutation , parent = self .values , suffix = f"permutation{ count } " )
170
173
171
- def indexed (self , multiindex , layer = None ):
172
- permute = lambda x : Indexed (self .permutation , (x ,))
173
- return super ().indexed (multiindex , layer = layer , permute = permute )
174
-
175
- def indexed_vector (self , n , shape , layer = None ):
176
- permute = lambda x : Indexed (self .permutation , (x ,))
177
- return super ().indexed_vector (n , shape , layer = layer , permute = permute )
174
+ def _permute (self , x ):
175
+ return Indexed (self .permutation , (x ,))
178
176
179
177
180
178
class CMap (Map ):
0 commit comments