Re: [C++-sig] Python converters for raw pointers: request for help

2009-11-01 Thread Michele De Stefano
Thank you very much. I had not thought to this solution. And I don't think there's a better one. Thank you again. Michele 2009/10/31 Ravi : > On Friday 23 October 2009 04:38:30 Michele De Stefano wrote: >> typedef struct _p_Mat*           Mat; > > Creating a converter to/from a raw pointer is ra

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-30 Thread Ravi
On Friday 23 October 2009 04:38:30 Michele De Stefano wrote: > typedef struct _p_Mat* Mat; Creating a converter to/from a raw pointer is rather tricky (due to the way argument type deduction handles pointers & references seamlessly, IIUC). You should either expose _p_Mat or wrap the ra

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-27 Thread Randolph Fritz
On 2009-10-27, Michele De Stefano wrote: > That's not what I'd like to do. I'd like to make a "from-Python" > converter. I don't want to make a wrapper that takes a > boost::python::object and then call extract ... > > The problem in my converter (see the previous e-mails) is that Python > does no

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-27 Thread Michele De Stefano
That's not what I'd like to do. I'd like to make a "from-Python" converter. I don't want to make a wrapper that takes a boost::python::object and then call extract ... The problem in my converter (see the previous e-mails) is that Python does not even enter into the "convertible" method ... 2009

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-26 Thread Randolph Fritz
I think what you want is here: and here: Take a look at that--see if it helps. -- Randolph Fritz

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-26 Thread Michele De Stefano
I was forgetting to give an example of the Python code I would like to write: >>> from petsc4py import PETSc ... now some uninteresting code for building a PETSc.Mat python object ... ... the result will be a PETSc.Mat m object ... once created, if I write "m" and press RETURN, this is the o

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-26 Thread Michele De Stefano
Ok. Let me clarify (I looked at the link you suggested, but I've not found the answers I was looking for). There exist a "petsc4py" package, which can be extended using its C API. This package, already exposes PETSc types (and also the Mat type). petsc4py is not programmed using Boost Python. Now

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-25 Thread Randolph Fritz
Additional thought. Take a look at: & see if it helps clarify some of the problems. -- Randolph Fritz design machine group, architecture department, university of washington rfr...@u.washington.edu -or- rfritz...@

Re: [C++-sig] Python converters for raw pointers: request for help

2009-10-25 Thread Randolph Fritz
Do you want to return an opaque type, would you like to expose some of the mat's methods in Python, or would you perhaps like to convert a numpy Matrix to a PETSc mat? These all take different approaches. Could you perhaps give an example of some of the Python code you would like to write? -- Ran

[C++-sig] Python converters for raw pointers: request for help

2009-10-23 Thread Michele De Stefano
Hello to everyone. I'm trying to write "from Python" converters for PETSc objects of the petsc4py package. Even if no-one of you uses petsc4py, I think you can help me, if I explain some basics. Please, be patient. I want to make converters for the PETSc Mat type. Mat is defined as below: typed