--- Begin Message ---
------------------------------------------------------------
revno: 5617
committer: Johan Hake <hake.dev@xxxxxxxxx>
branch nick: dolfin
timestamp: Mon 2011-01-31 09:20:27 -0800
message:
Fix interface to Hierarchical for derived classes.
-- SWIG does not like templated baseclasses where the templated
class is the derived class
-- Some forward declarations made the cake
-- shared_ptr inheritance also made it a bit trickey...
modified:
dolfin/swig/common_pre.i
dolfin/swig/function_post.i
dolfin/swig/function_pre.i
dolfin/swig/mesh_post.i
dolfin/swig/mesh_pre.i
dolfin/swig/shared_ptr_classes.i
--
lp:dolfin
https://code.launchpad.net/~dolfin-core/dolfin/main
Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
=== modified file 'dolfin/swig/common_pre.i'
--- dolfin/swig/common_pre.i 2011-01-31 12:44:59 +0000
+++ dolfin/swig/common_pre.i 2011-01-31 17:20:27 +0000
@@ -94,3 +94,12 @@
// Ignores for Hierarchical
//-----------------------------------------------------------------------------
%ignore dolfin::Hierarchical::operator=;
+
+//-----------------------------------------------------------------------------
+// Forward declare Hierarchical template class
+//-----------------------------------------------------------------------------
+namespace dolfin {
+ template<class T>
+ class Hierarchical;
+}
+
=== modified file 'dolfin/swig/function_post.i'
--- dolfin/swig/function_post.i 2010-12-04 21:43:52 +0000
+++ dolfin/swig/function_post.i 2011-01-31 17:20:27 +0000
@@ -1,3 +1,10 @@
+/* -*- C -*- */
+// Copyright (C) 2007-2009 Johan Hake
+// Licensed under the GNU LGPL Version 2.1.
+//
+// First added: 2008-11-02
+// Last changed: 2011-01-31
+
//-----------------------------------------------------------------------------
// Extend FunctionSpace so one can check if a Function is in a FunctionSpace
//-----------------------------------------------------------------------------
@@ -21,3 +28,4 @@
return FunctionSpaceFromCpp(self._function_space())
%}
}
+
=== modified file 'dolfin/swig/function_pre.i'
--- dolfin/swig/function_pre.i 2011-01-31 12:44:59 +0000
+++ dolfin/swig/function_pre.i 2011-01-31 17:20:27 +0000
@@ -82,6 +82,10 @@
%feature("nodirector") dolfin::Expression::compute_vertex_values;
//-----------------------------------------------------------------------------
-// Handle Hierarchical template
+// Instantiate Hierarchical FunctionSpace template class
//-----------------------------------------------------------------------------
-%template () dolfin::Hierarchical<dolfin::FunctionSpace>;
+namespace dolfin {
+ class FunctionSpace;
+}
+
+%template (HierarchicalFunctionSpace) dolfin::Hierarchical<dolfin::FunctionSpace>;
=== modified file 'dolfin/swig/mesh_post.i'
--- dolfin/swig/mesh_post.i 2010-12-08 16:54:24 +0000
+++ dolfin/swig/mesh_post.i 2011-01-31 17:20:27 +0000
@@ -8,7 +8,7 @@
// Modified by Johan Hake 2008-2009
//
// First added: 2006-09-20
-// Last changed: 2010-12-08
+// Last changed: 2011-01-31
//=============================================================================
// SWIG directives for the DOLFIN Mesh kernel module (post)
@@ -187,3 +187,4 @@
double __getitem__(int i) { return (*self)[i]; }
void __setitem__(int i, double val) { (*self)[i] = val; }
}
+
=== modified file 'dolfin/swig/mesh_pre.i'
--- dolfin/swig/mesh_pre.i 2011-01-31 12:44:59 +0000
+++ dolfin/swig/mesh_pre.i 2011-01-31 17:20:27 +0000
@@ -175,6 +175,11 @@
%feature("director") dolfin::SubDomain;
//-----------------------------------------------------------------------------
-// Handle Hierarchical template
+// Instantiate Hierarchical Mesh template class
//-----------------------------------------------------------------------------
-%template () dolfin::Hierarchical<dolfin::Mesh>;
+namespace dolfin {
+ class Mesh;
+}
+
+%template (HierarchicalMesh) dolfin::Hierarchical<dolfin::Mesh>;
+
=== modified file 'dolfin/swig/shared_ptr_classes.i'
--- dolfin/swig/shared_ptr_classes.i 2011-01-22 06:52:02 +0000
+++ dolfin/swig/shared_ptr_classes.i 2011-01-31 17:20:27 +0000
@@ -6,7 +6,7 @@
// Modified by Garth N. Wells, 2009.
//
// First added: 2007-11-25
-// Last changed: 2011-01-21
+// Last changed: 2011-01-31
//=============================================================================
// SWIG directives for the shared_ptr stored classes in PyDOLFIN
@@ -46,6 +46,7 @@
%shared_ptr(dolfin::FiniteElement)
+%shared_ptr(dolfin::Hierarchical<dolfin::FunctionSpace>)
%shared_ptr(dolfin::FunctionSpace)
%shared_ptr(dolfin::SubSpace)
@@ -56,6 +57,7 @@
%shared_ptr(dolfin::Constant)
%shared_ptr(dolfin::MeshCoordinates)
+%shared_ptr(dolfin::Hierarchical<dolfin::Mesh>)
%shared_ptr(dolfin::Mesh)
%shared_ptr(dolfin::BoundaryMesh)
%shared_ptr(dolfin::SubMesh)
--- End Message ---