pnet_addconnect(3)

NAME
pnet_addconnect - Add connection to network

SYNOPSIS
#include <mpi.h>
#include "pnet.h"
int pnet_addconnect(Pnet *pnet, int to,int from);

DESCRIPTION
The function adds a connection to the network. Must be called after pnet_init and before pnet_setup. The arguments of pnet_addconnect are:

pnet
    Pointer to initialized Pnet struct

to  Target node of connection

from
    Source node of connection

RETURN VALUE
Upon successful completion PNET_OK is returned.

ERRORS

PNET_TO_INDEX_ERR
    target node is not in the range of pnet_lo(pnet),...,pnet_hi(pnet).

PNET_FROM_INDEX_ERR
    Source node is not in the range of 0,...,pnet_nodes(pnet)-1.

PNET_ALLOC_ERR
    Cannot allocate memory for connection.

EXAMPLE

Create network with all to all connections
    Pnet *pnet;
    int i,j;
    MPI_Init(&argc,&argv);
    pnet=pnet_init(MPI_COMM_WORLD,MPI_FLOAT,100)
    for(i=pnet_lo(pnet);i<=pnet_hi(pnet);i++)
      for(j=0;j<100;j++)
        pnet_addconnect(pnet,i,j);
    pnet_setup(pnet);

AUTHOR
Werner von Bloh (bloh@pik-potsdam.de)

SEE ALSO
pnet_init(3), pnet_free(3), pnet_setup(3), pnet_lo(3), pnet_hi(3), pnet_nodes(3)