subroutine collect_map( pixelization, nmaps, mapnum, ncomp, map, first_ring, last_ring, map_size, local_map, myid, numprocs, root, comm)
 
 Purpose:
  
Collects on a proc root a map of ncomp components, which is stored in the distributed form in local_map as a map
number mapnum. A single map is collected in a single call of the routine.
 
 Parameters:
 
 
input:
- pixelization--  [pixeltype], an S2HAT structure containing the info about the pixelization;
 
 
- nmaps-- [integer(4b)], a total number of maps distributed over procs and stored in local_map;
 
 
- mapnum-- [integer(4b)], a number of a map to be gathered on the proc root on the output;
 
 
- ncomp-- [integer(4b)], a number of components per map(=1,2 or 3);
 
 
- first_ring, last_ring-- [integer(4b)], numbers of a first and last ring which define a sub map (both included) 
to be stored on a given proc;  
 
 
- map_size-- [integer(4b)], a number of pixels corresponding to a set of 
rings defined by first_ring and last_ring above; 
 
 
- local_map-- [real(dp)], an allocated pointer of a 3dim array of a size (0:map_size-1,1:ncomp,1:nmaps)
containing the ncomp component maps in the distributed form;
 
 
- myid-- [integer(4b)], proc id (0,...,numprocs-1);    
 
 
- numprocs-- [integer(4b)], total number of procs used;
 
 
- root-- [integer(4b)], defines a proc root on which the full map
    map is stored;
 
 
- comm-- [integer(4b)], an mpi communicator for the numprocs procs.
 
 
output:
- map-- [real(dp)], an allocated pointer to a 2dim array of dimensions 
(0:npixall-1, 1:ncomp) storing a complete mapnum map on the proc root.
 
 
Comments:
 
 
On the proc root the full-size map will be always assembled. Its rings which have not be computed by any of the procs will have a zero value
and  may need to be post-processed prior to a further use. (Note for example that the partially oserved rings are computed in full by the routines.)
 
On all the  procs the input submaps, local_map, are assumed to be disjoint and composed of complete rings of both northern or southern hemispheres,
with numbers in the range [first_ring, last_ring]. (Though that may lead to some extra memory overhead, especially for the scans confined
fully to one or the other hemisphere, it does not affect the load_balancing and operation count. That may be corrected later.) 
  |