Loading [MathJax]/extensions/TeX/AMSsymbols.js
 Reference documentation for deal.II version 9.2.0
\(\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\}}\)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
17 
18 #include <ctime>
19 
20 #ifdef DEAL_II_HAVE_UNISTD_H
21 # include <unistd.h>
22 #endif
23 
25 
26 
27 const JobIdentifier &
29 {
30  static JobIdentifier dealjobid;
31  return dealjobid;
32 }
33 
34 
35 
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
55 {
56  return id;
57 }
58 
59 
60 std::string
61 JobIdentifier::base_name(const std::string &filename)
62 {
63  std::string name(filename);
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 
job_identifier.h
JobIdentifier::operator()
const std::string operator()() const
Definition: job_identifier.cc:54
JobIdentifier::get_dealjobid
static const JobIdentifier & get_dealjobid()
Definition: job_identifier.cc:28
JobIdentifier::base_name
static std::string base_name(const std::string &filename)
Definition: job_identifier.cc:61
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
JobIdentifier
Definition: job_identifier.h:33
LinearAlgebra::CUDAWrappers::kernel::size_type
types::global_dof_index size_type
Definition: cuda_kernels.h:45
JobIdentifier::JobIdentifier
JobIdentifier()
Definition: job_identifier.cc:36
JobIdentifier::id
std::string id
Definition: job_identifier.h:79
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359