tem_color_prop_out Subroutine

public subroutine tem_color_prop_out(me, offset, nElems, basename, myPart, comm)

Write the color property to disk.

Arguments

Type IntentOptional Attributes Name
type(tem_color_prop_type), intent(out) :: me

Color definitions to load.

integer(kind=long_k), intent(in) :: offset

Offset of the local set of elements in the global list

integer, intent(in) :: nElems

Local number of elements with this property

character(len=*), intent(in) :: basename

Name of the file, the data is stored in, will be appended with ".lua" for the header information and ".lsb" or ".msb" for the binary data. An ".ascii" extension will be used for ASCII data.

integer, intent(in) :: myPart

Partition to load

integer, intent(in) :: comm

Communicator to use


Calls

proc~~tem_color_prop_out~~CallsGraph proc~tem_color_prop_out tem_color_prop_out proc~aot_out_close aot_out_close proc~tem_color_prop_out->proc~aot_out_close proc~aot_out_open_table aot_out_open_table proc~tem_color_prop_out->proc~aot_out_open_table proc~aot_out_close_table aot_out_close_table proc~tem_color_prop_out->proc~aot_out_close_table proc~aot_out_val aot_out_val proc~tem_color_prop_out->proc~aot_out_val proc~aot_out_open aot_out_open proc~tem_color_prop_out->proc~aot_out_open proc~tem_open tem_open proc~tem_color_prop_out->proc~tem_open proc~upper_to_lower upper_to_lower proc~tem_open->proc~upper_to_lower proc~tem_abort tem_abort proc~tem_open->proc~tem_abort proc~newunit newunit proc~tem_open->proc~newunit mpi_abort mpi_abort proc~tem_abort->mpi_abort

Contents

Source Code


Source Code

  subroutine tem_color_prop_out( me, offset, nElems, basename, myPart, comm )
    ! --------------------------------------------------------------------------!
    !> Color definitions to load.
    type(tem_color_prop_type), intent(out) :: me

    !> Offset of the local set of elements in the global list
    integer(kind=long_k), intent(in) :: offset

    !> Local number of elements with this property
    integer, intent(in) :: nElems

    !> Name of the file, the data is stored in, will be appended with
    !! ".lua" for the header information and ".lsb" or ".msb" for the
    !! binary data. An ".ascii" extension will be used for ASCII data.
    character(len=*), intent(in) :: basename

    !> Partition to load
    integer, intent(in) :: myPart

    !> Communicator to use
    integer, intent(in) :: comm
    ! --------------------------------------------------------------------------!
    type(aot_out_type) :: conf
    integer :: locomm
    integer :: root
    integer :: rl
    integer :: fUnit
    integer :: i
    character(len=pathLen) :: headerfile
    character(len=pathLen) :: datafile
    ! --------------------------------------------------------------------------!

    root = 0

    locomm = comm

    headerfile = trim(basename)//'.lua'
    datafile   = trim(basename)//'.ascii'

    if (myPart == root) then
      ! Write the header only on the root process
      call aot_out_open( put_conf = conf, filename = headerfile )
      call aot_out_val( put_conf = conf, vname='nColors', val = me%nColors )
      call aot_out_open_table(conf, 'color_label')
      do i=1,me%nColors
        call aot_out_val( put_conf = conf, val = me%color_label(i) )
      end do
      call aot_out_close_table(conf)
      call aot_out_close(conf)
    end if

    ! If there are actually colored elements on the local process,
    ! write them now.
    ! @todo HK: replace this color output by MPI-IO.
    if (nElems > 0) then

      inquire(iolength=rl) me%colored_bit(:,1)
      call tem_open( newunit = fUnit,         &
        &            file    = datafile,      &
        &            action  = 'write',       &
        &            access  = 'direct',      &
        &            form    = 'unformatted', &
        &            recl    = rl,            &
        &            status  = 'replace'      )
      write(fUnit, rec=offset+1) me%colored_bit
      close(fUnit)

    end if

  end subroutine tem_color_prop_out