← Back to team overview

dolfin team mailing list archive

[noreply@xxxxxxxxxxxxx: [Branch ~dolfin-core/dolfin/main] Rev 5651: Another try to make the Macbot happy]

 

Does mesh.entities(i) still produce incorrect results?

--
Anders
--- Begin Message ---
------------------------------------------------------------
revno: 5651
committer: Johan Hake <hake.dev@xxxxxxxxx>
branch nick: dolfin
timestamp: Mon 2011-02-07 10:19:48 -0800
message:
  Another try to make the Macbot happy
    -- totally revert the typemaps for uint and int to how it 
       was before my first fix
modified:
  dolfin/swig/typemaps.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/typemaps.i'
--- dolfin/swig/typemaps.i	2011-02-01 17:14:58 +0000
+++ dolfin/swig/typemaps.i	2011-02-07 18:19:48 +0000
@@ -102,7 +102,15 @@
 //-----------------------------------------------------------------------------
 %typemap(in) dolfin::uint
 {
-  if(!SWIG_IsOK(Py_uint_convert($input, $1)))
+  if (PyInteger_Check($input))
+  {
+    long tmp = static_cast<long>(PyInt_AsLong($input));
+    if (tmp>=0)
+      $1 = static_cast<dolfin::uint>(tmp);
+    else
+      SWIG_exception(SWIG_TypeError, "expected positive 'int' for argument $argnum");
+  }
+  else
     SWIG_exception(SWIG_TypeError, "expected positive 'int' for argument $argnum");
 }
 
@@ -119,8 +127,11 @@
 //-----------------------------------------------------------------------------
 %typemap(in) int
 {
-  if(!SWIG_IsOK(Py_int_convert($input, $1)))
+  if (PyInteger_Check($input))
+  {
+    long tmp = static_cast<long>(PyInt_AsLong($input));
+    $1 = static_cast<int>(tmp);
+  }
+  else
     SWIG_exception(SWIG_TypeError, "expected 'int' for argument $argnum");
 }
-
-


--- End Message ---

Follow ups