subroutine collect_partialmap( pixelization, nmaps, mapnum, ncomp, first_pix, last_pix, submap, first_ring, last_ring, submap_size, local_map, myid, numprocs, root, comm)
 
 Purpose:
  
Collects on a proc root part of a map made of submap_size consecutive pixels starting with pixel first_pix and including 
ncomp components, which are initially stored in the distributed form in local_map as a map
number mapnum. 
 
 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_pix, last_pix-- [integer(8b)], a global number of the first and last pixel, respectively, to be collected; 
 
- first_ring, last_ring-- [integer(4b)], a number of a first and last ring, respectively, which define a distributed map (both included) 
to be stored on a given proc;  
 
 
- submap_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:submap_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:
- submap-- [real(dp)], an allocated pointer to a 2dim array of dimensions 
(0:last_pix-first_pix, 1:ncomp) storing a complete mapnum map on the proc root.
 
 
Comments:
 
 
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.) 
  |