← Back to team overview

dolfin team mailing list archive

Re: [Question #99875]: restricted dof

 

Question #99875 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/99875

Anders Logg posted a new comment:
On Thu, Feb 11, 2010 at 08:32:17AM -0800, Johan Hake wrote:
> On Thursday 11 February 2010 06:31:18 dbeacham wrote:
> > Question #99875 on DOLFIN changed:
> > https://answers.launchpad.net/dolfin/+question/99875
> >
> >     Status: Answered => Solved
> >
> > dbeacham confirmed that the question is solved:
> > Thanks, this had put me on the right track. Just one more thing
> > (hopefully):
> >
> > In the python interface, how do I generate the 'ufc::cell const &'
> > argument used in DofMap.local_dimension? I've tried using
> > V.cell()/V.ufl_element() but they don't work, so I assume they're the
> > incorrect way.
>
> I guess you can't as it is not possible to create an ufc::cell in the Python
> interface (as far as I know...). I am also not sure we want to expose more of
> the UFC interface to PyDOLFIN, and particular not ufc::cell, as it comes with
> some nasty double ** attributes in its public interface.
>
> However, in DofMap many functions come in one DOLFIN and one UFC version, but
> local_dimension is not one of them. Is there a reason for this Anders? It
> should be straight forward to just add it.
>
> Johan

It is actually possible to call some of them. I have added
dolfin::Cell versions for some of UFC functions, for example
tabulate_dofs in DofMap:

  /// Tabulate the local-to-global mapping of dofs on a cell (UFC cell version)
  void tabulate_dofs(uint* dofs, const ufc::cell& ufc_cell, uint cell_index) const;

  /// Tabulate the local-to-global mapping of dofs on a cell (DOLFIN cell version)
  void tabulate_dofs(uint* dofs, const Cell& cell) const;

I don't think it would be a problem to add more of these. It's useful
for testing out algorithms in Python. See for example the attached
script which makes heavy use of low-level UFC functions from Python.
The algorithm in question has now been ported to C++ in the DOLFIN
Extrapolation class (which was something like a factor 1000 faster).

But in your case, are you sure you need to call DofMap::local_dimension? If the
dimension does not vary over the mesh, you can call
DofMap::max_local_dimension.

--
Anders

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



References