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

Go to the source code of this file.

Functions/Subroutines

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

Function/Subroutine Documentation

◆ ut_convertToArrayIndicies()

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

Routine to convert a memory offset into integer indicies of a hypothetical N-dimensional contiguous array. 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 indicies corresponding to a memory offset of 5. In this case the subroutine returns the indicies (2,3) 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. memoryOffset : Memory offset from the start of the hypothetical array. This is then converted into integer indicies in the subroutine. The memory offset is required in terms of the datatype of the array, as opposed to bytes. arrayLBound : Array containing the lower bounds of the hypothetical array. arrayUBound : Array containing the upper bounds of the hypothetical array. elementCoord : The returned integer indicies.

Definition at line 41 of file ut_convertToArrayIndicies.F90.