tem_size_stlb Subroutine

public subroutine tem_size_stlb(filename, nNodes, nTris)

This subroutine reads the number of nodes and triangles from a given binary stl file.

Arguments

Type IntentOptional Attributes Name
character(len=PathLen), intent(in) :: filename

name of the binary stl file

integer, intent(out) :: nNodes

number of nodes in the file

integer, intent(out) :: nTris

number of triangles in the file


Calls

proc~~tem_size_stlb~~CallsGraph proc~tem_size_stlb tem_size_stlb proc~tem_abort tem_abort proc~tem_size_stlb->proc~tem_abort proc~tem_open tem_open proc~tem_size_stlb->proc~tem_open mpi_abort mpi_abort proc~tem_abort->mpi_abort proc~tem_open->proc~tem_abort proc~upper_to_lower upper_to_lower proc~tem_open->proc~upper_to_lower proc~newunit newunit proc~tem_open->proc~newunit

Called by

proc~~tem_size_stlb~~CalledByGraph proc~tem_size_stlb tem_size_stlb proc~tem_read_stlfiles tem_read_stlFiles proc~tem_read_stlfiles->proc~tem_size_stlb proc~tem_readandunify_surfdata tem_readAndUnify_surfData proc~tem_readandunify_surfdata->proc~tem_size_stlb proc~tem_load_stl tem_load_stl proc~tem_load_stl->proc~tem_read_stlfiles proc~tem_load_shape_single tem_load_shape_single proc~tem_load_shape_single->proc~tem_load_stl 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

Contents

Source Code


Source Code

  subroutine tem_size_stlb( filename, nNodes, nTris )
    ! --------------------------------------------------------------------------
    !> name of the binary stl file
    character(len=PathLen),intent(in) :: filename
    !> number of nodes in the file
    integer,intent(out) :: nNodes
    !> number of triangles in the file
    integer,intent(out) :: nTris
    ! --------------------------------------------------------------------------
    character(len=LabelLen) :: header
    integer :: stlUnit
    logical :: file_exists
    ! --------------------------------------------------------------------------

    inquire(file = trim(filename), exist = file_exists)
    if (.not. file_exists) then
      write(logUnit(0),*) trim(filename)//" file was not found. Dying..."
      call tem_abort()
    endif

    call tem_open( newunit = stlUnit,        &
      &            file    = trim(filename), &
      &            access  = 'stream',       &
      &            action  = 'read',         &
      &            status  = 'old'           )

    read(stlUnit) header
    read(stlUnit) nTris
    nNodes = nTris * 3

    close(stlUnit)

  end subroutine tem_size_stlb