← Back to team overview

ffc team mailing list archive

Patch for shared_ptr<const ufc::form>

 

Hello!

I fixed the -ldolfin generated code. All ufc::forms are now instantiated using 
shared_ptr.

Patch is attached.

Johan
# HG changeset patch
# User "Johan Hake <hake@xxxxxxxxx>"
# Date 1227602862 -3600
# Node ID c64ee8341a3fafc9e8c2169046b8bddc15300a88
# Parent  1e75117bc1e9dbb891bb37532b3385d78791f943
ffc -ldolfin now instantiate ufc:forms using shared_ptr

diff -r 1e75117bc1e9 -r c64ee8341a3f ffc/compiler/format/dolfinformat.py
--- a/ffc/compiler/format/dolfinformat.py	Mon Nov 24 19:50:35 2008 +0100
+++ b/ffc/compiler/format/dolfinformat.py	Tue Nov 25 09:47:42 2008 +0100
@@ -268,10 +268,10 @@
             constructor_body_sc += "\n\n"
         constructor_body_rc += assign_coefficients
         constructor_body_sc += assign_coefficients
-        constructor_body_r  += "    _ufc_form = new UFC_%s();" % form_prefix
-        constructor_body_rc += "    _ufc_form = new UFC_%s();" % form_prefix
-        constructor_body_s  += "    _ufc_form = new UFC_%s();" % form_prefix
-        constructor_body_sc += "    _ufc_form = new UFC_%s();" % form_prefix
+        constructor_body_r  += "    _ufc_form = std::tr1::shared_ptr<const ufc::form>(new UFC_%s());" % form_prefix
+        constructor_body_rc += "    _ufc_form = std::tr1::shared_ptr<const ufc::form>(new UFC_%s());" % form_prefix
+        constructor_body_s  += "    _ufc_form = std::tr1::shared_ptr<const ufc::form>(new UFC_%s());" % form_prefix
+        constructor_body_sc += "    _ufc_form = std::tr1::shared_ptr<const ufc::form>(new UFC_%s());" % form_prefix
 
         # Generate class in different ways depending on the situation
         if form_data.rank > 0: