7.0
general documentation
cs_rank_neighbors.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_block_dist.h"
#include "cs_crystal_router.h"
#include "cs_log.h"
#include "cs_order.h"
#include "cs_timer.h"
#include "cs_rank_neighbors.h"
+ Include dependency graph for cs_rank_neighbors.c:

Functions

cs_rank_neighbors_tcs_rank_neighbors_create (size_t n_elts, const int elt_rank[])
 Create a rank neighbors structure base on a list of element ranks. More...
 
void cs_rank_neighbors_destroy (cs_rank_neighbors_t **n)
 Destroy a rank neighborhood structure. More...
 
void cs_rank_neighbors_to_index (const cs_rank_neighbors_t *n, size_t n_elts, const int elt_rank[], int *elt_rank_index)
 Given a list of element ranks, determine the associated element rank indexes in a rank neighborhood structure. More...
 
void cs_rank_neighbors_symmetrize (cs_rank_neighbors_t *n, MPI_Comm comm)
 Symmetrize a rank neighborhood structure. More...
 
void cs_rank_neighbors_count (const cs_rank_neighbors_t *n, size_t n_elts, const int *elt_rank_index, cs_lnum_t *elt_rank_count)
 Given a list of element rank indexes, count occurences for a rank neighborhood structure. More...
 
void cs_rank_neighbors_sync_count (const cs_rank_neighbors_t *n_send, cs_rank_neighbors_t **n_recv, const cs_lnum_t *send_count, cs_lnum_t **recv_count, MPI_Comm comm)
 Exchange send and receive counts for rank neighborhoods. More...
 
void cs_rank_neighbors_sync_count_m (const cs_rank_neighbors_t *n_send, cs_rank_neighbors_t **n_recv, const cs_lnum_t *send_count, cs_lnum_t **recv_count, cs_rank_neighbors_exchange_t exchange_type, MPI_Comm comm)
 Exchange send and receive counts for rank neighborhoods, using a given method. More...
 
cs_rank_neighbors_exchange_t cs_rank_neighbors_get_exchange_type (void)
 Get current type of rank neighbors collective algorithm choice. More...
 
void cs_rank_neighbors_set_exchange_type (cs_rank_neighbors_exchange_t t)
 Set current type of rank neighbors collective algorithm choice. More...
 

Detailed Description

Management of parallel rank neighbors.

Algorithm names are based upon [4] and [3] .

Function Documentation

◆ cs_rank_neighbors_count()

void cs_rank_neighbors_count ( const cs_rank_neighbors_t n,
size_t  n_elts,
const int *  elt_rank_index,
cs_lnum_t elt_rank_count 
)

Given a list of element rank indexes, count occurences for a rank neighborhood structure.

Parameters
[in]npointer to rank neighborhood structure
[in]n_eltsnumber of elements
[in]elt_rank_indexelement rank index in neighborhood (size: n_elts)
[out]elt_rank_countelement rank count in neighborhood (size: n->size)

◆ cs_rank_neighbors_create()

cs_rank_neighbors_t* cs_rank_neighbors_create ( size_t  n_elts,
const int  elt_rank[] 
)

Create a rank neighbors structure base on a list of element ranks.

Parameters
[in]n_eltsnumber of elements
[in]elt_rankelement rank in
Returns
pointer to new rank neighborhood.

◆ cs_rank_neighbors_destroy()

void cs_rank_neighbors_destroy ( cs_rank_neighbors_t **  n)

Destroy a rank neighborhood structure.

Parameters
[in,out]npointer to associated rank neighborhood

◆ cs_rank_neighbors_get_exchange_type()

cs_rank_neighbors_exchange_t cs_rank_neighbors_get_exchange_type ( void  )

Get current type of rank neighbors collective algorithm choice.

Returns
current type of rank neighbors collective algorithm choice

◆ cs_rank_neighbors_set_exchange_type()

void cs_rank_neighbors_set_exchange_type ( cs_rank_neighbors_exchange_t  t)

Set current type of rank neighbors collective algorithm choice.

Parameters
ttype of rank neighbors collective algorithm choice

◆ cs_rank_neighbors_symmetrize()

void cs_rank_neighbors_symmetrize ( cs_rank_neighbors_t n,
MPI_Comm  comm 
)

Symmetrize a rank neighborhood structure.

This is a collective operation ,which ensures that if rank i has j among its neighbors, then j will also jave i among its neighbors.

Parameters
[in,out]npointer to rank neighborhood structure
[in]commassociated communicator

◆ cs_rank_neighbors_sync_count()

void cs_rank_neighbors_sync_count ( const cs_rank_neighbors_t n_send,
cs_rank_neighbors_t **  n_recv,
const cs_lnum_t send_count,
cs_lnum_t **  recv_count,
MPI_Comm  comm 
)

Exchange send and receive counts for rank neighborhoods.

This allocates the n_recv ranks neighborhood structure and the recv_count counts array, which the caller is responsible for freeing.

Parameters
[in]n_sendpointer to rank neighborhood used for sending
[out]n_recvpointer to rank neighborhood used for receiving
[in]send_countpointer to rank neighborhood used for sending
[in]recv_countpointer to rank neighborhood used for sending
[in]commassociated communicator

◆ cs_rank_neighbors_sync_count_m()

void cs_rank_neighbors_sync_count_m ( const cs_rank_neighbors_t n_send,
cs_rank_neighbors_t **  n_recv,
const cs_lnum_t send_count,
cs_lnum_t **  recv_count,
cs_rank_neighbors_exchange_t  exchange_type,
MPI_Comm  comm 
)

Exchange send and receive counts for rank neighborhoods, using a given method.

This allocates the n_recv ranks neighborhood structure and the recv_count counts array, which the caller is responsible for freeing.

Parameters
[in]n_sendpointer to rank neighborhood used for sending
[out]n_recvpointer to rank neighborhood used for receiving
[in]send_countpointer to rank neighborhood used for sending
[in]recv_countpointer to rank neighborhood used for sending
[in]exchange_typeexchange type
[in]commassociated communicator

◆ cs_rank_neighbors_to_index()

void cs_rank_neighbors_to_index ( const cs_rank_neighbors_t n,
size_t  n_elts,
const int  elt_rank[],
int *  elt_rank_index 
)

Given a list of element ranks, determine the associated element rank indexes in a rank neighborhood structure.

The elt_rank and elt_rank_index may be identical, in which case it is updated.

Parameters
[in]npointer to rank neighborhood structure
[in]n_eltsnumber of elements
[in]elt_rankelement rank (size: n_elts)
[out]elt_rank_indexelement rank index in neighborhood (size: n_elts)