HermesCommon  3.0
api.h
Go to the documentation of this file.
1 // This file is part of Hermes2D
2 //
3 // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR).
4 // Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/.
5 //
6 // Hermes2D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published
8 // by the Free Software Foundation; either version 2 of the License,
9 // or (at your option) any later version.
10 //
11 // Hermes2D 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 Hermes2D; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef __HERMES_API_H_
23 #define __HERMES_API_H_
24 
25 #include "util/compat.h"
26 #include "common.h"
27 #if defined __GNUC__ && defined HAVE_BFD
28 #include "signal.h"
29 #endif
30 namespace Hermes
31 {
34  {
35  numThreads,
36  matrixSolverType,
37  directMatrixSolverType,
38  showInternalWarnings,
39  checkMeshesOnLoad,
40  useAccelerators
41  };
42 
44  class HERMES_API Api
45  {
46  public:
47  Api();
48  ~Api();
49 
54  typedef void(*SetterHandler)();
55 
56  protected:
59  class HERMES_API Parameter
60  {
61  public:
64  Parameter(int default_val);
65  bool user_set;
66  int user_val;
67  int default_val;
68  };
69 
73  std::map<HermesCommonApiParam, Parameter*> parameters;
74 
79  std::map<HermesCommonApiParam, SetterHandler> setter_handlers;
80 
84  std::map<std::pair<HermesCommonApiParam, int>, SetterHandler> value_setter_handlers;
85 
90  std::map<std::pair<HermesCommonApiParam, int>, SetterHandler> change_handlers;
91 
92  public:
93  int get_integral_param_value(HermesCommonApiParam);
94  void set_integral_param_value(HermesCommonApiParam, int value);
95 
96 #if defined __GNUC__ && defined HAVE_BFD
97  struct sigaction act;
98 #endif
99  };
100 
102  HERMES_COMMON_API extern Hermes::Api HermesCommonApi;
103 }
104 #endif
API Class containing settings for the whole HermesCommon.
Definition: api.h:44
General namespace for the Hermes library.
std::map< std::pair< HermesCommonApiParam, int >, SetterHandler > value_setter_handlers
Definition: api.h:84
std::map< HermesCommonApiParam, Parameter * > parameters
Definition: api.h:73
std::map< HermesCommonApiParam, SetterHandler > setter_handlers
Definition: api.h:79
HERMES_COMMON_API Hermes::Api HermesCommonApi
Global instance used inside Hermes which is also accessible to users.
Definition: api.cpp:158
std::map< std::pair< HermesCommonApiParam, int >, SetterHandler > change_handlers
Definition: api.h:90
File containing platform compatibility layer, especially for Win / MSVC.
HermesCommonApiParam
Enumeration of potential keys in the Api::parameters storage.
Definition: api.h:33
File containing common definitions, and basic global enums etc. for HermesCommon. ...