So of course it's easy to create a domain (and from that, an array) with fixed known rank and array of sizes,
proc do_something(sizes: [1..2] int) {
const D: domain(2) = {1..sizes[1], 1..sizes[2]};
var arr: [D] int;
// ...
}
But what does one do with an array of varying sizes, of runtime-determined (or at least not hardcoded-in) length?
proc do_something_2(sizes: [?sd] int) {
const rank = sd.rank;
var D: domain(rank);
var arr: [D] int;
writeln(arr);
}
The line var D: domain(rank);
fails, as it seems to need a param
rank - but even if that worked it's not clear how to set the domain afterwards; expand
seems like it expands the domain in both directions.