GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
map.c File Reference
#include "ghost/map.h"
#include "ghost/locality.h"
#include "ghost/util.h"
#include "ghost/error.h"
Include dependency graph for map.c:

Functions

ghost_error ghost_map_create (ghost_map **map, ghost_gidx gdim, ghost_mpi_comm comm, ghost_maptype type, ghost_map_flags flags)
 Create a map. More...
 
static int diag (ghost_gidx row, ghost_lidx *rowlen, ghost_gidx *col, void *val, __attribute__((unused)) void *arg)
 
ghost_error ghost_map_create_distribution (ghost_map *map, ghost_sparsemat_src_rowfunc *matsrc, double weight, ghost_map_dist_type distType, ghost_lidx *el_per_rank)
 Initialize a map's distribution. More...
 
void ghost_map_destroy (ghost_map *map)
 Destroy a map and free all its resources if no more references to it exist. More...
 
int ghost_rank_of_row (ghost_map *map, ghost_gidx row)
 Get the rank of a given global row in a given map. More...
 
ghost_mapghost_map_create_light (ghost_lidx dim, ghost_mpi_comm mpicomm)
 Create a light map with only a dimension and an MPI communicator. More...
 

Function Documentation

static int diag ( ghost_gidx  row,
ghost_lidx rowlen,
ghost_gidx col,
void *  val,
__attribute__((unused)) void *  arg 
)
static
ghost_error ghost_map_create ( ghost_map **  map,
ghost_gidx  gdim,
ghost_mpi_comm  comm,
ghost_maptype  type,
ghost_map_flags  flags 
)

Create a map.

Parameters
mapThe map.
gdimThe global dimensions of the map.
commThe map's MPI communicator.
typeThe type of the map.
flagsOptional flags.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_error ghost_map_create_distribution ( ghost_map map,
ghost_sparsemat_src_rowfunc matsrc,
double  weight,
ghost_map_dist_type  distType,
ghost_lidx el_per_rank 
)

Initialize a map's distribution.

Parameters
mapThe map.
matsrcThe sparse matrix construction function or NULL.
weightThe weight of this rank.
distTypeThe distribution scheme.
el_per_rankAn array of length $nranks which prescribed the distribution or NULL.

In case matsrc is NULL, the only possible distType is GHOST_MAP_DIST_NROWS.

Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_map* ghost_map_create_light ( ghost_lidx  dim,
ghost_mpi_comm  mpicomm 
)

Create a light map with only a dimension and an MPI communicator.

This map is usually used for non-distributed dense matrices. The map does not have to be free'd by the user but will be free'd in ghost_densemat_destroy().

Parameters
dimThe dimension.
mpicommThe MPI communicator.
Returns
The map.

Here is the call graph for this function:

void ghost_map_destroy ( ghost_map map)

Destroy a map and free all its resources if no more references to it exist.

Parameters
mapThe map.

This decreases the ghost_map::ref_count and, in case it is zero afterwards, free's the map's resources.

int ghost_rank_of_row ( ghost_map map,
ghost_gidx  row 
)

Get the rank of a given global row in a given map.

Parameters
mapThe map.
rowThe global row.
Returns
The rank inside the map's MPI communicator which owns the given row.

Here is the call graph for this function: