Write the color property to disk.
Type | Intent | Optional | 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 |
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