HΦ  3.2.0
FileIO.c File Reference

Functions to open file(s) in output/ directory. More...

#include "FileIO.h"
#include "wrapperMPI.h"
+ Include dependency graph for FileIO.c:

Go to the source code of this file.

Functions

int childfopenMPI (const char *_cPathChild, const char *_cmode, FILE **_fp)
 Only the root process open file in output/ directory. More...
 
int childfopenALL (const char *_cPathChild, const char *_cmode, FILE **_fp)
 All processes open file in output/ directory. More...
 

Detailed Description

Functions to open file(s) in output/ directory.

Definition in file FileIO.c.

Function Documentation

◆ childfopenALL()

int childfopenALL ( const char *  _cPathChild,
const char *  _cmode,
FILE **  _fp 
)

All processes open file in output/ directory.

Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Returns
-1 if file cannot be opened, 0 if not.
Parameters
[in]_cPathChildFile name
[in]_cmode"w", "r", etc.
[in,out]_fpFile pointr

Definition at line 50 of file FileIO.c.

References cErrFIOpen, cParentOutputFolder, and D_FileNameMax.

Referenced by CalcByLanczos(), CalcByLOBPCG(), CalcByTEM(), CalcByTPQ(), CalcSpectrum(), CalcSpectrumByBiCG(), CalcSpectrumByTPQ(), Initialize_wave(), Output_restart(), OutputLanczosVector(), ReadInitialVector(), and ReadTMComponents_BiCG().

54  {
55  char ctmpPath[D_FileNameMax]="";
56  strcat(ctmpPath, cParentOutputFolder);
57  strcat(ctmpPath, _cPathChild);
58  *_fp = fopen(ctmpPath, _cmode);
59 
60  if(*_fp == NULL){
61  fprintf(stdout, cErrFIOpen, ctmpPath);
62  return -1;
63  }
64 
65  return 0;
66 }/*int childfopenALL*/
#define D_FileNameMax
Definition: global.h:23
char * cErrFIOpen
Error Message in FileIO.c.
Definition: ErrorMessage.c:111
const char * cParentOutputFolder
Definition: global.c:20
+ Here is the caller graph for this function:

◆ childfopenMPI()

int childfopenMPI ( const char *  _cPathChild,
const char *  _cmode,
FILE **  _fp 
)

Only the root process open file in output/ directory.

Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)
Returns
-1 if file cannot be opened, 0 if not.
Parameters
[in]_cPathChildFile name
[in]_cmode"w", "r", etc.
[in,out]_fpFile pointer

Definition at line 27 of file FileIO.c.

References cErrFIOpen, cParentOutputFolder, D_FileNameMax, fopenMPI(), and stdoutMPI.

Referenced by CalcByLanczos(), CalcByLOBPCG(), CalcByTEM(), CalcByTPQ(), CalcSpectrumByBiCG(), CG_EigenVector(), check(), diagonalcalc(), expec_cisajs(), expec_cisajscktaltdc(), HPhiTrans(), inputHam(), Lanczos_EigenValue(), lapack_diag(), LOBPCG_Main(), output(), output_list(), outputHam(), OutputTimer(), OutputTMComponents(), OutputTMComponents_BiCG(), Read_sz(), ReadTMComponents(), SetOmega(), sz(), TimeKeeper(), TimeKeeperWithRandAndStep(), and TimeKeeperWithStep().

31  {
32  char ctmpPath[D_FileNameMax]="";
33  strcat(ctmpPath, cParentOutputFolder);
34  strcat(ctmpPath, _cPathChild);
35  *_fp = fopenMPI(ctmpPath, _cmode);
36 
37  if(*_fp == NULL){
38  fprintf(stdoutMPI, cErrFIOpen, ctmpPath);
39  return -1;
40  }
41 
42  return 0;
43 }/*int childfopenMPI*/
#define D_FileNameMax
Definition: global.h:23
char * cErrFIOpen
Error Message in FileIO.c.
Definition: ErrorMessage.c:111
const char * cParentOutputFolder
Definition: global.c:20
FILE * fopenMPI(const char *FileName, const char *mode)
MPI file I/O (open) wrapper. Only the root node (myrank = 0) should be open/read/write (small) parame...
Definition: wrapperMPI.c:105
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()
Definition: global.h:165
+ Here is the call graph for this function:
+ Here is the caller graph for this function: