deal.II version GIT relicensing-2167-g9622207b8f 2024-11-21 12:40: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
19
#ifdef DEAL_II_HAVE_UNISTD_H
20
# include <unistd.h>
21
#endif
22
23
DEAL_II_NAMESPACE_OPEN
24
25
26
const
JobIdentifier
&
27
JobIdentifier::get_dealjobid
()
28
{
29
static
JobIdentifier
dealjobid;
30
return
dealjobid;
31
}
32
33
34
35
JobIdentifier::JobIdentifier
()
36
{
37
time_t t = std::time(
nullptr
);
38
id
=
"JobId "
;
39
40
#if defined(DEAL_II_HAVE_UNISTD_H) && defined(DEAL_II_HAVE_GETHOSTNAME)
41
char
name[100];
42
gethostname(name, 99);
43
id
+= std::string(name) +
" "
;
44
#else
45
id
+=
"unknown "
;
46
#endif
47
48
id
+= std::string(std::ctime(&t));
49
}
50
51
52
std::string
53
JobIdentifier::operator()
()
const
54
{
55
return
id
;
56
}
57
58
59
std::string
60
JobIdentifier::base_name
(
const
std::string &filename)
61
{
62
std::string name(filename);
63
std::string::size_type pos;
64
pos = name.rfind(
'/'
);
65
if
(pos != std::string::npos)
66
name.erase(0, pos + 1);
67
pos = name.rfind(
'.'
);
68
if
(pos != std::string::npos)
69
name.erase(pos, name.size());
70
return
name;
71
}
72
73
74
75
DEAL_II_NAMESPACE_CLOSE
JobIdentifier
Definition
job_identifier.h:33
JobIdentifier::get_dealjobid
static const JobIdentifier & get_dealjobid()
Definition
job_identifier.cc:27
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:60
JobIdentifier::JobIdentifier
JobIdentifier()
Definition
job_identifier.cc:35
JobIdentifier::operator()
std::string operator()() const
Definition
job_identifier.cc:53
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