##
Descriptor data structure

All the general matrix informations and elements to be exchanged among processes are stored within a data structure of the type descdata`psb_desc_type`. Every structure of this type is associated with a discretization pattern and enables data communications and other operations that are necessary for implementing the various algorithms of interest to us.

The data structure itself `psb_desc_type` can be treated as an opaque object handled via the tools routines of Sec. 6 or the query routines detailed below; nevertheless we include here a description for the curious reader.

First we describe the `psb_indx_map` type. This is a data structure that keeps track of a certain number of basic issues such as:

- The value of the communication/MPI context;
- The number of indices in the index space, i.e. global number of rows and columns of a sparse matrix;
- The local set of indices, including:
  - The number of local indices (and local rows);
  - The number of halo indices (and therefore local columns);
  - The global indices corresponding to the local ones.

There are many different schemes for storing these data; therefore there are a number of types extending the base one, and the descriptor structure holds a polymorphic object whose dynamic type can be any of the extended types. The methods associated with this data type answer the following queries:

- For a given set of local indices, find the corresponding indices in the global numbering;
- For a given set of global indices, find the corresponding indices in the local numbering, if any, or return an invalid
- Add a global index to the set of halo indices;
- Find the process owner of each member of a set of global indices.

All methods but the last are purely local; the last method potentially requires communication among processes, and thus is a synchronous method. The choice of a specific dynamic type for the index map is made at the time the descriptor is initially allocated, according to the mode of initialization (see also 6).

The descriptor contents are as follows:

indxmap
  A polymorphic variable of a type that is any extension of the indx_map type described above.
halo_index
  A list of the halo and boundary elements for the current process to be exchanged with other processes; for each processes with which it is necessary to communicate:
  1. Process identifier;
  2. Number of points to be received;
  3. Indices of points to be received;
  4. Number of points to be sent;
  5. Indices of points to be sent;
  Specified as: a vector of integer type, see 3.3.
ext_index
  A list of element indices to be exchanged to implement the mapping between a base descriptor and a descriptor with overlap.
  Specified as: a vector of integer type, see 3.3.
ovrlap_index
  A list of the overlap elements for the current process, organized in groups like the previous vector:
  1. Process identifier;
  2. Number of points to be received;
  3. Indices of points to be received;
  4. Number of points to be sent;
  5. Indices of points to be sent;
  Specified as: a vector of integer type, see 3.3.
ovr_mst_idx
  A list to retrieve the value of each overlap element from the respective master process.
  Specified as: a vector of integer type, see 3.3.
ovrlap_elem
  For all overlap points belonging to th ecurrent process:
  1. Overlap point index;
  2. Number of processes sharing that overlap points;
  3. Index of a “master” process:
  Specified as: an allocatable integer array of rank two.
bnd_elem
  A list of all boundary points, i.e. points that have a connection with other processes.

The Fortran 2003 declaration for `psb_desc_type` structures is as follows:

Figure 3: The PSBLAS defined data type that contains the communication descriptor.

    type psb_desc_type
        class(psb_indx_map), allocatable :: indxmap
        type(psb_i_vect_type) :: v_halo_index
        type(psb_i_vect_type) :: v_ext_index
        type(psb_i_vect_type) :: v_ovrlap_index
        type(psb_i_vect_type) :: v_ovr_mst_idx
        integer, allocatable  :: ovrlap_elem(:,:)
        integer, allocatable  :: bnd_elem(:)
    end type psb_desc_type

A communication descriptor associated with a sparse matrix has a state, which can take the following values:

Build:
  State entered after the first allocation, and before the first assembly; in this state it is possible to add communication requirements among different processes.
Assembled:
  State entered after the assembly; computations using the associated sparse matrix, such as matrix-vector products, are only possible in this state.

Subsections

- Descriptor Methods
- get_local_rows -- Get number of local rows
- get_local_cols -- Get number of local cols
- get_global_rows -- Get number of global rows
- get_global_cols -- Get number of global cols
- get_global_indices -- Get vector of global indices
- get_context -- Get communication context
- Clone -- clone current object
- CNV -- convert internal storage format
- psb_cd_get_large_threshold -- Get threshold for index mapping switch
- psb_cd_set_large_threshold -- Set threshold for index mapping switch
- Named Constants