Hermes2D  3.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://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_2D_H_
23 #define __HERMES_API_2D_H_
24 
25 #include "util/compat.h"
26 #include "hermes_common.h"
27 #include "config.h"
28 
29 namespace Hermes
30 {
31  namespace Hermes2D
32  {
33  class Mesh;
34  template<typename Scalar> class Space;
35  template<typename Scalar> class Solution;
36 
39  {
40  xmlSchemasDirPath,
41  precalculatedFormsDirPath
42  };
43 
45  class HERMES_API Api2D
46  {
47  public:
48  Api2D();
49  ~Api2D();
50  protected:
53  template<typename T>
54  class HERMES_API Parameter
55  {
56  public:
59  Parameter(T default_val);
60  ~Parameter();
61  bool user_set;
62  T user_val;
63  T default_val;
64  };
65 
69 
70  std::map<Hermes2DApiParam, Parameter<int>*> integral_parameters;
71  std::map<Hermes2DApiParam, Parameter<std::string>*> text_parameters;
72  public:
73  int get_integral_param_value(Hermes2DApiParam);
74  std::string get_text_param_value(Hermes2DApiParam);
75 
76  void set_integral_param_value(Hermes2DApiParam, int value);
77  void set_text_param_value(Hermes2DApiParam, std::string value);
78  private:
79 
80  friend class Mesh;
81  friend class MeshReaderH2DXML;
82  template<typename T1> friend class Space;
83  template<typename T1> friend class Solution;
84  };
85 
87  extern HERMES_API Hermes::Hermes2D::Api2D Hermes2DApi;
88 #ifdef WITH_PJLIB
89  extern HERMES_API pj_caching_pool Hermes2DMemoryPoolCache;
90 #else
91 #define pj_pool_t void
92 #define pj_pool_alloc(T, size) malloc(size)
93 #endif
94  }
95 }
96 #endif
Definition: adapt.h:24
HERMES_API Hermes::Hermes2D::Api2D Hermes2DApi
Global instance used inside Hermes which is also accessible to users.
Definition: api2d.cpp:117
Represents a finite element mesh. Typical usage: MeshSharedPtr mesh; Hermes::Hermes2D::MeshReaderH2DX...
Definition: mesh.h:61
Hermes2DApiParam
Enumeration of potential keys in the Api2D::parameters storage.
Definition: api2d.h:38
API Class containing settings for the whole Hermes2D.
Definition: api2d.h:45
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Represents a finite element space over a domain.
Definition: api2d.h:34
Represents the solution of a PDE.
Definition: api2d.h:35
std::map< Hermes2DApiParam, Parameter< int > * > integral_parameters
Definition: api2d.h:70