getfem-users
[Top][All Lists]

## Re: [Getfem-users] Data for piecewise constant coefficients

 From: Yves Renard Subject: Re: [Getfem-users] Data for piecewise constant coefficients Date: Wed, 8 Jul 2009 18:24:38 +0200 User-agent: KMail/1.9.9

```Dear Jehanzeb,

This is the same of all finite element method. The function

mf.ind_dof_of_element(icv)

gives the dof number of element icv (a unique dof for the P0 method), and the
function

mf.point_of_dof(idof)

gives the coordinate of the finite element node. With this, is is not
difficult to fill the vector of dof (without any additional storage).

Yves.

On mercredi 8 juillet 2009, Jehanzeb Hameed wrote:
> Is there a simple way in getfem to map points to convexes, that is:
> > the interpolation point for each element is the barycenter. So you
> > can discriminate in wich part of your domain is the point.
>
> Given the particular barycenter, say 'b', do I have to build a list of
> all barycenters in the beginning, and then search for 'b' in that
> list? Or is there some already builtin way to go about it.
>
> Thanks,
> -Jehanzeb
>
> On Wed, Jul 8, 2009 at 4:50 AM, Yves Renard<address@hidden> wrote:
> > On mardi 7 juillet 2009, Jehanzeb Hameed wrote:
> >> Hello,
> >>
> >> In laplacian.cc  "getfem::classical_fem(pgt,0))" is used to represent
> >> the fem space for coefficient function (mf_coef). This coefficient
> >> function is constant on each convex. It is not used in laplacian.cc,
> >> and is set to one by creating a vector ones (
> >> std::vector<scalar_type>(mf_coef.nb_dof(), 1.0) ).
> >>
> >> Now say, I want to this coefficient to be piecewise constant, that is
> >> constant on each of (say two) subdomains. It seems I cant use
> >> interpolation for it, as interpolation functions use coordinates of
> >> points, and dont seem to indicate which convex they come from.
> >
> > Indeed you can. If you represent your coefficient on a P0 method
> > (piecewise constant), the interpolation point for each element is the
> > barycenter. So you can discriminate in wich part of your domain is the
> > point. If you want to fill the corresponding vector by hand, you can use
> > the method
> > mf.point_of_dof(i) for the P0 method which will give you the coordinates
> > of the corresponding barycenter. Otherwise, you can also use the
> > interpolation functions.
> >
> > Yves.
> >
> >> One way
> >> I can think of doing it, is to loop for mesh convexes, look up which
> >> region the convex belongs to, and then set the corresponding entry in
> >> the coefficient vector. However I am not sure if this is the way to
> >> go, as numbering of convexes in the mesh  may not correspond to
> >> numbering of dof's of the vector passed as data for assembly.
> >>
> >> Is the above method the one to use, or is there a more elegant way
> >> around this?
> >>
> >> Thanks,
> >> -Jehanzeb
> >>
> >> _______________________________________________
> >> Getfem-users mailing list
> >> https://mail.gna.org/listinfo/getfem-users
> >
> > --
> >
> >  Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
> >  Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
> >  20, rue Albert Einstein
> >  69621 Villeurbanne Cedex, FRANCE
> >  http://math.univ-lyon1.fr/~renard
> >
> > ---------

--

Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
20, rue Albert Einstein
69621 Villeurbanne Cedex, FRANCE
http://math.univ-lyon1.fr/~renard

---------

```