HΦ  3.2.0
log.c File Reference

File for defining functions to write log messages. More...

#include <time.h>
#include "Common.h"
#include "log.h"
#include "FileIO.h"
+ Include dependency graph for log.c:

Go to the source code of this file.

Functions

int TimeKeeper (struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType)
 Functions for writing a time log. More...
 
int TimeKeeperWithStep (struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int istep)
 Functions for writing a time log. More...
 
int TimeKeeperWithRandAndStep (struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType, const int irand, const int istep)
 Functions for writing a time log. More...
 

Detailed Description

File for defining functions to write log messages.

Definition in file log.c.

Function Documentation

◆ TimeKeeper()

int TimeKeeper ( struct BindStruct X,
const char *  cFileName,
const char *  cTimeKeeper_Message,
const char *  cWriteType 
)

Functions for writing a time log.

Parameters
[in]XDefine List for parameters.
[in]cFileNamecharacter for a file name of writing.
[in]cTimeKeeper_Messagecharacter for a sentence writing in a file.
[in]cWriteTypecharacter for determining writing option for fopen.
Return values
0normally finished.
-1unnormally finished.
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 42 of file log.c.

References DefineList::CDataFileHead, childfopenMPI(), D_FileNameMax, BindStruct::Def, and TimeKeeperWithStep().

Referenced by CalcByLanczos(), CalcByLOBPCG(), CalcByTEM(), CalcSpectrum(), CalcSpectrumByBiCG(), CalcSpectrumByTPQ(), CG_EigenVector(), diagonalcalc(), expec_cisajs(), expec_cisajscktaltdc(), expec_energy_flct(), Lanczos_EigenValue(), Lanczos_EigenVector(), LOBPCG_Main(), main(), OutputLanczosVector(), Read_sz(), ReadInitialVector(), and sz().

48 {
49  FILE *fp;
50  char sdt[D_FileNameMax];
51  struct tm *area;
52  time_t tx;
53 
54  sprintf(sdt, cFileName, X->Def.CDataFileHead);
55  tx = time(NULL);
56  area = localtime(&tx);
57  if(childfopenMPI(sdt, cWriteType, &fp)!=0){
58  return -1;
59  }
60  fprintf(fp, cTimeKeeper_Message, asctime(area));
61  fclose(fp);
62  return 0;
63 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
#define D_FileNameMax
Definition: global.h:23
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.c:27
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green&#39;s function.
Definition: struct.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TimeKeeperWithRandAndStep()

int TimeKeeperWithRandAndStep ( struct BindStruct X,
const char *  cFileName,
const char *  cTimeKeeper_Message,
const char *  cWriteType,
const int  irand,
const int  istep 
)

Functions for writing a time log.

Parameters
[in]XDefine List for parameters.
[in]cFileNamecharacter for a file name of writing.
[in]cTimeKeeper_Messagecharacter for a sentence writing in a file.
[in]cWriteTypecharacter for determining writing option for fopen.
[in]irandint for writing a number of seed of rand.
[in]istepint for writing steps of progress for a function under calculating.
Return values
0normally finished.
-1unnormally finished.
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 117 of file log.c.

References DefineList::CDataFileHead, childfopenMPI(), D_FileNameMax, and BindStruct::Def.

Referenced by CalcByTPQ(), expec_cisajs(), expec_cisajscktaltdc(), and TimeKeeperWithStep().

124  {
125  FILE *fp;
126  char sdt[D_FileNameMax];
127  struct tm *area;
128  time_t tx;
129 
130  sprintf(sdt, cFileName, X->Def.CDataFileHead);
131  tx = time(NULL);
132  area = localtime(&tx);
133  if(childfopenMPI(sdt, cWriteType, &fp)!=0){
134  return -1;
135  }
136  fprintf(fp, cTimeKeeper_Message, irand, istep, asctime(area));
137  fclose(fp);
138  return 0;
139 
140 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
#define D_FileNameMax
Definition: global.h:23
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.c:27
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green&#39;s function.
Definition: struct.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TimeKeeperWithStep()

int TimeKeeperWithStep ( struct BindStruct X,
const char *  cFileName,
const char *  cTimeKeeper_Message,
const char *  cWriteType,
const int  istep 
)

Functions for writing a time log.

Parameters
[in]XDefine List for parameters.
[in]cFileNamecharacter for a file name of writing.
[in]cTimeKeeper_Messagecharacter for a sentence writing in a file.
[in]cWriteTypecharacter for determining writing option for fopen.
[in]istepint for writing steps of progress for a function under calculating.
Return values
0normally finished.
-1unnormally finished.
Author
Takahiro Misawa (The University of Tokyo)
Kazuyoshi Yoshimi (The University of Tokyo)

Definition at line 78 of file log.c.

References DefineList::CDataFileHead, childfopenMPI(), D_FileNameMax, BindStruct::Def, and TimeKeeperWithRandAndStep().

Referenced by CalcByTEM(), expec_cisajs(), expec_cisajscktaltdc(), expec_energy_flct(), Lanczos_EigenValue(), Lanczos_GetTridiagonalMatrixComponents(), LOBPCG_Main(), and TimeKeeper().

85 {
86  FILE *fp;
87  char sdt[D_FileNameMax];
88  struct tm *area;
89  time_t tx;
90 
91  sprintf(sdt, cFileName, X->Def.CDataFileHead);
92  tx = time(NULL);
93  area = localtime(&tx);
94  if(childfopenMPI(sdt, cWriteType, &fp)!=0){
95  return -1;
96  }
97  fprintf(fp, cTimeKeeper_Message, istep, asctime(area));
98  fclose(fp);
99  return 0;
100 }
struct DefineList Def
Definision of system (Hamiltonian) etc.
Definition: struct.h:410
#define D_FileNameMax
Definition: global.h:23
int childfopenMPI(const char *_cPathChild, const char *_cmode, FILE **_fp)
Only the root process open file in output/ directory.
Definition: FileIO.c:27
char * CDataFileHead
Read from Calcmod in readdef.h. Header of output file such as Green&#39;s function.
Definition: struct.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function: