HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
MPIGetFilename.c File Reference

Get filename indexed by MPI rank. More...

#include <mpi.h>
#include <string.h>
#include <basic.h>
#include <mpivars.h>
#include <common.h>

Go to the source code of this file.

Functions

void MPIGetFilename (char *root, void *c, char *filename)
 

Detailed Description

Get filename indexed by MPI rank.

Author
Debojyoti Ghosh

Definition in file MPIGetFilename.c.

Function Documentation

◆ MPIGetFilename()

void MPIGetFilename ( char *  root,
void *  c,
char *  filename 
)

Get a string representing a filename indexed by the MPI rank: filename = root.index, where index is the string corresponding to the MPI rank.

Parameters
rootfilename root
cMPI communicator
filenamefilename

Definition at line 19 of file MPIGetFilename.c.

24 {
25  char tail[_MAX_STRING_SIZE_]="";
26  int rank;
27 
28 #ifndef serial
29  MPI_Comm comm = *((MPI_Comm*)c);
30  MPI_Comm_rank(comm,&rank);
31 #else
32  rank = 0;
33 #endif
34 
35  GetStringFromInteger(rank,tail,4);
36  strcpy(filename,"");
37  strcat(filename,root);
38  strcat(filename,"." );
39  strcat(filename,tail);
40 
41  return;
42 }
#define _MAX_STRING_SIZE_
Definition: basic.h:14
void GetStringFromInteger(int, char *, int)