Commit de1fdb9f authored by aarograh's avatar aarograh
Browse files

Add hex_switch_orientation

parent 40f47289
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ PUBLIC :: rotate_2d_vector
PUBLIC :: hexagon_vertexes
PUBLIC :: hex_2D_to_1D
PUBLIC :: hex_1D_to_2D
PUBLIC :: hex_switch_orientation

INTERFACE newGeom
  !> @copybrief Geom::newGeom_line
+15 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ PUBLIC :: rotate_2d_vector
PUBLIC :: hexagon_vertexes
PUBLIC :: hex_2D_to_1D
PUBLIC :: hex_1D_to_2D
PUBLIC :: hex_switch_orientation

!> Enumerations for hexagonal unit orientations
INTEGER(SIK),PARAMETER,PUBLIC :: HEX_POINTY_TOP=0
@@ -322,4 +323,18 @@ PURE FUNCTION hex_1D_to_2D(rings, index) RESULT(indexes)

ENDFUNCTION hex_1D_to_2D
!
!-------------------------------------------------------------------------------
!> @brief Reverses the hexagonal geometry orientation
!> @param orientation the original orientation (HEX_FLAT_TOP or HEX_POINTY_TOP)
!> @returns reversed the opposite orientation (HEX_POINTY_TOP or HEX_FLAT_TOP)
!>
FUNCTION hex_switch_orientation(orientation) RESULT(reversed)
  INTEGER(SIK),INTENT(IN) :: orientation
  INTEGER(SIK) :: reversed

  REQUIRE(ANY(orientation == HEX_ORIENTATIONS))
  reversed = 2_SIK - orientation

ENDFUNCTION hex_switch_orientation
!
ENDMODULE Geom_Hex
 No newline at end of file