MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_Behavior.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#include "Teuchos_EnvVariables.hpp"
11#include "MueLu_Behavior.hpp"
12#include <array>
13#include <map>
14
15// environ should be available on posix platforms
16#if not(defined(WIN) && (_MSC_VER >= 1900))
17// needs to be in the global namespace
18extern char **environ;
19#endif
20
21namespace MueLu {
22
23namespace BehaviorDetails {
24
25constexpr const std::string_view DEBUG = "MUELU_DEBUG";
26
27} // namespace BehaviorDetails
28
29namespace { // (anonymous)
30
31constexpr bool debugDefault() {
32#ifdef HAVE_MUELU_DEBUG
33 return true;
34#else
35 return false;
36#endif // HAVE_MUELU_DEBUG
37}
38
39} // namespace
40
42 constexpr bool defaultValue = debugDefault();
43
44 static bool value_ = defaultValue;
45 static bool initialized_ = false;
46 return Teuchos::idempotentlyGetEnvironmentVariable(
47 value_, initialized_, BehaviorDetails::DEBUG, defaultValue);
48}
49
50} // namespace MueLu
static bool debug()
Whether MueLu is in debug mode.
constexpr const std::string_view DEBUG
Namespace for MueLu classes and methods.