tem_load_deformation Subroutine

private subroutine tem_load_deformation(deform, conf, thandle)

This routine loads the deformation table from transformation table

Arguments

Type IntentOptional Attributes Name
type(tem_deformation_type), intent(out) :: deform

deform for spatial object

type(flu_State) :: conf

lua state

integer, intent(in) :: thandle

spatial object parent handle


Calls

proc~~tem_load_deformation~~CallsGraph proc~tem_load_deformation tem_load_deformation proc~aot_get_val~2 aot_get_val proc~tem_load_deformation->proc~aot_get_val~2 proc~aot_table_close aot_table_close proc~tem_load_deformation->proc~aot_table_close proc~tem_abort tem_abort proc~tem_load_deformation->proc~tem_abort proc~aot_table_open aot_table_open proc~tem_load_deformation->proc~aot_table_open mpi_abort mpi_abort proc~tem_abort->mpi_abort

Called by

proc~~tem_load_deformation~~CalledByGraph proc~tem_load_deformation tem_load_deformation proc~tem_load_transformation tem_load_transformation proc~tem_load_transformation->proc~tem_load_deformation proc~tem_load_shape_single tem_load_shape_single proc~tem_load_shape_single->proc~tem_load_transformation proc~tem_load_shapes tem_load_shapes proc~tem_load_shapes->proc~tem_load_shape_single interface~tem_load_shape tem_load_shape interface~tem_load_shape->proc~tem_load_shape_single interface~tem_load_shape->proc~tem_load_shapes proc~load_spatial_parabol load_spatial_parabol proc~load_spatial_parabol->interface~tem_load_shape proc~tem_load_convergenceheader tem_load_convergenceHeader proc~tem_load_convergenceheader->interface~tem_load_shape proc~tem_load_spacetime_single tem_load_spacetime_single proc~tem_load_spacetime_single->interface~tem_load_shape proc~tem_load_trackingconfig tem_load_trackingConfig proc~tem_load_trackingconfig->interface~tem_load_shape

Contents

Source Code


Source Code

  subroutine tem_load_deformation( deform, conf, thandle )
    !--------------------------------------------------------------------------!
    !inferface variables
    !> deform for spatial object
    type(tem_deformation_type), intent(out) :: deform
    !> lua state
    type(flu_state) :: conf
    !> spatial object parent handle
    integer, intent(in) :: thandle
    !--------------------------------------------------------------------------!
    integer :: deform_handle, deform_subhandle
    integer :: iError, iPos
    integer :: vError(3), errFatal(3)
    real(kind=rk) :: const, vec(3)
    !--------------------------------------------------------------------------!
    errFatal = aoterr_fatal

    deform%active = .false.
    deform%matrix = 0.0_rk


    !First check if deformation is defined as a constant
    call aot_get_val(L=conf, thandle = thandle, key='deformation', &
      &              val=const, ErrCode=iError)
    if(btest(iError, aoterr_fatal)) then
      call aot_table_open(L = conf, parent = thandle, &
        &                 thandle = deform_handle, &
        &                 key = 'deformation')

      if(deform_handle > 0) then
        deform%active = .true.
        !deformation is defined as a table
        call aot_table_open(L = conf, parent = deform_handle, &
          &                 thandle = deform_subhandle, &
          &                 pos = 1)
        if(deform_subhandle > 0) then
          call aot_table_close(L=conf, thandle=deform_subHandle)
          !sub table exist load it as matrix
          do iPos=1,3
            call aot_get_val(L=conf, thandle=deform_handle, &
              &              pos=iPos, val=vec, ErrCode=vError)

            if (any(btest(vError, errFatal))) then
              write(logunit(0),*) 'Error in configuration: '
              write(logunit(0),*) '     Deformation table at pos', iPos
              call tem_abort()
            end if
            deform%matrix(iPos,:) = vec
          end do
        else
          call aot_table_close(L=conf, thandle=deform_Handle)
          !if single table then it is vec
          call aot_get_val(L=conf, thandle=thandle, &
            &              key='deformation', val=vec, ErrCode=vError)
          if (any(btest(vError, errFatal))) then
            write(logunit(0),*) 'Error in configuration: '
            write(logunit(0),*) '   Loading deformation table as vector'
            call tem_abort()
          end if
          deform%matrix(1,1) = vec(1)
          deform%matrix(2,2) = vec(2)
          deform%matrix(3,3) = vec(3)
        endif
      else !deformation table not defined
        !close the table
        call aot_table_close(L=conf, thandle=deform_Handle)
      endif
    else
      !it is a constant scaling factor
      deform%active = .true.
      deform%matrix(1,1) = const
      deform%matrix(2,2) = const
      deform%matrix(3,3) = const
    endif


    if (deform%active) then
      write(logunit(1),"(A,3E12.5)") ' Deformation = ', deform%matrix(1,:)
      write(logunit(1),"(A,3E12.5)") '               ', deform%matrix(2,:)
      write(logunit(1),"(A,3E12.5)") '               ', deform%matrix(3,:)
    endif

  end subroutine tem_load_deformation