On Wednesday 04 March 2009 13:50:18 Anders Logg wrote: > On Wed, Mar 04, 2009 at 01:39:10PM +0100, Johan Hake wrote: > > On Wednesday 04 March 2009 13:34:17 Anders Logg wrote: > > > On Wed, Mar 04, 2009 at 01:28:10PM +0100, Johan Hake wrote: > > > > On Wednesday 04 March 2009 13:17:37 Garth N. Wells wrote: > > > > > When running demo/mesh/intersection/demo.py, I get > > > > > > > > > > Traceback (most recent call last): > > > > > File "demo.py", line 33, in <module> > > > > > cells = STLVectorUInt() > > > > > NameError: name 'STLVectorUInt' is not defined > > > > > > > > > > Any ideas? > > > > > > > > Should be fixed now > > > > > > How is the STL integration with Python lists? The optimal thing would > > > be if one could write > > > > > > cells = omega0.intersection(boundary, False) > > > > > > instead of > > > > > > cells = STLVectorUInt() > > > omega0.intersection(boundary, cells, False) > > > > > > and cells would be a Python list. > > > > Agree on this. > > > > Should be doable with the right typemaps. > > > > I can fix it but not right now... > > ok, nice. > > > Is this the only place where we use STLVectorFoo? > > Yes, at least in the demos. It (std::vector) appears in quite a few > places now in function calls in the C++ interface, but it's mostly > invisible from Python. For example, the Assembler uses this but it's > wrapped and handled from Python with standard Python lists or tuples.
Ok, I see that it is needed in assemble_system and VariationalProblem also use it. I think it would be doable to remove all these from the python interface, with a proper typemap. I could e.g. add a typemap macro for all type Foo, that we want to be able to pass to the c++ as std::vector<Foo>, using any iterable from python, e.g., tuple, list and numpy arrays. The output typemap of intersection detector will probably need some extra attention. Johan > > I feel that this type is a > > bit too low level to be used in the python interface, and we should as > > you suggest try to get rid of it. > > Yes, it's a bit ugly. _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
