subroutinewrite_entity_pagesprivate
subroutine write_entity_pages(site, ids, directory, count, stat, errmsg)
Render the pages of entities ids and write them, in parallel. A page is not kept once it is
written, as together they can be larger than everything else in memory.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| site | type(site_t) | in | the site | |
| ids | integer | in | dimension(:) | the entities |
| directory | character(len=*) | in | the directory of the site | |
| count | integer | out | how many pages were written | |
| stat | integer | out | nonzero on failure | |
| errmsg | character(len=:) | out | allocatable | what is wrong |
Calls
Source
Show the code
subroutine write_entity_pages(site, ids, directory, count, stat, errmsg)
type(site_t), intent(in) :: site !! the site
integer, intent(in) :: ids(:) !! the entities
character(len=*), intent(in) :: directory !! the directory of the site
integer, intent(out) :: count !! how many pages were written
integer, intent(out) :: stat !! nonzero on failure
character(len=:), allocatable, intent(out) :: errmsg !! what is wrong
integer, allocatable :: results(:)
integer :: k
allocate (results(size(ids)))
call progress_start('Rendering pages', size(ids))
!$omp parallel do schedule(dynamic) num_threads(max(1, site%s%parallel)) default(shared) private(k)
do k = 1, size(ids)
call write_entity_page(site, ids(k), directory, results(k))
call progress_tick()
end do
!$omp end parallel do
call progress_finish()
count = size(ids)
stat = 0
errmsg = ''
do k = 1, size(ids)
if (results(k) == 0) cycle
stat = results(k)
errmsg = 'could not write the page of '//site%p%list%box(ids(k))%e%name
return
end do
end subroutine write_entity_pages