Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ag-ohlberger
dune-community
dune-xt
Commits
7e39c024
Commit
7e39c024
authored
8 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
add python bindings as target `functions`
parent
2de40db2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+2
-0
2 additions, 0 deletions
CMakeLists.txt
dune/xt/CMakeLists.txt
+5
-0
5 additions, 0 deletions
dune/xt/CMakeLists.txt
dune/xt/functions/bindings.cc
+210
-0
210 additions, 0 deletions
dune/xt/functions/bindings.cc
with
217 additions
and
0 deletions
CMakeLists.txt
+
2
−
0
View file @
7e39c024
...
...
@@ -27,6 +27,8 @@ list(APPEND CMAKE_MODULE_PATH
"
${
dune-xt-common_MODULE_PATH
}
"
)
include
(
DuneUtils
)
include
(
DunePybindxiUtils
)
# start a dune project with information from dune.module
dune_project
()
dune_enable_all_packages
(
MODULE_LIBRARIES dunextfunctions
...
...
This diff is collapsed.
Click to expand it.
dune/xt/CMakeLists.txt
+
5
−
0
View file @
7e39c024
...
...
@@ -9,4 +9,9 @@ add_subdirectory(functions)
add_subdirectory
(
functions/test EXCLUDE_FROM_ALL
)
if
(
dune-pybindxi_FOUND
)
dune_pybindxi_add_module
(
functions functions/bindings.cc
)
target_link_dune_default_libraries
(
functions
)
endif
()
include_directories
(
SYSTEM
${
DUNE_XT_COMMON_TEST_DIR
}
/gtest
)
This diff is collapsed.
Click to expand it.
dune/xt/functions/bindings.cc
0 → 100644
+
210
−
0
View file @
7e39c024
#include
"config.h"
#if HAVE_DUNE_PYBINDXI
#include
<string>
#include
<vector>
#include
<dune/pybindxi/pybind11.h>
//#include <dune/pybindxi/stl_bind.h> // <- see dune/xt/common/bindings.cc
// PYBIND11_MAKE_OPAQUE(std::vector<ssize_t>);
// PYBIND11_MAKE_OPAQUE(std::vector<std::string>);
// PYBIND11_MAKE_OPAQUE(std::vector<double>);
// PYBIND11_MAKE_OPAQUE(std::vector<std::vector<ssize_t>>);
// PYBIND11_MAKE_OPAQUE(std::vector<std::vector<std::string>>);
// PYBIND11_MAKE_OPAQUE(std::vector<std::vector<double>>);
#include
<dune/xt/grid/grids.hh>
#include
"interfaces.pbh"
#include
"constant.pbh"
#include
"checkerboard.pbh"
#include
"expression.pbh"
#include
"spe10.pbh"
namespace
py
=
pybind11
;
using
namespace
pybind11
::
literals
;
PYBIND11_PLUGIN
(
functions
)
{
py
::
module
m
(
"functions"
,
"dune-xt-functions"
);
py
::
module
::
import
(
"common"
);
py
::
module
::
import
(
"grid"
);
typedef
Dune
::
YaspGrid
<
2
,
Dune
::
EquidistantOffsetCoordinates
<
double
,
2
>>
YaspGrid2dType
;
const
std
::
string
yasp_grid_2d_id
=
"2d_cube_yaspgrid"
;
auto
i_1_1
=
Dune
::
XT
::
Functions
::
bind_LocalizableFunctionInterface
<
YaspGrid2dType
,
1
,
1
>
(
m
,
yasp_grid_2d_id
);
auto
i_1_2
=
Dune
::
XT
::
Functions
::
bind_LocalizableFunctionInterface
<
YaspGrid2dType
,
1
,
2
>
(
m
,
yasp_grid_2d_id
);
auto
i_1_3
=
Dune
::
XT
::
Functions
::
bind_LocalizableFunctionInterface
<
YaspGrid2dType
,
1
,
3
>
(
m
,
yasp_grid_2d_id
);
auto
i_1_4
=
Dune
::
XT
::
Functions
::
bind_LocalizableFunctionInterface
<
YaspGrid2dType
,
1
,
4
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
difference
,
1
,
1
,
1
,
1
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
difference
,
1
,
1
,
1
,
1
>
(
i_1_1
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
difference
,
1
,
2
,
1
,
2
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
difference
,
1
,
2
,
1
,
2
>
(
i_1_2
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
difference
,
1
,
3
,
1
,
3
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
difference
,
1
,
3
,
1
,
3
>
(
i_1_3
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
difference
,
1
,
4
,
1
,
4
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
difference
,
1
,
4
,
1
,
4
>
(
i_1_4
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
sum
,
1
,
1
,
1
,
1
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
sum
,
1
,
1
,
1
,
1
>
(
i_1_1
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
sum
,
1
,
2
,
1
,
2
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
sum
,
1
,
2
,
1
,
2
>
(
i_1_2
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
sum
,
1
,
3
,
1
,
3
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
sum
,
1
,
3
,
1
,
3
>
(
i_1_3
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
sum
,
1
,
4
,
1
,
4
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
sum
,
1
,
4
,
1
,
4
>
(
i_1_4
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
product
,
1
,
1
,
1
,
1
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
product
,
1
,
1
,
1
,
1
>
(
i_1_1
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
product
,
1
,
1
,
1
,
2
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
product
,
1
,
1
,
1
,
2
>
(
i_1_1
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
product
,
1
,
1
,
1
,
3
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
product
,
1
,
1
,
1
,
3
>
(
i_1_1
);
Dune
::
XT
::
Functions
::
bind_combined_LocalizableFunction
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
product
,
1
,
1
,
1
,
4
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
addbind_LocalizableFunctionInterface_combined_op
<
YaspGrid2dType
,
Dune
::
XT
::
Functions
::
internal
::
Combination
::
product
,
1
,
1
,
1
,
4
>
(
i_1_1
);
Dune
::
XT
::
Functions
::
bind_ConstantFunction
<
YaspGrid2dType
,
1
,
1
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_ConstantFunction
<
YaspGrid2dType
,
1
,
2
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_ConstantFunction
<
YaspGrid2dType
,
1
,
3
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_ConstantFunction
<
YaspGrid2dType
,
1
,
4
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_CheckerboardFunction
<
YaspGrid2dType
,
1
,
1
>
(
m
,
yasp_grid_2d_id
);
// Dune::XT::Functions::bind_CheckerboardFunction<YaspGrid2dType, 1, 2>(m, yasp_grid_2d_id);
// Dune::XT::Functions::bind_CheckerboardFunction<YaspGrid2dType, 1, 3>(m, yasp_grid_2d_id);
// Dune::XT::Functions::bind_CheckerboardFunction<YaspGrid2dType, 1, 4>(m, yasp_grid_2d_id);
Dune
::
XT
::
Functions
::
bind_ExpressionFunction
<
YaspGrid2dType
,
1
,
1
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_ExpressionFunction
<
YaspGrid2dType
,
1
,
2
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_ExpressionFunction
<
YaspGrid2dType
,
1
,
3
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_ExpressionFunction
<
YaspGrid2dType
,
1
,
4
>
(
m
,
yasp_grid_2d_id
);
Dune
::
XT
::
Functions
::
bind_Spe10Model1Function
<
YaspGrid2dType
,
1
,
1
>
(
m
,
yasp_grid_2d_id
);
return
m
.
ptr
();
}
#endif // HAVE_DUNE_PYBINDXI
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment