On Monday 18 January 2010 12:58:19 Anders Logg wrote: > On Mon, Jan 18, 2010 at 09:47:38PM +0100, Andre Massing wrote: > > Hi, > > > > I am looking for suitable container in C++ (list, vector, array, > > something ordered, not a set) which is suitable to contain (shared) > > pointer or references to meshes *and* is willing to nicely interplay > > with the swig built python interface. I just want to pass a list of > > meshes to a constructor of a class. Is there any suitable classes > > around DOLFIN? Or it is now easy to wrap a say > > std::vector<boost::shared_ptr<Mesh> > or something similiar? > > > > Regards, > > Andre > > I think the dolfin::Array class is the best option. > > I'm not sure of the status of the wrapping of Array to Python but the > idea is that Array should be designed particularly for simple wrapping > to Python. Hake or Garth knows more.
The transition is only done for ArrayDouble and maybe ArrayUInt I guess. For now you should be able to just add: IN_TYPEMAPS_STD_VECTOR_OF_POINTERS(Mesh) in std_vector_typemaps.i where the other similar macros are run. Then you should be able to pass list of Mesh objects to the wrapped C++ method/function. The signature of the C++ function can be any of: bar([const] std::vector< [const] Mesh&> >) where the const are optional (but for now you need at least one of them). We need to reiterate where we want to use the Array<Foo> class. It was primarily introduced to handle std::vector<double>, double* <-> NumPy typemaps. Not std::vector<Foo&> <-> PythonSequence(Foo). But I guess Garth also want's the latter ;). Johan > -- > Anders > _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

