← Back to team overview

dolfin team mailing list archive

[noreply@xxxxxxxxxxxxx: [Branch ~dolfin-core/dolfin/main] Rev 4756: Updated PyDOLFIN for comming changes in SWIG]

 

Are the changes backwards compatible (so they work with the current
SWIG)?

--
Anders
--- Begin Message ---
------------------------------------------------------------
revno: 4756
committer: Johan Hake <hake.dev@xxxxxxxxx>
branch nick: dolfin
timestamp: Thu 2010-05-27 12:01:44 -0700
message:
  Updated PyDOLFIN for comming changes in SWIG
    -- UFC also need a simulare update
modified:
  dolfin/swig/shared_ptr_classes.i
  site-packages/dolfin/compilemodules/__init__.py


--
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/shared_ptr_classes.i'
--- dolfin/swig/shared_ptr_classes.i	2010-05-25 16:13:39 +0000
+++ dolfin/swig/shared_ptr_classes.i	2010-05-27 19:01:44 +0000
@@ -37,8 +37,41 @@
 %import "swig/ufc.i"
 
 //-----------------------------------------------------------------------------
-// Decalare shared_ptr stored types in PyDOLFIN
+// Declare shared_ptr stored types in PyDOLFIN
 //-----------------------------------------------------------------------------
+#if SWIG_VERSION >= 0x020000
+%shared_ptr(dolfin::GenericDofMap)
+%shared_ptr(dolfin::DofMap)
+
+%shared_ptr(dolfin::FiniteElement)
+
+%shared_ptr(dolfin::FunctionSpace)
+%shared_ptr(dolfin::SubSpace)
+
+%shared_ptr(dolfin::GenericFunction)
+%shared_ptr(dolfin::Function)
+%shared_ptr(dolfin::Expression)
+%shared_ptr(dolfin::FacetArea)
+%shared_ptr(dolfin::CellSize)
+%shared_ptr(dolfin::Constant)
+%shared_ptr(dolfin::MeshCoordinates)
+
+%shared_ptr(dolfin::Mesh)
+%shared_ptr(dolfin::BoundaryMesh)
+%shared_ptr(dolfin::SubMesh)
+%shared_ptr(dolfin::UnitCube)
+%shared_ptr(dolfin::UnitInterval)
+%shared_ptr(dolfin::Interval)
+%shared_ptr(dolfin::UnitSquare)
+%shared_ptr(dolfin::UnitCircle)
+%shared_ptr(dolfin::Box)
+%shared_ptr(dolfin::Rectangle)
+%shared_ptr(dolfin::UnitSphere)
+
+%shared_ptr(dolfin::SubDomain)
+%shared_ptr(dolfin::DomainBoundary)
+#else
+
 SWIG_SHARED_PTR(GenericDofMap,dolfin::GenericDofMap)
 SWIG_SHARED_PTR_DERIVED(DofMap,dolfin::GenericDofMap,dolfin::DofMap)
 SWIG_SHARED_PTR(FiniteElement,dolfin::FiniteElement)
@@ -68,6 +101,7 @@
 
 SWIG_SHARED_PTR(SubDomain,dolfin::SubDomain)
 SWIG_SHARED_PTR_DERIVED(DomainBoundary,dolfin::SubDomain,dolfin::DomainBoundary)
+#endif
 
 //-----------------------------------------------------------------------------
 // Macro that exposes the Variable interface for the derived classes

=== modified file 'site-packages/dolfin/compilemodules/__init__.py'
--- site-packages/dolfin/compilemodules/__init__.py	2010-05-24 22:55:39 +0000
+++ site-packages/dolfin/compilemodules/__init__.py	2010-05-27 19:01:44 +0000
@@ -1,7 +1,7 @@
 "This module provides functionality to compile PyDOLFIN compatible extension modules."
 
 __author__ = "Johan Hake (hake@xxxxxxxxx)"
-__date__ = "2009-08-15 -- 2009-12-16"
+__date__ = "2009-08-15 -- 2010-05-27"
 __copyright__ = "Copyright (C) 2009 Johan Hake"
 __license__  = "GNU LGPL Version 2.1"
 
@@ -353,6 +353,7 @@
     " Extract any declaration for shared_ptr"
     # Check if there are any classes that is derived from any of the
     # shared_ptr classes in PyDOLFIN and declare if any
+    new_shared_ptr_format = "%%shared_ptr(dolfin::%s)"
     shared_ptr_format = "SWIG_SHARED_PTR(%s,dolfin::%s)"
     derived_shared_ptr_format = "SWIG_SHARED_PTR_DERIVED(%s,dolfin::%s,dolfin::%s)"
     derived_and_base = [(derived, base) for derived, base in \
@@ -362,24 +363,32 @@
     bases = set([base for derived, base in derived_and_base])
 
     if using_reduced_import:
+        # If using reduced import we need to declare base classes as shared_ptr
         for derived_function in ["Expression","Function"]:
             if derived_function in bases:
                 bases.remove(derived_function)
                 bases.add("GenericFunction")
-                derived_and_base.insert(0, (derived_function,"GenericFunction"))
+                derived_and_base.insert(0, (derived_function, "GenericFunction"))
 
         shared_ptr_declarations = "\n".join([shared_ptr_format%
                                              (base, base) \
                                              for base in bases])
         shared_ptr_declarations += "\n"
 
+        new_shared_ptr_declarations = "\n".join(new_shared_ptr_format%base
+                                                for base in bases)
+
     else:
         shared_ptr_declarations = ""
+        new_shared_ptr_declarations = ""
 
     shared_ptr_declarations += "\n".join([derived_shared_ptr_format%
                                           (derived, base, derived) \
                                           for derived, base in derived_and_base])
 
+    new_shared_ptr_declarations += "\n".join([new_shared_ptr_format%derived \
+                                              for derived, base in derived_and_base])
+
     if len(shared_ptr_declarations) > 0:
         return """
 //Uncomment these to produce code for std::tr1::shared_ptr
@@ -388,7 +397,13 @@
 %include <boost_shared_ptr.i>
 ""","""
 // Swig shared_ptr macro declarations
-%s
-"""%shared_ptr_declarations
+#if SWIG_VERSION >= 0x020000
+%s
+
+#else
+%s
+
+#endif
+"""%(new_shared_ptr_declarations, shared_ptr_declarations)
     else:
         return ("\n","\n")


--- End Message ---

Attachment: signature.asc
Description: Digital signature


Follow ups