dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #15065
Re: [HG DOLFIN] Major revision in PyDOLFIN
On Thu, Sep 03, 2009 at 07:48:13AM +0200, Johan Hake wrote:
> On Wednesday 02 September 2009 23:13:04 Anders Logg wrote:
> > On Wed, Sep 02, 2009 at 10:56:28PM +0200, Johan Hake wrote:
> > > On Wednesday 02 September 2009 22:35:37 DOLFIN wrote:
> > > > One or more new changesets pushed to the primary dolfin repository.
> > > > A short summary of the last three changesets is included below.
> > > >
> > > > changeset: 6876:b2bf81ebe3725e0548b50e6b4fd3cf5827ce3f48
> > > > tag: tip
> > > > user: "Johan Hake <hake@xxxxxxxxx>"
> > > > date: Wed Sep 02 22:35:31 2009 +0200
> > > > files: ChangeLog demo/mesh/intersection/python/demo.py
> > > > dolfin/fem/assemble.cpp dolfin/fem/assemble.h dolfin/swig/Indices.i
> > > > dolfin/swig/common_post.i dolfin/swig/common_pre.i
> > > > dolfin/swig/defines.i dolfin/swig/directors.i dolfin/swig/docstrings.i
> > > > dolfin/swig/dolfin.i dolfin/swig/dolfin_common_post.i
> > > > dolfin/swig/dolfin_common_pre.i dolfin/swig/dolfin_docstrings.i
> > > > dolfin/swig/dolfin_exceptions.i dolfin/swig/dolfin_fem_pre.i
> > > > dolfin/swig/dolfin_la_post.i
> > > > dolfin/swig/dolfin_la_pre.i dolfin/swig/dolfin_log_post.i
> > > > dolfin/swig/dolfin_log_pre.i dolfin/swig/dolfin_mesh_post.i
> > > > dolfin/swig/dolfin_mesh_pre.i dolfin/swig/dolfin_parameter_post.i
> > > > dolfin/swig/dolfin_parameter_pre.i
> > > > dolfin/swig/dolfin_shared_ptr_classes.i
> > > > dolfin/swig/dolfin_std_vector_typemaps.i dolfin/swig/exceptions.i
> > > > dolfin/swig/fem_pre.i dolfin/swig/function_post.i
> > > > dolfin/swig/function_pre.i dolfin/swig/generate.py
> > > > dolfin/swig/generate_docstrings.py dolfin/swig/headers.i
> > > > dolfin/swig/ignores.i dolfin/swig/io_post.i dolfin/swig/la_post.i
> > > > dolfin/swig/la_pre.i dolfin/swig/log_post.i dolfin/swig/log_pre.i
> > > > dolfin/swig/mesh_post.i dolfin/swig/mesh_pre.i
> > > > dolfin/swig/numpy_typemaps.i dolfin/swig/parameter_post.i
> > > > dolfin/swig/parameter_pre.i dolfin/swig/renames.i
> > > > dolfin/swig/renames_pre.i dolfin/swig/shared_ptr_classes.i
> > > > dolfin/swig/std_vector_typemaps.i dolfin/swig/swig_version.i
> > > > dolfin/swig/typemaps.i sandbox/misc/python/test_params.py
> > > > site-packages/dolfin/__init__.py site-packages/dolfin/assemble.py
> > > > site-packages/dolfin/form.py
> > > > site-packages/dolfin/variationalproblem.py description:
> > > > Major revision in PyDOLFIN
> > >
> > > Sorry for the big word. Not really major. It just touch most of the SWIG
> > > interface files.
> > >
> > > The only real change for the user is that we now do not use the
> > > STLFooVector. We do not use the built in SWIG interface as the
> > > std_vector.i macros produces a lot of code and functionalities we do not
> > > use. The functionalities is now substituted by typemaps. Please inform me
> > > if some functionality got lost on the way.
> >
> > Very good!
> >
> > > Other implications:
> > > In IntersectionDetector.intersection we now return the intersected cells
> > > using a numpy array of int, instead of a handed STLUintVector
> >
> > Also good.
>
> We do some copying to facilitate this, so we have traded some speed for
> usability.
ok.
> Also a
>
> std::vector<double> & values
>
> typemap, used for getting the values out of a row, using
> GenericMatrix::getrow, triggers some MPI::foo typemaps. This means that some
> functions in the MPI class now only returns values. That is to say we cannot
> send a numpy array of doubles using MPI in python, where the above signature
> is used. My knowledge of the MPI interface in DOLFIN is limited so this might
> not be a problem.
We're not really using the MPI interface from Python now anyway, just
the basic stuff like num_processes, process_number and barrier.
> Not sure how we should tackle this. We might choose another name on the
> argument. We could also split the inclusion of the foo_pre.i and foo_post.i,
> so the logic of including module specific SWIG interface files would be:
>
> %include foo_pre.i
> %include foo_headers.i
> %include foo_post.i
>
> %include bar_pre.i
> %include bar_headers.i
> %include bar_post.i
>
> instead of
>
> %include foo_pre.i
> %include bar_pre.i
>
> %include foo_headers.i
> %include bar_headers.i
>
> %include foo_post.i
> %include bar_post.i
>
> as it is now. Then we can apply module specific typemaps, which only kicks in
> for a certain modules. We could generate such an inclusion file automatically
> using the generate.py script.
No opinion.
> > > We can now also send a list of FunctionSpaces, Functions,
> > > BoundaryConditions a.s.o instead of instantiate a STLFooVector and push
> > > the objects to this. We can now also handle std::vector<const Foo*>&,
> > > where the const was the tricky one before, using just a list of Foo
> > > objects. So we no longer need the assemble_system_swig function.
> >
> > Very good. I guess this mostly affected the code in
> > site-packages/dolfin, not user code?
>
> That is true. However it might be useful to go over the C++ interface and
> change any:
>
> const std::vector<Foo*>&
>
> to
>
> const std::vector<const Foo*>&
>
> where this make sense. We have avoided this before as the SWIG std::vector
> interface prevented this before.
Yes, I remember now. That would be good. So it should be possible now
to fix this without breaking the Python wrappers?
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups
References