MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_VerbosityLevel.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
11#include "MueLu_Exceptions.hpp"
12#include "MueLu_Utilities.hpp"
13#include <string>
14#include <locale>
15
16namespace MueLu {
17
18VerbLevel toMueLuVerbLevel(const Teuchos::EVerbosityLevel verbLevel) {
19 switch (verbLevel) {
20 case Teuchos::VERB_NONE:
21 return None;
22 case Teuchos::VERB_DEFAULT:
23 return Default;
24 case Teuchos::VERB_LOW:
25 return Low;
26 case Teuchos::VERB_MEDIUM:
27 return Medium;
28 case Teuchos::VERB_HIGH:
29 return High;
30 case Teuchos::VERB_EXTREME:
31 return Extreme;
32 default:
33 TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "Unknown enum value found.");
34 }
35}
36
37std::string
38lowerCase(const std::string& s) {
39 typedef std::string::value_type char_t;
40 typedef std::ctype<char_t> facet_type;
41 const facet_type& facet = std::use_facet<facet_type>(std::locale());
42
43 const std::string::size_type len = s.size();
44 std::string s_lc(s);
45 for (std::string::size_type k = 0; k < len; ++k) {
46 s_lc[k] = facet.tolower(s[k]);
47 }
48
49 return s_lc;
50}
51
52MsgType toVerbLevel(const std::string& verbLevelStr) {
53 std::map<std::string, MsgType> verbMap;
54 // for developers
55 verbMap["errors"] = Errors;
56 verbMap["warnings0"] = Warnings0;
57 verbMap["warnings00"] = Warnings00;
58 verbMap["warnings1"] = Warnings1;
59 verbMap["perfWarnings"] = PerfWarnings;
60 verbMap["runtime0"] = Runtime0;
61 verbMap["runtime1"] = Runtime1;
62 verbMap["runtimeTimings"] = RuntimeTimings;
63 verbMap["noTimeReport"] = NoTimeReport;
64 verbMap["parameters0"] = Parameters0;
65 verbMap["parameters1"] = Parameters1;
66 verbMap["statistics0"] = Statistics0;
67 verbMap["statistics1"] = Statistics1;
68 verbMap["timings0"] = Timings0;
69 verbMap["timings1"] = Timings1;
70 verbMap["timingsByLevel"] = TimingsByLevel;
71 verbMap["external"] = External;
72 verbMap["developer"] = Developer;
73 verbMap["debug"] = Debug;
74 verbMap["test"] = Test;
75
76 verbMap["warnings"] = Warnings;
77 verbMap["runtime"] = Runtime;
78 verbMap["parameters"] = Parameters;
79 verbMap["statistics"] = Statistics;
80 verbMap["timings"] = Timings;
81 verbMap["test"] = Test;
82 verbMap["interfacetest"] = InterfaceTest;
83 // for users and developers
84 verbMap["none"] = None;
85 verbMap["low"] = Low;
86 verbMap["medium"] = Medium;
87 verbMap["high"] = High;
88 verbMap["extreme"] = Extreme;
89
90 std::string lcVerb = lowerCase(verbLevelStr);
91 if (verbMap.find(lcVerb) != verbMap.end())
92 return verbMap[lcVerb];
93 else {
94 TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "MueLu::ParameterListInterpreter():: invalid verbosity level: " << verbLevelStr);
95 TEUCHOS_UNREACHABLE_RETURN(Errors);
96 }
97}
98
99} // namespace MueLu
Exception throws to report errors in the internal logical of the program.
Namespace for MueLu classes and methods.
@ Warnings00
Important warning messages (more verbose)
@ Timings1
Detailed timing information (use Teuchos::TimeMonitor::summarize() to print)
@ Warnings0
Important warning messages (one line)
@ RuntimeTimings
Timers that are enabled (using Timings0/Timings1) will be printed during the execution.
@ Developer
Print information primarily of interest to developers.
@ Warnings
Print all warning messages.
@ Debug
Print additional debugging information.
@ Statistics1
Print more statistics.
@ External
Print external lib objects.
@ Runtime
Print description of what is going on.
@ NoTimeReport
By default, enabled timers appears in the teuchos time monitor summary. Use this option if you do not...
@ Timings0
High level timing information (use Teuchos::TimeMonitor::summarize() to print)
@ PerfWarnings
Performance warnings.
@ Runtime0
One-liner description of what is happening.
@ Runtime1
Description of what is happening (more verbose)
@ Parameters
Print parameters.
@ Statistics
Print all statistics.
@ TimingsByLevel
Record timing information level by level. Must be used in combinaison with Timings0/Timings1.
@ Warnings1
Additional warnings.
@ Timings
Print all timing information.
@ Parameters0
Print class parameters.
@ Statistics0
Print statistics that do not involve significant additional computation.
@ Parameters1
Print class parameters (more parameters, more verbose)
std::string lowerCase(const std::string &s)
MsgType toVerbLevel(const std::string &verbLevelStr)
VerbLevel toMueLuVerbLevel(const Teuchos::EVerbosityLevel verbLevel)
Translate Teuchos verbosity level to MueLu verbosity level.