← Back to team overview

dolfin team mailing list archive

Re: Assembler interface

 

On Thu, Oct 23, 2008 at 05:58:57PM +0200, Martin Sandve Alnæs wrote:
> 2008/10/23 Anders Logg <logg@xxxxxxxxx>:
> > On Thu, Oct 23, 2008 at 04:46:28PM +0100, Garth N. Wells wrote:
> >>
> >>
> >> Anders Logg wrote:
> >> > On Thu, Oct 23, 2008 at 04:29:16PM +0100, Garth N. Wells wrote:
> >> >>
> >> >> Anders Logg wrote:
> >> >>> On Thu, Oct 23, 2008 at 05:24:54PM +0200, Anders Logg wrote:
> >> >>>> Now that we have removed DofMapSet, how should the general assembly
> >> >>>> interface look? We have lots of simple assemble() functions and they
> >> >>>> all end up calling the main function which is
> >> >>>>
> >> >>>>   void assemble(GenericTensor& A,
> >> >>>>                 const ufc::form& form,
> >> >>>>                 const Array<Function*>& coefficients,
> >> >>>>                 const DofMapSet& dof_map_set,
> >> >>>>                 const MeshFunction<uint>* cell_domains,
> >> >>>>                 const MeshFunction<uint>* exterior_facet_domains,
> >> >>>>                 const MeshFunction<uint>* interior_facet_domains,
> >> >>>>                 bool reset_tensor = true);
> >> >>>>
> >> >>>> One option would be
> >> >>>>
> >> >>>>   void assemble(GenericTensor& A,
> >> >>>>                 const ufc::form& form,
> >> >>>>                 const std::vector<std::tr1::shared_ptr<FunctionSpace> > function_spaces,
> >> >>>>                 const std::vector<std::tr1::shared_ptr<Function> > coefficients,
> >> >>>>                 const MeshFunction<uint>* cell_domains,
> >> >>>>                 const MeshFunction<uint>* exterior_facet_domains,
> >> >>>>                 const MeshFunction<uint>* interior_facet_domains,
> >> >>>>                 bool reset_tensor = true);
> >> >>> I meant
> >> >>>
> >> >>>     void assemble(GenericTensor& A,
> >> >>>                   const ufc::form& form,
> >> >>>                   const std::vector<FunctionSpace&> function_spaces,
> >> >>>                   const std::vector<Function&> coefficients,
> >> >>>                   const MeshFunction<uint>* cell_domains,
> >> >>>                   const MeshFunction<uint>* exterior_facet_domains,
> >> >>>                   const MeshFunction<uint>* interior_facet_domains,
> >> >>>                   bool reset_tensor = true);
> >> >>>
> >> >> That look better.
> >> >>
> >> >> Why is
> >> >>
> >> >>    const std::vector<FunctionSpace&> function_spaces
> >> >>
> >> >> required in the assembler?
> >> >>
> >> >> Garth
> >> >
> >> > What about dolfin::Array vs std::vector?
> >> >
> >>
> >> OK with me. Can't remember any more if there was a reason for using
> >> std::vector instead of Array.
> >
> > The initial reason was to avoid confusion with dolfin::Vector, but we
> 
> Also, dolfin::Array has some constructors that std::vector doesn't
> have, for small vectors.

We can probably live with using push_back in the library code. The
only place where the removal of Array may be a problem is in C++
demos. I found 4 places where this is used:

demo/pde/stokes/taylor-hood/cpp/main.cpp:  Array<DirichletBC*> bcs(&bc0, &bc1, &bc2);
demo/pde/stokes/stabilized/cpp/main.cpp:  Array<DirichletBC*> bcs(&bc0, &bc1, &bc2);
demo/pde/periodic/cpp/main.cpp:  Array<BoundaryCondition*> bcs(&bc0, &bc1);
demo/pde/bcs/cpp/main.cpp:  Array<DirichletBC*> bcs(&bc0, &bc1, &bc2, &bc3);

I think we can also live with using push_back in these demos.

-- 
Anders

Attachment: signature.asc
Description: Digital signature


References