← Back to team overview

dolfin team mailing list archive

Re: Adding factory functions in UFC

 

On Fri, Jan 28, 2011 at 01:09:15PM +0100, Mehdi Nikbakht wrote:
> On Fri, 2011-01-28 at 12:55 +0100, Anders Logg wrote:
> > On Fri, Jan 28, 2011 at 11:37:23AM +0000, Garth N. Wells wrote:
> > >
> > >
> > > On 28/01/11 11:33, Mehdi Nikbakht wrote:
> > > > On Fri, 2011-01-28 at 11:25 +0100, Andre Massing wrote:
> > > >> Den 28.01.11 00.30, skrev Anders Logg:
> > > >>> On Thu, Jan 27, 2011 at 11:10:08PM +0100, Anders Logg wrote:
> > > >>>> I would like to add factory functions in UFC, in particular
> > > >>>>
> > > >>>>    finite_element* finite_element::create() const;
> > > >>>>    dof_map* dof_map::create() const;
> > > >>>>
> > > >>>> Are there any objections to this? It would be easy to add and easy to
> > > >>>> implement in FFC.
> > > >>>>
> > > >>>> I need it to implement refinement of FunctionSpaces in DOLFIN where
> > > >>>> fresh copies of ufc::finite_element and ufc::dof_map are needed given
> > > >>>> a ufc::finite_element or ufc::dof_map.
> > > >>>>
> > > >>>> An alternative is to hack create_sub_foo so that it returns a copy of
> > > >>>> the element/dofmap itself if the component argument 'i' is>= the
> > > >>>> number of sub elements/dofmaps.
> > > >>>
> > > >>> I suggest we add this to UFC 1.6 and make a release next week together
> > > >>> with DOLFIN 0.9.10, FFC 0.9.5 + other packages that need release. The
> > > >>> sooner the better: there will be time to make bug fix releases and
> > > >>> things will be tested before 1.0 in March.
> > > >>>
> > > >>> If there are any other things we want to add to UFC, now's a good
> > > >>> time.
> > > >>
> > > >> What about the tabulate_tensor function taking arguments for runtime
> > > >> quadrature rules, as we discussed a while ago? ATM I hacked UFC and my
> > > >> generated form files having an additional function
> > > >>
> > > >> virtual void tabulate_tensor(double* A,
> > > >>                               const double * const * w,
> > > >>                               const ufc::cell& c,
> > > >> 			     dolfin::uint num_quad_points,
> > > >> 			     const double * const * coordinates,
> > > >> 			     const double * weights) const
> > > >>
> > > >> Such an interface would add a flexible layer for those who wants to have
> > > >> some type of runtime quadrature.
> > > >>
> > > >> General opinons about that?
> > > >
> > > > Although this makes life easier for the case that we have to compute
> > > > quadrature rule in the run-time, but the current interface can also
> > > > handle this problem.  You can derive a class form ufc::foo_integrals and
> > > > pass object containing new gauss quadrature rule to its constructor as
> > > > we do for partition of unity method.
> >
> > How is that possible? I assume you make a subclass and implement the
> > tabulate_tensor functions yourself using the points given in the
> > constructor. That's fine, but the point here would be that FFC
> > generates the code for us and the generated code would use the
> > quadrature points.
>
> Yes, we generate required code for tabulate_tensor using ffcpum. The
> most important point is runtime evaluation of basis function and their
> derivatives using object of ufc::finite_element at the given quadrature
> points. The approach used for run-time computation of quadrature points
> is a secondary issue. These quadrature points can be given to the
> constructor of foo_integrals (as we it do now) or can be passed through
> tabulate_tensor(as the proposed interface can do).
>
> Mehdi

ok. The point of the new tabulate_tensor function would be that FFC
handles the code generation without need for a special purpose
compiler.

--
Anders



References