Reference documentation for deal.II version 9.5.1
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
source
base
job_identifier.cc
Go to the documentation of this file.
1
// ---------------------------------------------------------------------
2
//
3
// Copyright (C) 1998 - 2018 by the deal.II authors
4
//
5
// This file is part of the deal.II library.
6
//
7
// The deal.II library is free software; you can use it, redistribute
8
// it, and/or modify it under the terms of the GNU Lesser General
9
// Public License as published by the Free Software Foundation; either
10
// version 2.1 of the License, or (at your option) any later version.
11
// The full text of the license can be found in the file LICENSE.md at
12
// the top level directory of deal.II.
13
//
14
// ---------------------------------------------------------------------
15
16
#include <
deal.II/base/job_identifier.h
>
17
18
#include <ctime>
19
20
#ifdef DEAL_II_HAVE_UNISTD_H
21
# include <unistd.h>
22
#endif
23
24
DEAL_II_NAMESPACE_OPEN
25
26
27
const
JobIdentifier
&
28
JobIdentifier::get_dealjobid
()
29
{
30
static
JobIdentifier
dealjobid;
31
return
dealjobid;
32
}
33
34
35
36
JobIdentifier::JobIdentifier
()
37
{
38
time_t t = std::time(
nullptr
);
39
id
= std::string(
"JobId "
);
40
41
#if defined(DEAL_II_HAVE_UNISTD_H) && defined(DEAL_II_HAVE_GETHOSTNAME)
42
char
name[100];
43
gethostname(name, 99);
44
id
+= std::string(name) + std::string(
" "
);
45
#else
46
id
+= std::string(
"unknown "
);
47
#endif
48
49
id
+= std::string(std::ctime(&t));
50
}
51
52
53
const
std::string
54
JobIdentifier::operator()
()
const
55
{
56
return
id
;
57
}
58
59
60
std::string
61
JobIdentifier::base_name
(
const
std::string &filename)
62
{
63
std::string name(filename);
64
std::string::size_type pos;
65
pos = name.rfind(
'/'
);
66
if
(pos != std::string::npos)
67
name.erase(0, pos + 1);
68
pos = name.rfind(
'.'
);
69
if
(pos != std::string::npos)
70
name.erase(pos, name.size());
71
return
name;
72
}
73
74
75
76
DEAL_II_NAMESPACE_CLOSE
JobIdentifier
Definition
job_identifier.h:34
JobIdentifier::get_dealjobid
static const JobIdentifier & get_dealjobid()
Definition
job_identifier.cc:28
JobIdentifier::id
std::string id
Definition
job_identifier.h:79
JobIdentifier::base_name
static std::string base_name(const std::string &filename)
Definition
job_identifier.cc:61
JobIdentifier::JobIdentifier
JobIdentifier()
Definition
job_identifier.cc:36
JobIdentifier::operator()
const std::string operator()() const
Definition
job_identifier.cc:54
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition
config.h:472
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition
config.h:473
job_identifier.h
Generated by
1.10.0