Is there a way I can declare an array which will be able to allocate any number of dimensions (in any shape) later in the code? Something like a the classic deferred shape but bearing in mind I do not know the rank, shape or size during declaration. For example, something similar to
real, allocatable :: a(:)
integer, parameter :: sh = [4,2,2]
allocate(a(sh))
which does not throw an error (of course it does in this case).