version 3.8
dumuxmessage.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_MESSAGE_HH
13#define DUMUX_MESSAGE_HH
14
15#include <iomanip>
16#include <iostream>
17#include <ctime>
18
19#include <dumux/io/format.hh>
20
21namespace Dumux {
22
28{
30 static const int nMessages_ = 12;
31
32public:
33
38 static void print(bool firstCall = false)
39 {
40 // initialize in case someone forgets to set first call
41 static int dice = 8;
42
43 if(firstCall)
44 {
45 // roll the dice to decide which start message will be displayed
46 std::srand(std::time(0));
47 dice = std::rand() % (nMessages_ + 1);
48 }
49
50 std::cout << std::endl;
51
52 switch (dice)
53 {
54 case 0:
55 if(firstCall)
56 std::cout << "Welcome aboard DuMuX airlines. Please fasten your seatbelts! "
57 << "Emergency exits are near the time integration." << std::endl;
58 else
59 std::cout << "We hope that you enjoyed simulating with us " << std::endl
60 << "and that you will choose us next time, too." << std::endl;
61 break;
62 case 1:
63 if(firstCall)
64 std::cout << "Let's get the cow off the ice." << std::endl;
65 else
66 std::cout << "DuMuX got the cow off the ice." << std::endl;
67 break;
68 case 2:
69 if(firstCall)
70 std::cout << "Science, my lad, is made up of mistakes, but they are "
71 << "mistakes which it is useful to make, because they lead little "
72 << "by little to the truth." << std::endl
73 << " - Jules Verne, A journey to the center of the earth" << std::endl;
74 else
75 std::cout << "[We see that] science is eminently perfectible, and that each theory has "
76 << "constantly to give way to a fresh one." << std::endl
77 << " - Jules Verne, Journey to the Center of the Earth" << std::endl;
78
79 break;
80 case 3:
81 if(firstCall)
82 std::cout << "Wherever he saw a hole he always wanted to know the depth of it. "
83 << "To him this was important." << std::endl
84 << " - Jules Verne, A journey to the center of the earth" << std::endl;
85 else
86 std::cout << "We may brave human laws, but we cannot resist natural ones." << std::endl
87 << " - Jules Verne, 20,000 Leagues Under the Sea" << std::endl;
88 break;
89 case 4:
90 if(firstCall)
91 std::cout << "Silence - to delight Bernd." << std::endl;
92 else
93 std::cout << std::endl << std::endl;
94 break;
95 case 5:
96 std::cout << "Don't panic... !" << std::endl;
97 break;
98 case 6:
99 if(firstCall)
100 std::cout << "You idiot! You signed the order to destroy Earth!" << std::endl
101 << " - Douglas Adams, HGttG" << std::endl;
102 else
103 std::cout << "Marvin: I've been talking to the main computer." << std::endl
104 << "Arthur: And?" << std::endl
105 << "Marvin: It hates me." << std::endl
106 << " - Douglas Adams, HGttG" << std::endl;
107 break;
108 case 7:
109 if(firstCall)
110 std::cout << "In the beginning the Universe was created. This has made a lot of "
111 << "people very angry and has been widely regarded as a bad move.!" << std::endl
112 << " - Douglas Adams, HGttG " << std::endl;
113 else
114 std::cout << "Forty-two. I checked it very thoroughly, and that quite definitely is the answer. I think "
115 << "the problem, to be quite honest with you, is that you\'ve never actually known what the question is." << std::endl
116 << " - Douglas Adams, HGttG " << std::endl;
117 break;
118 case 8:
119 std::cout << " ## @@@@ @ @ @ @" << std::endl;
120 std::cout << " ### # @ @ @@ @@ @ " << std::endl;
121 std::cout << " ## # @ @ @ @ @ @ @ @ @ @ @" << std::endl;
122 std::cout << " ## # @ @ @ @ @ @ @ @ " << std::endl;
123 std::cout << " # # @@@@ @@@ @ @ @@@ " << std::endl;
124 std::cout << " # # " << std::endl;
125 std::cout << " # # " << std::endl;
126 std::cout << " # ## %%% " << std::setw(8) << std::right << DUMUX_VERSION << std::endl;
127 std::cout << " # ### % % %% %% " << std::endl;
128 std::cout << "#### #%%% %% %%%%% %%%%%%%%%%%%%%%%%" << std::endl;
129 break;
130 case 9:
131 std::cout << "### # # # # " << std::endl;
132 std::cout << "# # # # ## ## # # # " << std::endl;
133 std::cout << "# # # # # # # # # # # " << std::endl;
134 std::cout << "### ## # # ## " << std::endl;
135 std::cout << " " << std::endl;
136 std::cout << "Dune for Multi-{ Phase, " << std::endl;
137 std::cout << " Component, " << std::endl;
138 std::cout << " Scale, " << std::endl;
139 std::cout << " Physics, " << std::endl;
140 std::cout << " ...} flow and transport in porous media" << std::endl;
141 break;
142 case 10:
143 if(firstCall)
144 std::cout << "Elliot Carver: Mr. Jones, are we ready to release our new software?" << std::endl
145 << "Jones: Yes, sir. As requested, it's full of bugs, which means people will be forced to upgrade for years." << std::endl
146 << " - James Bond, Tomorrow Never Dies" << std::endl;
147 else
148 {
149 std::cout << "Elliot Carver: Outstanding." << std::endl
150 << " - James Bond, Tomorrow Never Dies" << std::endl;
151 }
152 break;
153 case 11:
154 if(firstCall)
155 std::cout << "Chuck Norris has successfully compiled DuMuX." << std::endl;
156 else
157 std::cout << "Chuck Norris has compiled DuMuX even two times in a row!" << std::endl;
158 break;
159 case 12:
160 if (firstCall)
161 {
162 std::cout << " ┌──────────────────┐" << std::endl;
163 std::cout << Fmt::format(" │{:^20}│", Fmt::format("DuMuX {} \u2661", DUMUX_VERSION)) << std::endl;
164 std::cout << " └──────────────────┘" << std::endl;
165 }
166 else
167 std::cout << "\n" << std::endl;
168 break;
169
170 // Note: If you add a case, you have to increase the number of messages (nMessages_ variable).
171
172 default: // silence to delight Bernd
173 return;
174 }
175 std::cout << std::endl;
176 }
177};
178
179} // end namespace Dumux
180
181#endif
DuMux start and end message.
Definition: dumuxmessage.hh:28
static void print(bool firstCall=false)
Selects random messages to write out at the start and end of a simulation run.
Definition: dumuxmessage.hh:38
Formatting based on the fmt-library which implements std::format of C++20.
Definition: adapt.hh:17