PaGMO  1.1.5
gsl_init.cpp
1 /*****************************************************************************
2  * Copyright (C) 2004-2015 The PaGMO development team, *
3  * Advanced Concepts Team (ACT), European Space Agency (ESA) *
4  * *
5  * https://github.com/esa/pagmo *
6  * *
7  * act@esa.int *
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program; if not, write to the *
21  * Free Software Foundation, Inc., *
22  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
23  *****************************************************************************/
24 
25 #include <gsl/gsl_errno.h>
26 #include <iostream>
27 
28 #include "gsl_init.h"
29 
30 namespace pagmo
31 {
32 
33 gsl_init::gsl_init():m_init(false)
34 {
35  gsl_set_error_handler(&custom_gsl_error_handler);
36  m_init = true;
37 }
38 
39 void custom_gsl_error_handler(const char *reason, const char *file, int line, int gsl_errno)
40 {
41  std::cout << "WARNING: GSL reported an error, details follow.\n\n";
42  std::cout << "Reason: " << reason << '\n';
43  std::cout << "File: " << file << '\n';
44  std::cout << "Line: " << line << '\n';
45  std::cout << "GSL error code: " << gsl_errno << '\n';
46 }
47 
48 }
Root PaGMO namespace.