While slicing one dimension effectively reduces the rank of a domain by one, what is the opposite, growing a domain by one. I looked up the documentation but I maybe I am not looking in the right place.
If I have an n-dimensional domain, say D below, how do I create an (n+1)-dimensional domain, say E, below. The example below is done in a manual fashion:
const n = 2;
const m = 10;
const D : domain(2) = {1..n, 1..n};
const E : domain(3) = {1..m, 1..n, 1..n};
var p : [1..10][D] real(64); // this data structure is a fall back
var q : [E] real(64); // this data structure is what I really want
var z = 1.0;
for k in 1..m do
{
for r in 1..n do
{
for c in 1..2 do
{
p[k][r, c] = z;
q[k, r, c] = z;
z += 1.0;
}
}
writeln(p[k]);
writeln("..");
}
writeln(D);
writeln(p); // this has a very weird format (but not one I am worried about).
writeln(q);
What I really want is something like
E = D.grow({1..n})
While I can only think of examples right now where I would want to expand left-wise by a single axis, that might need to grow by two axes. For example,
const P = domain(2) = {1..n, 1..n};
const Q = domain(2) = {1..m, 1..m};
const R = domain(4) = {1..m, 1..m, 1..n, 1..n};
const S = domain(4) = {1..n, 1..n, 1..m, 1..m};
assert(R == P.grow(Q));
assert(S == Q.grow(P));
Or is is more like some sort of multiplication operator on a domain:
R = Q * P
S = P * Q;
One can handle growing left or right by just amending the order one does things. I think.
I apologise if the above is not clear.