← Back to team overview

fenics team mailing list archive

dolfinPython wrapper error in dorsal

 

Hi,
   I try to build FEniCS using dorsal on Mac 10.7. but at first python
wrapper fails to build.  The swig interface in dolfinPYTHON_wrap.cxx are
not correct generated and cannot be compiled.  After the following patch is
applied, it can be compiled but the demo programs don't run due to some
SWIG-boost error.

mac0347712n$ python demo_cahn-hilliard.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
Traceback (most recent call last):
  File "demo_cahn-hilliard.py", line 64, in <module>
    V = FunctionSpace(mesh, "Lagrange", 1)
  File
"/Users/sgu/softwares/mpi/FEniCS/lib/python2.7/site-packages/dolfin/functions/functionspace.py",
line 353, in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File
"/Users/sgu/softwares/mpi/FEniCS/lib/python2.7/site-packages/dolfin/functions/functionspace.py",
line 80, in __init__
    self._dolfin_element = cpp.FiniteElement(ufc_element)
  File
"/Users/sgu/softwares/mpi/FEniCS/lib/python2.7/site-packages/dolfin/cpp.py",
line 17790, in __init__
    _cpp.FiniteElement_swiginit(self,_cpp.new_FiniteElement(*args))
TypeError: in method 'new_FiniteElement', argument 1 of type
'boost::shared_ptr< ufc::finite_element const >'



 the dolfin-config.cmake, lion.platform, dolfin.package are attached.
---------------------------
--- dolfinPYTHON_wrap.cxx 2012-11-18 00:27:37.000000000 -0600
+++ dolfinPYTHON_wrap_new.cxx 2012-11-18 13:28:49.000000000 -0600
@@ -4901,7 +4901,7 @@
 dolfin::uint SwigDirector_uBLASKrylovMatrix::size(dolfin::uint dim) const {
   dolfin::uint c_result;
   swig::SwigVar_PyObject obj0;
-  obj0 = SWIG_From_unsigned_SS_int(static_cast< unsigned int >());
+  obj0 = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(dim));
   if (!swig_get_self()) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot
to call uBLASKrylovMatrix.__init__.");
   }
@@ -4932,9 +4932,9 @@

 void SwigDirector_uBLASKrylovMatrix::mult(dolfin::uBLASVector const &x,
dolfin::uBLASVector &y) const {
   swig::SwigVar_PyObject obj0;
-  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&),
SWIGTYPE_p_dolfin__uBLASVector,  0 );
+  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&x),
SWIGTYPE_p_dolfin__uBLASVector,  0 );
   swig::SwigVar_PyObject obj1;
-  obj1 = SWIG_NewPointerObj(SWIG_as_voidptr(&),
SWIGTYPE_p_dolfin__uBLASVector,  0 );
+  obj1 = SWIG_NewPointerObj(SWIG_as_voidptr(&y),
SWIGTYPE_p_dolfin__uBLASVector,  0 );
   if (!swig_get_self()) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot
to call uBLASKrylovMatrix.__init__.");
   }
@@ -4976,7 +4976,7 @@
 std::string SwigDirector_PETScKrylovMatrix::str(bool verbose) const {
   std::string c_result;
   swig::SwigVar_PyObject obj0;
-  obj0 = SWIG_From_bool(static_cast< bool >());
+  obj0 = SWIG_From_bool(static_cast< bool >(verbose));
   if (!swig_get_self()) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot
to call PETScKrylovMatrix.__init__.");
   }
@@ -5008,9 +5008,9 @@

 void SwigDirector_PETScKrylovMatrix::resize(dolfin::uint m, dolfin::uint
n) {
   swig::SwigVar_PyObject obj0;
-  obj0 = SWIG_From_unsigned_SS_int(static_cast< unsigned int >());
+  obj0 = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(m));
   swig::SwigVar_PyObject obj1;
-  obj1 = SWIG_From_unsigned_SS_int(static_cast< unsigned int >());
+  obj1 = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(n));
   if (!swig_get_self()) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot
to call PETScKrylovMatrix.__init__.");
   }
@@ -5238,7 +5238,7 @@
     obj0 = make_1d_numpy_array_double(x.size(), x.data().get(), false);
   }
   swig::SwigVar_PyObject obj1;
-  obj1 = SWIG_From_bool(static_cast< bool >());
+  obj1 = SWIG_From_bool(static_cast< bool >(on_boundary));
   if (!swig_get_self()) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot
to call SubDomain.__init__.");
   }
@@ -5371,7 +5371,7 @@
     obj1 = make_1d_numpy_array_double(x.size(), x.data().get(), false);
   }
   swig::SwigVar_PyObject obj2;
-  obj2 = SWIG_NewPointerObj(SWIG_as_voidptr(&), SWIGTYPE_p_ufc__cell,  0 );
+  obj2 = SWIG_NewPointerObj(SWIG_as_voidptr(&cell), SWIGTYPE_p_ufc__cell,
 0 );
   if (!swig_get_self()) {
     Swig::DirectorException::raise("'self' uninitialized, maybe you forgot
to call Expression.__init__.");
   }

Attachment: dolfin-config.cmake
Description: Binary data

Attachment: lion.platform
Description: Binary data

Attachment: dolfin.package
Description: Binary data


Follow ups