deal.II version GIT relicensing-2577-g108be0c5b5 2025-02-07 13:10:00+00:00
\(\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
// SPDX-License-Identifier: LGPL-2.1-or-later
4
// Copyright (C) 1998 - 2023 by the deal.II authors
5
//
6
// This file is part of the deal.II library.
7
//
8
// Part of the source code is dual licensed under Apache-2.0 WITH
9
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10
// governing the source code and code contributions can be found in
11
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12
//
13
// ------------------------------------------------------------------------
14
15
#include <
deal.II/base/job_identifier.h
>
16
17
#include <ctime>
18
#include <string>
19
20
21
#ifdef DEAL_II_HAVE_UNISTD_H
22
# include <unistd.h>
23
#endif
24
25
DEAL_II_NAMESPACE_OPEN
26
27
28
const
JobIdentifier
&
29
JobIdentifier::get_dealjobid
()
30
{
31
static
JobIdentifier
dealjobid;
32
return
dealjobid;
33
}
34
35
36
37
JobIdentifier::JobIdentifier
()
38
{
39
time_t t = std::time(
nullptr
);
40
id
=
"JobId "
;
41
42
#if defined(DEAL_II_HAVE_UNISTD_H) && defined(DEAL_II_HAVE_GETHOSTNAME)
43
char
name[100];
44
gethostname(name, 99);
45
id
+= std::string(name) +
" "
;
46
#else
47
id
+=
"unknown "
;
48
#endif
49
50
id
+= std::string(std::ctime(&t));
51
}
52
53
54
std::string
55
JobIdentifier::operator()
()
const
56
{
57
return
id
;
58
}
59
60
61
std::string
62
JobIdentifier::base_name
(
const
std::string &filename)
63
{
64
std::string name(filename);
65
std::string::size_type pos;
66
pos = name.rfind(
'/'
);
67
if
(pos != std::string::npos)
68
name.erase(0, pos + 1);
69
pos = name.rfind(
'.'
);
70
if
(pos != std::string::npos)
71
name.erase(pos, name.size());
72
return
name;
73
}
74
75
76
77
DEAL_II_NAMESPACE_CLOSE
JobIdentifier
Definition
job_identifier.h:33
JobIdentifier::get_dealjobid
static const JobIdentifier & get_dealjobid()
Definition
job_identifier.cc:29
JobIdentifier::id
std::string id
Definition
job_identifier.h:78
JobIdentifier::base_name
static std::string base_name(const std::string &filename)
Definition
job_identifier.cc:62
JobIdentifier::JobIdentifier
JobIdentifier()
Definition
job_identifier.cc:37
JobIdentifier::operator()
std::string operator()() const
Definition
job_identifier.cc:55
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition
config.h:498
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition
config.h:499
job_identifier.h
Generated by
1.9.8