Debian Codegraph @

packages/muelu/src/MueCentral/MueLu_Describable.cpp

raw
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 #ifndef MUELU_DESCRIBABLE_HPP
11 #define MUELU_DESCRIBABLE_HPP
12
13 #include "MueLu_Describable.hpp"
14
15 namespace MueLu {
16
17 Describable::~Describable() {}
18
19 void Describable::describe(Teuchos::FancyOStream &out_arg, const VerbLevel /* verbLevel */) const {
20 Teuchos::RCP<Teuchos::FancyOStream> out = rcp(&out_arg, false); // JG: no idea why we have to do that, but it's how Teuchos::Describable::describe() is implemented
21 Teuchos::OSTab tab(out);
22 *out << this->description() << std::endl;
23 }
24
25 std::string Describable::description() const {
26 std::string str = Teuchos::Describable::description();
27
28 // remove template parameters
29 size_t found = str.find_first_of("<");
30 if (found != std::string::npos)
31 return str.substr(0, found);
32
33 return str;
34 }
35
36 void Describable::describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const { describe(out, toMueLuVerbLevel(verbLevel)); }
37
38 std::string Describable::ShortClassName() const {
39 if (shortClassName_.empty()) {
40 std::string str = Teuchos::Describable::description();
41
42 // remove template parameters
43 {
44 size_t found = str.find_first_of("<");
45 if (found != std::string::npos)
46 str = str.substr(0, found);
47 }
48
49 // remove namespace
50 {
51 size_t found = str.find_last_of(":");
52 if (found != std::string::npos)
53 str = str.substr(found + 1);
54 }
55 shortClassName_ = str;
56 }
57 return shortClassName_;
58 }
59
60 } // namespace MueLu
61
62 #define MUELU_DESCRIBABLE_SHORT
63 #endif // MUELU_DESCRIBABLE_HPP