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 11:50:14 +0200 User-agent: KMail/1.9.9

```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

---------

```