42integer,
intent(IN) :: dims
43integer, dimension(
1:dims),
intent(IN) :: elementCoord, arrayUBound, arrayLBound
44integer,
intent(OUT) :: memoryOffset
45integer, dimension(
1:dims) :: elementsToNextIndicy
50 if (elementCoord(i)
< arrayLBound(i)
.or. elementCoord(i)
> arrayUBound(i))
then
51 print *,
"[ConvertToMemoryOffset]: Invalid data passed!"
58elementsToNextIndicy(
1)
= 1
60 elementsToNextIndicy(i)
= elementsToNextIndicy(i
-1)
* (arrayUbound(i
-1)
- arrayLbound(i
-1)
+ 1)
66memoryOffset
= sum( (elementCoord(
1:dims)
- arrayLBound(
1:dims))
* elementsToNextIndicy(
1:dims) )
subroutine ut_convertToMemoryOffset(dims, elementCoord, arrayLBound, arrayUBound, memoryOffset)