version.c 2.39 KB
Newer Older
1
2
/*******************************************************************************
 * This file is part of SWIFT.
3
4
 * Copyright (C) 2012 Matthieu Schaller (matthieu.schaller@durham.ac.uk).
 * Copyright (C) 2015 Peter W. Draper (p.w.draper@durham.ac.uk).
5
 *
6
7
8
9
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
10
 *
11
12
13
14
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
15
 *
16
17
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 *
19
20
 ******************************************************************************/

21
/* Some standard headers. */
22
#include <stdio.h>
23
24

/* This object's header. */
25
#include "error.h"
26
#include "version.h"
27

28

29
30
31
/**
 * @brief Return the source code git revision
 *
32
 * @details The SHA of the code checked out when the library was last built.
33
34
 * Will include -dirty if they are local modifications.
 */
35
36
37
const char *git_revision(void) {
  static const char *revision = GIT_REVISION;
  return revision;
38
}
39

40
41
42
/**
 * @brief The version of SWIFT
 */
43
44
45
const char *package_version(void) {
  static const char *version = PACKAGE_VERSION;
  return version;
46
47
48
49
50
}

/**
 * @brief A description of the package version and code status.
 */
51
52
53
54
55
56
57
58
59
const char *package_description(void) {
  static char buf[256];
  static int initialised = 0;
  if (!initialised) {
    sprintf(buf, "SWIFT version: %s, at revision: %s", PACKAGE_VERSION,
            GIT_REVISION);
    initialised = 1;
  }
  return buf;
60
}
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77


void greetings(void) {

  printf( " Welcome to the cosmological code\n" );
  printf( "    ______       __________________\n"   );
  printf( "   / ___/ |     / /  _/ ____/_  __/\n"   );
  printf( "   \\__ \\| | /| / // // /_    / /   \n" );
  printf( "  ___/ /| |/ |/ // // __/   / /    \n"   );
  printf( " /____/ |__/|__/___/_/     /_/     \n" );
  printf( " SPH With Inter-dependent Fine-grained Tasking\n\n");

  printf( " Version : %s\n", package_version() );
  printf( " Revision: %s\n", git_revision() );
  printf( " Webpage : www.swiftsim.com\n\n" );

}