From b90fd6f3741a6a885c7d374fa97d8d965fa18e5a Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Mon, 25 Jul 2016 18:15:43 -0400 Subject: [PATCH] Rename the python modules. --- contrib/python-bindings/source/__init__.py | 7 +++-- .../source/cell_accessor_wrapper.cc | 8 +++--- .../python-bindings/source/point_wrapper.cc | 2 ++ contrib/python-bindings/source/wrappers.cc | 26 +++++++++++++++++-- .../tests/cell_accessor_wrapper.py | 2 +- .../python-bindings/tests/point_wrapper.py | 2 +- .../tests/triangulation_wrapper.py | 2 +- 7 files changed, 36 insertions(+), 13 deletions(-) diff --git a/contrib/python-bindings/source/__init__.py b/contrib/python-bindings/source/__init__.py index dd99d5fdbd..5e7a0469da 100644 --- a/contrib/python-bindings/source/__init__.py +++ b/contrib/python-bindings/source/__init__.py @@ -13,7 +13,6 @@ # # --------------------------------------------------------------------- -from .PyDealII import * - -__all__ = ['PyDealII'] -__doc__ = PyDealII.__doc__ +__doc__ = 'PyDealII is just an empty shell. You need to either\n\ + import PyDealII.Debug or PyDealII.Release. Do not\n\ + import both of them.' diff --git a/contrib/python-bindings/source/cell_accessor_wrapper.cc b/contrib/python-bindings/source/cell_accessor_wrapper.cc index 3aa3495b1b..ce00a3b379 100644 --- a/contrib/python-bindings/source/cell_accessor_wrapper.cc +++ b/contrib/python-bindings/source/cell_accessor_wrapper.cc @@ -240,7 +240,7 @@ namespace python { const CellAccessor *cell = static_cast*>(cell_accessor); - cell->manifold_id(); + return cell->manifold_id(); } } @@ -468,11 +468,11 @@ namespace python int CellAccessorWrapper::get_manifold_id() const { if ((dim == 2) && (spacedim == 2)) - internal::get_manifold_id<2,2>(cell_accessor); + return internal::get_manifold_id<2,2>(cell_accessor); else if ((dim== 2) && (spacedim == 3)) - internal::get_manifold_id<2,3>(cell_accessor); + return internal::get_manifold_id<2,3>(cell_accessor); else - internal::get_manifold_id<3,3>(cell_accessor); + return internal::get_manifold_id<3,3>(cell_accessor); } } diff --git a/contrib/python-bindings/source/point_wrapper.cc b/contrib/python-bindings/source/point_wrapper.cc index 7d8e928498..3fb1863090 100644 --- a/contrib/python-bindings/source/point_wrapper.cc +++ b/contrib/python-bindings/source/point_wrapper.cc @@ -119,6 +119,8 @@ namespace python else AssertThrow(false, ExcMessage("The z coordinate is only available for three-dimensional points")); + // Silence a warning + return 0.; } diff --git a/contrib/python-bindings/source/wrappers.cc b/contrib/python-bindings/source/wrappers.cc index e64fb1b7a9..6d644bad54 100644 --- a/contrib/python-bindings/source/wrappers.cc +++ b/contrib/python-bindings/source/wrappers.cc @@ -34,10 +34,14 @@ char const *pydealii_docstring = " \n" "PyDealII \n" "======== \n" - "Some interesting doc. \n" + "This module contains the python bindings to deal.II. \n" + "The Debug module uses deal.II compiled in Debug mode while \n" + "the Release module uses deal.II compiled in Release mode. \n" ; -BOOST_PYTHON_MODULE(PyDealII) +#ifdef DEBUG + +BOOST_PYTHON_MODULE(Debug) { boost::python::scope().attr("__doc__") = pydealii_docstring; @@ -51,4 +55,22 @@ BOOST_PYTHON_MODULE(PyDealII) dealii::python::export_triangulation(); } +#else + +BOOST_PYTHON_MODULE(Release) +{ + boost::python::scope().attr("__doc__") = pydealii_docstring; + + boost::python::docstring_options doc_options; + doc_options.enable_user_defined(); + doc_options.enable_py_signatures(); + doc_options.disable_cpp_signatures(); + + dealii::python::export_cell_accessor(); + dealii::python::export_point(); + dealii::python::export_triangulation(); +} + +#endif + #endif diff --git a/contrib/python-bindings/tests/cell_accessor_wrapper.py b/contrib/python-bindings/tests/cell_accessor_wrapper.py index 8f8308b885..af18f14020 100644 --- a/contrib/python-bindings/tests/cell_accessor_wrapper.py +++ b/contrib/python-bindings/tests/cell_accessor_wrapper.py @@ -14,7 +14,7 @@ # --------------------------------------------------------------------- import unittest -from pydealii.PyDealII import * +from PyDealII.Debug import * class TestCellAccessorWrapper(unittest.TestCase): diff --git a/contrib/python-bindings/tests/point_wrapper.py b/contrib/python-bindings/tests/point_wrapper.py index c68482ca2c..4fcbc309e3 100644 --- a/contrib/python-bindings/tests/point_wrapper.py +++ b/contrib/python-bindings/tests/point_wrapper.py @@ -14,7 +14,7 @@ # --------------------------------------------------------------------- import unittest -from pydealii.PyDealII import * +from PyDealII.Debug import * class TestPointWrapper(unittest.TestCase): diff --git a/contrib/python-bindings/tests/triangulation_wrapper.py b/contrib/python-bindings/tests/triangulation_wrapper.py index 52ac71f7d7..fff385bf69 100644 --- a/contrib/python-bindings/tests/triangulation_wrapper.py +++ b/contrib/python-bindings/tests/triangulation_wrapper.py @@ -14,7 +14,7 @@ # --------------------------------------------------------------------- import unittest -from pydealii.PyDealII import * +from PyDealII.Debug import * class TestTriangulationWrapper(unittest.TestCase): -- 2.39.5