GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
LogManager.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
5
/*
6
* Log.h
7
*
8
* Created on: 17 Jun 2020
9
* Author: Maxim Masterov
10
* Company: SURFSara
11
*/
12
13
#ifndef MANAGERS_IO_LOGMANAGER_H_
14
#define MANAGERS_IO_LOGMANAGER_H_
15
16
#include <iostream>
17
18
#ifdef GPR_LINALG_SCALAPACK
19
#include <mpi.h>
20
#endif
21
22
namespace
gpr
{
23
namespace
io
{
24
28
class
LogManager
{
29
public
:
30
LogManager
() { }
31
~LogManager
() { }
32
37
inline
void
setEnabled
(
bool
enabled
)
noexcept
38
{
39
enabled_ =
enabled
;
40
}
41
42
[[nodiscard]]
inline
bool
enabled
() const noexcept
43
{
44
return
enabled_;
45
}
46
52
template
<
typename
T>
53
inline
LogManager
&
operator<<
(
const
T& data)
54
{
55
if
(!enabled_)
return
*
this
;
56
#ifdef GPR_LINALG_SCALAPACK
57
int
rank = 0;
58
int
init = 0;
59
MPI_Initialized(&init);
60
if
(init) MPI_Comm_rank(MPI_COMM_WORLD, &rank);
61
if
(rank != 0)
return
*
this
;
62
#endif
63
std::clog << data;
64
return
*
this
;
65
}
66
67
private
:
68
bool
enabled_ =
true
;
69
};
70
71
}
/* namespace io */
72
}
/* namespace gpr */
73
74
#endif
/* MANAGERS_IO_LOGMANAGER_H_ */
gpr::io::LogManager::operator<<
LogManager & operator<<(const T &data)
Writes data to the log.
Definition
LogManager.h:53
gpr::io::LogManager::LogManager
LogManager()
Definition
LogManager.h:30
gpr::io::LogManager::enabled
bool enabled() const noexcept
Definition
LogManager.h:42
gpr::io::LogManager::setEnabled
void setEnabled(bool enabled) noexcept
Switch the log on or off. A log starts enabled. A disabled log discards what is written to it.
Definition
LogManager.h:37
gpr::io::LogManager::~LogManager
~LogManager()
Definition
LogManager.h:31
gpr::io
Definition
SeededSearch.h:8
gpr
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition
Macros.h:16
managers
io
LogManager.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf