diff --git a/dune/fufem/test/dunepythontest.cc b/dune/fufem/test/dunepythontest.cc index 7126c1ded329d11e9e26b3f4dbbe20933b98542e..9abd90ca857c2c2197b3a73f0e2cf7148d8c1a93 100644 --- a/dune/fufem/test/dunepythontest.cc +++ b/dune/fufem/test/dunepythontest.cc @@ -12,6 +12,8 @@ #include <dune/common/fvector.hh> #include <dune/common/function.hh> #include <dune/common/parametertree.hh> +#include <dune/common/tuplevector.hh> +#include <dune/common/indices.hh> #if HAVE_UG #include <dune/grid/uggrid.hh> @@ -25,6 +27,7 @@ #include <dune/fufem/dunepython.hh> +using namespace Dune::Indices; int main(int argc, char** argv) { @@ -401,6 +404,7 @@ int main(int argc, char** argv) auto int_list = module.get("int_list"); auto str_list = module.get("str_list"); auto int_tuple = module.get("int_tuple"); + auto mixed_tuple = module.get("mixed_tuple"); // Modify first argument of int_list. // Similar to calling a Callable you can either hand @@ -431,6 +435,15 @@ int main(int argc, char** argv) std::cout << "python integer tuple converted to vector<int>:" << std::endl; for(size_t i=0; i<int_vec2.size(); ++i) std::cout << int_vec2[i] << std::endl; + + // Convert python mixed tuple to Dune::TupleVector and print results: + Dune::TupleVector<std::vector<int>,std::string> mixed_tuple_c; + mixed_tuple.toC(mixed_tuple_c); + std::cout << "python mixed tuple (string representation):" << mixed_tuple.str() << std::endl; + std::cout << "python mixed tuple converted to Dune::TupleVector:" << std::endl; + for(size_t i=0; i<mixed_tuple_c[_0].size(); ++i) + std::cout << mixed_tuple_c[_0][i] << std::endl; + std::cout << mixed_tuple_c[_1] << std::endl; } diff --git a/dune/fufem/test/dunepythontest.py b/dune/fufem/test/dunepythontest.py index c82d9397b04326b03732daeca5d13c8c52adfebb..b9a322415b57fdd1c4578d75a3d3401eda92ff33 100644 --- a/dune/fufem/test/dunepythontest.py +++ b/dune/fufem/test/dunepythontest.py @@ -10,6 +10,7 @@ def add(x,y): int_list=[11,12,13] str_list=["string1","string2","string3"] int_tuple=(1,2,3) +mixed_tuple=((1,2),"three")