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