MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
10 #include "MueLu_VerbosityLevel.hpp"
11 #include "MueLu_Exceptions.hpp"
12 #include "MueLu_Utilities.hpp"
13 #include <string>
14 #include <locale>
15 
16 namespace MueLu {
17 
19  switch (verbLevel) {
20  case Teuchos::VERB_NONE:
21  return None;
23  return Default;
24  case Teuchos::VERB_LOW:
25  return Low;
27  return Medium;
28  case Teuchos::VERB_HIGH:
29  return High;
31  return Extreme;
32  default:
33  TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "Unknown enum value found.");
34  }
35 }
36 
37 std::string
38 lowerCase(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 
52 MsgType 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);
96  }
97 }
98 
99 } // namespace MueLu
Important warning messages (one line)
High level timing information (use Teuchos::TimeMonitor::summarize() to print)
Print external lib objects.
Print parameters.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Print more statistics.
Print information primarily of interest to developers.
VerbLevel toMueLuVerbLevel(const Teuchos::EVerbosityLevel verbLevel)
Translate Teuchos verbosity level to MueLu verbosity level.
Print additional debugging information.
One-liner description of what is happening.
MsgType toVerbLevel(const std::string &verbLevelStr)
Print all statistics.
Additional warnings.
Important warning messages (more verbose)
Print statistics that do not involve significant additional computation.
Detailed timing information (use Teuchos::TimeMonitor::summarize() to print)
By default, enabled timers appears in the teuchos time monitor summary. Use this option if you do not...
Print all timing information.
Print class parameters.
Timers that are enabled (using Timings0/Timings1) will be printed during the execution.
std::string lowerCase(const std::string &s)
Performance warnings.
Record timing information level by level. Must be used in combinaison with Timings0/Timings1.
Print description of what is going on.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Print class parameters (more parameters, more verbose)
Exception throws to report errors in the internal logical of the program.
Print all warning messages.
Description of what is happening (more verbose)