use generated templates to avoid code duplication
Since each rank needs a subroutine (and select rank wouldn't help much for this) we use generated code templates for this (via CMake or Meson). This increases code quality in general.
avoided the name %rank
for possible confusion with intrinsic rank()
Noted that GCC 10.2.0 is making spurious warning over intrinsic :: rank
that is needed to workaround an Intel compiler bug.