tem_getNextCoordOfcanonicalND Function

public pure function tem_getNextCoordOfcanonicalND(me, iElem) result(coord)

Return the next coordinate of the canonical shape.

Arguments

Type IntentOptional Attributes Name
type(tem_canonicalND_type), intent(in) :: me

current canonical type

integer, intent(in) :: iElem

current element within total amount of elements to process

Return Value real(kind=rk), (3)

calulated real-world coordinate, which is returned


Contents


Source Code

  pure function tem_getNextCoordOfcanonicalND( me, iElem ) result( coord )
    ! --------------------------------------------------------------------------
    !> current element within total amount of elements to process
    integer, intent(in) :: iElem
    !> current canonical type
    type( tem_canonicalND_type ), intent(in) :: me
    !> calulated real-world coordinate, which is returned
    real(kind=rk) :: coord(3)
    ! --------------------------------------------------------------------------

    ! Start from the origin, step through the segments on the two
    ! defining vectors successively

    coord = me%origin                                                        &
          ! offset in direction of vector A
      &   + real(mod(( iElem-1 ), me%segments( 1 )), kind=rk)                &
      &   / real( max(me%segments( 1 )-1,1), kind=rk)                        &
      &   * me%vec(:,1)                                                      &
          ! offset in direction of vector B
          + real(mod( (iElem-1)/me%segments( 1 ), me%segments( 2 )),         &
      &          kind=rk)                                                    &
      &   / real( max(me%segments( 2 )-1,1), kind=rk)                        &
      &   * me%vec(:,2)                                                      &
          ! offset in direction of vector C
          + real(mod( (iElem-1)/(me%segments( 1 )*me%segments( 2 )),         &
      &               me%segments( 3 )), kind=rk)                            &
      &   / real( max(me%segments( 3 )-1,1), kind=rk)                        &
      &   * me%vec(:,3)

  end function tem_getNextCoordOfcanonicalND