-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathpysgpp.i
161 lines (130 loc) · 2.84 KB
/
pysgpp.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// Copyright (C) 2008-today The SG++ project
// This file is part of the SG++ project. For conditions of distribution and
// use, please see the copyright notice provided with SG++ or at
// sgpp.sparsegrids.org
%module(directors="1") pysgpp_swig
// %feature("autodoc", "2");
// %feature("docstring");
// fix needed for MinGW: cmath has to be included before Python.h,
// otherwise there are g++ errors like "Error: '::hypot' has not been declared"
%begin %{
#include <cmath>
%}
%include "base/src/sgpp/globaldef.hpp"
%include "stl.i"
%include "std_vector.i"
%include "std_list.i"
%include "std_pair.i"
%include "std_complex.i"
%include "std_map.i"
%include "carrays.i"
%include "cpointer.i"
%include "typemaps.i"
%include "stdint.i"
%include "exception.i"
%include "carrays.i"
%array_class(unsigned int, unsignedIntArray);
%array_class(bool,BoolArray);
%array_class(int, IntArray);
%exception {
try {
$action
} catch (const std::exception& e) {
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
%{
#include <omp.h>
%}
// -----------------------------------------------------------
// needed for MSVC++ wrapper since swig does not understand
// that unsigned int is equal to size_t and generates
// template specifications twice
#ifdef SWIGWIN
typedef unsigned int size_t;
#endif
// -----------------------------------------------------------
%{
#define SWIG_FILE_WITH_INIT
%}
%include "numpy.i"
%init %{
import_array();
%}
%{
#include "sgpp/globaldef.hpp"
#include "sgpp_base.hpp"
#ifdef SG_DATADRIVEN
#include "sgpp_datadriven.hpp"
#endif
#ifdef SG_PDE
#include "sgpp_pde.hpp"
#endif
#ifdef SG_FINANCE
#include "sgpp_finance.hpp"
#endif
#ifdef SG_SOLVER
#include "sgpp_solver.hpp"
#endif
#ifdef SG_PARALLEL
#include "sgpp_parallel.hpp"
#endif
#ifdef SG_COMBIGRID
#include "combigrid.hpp"
#endif
#ifdef SG_QUADRATURE
#include "sgpp_quadrature.hpp"
#endif
#ifdef SG_OPTIMIZATION
#include "sgpp_optimization.hpp"
#endif
#ifdef SG_MISC
#include "sgpp_misc.hpp"
#endif
%}
#ifdef PYDOC
%include "base_doc.i"
#endif
%include "base/build/pysgpp/base.i"
#ifdef SG_DATADRIVEN
#ifdef PYDOC
%include "datadriven_doc.i"
#endif
%include "datadriven/build/pysgpp/datadriven.i"
#endif
#ifdef SG_PDE
#ifdef PYDOC
%include "pde_doc.i"
#endif
%include "pde/build/pysgpp/pde.i"
#endif
#ifdef SG_FINANCE
#ifdef PYDOC
%include "finance_doc.i"
#endif
%include "finance/build/pysgpp/finance.i"
#endif
#ifdef SG_SOLVER
#ifdef PYDOC
%include "solver_doc.i"
#endif
%include "solver/build/pysgpp/solver.i"
#endif
#ifdef SG_QUADRATURE
#ifdef PYDOC
%include "quadrature_doc.i"
#endif
%include "quadrature/build/pysgpp/quadrature.i"
#endif
#ifdef SG_COMBIGRID
#ifdef PYDOC
%include "combigrid_doc.i"
#endif
%include "combigrid/build/pysgpp/combigrid.i"
#endif
#ifdef SG_OPTIMIZATION
#ifdef PYDOC
%include "optimization_doc.i"
#endif
%include "optimization/build/pysgpp/optimization.i"
#endif