FLASH-X
Doxygen Generated Documentation From Interface Source Code
Functions/Subroutines
ut_convertToMemoryOffset.F90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine ut_convertToMemoryOffset (dims, elementCoord, arrayLBound, arrayUBound, memoryOffset)
 

Function/Subroutine Documentation

◆ ut_convertToMemoryOffset()

subroutine ut_convertToMemoryOffset ( integer  dims,
integer  elementCoord,
integer  arrayLBound,
integer  arrayUBound,
integer  memoryOffset 
)

Routine to convert integer indicies of a hypothetical N-dimensional contiguous array into a memory offset in terms of the underlying datatype. Here, the memory offset is an input parameter which holds the offset relative to the start of the N-dimensional array. e.g. suppose we have the following two dimensional array: myArray(1:2,1:4), and we want to know the memory offset corresponding to the indicies (2,3). In this case the subroutine returns the memory offset 5 because the contiguous indicy coordinates are (1,1), (2,1), (1,2), (2,2), (1,3), (2,3). Here, (1,1) is the starting coordinate, so it corresponds to memory offset 0.

dims : Dimensionality of the hypothetical array. elementCoord : The input integer indicies. arrayLBound : Array containing the lower bounds of the hypothetical array. arrayUBound : Array containing the upper bounds of the hypothetical array. memoryOffset : Memory offset from the start of the hypothetical array. The memory offset is given in terms of the datatype of the array, as opposed to bytes.

Definition at line 39 of file ut_convertToMemoryOffset.F90.