 |
FrontISTR
5.7.0
Large-scale structural analysis program with finit element method
|
Go to the documentation of this file.
19 #define HECMW_LINE_MAX 1023
21 #define USEFUL_LOGLVS(lv) ((lv) ? (lv | (lv - 1)) : 0)
23 static struct loglv_ent {
26 } hecmw_loglv_table[] = {
46 static int enable_by_rank = 1;
48 static int check_loglv(
int loglv) {
50 for (i = 0; i <
sizeof(hecmw_loglv_table) /
sizeof(hecmw_loglv_table[0]);
52 if (loglv == hecmw_loglv_table[i].loglv)
return 0;
71 if (logfile ==
NULL) {
80 sprintf(logfilename,
"%s%s", logfile, rank);
92 if (!useful_logent[i])
continue;
93 if (strcmp(logfilename, logent[i].
file) == 0) {
102 if (useful_logent[i])
continue;
107 if (newent ==
NULL) {
112 strcpy(newent->
file, logfilename);
115 if (enable_by_rank && loglv & loglevels) {
116 if ((
fp = fopen(logfilename,
"a")) ==
NULL) {
126 useful_logent[newent_idx] = 1;
127 return newent_idx + 1;
138 p = (
struct log_ent *)&logent[
id];
146 memset(p, 0,
sizeof(*p));
147 useful_logent[id] = 0;
152 static void output_log(
int loglv,
const char *fmt, va_list ap, FILE *
fp) {
172 HECMW_snprintf(buf + len,
sizeof(buf) - len,
" PE[%d/%d]", my_rank,
181 int thread_num = omp_get_thread_num();
182 int num_threads = omp_get_num_threads();
183 if (num_threads > 1) {
185 HECMW_snprintf(buf + len,
sizeof(buf) - len,
" TH(%d/%d)", thread_num,
192 for (i = 0; i <
sizeof(hecmw_loglv_table) /
sizeof(hecmw_loglv_table[0]);
194 if (hecmw_loglv_table[i].loglv == loglv) {
212 if ((len > 0 && buf[len - 1] !=
'\n') || len == 0) {
226 if (!enable_by_rank)
return 0;
227 if (check_loglv(loglv)) {
232 if (!(loglv & loglevels))
return 0;
236 struct log_ent *p = &logent[i];
237 if (!useful_logent[i])
continue;
238 if (loglv & loglevels & p->
lv) {
246 output_log(loglv, fmt, ap, p->
fp);
248 output_log(loglv, fmt, ap, stderr);
254 output_log(loglv, fmt, ap, stderr);
270 if (from > to)
return;
272 enable_by_rank = (true_or_false) ? 1 : 0;
330 int *ierror,
int len) {
344 int *ierror,
int len) {
349 int *ierror,
int len) {
354 int *ierror,
int len) {
void HECMW_CLOSELOG_IF(int *id, int *ierror)
void hecmw_setloglv_if_(int *loglv)
void hecmw_openlog_if__(char *logfile, int *loglv, int *options, int *id, int *ierror, int len)
int HECMW_snprintf(char *str, size_t size, const char *format,...)
void hecmw_log_if__(int *loglv, char *msg, int len)
int HECMW_log(int loglv, const char *fmt,...)
void HECMW_log_set_enable(int from, int to, int true_or_false)
int HECMW_comm_get_size(void)
int HECMW_vlog(int loglv, const char *fmt, va_list ap)
void hecmw_log_set_enable_if(int *from, int *to, int *true_or_false)
void hecmw_log_set_enable_if__(int *from, int *to, int *true_or_false)
int HECMW_comm_get_rank(void)
int HECMW_openlog(const char *logfile, int loglv, int options)
void hecmw_closelog_if(int *id, int *ierror)
char * HECMW_get_date_r(char *buf, int len)
void hecmw_setloglv_if(int *loglv)
void HECMW_LOG_IF(int *loglv, char *msg, int len)
void hecmw_log_if_(int *loglv, char *msg, int len)
#define USEFUL_LOGLVS(lv)
void HECMW_SETLOGLV_IF(int *loglv)
int HECMW_vsnprintf(char *str, size_t size, const char *format, va_list ap)
void hecmw_openlog_if_(char *logfile, int *loglv, int *options, int *id, int *ierror, int len)
void hecmw_log_set_enable_if_(int *from, int *to, int *true_or_false)
void HECMW_OPENLOG_IF(char *logfile, int *loglv, int *options, int *id, int *ierror, int len)
int HECMW_closelog(int id)
void hecmw_log_if(int *loglv, char *msg, int len)
void hecmw_setloglv_if__(int *loglv)
char * HECMW_strcpy_f2c_r(const char *fstr, int flen, char *buf, int bufsize)
int HECMW_set_error(int errorno, const char *fmt,...)
void hecmw_openlog_if(char *logfile, int *loglv, int *options, int *id, int *ierror, int len)
void HECMW_setloglv(int loglv)
#define HECMW_assert(cond)
#define HECMW_FILENAME_LEN
struct option_rec options[]
specify command line option name and executing function name.
void hecmw_closelog_if_(int *id, int *ierror)
void HECMW_LOG_SET_ENABLE_IF(int *from, int *to, int *true_or_false)
char file[HECMW_FILENAME_LEN+1]
void hecmw_closelog_if__(int *id, int *ierror)