@@ -147,7 +147,20 @@ ${prefix + joinstr.join([line.strip() for line in txt.split("\n")]) + suffix}$
147
147
#:endcall
148
148
#:enddef
149
149
150
-
150
+ #!
151
+ #! Generates an array rank suffix for subarrays along a dimension
152
+ #!
153
+ #! Args:
154
+ #! rank (int): Rank of the original variable
155
+ #! dim (int): Dimension of the variable
156
+ #!
157
+ #! Returns:
158
+ #! Array rank suffix string enclosed in braces
159
+ #!
160
+ #! E.g.,
161
+ #! select_subvector(5, 2)
162
+ #! -> (j_, :, j___, j____, j_____)
163
+ #!
151
164
#:def select_subvector(rank, idim)
152
165
#:assert rank > 0
153
166
#:call join_lines(joinstr=", ", prefix="(", suffix=")")
@@ -161,6 +174,20 @@ ${prefix + joinstr.join([line.strip() for line in txt.split("\n")]) + suffix}$
161
174
#:endcall
162
175
#:enddef
163
176
177
+ #!
178
+ #! Generates an array rank suffix for arrays
179
+ #!
180
+ #! Args:
181
+ #! rank (int): Rank of the original variable
182
+ #! idim (int): Dimension of the variable
183
+ #!
184
+ #! Returns:
185
+ #! Array rank suffix string enclosed in braces
186
+ #!
187
+ #! E.g.,
188
+ #! select_subvector(5, 2)
189
+ #! -> (j_, j___, j____, j_____)
190
+ #!
164
191
#:def reduce_subvector(rank, idim)
165
192
#:assert rank > 0
166
193
#:if rank > 1
@@ -175,6 +202,4 @@ ${prefix + joinstr.join([line.strip() for line in txt.split("\n")]) + suffix}$
175
202
#:endif
176
203
#:enddef
177
204
178
-
179
-
180
205
#:endmute
0 commit comments