tem_load_stl Subroutine

public subroutine tem_load_stl(stl_data, transform, conf, thandle)

This routine loads STL files from config and reads the triangles from the files into the dynamic array of triangles.

Arguments

Type IntentOptional Attributes Name
type(tem_stlData_type), intent(out) :: stl_data

Array array of triangles in stlData

type(tem_transformation_type), intent(in) :: transform

transformation for spatial object

type(flu_State) :: conf

Lua state

integer, intent(in) :: thandle

Source Code

  subroutine tem_load_stl(stl_data, transform, conf, thandle)
    ! --------------------------------------------------------------------------!
    !> Array array of triangles in stlData
    type(tem_stlData_type), intent(out) :: stl_data
    !> transformation for spatial object
    type(tem_transformation_type), intent(in) :: transform
    !> Lua state
    type(flu_state) :: conf
    integer, intent(in) :: thandle !< handle for canonical objects
    ! --------------------------------------------------------------------------!
    integer :: iTri, iVer
    ! --------------------------------------------------------------------------!

    ! Load stl files from config file.
    call tem_load_stlhead(me = stl_data%head, conf = conf, thandle = thandle)

    ! Load triangles and nodes from stl files.
    call tem_read_stlFiles(stl_data = stl_data )

    ! if transformation is active apply transformation to all triangles
    ! first apply deformation and then translation
    if(transform%active) then
      if(transform%deform%active) then
        do iTri=1, stl_data%nTris
          do iVer=1,3
            stl_data%nodes(:, stl_data%tri_node(iVer, iTri)) = &
              &            matmul( transform%deform%matrix, &
              &            stl_data%nodes(:, stl_data%tri_node(iVer, iTri)) )
          enddo
        enddo
      endif
      if(transform%translate%active) then
        do iTri=1, stl_data%nTris
          do iVer=1,3
            stl_data%nodes(:, stl_data%tri_node(iVer, iTri)) = &
              &            transform%translate%vec + &
              &            stl_data%nodes(:, stl_data%tri_node(iVer, iTri))
          enddo
        enddo
      endif
    endif

  end subroutine tem_load_stl