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 AttributesName
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~newunit newunit proc~tem_size_stlb->proc~newunit mpi_abort mpi_abort proc~tem_abort->mpi_abort

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
    integer :: ierr
    logical :: file_exists
    ! ---------------------------------------------------------------------------

    stlUnit = newUnit()

    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

    open(unit = stlUnit, file = trim(filename), access = 'stream', &
      &  action = 'read', status = 'old', iostat = ierr)
    if(ierr .ne. 0)then
      write(logUnit(0),*) "Error opening file "//trim(filename)
      call tem_abort()
    end if

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

   close(stlUnit)

  end subroutine tem_size_stlb