File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -75,3 +75,23 @@ Converts from a block index to a tuple containing the global indices
75
75
return $ ex
76
76
end
77
77
end
78
+
79
+ # I hate having these function definitions but the generated function above sometimes(!) generates bad code and starts to allocate
80
+ @inline function blockindex2global (block_sizes:: BlockSizes{1} , block_index:: BlockIndex{1} )
81
+ @inbounds v = (block_sizes[1 , block_index. I[1 ]] + block_index. α[1 ] - 1 )
82
+ return v
83
+ end
84
+
85
+ @inline function blockindex2global (block_sizes:: BlockSizes{2} , block_index:: BlockIndex{2} )
86
+ @inbounds v = (block_sizes[1 , block_index. I[1 ]] + block_index. α[1 ] - 1 ,
87
+ block_sizes[2 , block_index. I[2 ]] + block_index. α[2 ] - 1 )
88
+ return v
89
+ end
90
+
91
+ @inline function blockindex2global (block_sizes:: BlockSizes{3} , block_index:: BlockIndex{3} )
92
+ @inbounds v = (block_sizes[1 , block_index. I[1 ]] + block_index. α[1 ] - 1 ,
93
+ block_sizes[2 , block_index. I[2 ]] + block_index. α[2 ] - 1 ,
94
+ block_sizes[3 , block_index. I[3 ]] + block_index. α[3 ] - 1 )
95
+ return v
96
+ end
97
+
You can’t perform that action at this time.
0 commit comments