subroutine distribute_mask( pixeltype pixelization, int nmasks, int masknum, int ncomp, int first_ring, int last_ring, int mask_size, int *local_mask, int *mask, int myid,
int numprocs, int root, MPI_Comm comm)
Purpose:
The routine distributes a full sky mask mask made of ncomp components stored in the memory of the proc root
over all processors of the communicator comm. The result is stored in a vector local_mask as a masknum mask.
To distribute nmasks
the routines needs to be called nmasks times, with masknum changing from 0 to nmask-1. In this way the need for
storing all the nmasks full sky masks in the memory of a single proc is avoided.
The mask is assumed to be a vector of 0 and 1 integers delineating the observed patch of the sky. For the float-valued map-like
objects (windows, apodization) use distribute_map.
To be called by all procs of the communicator comm. Blocking.
Parameters:
input:
- pixelization(*)-- [pixeltype], an S2HAT structure containing the info about the pixelization;
- masknum(*)-- [int], a current number of a mask which is being now distributed;
- nmasks(*)-- [int], a total number of masks to be distributed and later processed;
- ncomp(*)-- [int], a number of components of the masks to be distributed (=1,2,3);
- first_ring, last_ring-- [int], a number of a first and last ring which define a distibuted map (both included)
to be stored on a given proc;
- mask_size-- [int], a number of pixels corresponding to a set of rings defined by
first_ring and last_ring above;
- mask-- [int*], a vector storing to a 2dim array of dimensions (0:npixall-1, 1:ncomp) in the
column-wise order. It needs to be defined and allocated only on the proc root and it will be distributed over all procs of the communicator
comm as a result of the routine.
- myid-- [int], proc id (0,...,numprocs-1);
- numprocs(*)-- [int], total number of procs used;
- root(*)-- [int], defines a proc root on which the full mask
mask is stored;
- comm(*)-- [MPI_Comm], an mpi communicator for the numprocs procs.
(*)The value must be the same on all procs of the communicator comm.
output:
- local_mask-- [int*], a vector storing a 3dim array of a size (0:mask_size-1,1:ncomp,1:nmasks) in the column-wise order to contain the
distributed mask.
Comments:
On the proc root a full sky mask is always assumed, even if only parts of it (as defined by first_ring and last_ring)
may actually be distributed.
On all procs the sub-mask, local_mask, is made of complete rings of both northern and southern hemispheres with numbers falling between
first_ring and the last_ring, inclusive.
|