dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #02392
Re: [HG] Add class NewFEM. This is a clean-up of the boundary condition functions in FEM.
On Tue, 2006-04-11 at 08:13 -0500, Anders Logg wrote:
> There is something I don't like about templating the code in FEM. It
> might be that I'm used to templating only data structures but not
> algorithms so I just need to get used to it...
>
I'm sensing this :), and I'm feeling a weird, irresistible compulsion to
template the member functions of FEM ;)
> Since BoundaryIterator does not really have anything to do with the
> boundary (in particular, it does not care about what it iterates over
> and does not know how to resolve between edges and faces) I suggest we
> name it MeshEntityIterator. It might as well be used with Cell or
> Vertex.
>
OK. I'll change the name.
> I expect we will have a MeshEntityIterator when we rework the data
> structures for Sieve later which will look different, but as usual
> it will then be called NewMeshEntityIterator for a while...
>
OK.
> Another suggestion to remove duplicated code in FEM.cpp is to have
> only one assemble() that does everything: BilinearForm, LinearForm or
> both. This function should be private and look as follows:
> static void assemble(BilinearForm* a, LinearForm* L,
> Matrix& A, Vector& b, Mesh& mesh)
> {
> ...
> for (CellIterator ...)
> {
> if ( a )
> {
> a.eval(block_A, map);
> A.add(block_A, test_nodes, m, trial_nodes, n);
> }
>
> if ( L )
> {
> L.eval(block_b, map);
> b.add(block, test_nodes, m);
> }
> }
> ...
> }
>
> This would complicate the assembly somewhat (adding a few if cases)
> but it would not affect performance and we could remove about 150-200
> lines of duplicated code.
>
Sounds good. Shouldn't really be more complicated. One more function
only, and three existing functions will be much shorter.
I'll clean-up the private boundary condition function in NewFEM (remove
the enum) to check if the Matrix/Vector has been allocated like you have
sketched above.
Garth
> /Anders
>
>
> On Tue, Apr 11, 2006 at 02:23:41PM +0200, Garth N. Wells wrote:
> > I've had a first cut at cleaning up the boundary conditions in FEM. I've
> > named the rearranged class NewFEM, so feel free to add, correct, modify,
> > improve, delete, expunge, . . .
> >
> > I've reduced the 6 FEM:applyBC_xD() functions to just one, and the
> > private FEM::assembleBCResidual() function could also be merged into
> > applyBC(). This required making some of the member functions templated
> > functions. This means more code in NewFEM.h (substantially less then
> > what there is in FEM.cpp), but I think that the benefits outweigh any
> > inconvenience of a larger header file.
> >
> > Garth
> >
> >
> > On Tue, 2006-04-11 at 14:13 +0200, 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: 1854:d6c50271cbfc83ed53ee6ad0a063bb6e01816ac2
> > > tag: tip
> > > user: "Garth N. Wells <g.n.wells@xxxxxxxxxx>"
> > > date: Tue Apr 11 14:12:46 2006 +0200
> > > files: Makefile.in aclocal.m4 configure src/Makefile.in src/config/Makefile.in src/demo/Makefile.in src/demo/fem/Makefile.in src/demo/nls/Makefile.in src/demo/nls/nonlinearpoisson/main.cpp src/demo/ode/Makefile.in src/demo/ode/homotopy/Makefile.in src/demo/ode/modeling/Makefile.in src/demo/pde/Makefile.in src/demo/pde/nonlinear/Makefile.in src/demo/pde/stokes/Makefile.in src/demo/scripting/Makefile.in src/demo/solvers/Makefile.in src/demo/solvers/navierstokes/Makefile.in src/greeting/Makefile.in src/kernel/Makefile.in src/kernel/common/Makefile.in src/kernel/common/dolfin/Makefile.in src/kernel/fem/Makefile.am src/kernel/fem/Makefile.in src/kernel/fem/NewFEM.cpp src/kernel/fem/dolfin/BoundaryValue.h src/kernel/fem/dolfin/Makefile.am src/kernel/fem/dolfin/Makefile.in src/kernel/fem/dolfin/NewFEM.h src/kernel/fem/dolfin/dolfin_fem.h src/kernel/form/Makefile.in src/kernel/form/dolfin/Makefile.in src/kernel/function/Makefile.in src/kernel/function/dolfin/Makefile.in s
rc/k
> > er
> > > nel/io/Makefile.in src/kernel/io/dolfin/Makefile.in src/kernel/la/Makefile.in src/kernel/la/dolfin/Makefile.in src/kernel/log/Makefile.in src/kernel/log/dolfin/Makefile.in src/kernel/main/Makefile.in src/kernel/main/dolfin/Makefile.in src/kernel/math/Makefile.in src/kernel/math/dolfin/Makefile.in src/kernel/nls/Makefile.in src/kernel/nls/dolfin/Makefile.in src/kernel/ode/Makefile.in src/kernel/ode/dolfin/Makefile.in src/kernel/parameter/Makefile.in src/kernel/parameter/dolfin/Makefile.in src/kernel/pde/Makefile.in src/kernel/pde/dolfin/Makefile.in src/kernel/quadrature/Makefile.in src/kernel/quadrature/dolfin/Makefile.in src/lib/Makefile.in src/modules/Makefile.in src/modules/convdiff/Makefile.in src/modules/convdiff/dolfin/Makefile.in src/modules/dolfin/Makefile.in src/modules/elasticity-updated/Makefile.in src/modules/elasticity-updated/dolfin/Makefile.in src/modules/elasticity/Makefile.in src/modules/elasticity/dolfin/Makefile.in src/modules/heat/Makefile.in src/mod
ules
> > /h
> > > eat/dolfin/Makefile.in src/modules/navierstokes/Makefile.in src/modules/navierstokes/dolfin/Makefile.in src/modules/poisson/Makefile.in src/modules/poisson/dolfin/Makefile.in src/modules/stokes/Makefile.in src/modules/stokes/dolfin/Makefile.in src/post/Makefile.in src/pre/Makefile.in src/pydolfin/Makefile.in src/utils/Makefile.in src/utils/convert/Makefile.in src/utils/inp2dx/Makefile.in
> > > description:
> > > Add class NewFEM. This is a clean-up of the boundary condition functions in FEM.
> > >
> > >
> > > changeset: 1853:3f10c4f2fab955eec65f1ef41ed419323359f7a7
> > > user: "Garth N. Wells <g.n.wells@xxxxxxxxxx>"
> > > date: Mon Apr 10 20:46:08 2006 +0200
> > > files: src/kernel/mesh/Makefile.am src/kernel/mesh/Makefile.in src/kernel/mesh/dolfin/BoundaryIterator.h src/kernel/mesh/dolfin/Makefile.am src/kernel/mesh/dolfin/Makefile.in src/kernel/mesh/dolfin/dolfin_mesh.h
> > > description:
> > > Add template BoundaryIterator to unify application of 2D and 3D boundary conditions.
> > >
> > >
> > > changeset: 1852:0d2243907dde1520b2f42c3a851aad50a0d5f129
> > > parent: 1851:4b0d1a6da7e76f13037301cd637534b30695df27
> > > parent: 1850:3f98103656a6d1586cd6543faf550d32615a102e
> > > user: "Johan Jansson <johanjan@xxxxxxxxxxxxxxxx>"
> > > date: Sat Apr 8 19:39:06 2006 +0200
> > > files:
> > > description:
> > > Merge.
> > >
> > >
> > > -------------------------------------------------------
> > > For more details, visit http://www.fenics.org/hg/dolfin
> > >
> > > _______________________________________________
> > > DOLFIN-dev mailing list
> > > DOLFIN-dev@xxxxxxxxxx
> > > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> >
> >
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> >
Follow ups
References