SPI
SLEPc PETSc Interface is used for rapid development and intuitive matrix operations similar to MatLab or NumPy style of operations
SPIprint.cpp
Go to the documentation of this file.
1 #include "SPIprint.hpp"
2 
3 namespace SPI{
5  PetscInt printf(
6  std::string msg,
7  ...
8  ){
9  MPI_Comm comm=PETSC_COMM_WORLD;
10  msg+="\n";
11  const char *format = msg.c_str();
12  // the rest of this is copied from PetscPrintf routine
13  PetscErrorCode ierr;
14  PetscMPIInt rank;
15 
16  PetscFunctionBeginUser;
17  ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
18  if (!rank) {
19  va_list Argp;
20  //va_start(Argp,format,1);
21  va_start(Argp,msg);
22  va_arg(Argp,const char*);
23  ierr = (*PetscVFPrintf)(PETSC_STDOUT,format,Argp);CHKERRQ(ierr);
24  va_end(Argp);
25  }
26  PetscFunctionReturn(0);
27  }
29  PetscInt printfc(
30  std::string msg,
31  PetscScalar val
32  ){
33  return printf(msg,PetscRealPart(val),PetscImaginaryPart(val));
34  }
35 }
SPIprint.hpp
SPI::printf
PetscInt printf(std::string msg,...)
Definition: SPIprint.cpp:5
SPI
Definition: SPIbaseflow.hpp:16
SPI::printfc
PetscInt printfc(std::string msg, const PetscScalar val)
Definition: SPIprint.cpp:29