Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
version.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
23#include "shamcomm/logs.hpp"
24#include <chrono>
25#include <iomanip>
26#include <sstream>
27#include <string>
28
29extern const std::string git_info_str;
30extern const std::string git_commit_hash;
31extern const std::string compile_arg;
32extern const std::string version_string;
33extern const bool is_git;
34
35// will be in compiler_id.cpp
36extern const char *shamrock_compiler_id_string;
37
38const u32 term_width = 64;
39
40// start allow utf-8
41inline std::string shamrock_title_bar_big = "\n\
42 █████████ █████ █████ █████████ ██████ ██████ ███████████ ███████ █████████ █████ ████\n\
43 ███░░░░░███░░███ ░░███ ███░░░░░███ ░░██████ ██████ ░░███░░░░░███ ███░░░░░███ ███░░░░░███░░███ ███░ \n\
44░███ ░░░ ░███ ░███ ░███ ░███ ░███░█████░███ ░███ ░███ ███ ░░███ ███ ░░░ ░███ ███ \n\
45░░█████████ ░███████████ ░███████████ ░███░░███ ░███ ░██████████ ░███ ░███░███ ░███████ \n\
46 ░░░░░░░░███ ░███░░░░░███ ░███░░░░░███ ░███ ░░░ ░███ ░███░░░░░███ ░███ ░███░███ ░███░░███ \n\
47 ███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░░███ ███ ░░███ ███ ░███ ░░███ \n\
48░░█████████ █████ █████ █████ █████ █████ █████ █████ █████ ░░░███████░ ░░█████████ █████ ░░████\n\
49 ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░ ░░░░░░░░░ ░░░░░ ░░░░ \n\
50";
51// end allow utf-8
52
53inline std::string get_date_hour_string() {
54 auto now = std::chrono::system_clock::now();
55 auto in_time_t = std::chrono::system_clock::to_time_t(now);
56 std::stringstream ss;
57 ss << std::put_time(std::localtime(&in_time_t), "%Y-%m-%d %H:%M:%S");
58 return ss.str();
59}
60
61inline void print_title_bar() {
62 logger::raw_ln(shamrock_title_bar_big);
63 logger::raw_ln(
64 shambase::term_colors::col8b_cyan()
65 + "Copyright (c) 2021-2026 Timothée David--Cléris (tim.shamrock@proton.me)"
66 + shambase::term_colors::reset());
67 logger::raw_ln(
68 shambase::term_colors::col8b_cyan() + "SPDX-License-Identifier"
69 + shambase::term_colors::reset() + " : CeCILL Free Software License Agreement v2.1");
70 logger::raw_ln(
71 shambase::term_colors::col8b_cyan() + "Start time" + shambase::term_colors::reset() + " : "
72 + get_date_hour_string());
73
74 logger::print_faint_row();
75
76 logger::raw_ln(
77 "\n" + shambase::term_colors::col8b_cyan() + "Shamrock version "
78 + shambase::term_colors::reset() + ": " + version_string + "\n");
79
80 if (is_git) {
81 logger::raw_ln(
82 shambase::term_colors::col8b_cyan() + "Git infos " + shambase::term_colors::reset()
83 + ":\n" + shambase::trunc_str(git_info_str, 512));
84 }
85}
std::uint32_t u32
32 bit unsigned integer
std::string trunc_str(std::string s, u32 max_len)
Truncate a string to a specified length, adding an ellipsis if necessary.
Definition string.hpp:215