Hermes2D  2.0
api2d.h
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://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_2D_H_
23 #define __HERMES_API_2D_H_
24 // This is here because of an operator-related error in gcc
25 #pragma GCC diagnostic warning "-fpermissive"
26 
27 #include "compat.h"
28 #include "hermes_common.h"
29 #include "config.h"
30 
31 namespace Hermes
32 {
33  namespace Hermes2D
34  {
35  class Mesh;
36  template<typename Scalar> class Space;
37  template<typename Scalar> class Solution;
38 
41  {
42  numThreads,
43  xmlSchemasDirPath,
44  precalculatedFormsDirPath
45  };
46 
48  class HERMES_API Api2D
49  {
50  public:
51  Api2D();
52  ~Api2D();
53  protected:
56  template<typename T>
57  class HERMES_API Parameter
58  {
59  public:
62  Parameter(T default_val);
63  bool user_set;
64  T user_val;
65  T default_val;
66  };
67 
71 
72  std::map<Hermes2DApiParam, Parameter<int>*> integral_parameters;
73  std::map<Hermes2DApiParam, Parameter<std::string>*> text_parameters;
74  public:
75  int get_integral_param_value(Hermes2DApiParam);
76  std::string get_text_param_value(Hermes2DApiParam);
77 
78  void set_integral_param_value(Hermes2DApiParam, int value);
79  void set_text_param_value(Hermes2DApiParam, std::string value);
80  private:
81 
82  friend class Mesh;
83  friend class MeshReaderH2DXML;
84  template<typename T1> friend class Space;
85  template<typename T1> friend class Solution;
86  };
87 
89  extern HERMES_API Hermes::Hermes2D::Api2D Hermes2DApi;
90  }
91 }
92 #endif