getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Getfem-users] Indexes of the points in the mesh


From: Yves Renard
Subject: Re: [Getfem-users] Indexes of the points in the mesh
Date: Wed, 19 Sep 2007 16:51:18 +0200
User-agent: KMail/1.9.5

Le mercredi 19 septembre 2007 15:02, vous avez écrit :
> Dear professor,
> I was trying to understand how values are stored inside the mesh structure.
> I built a symple function that should return the value of the coordinate x,
> and I interpolated it on my mesh. then I tried to write on a file the
> following informations:
> index of the node, coordinates of the node and value of the function in the
> node. But The value of the function is not correct.
> For example here are the first 6 lines of the file:
> 0 [0, 0] 1
> 1 [1, 0] 1
> 2 [1, 1] 0.980593
> 3 [0, 1] 0.974359
> 4 [0.025641, 0] 1
> 5 [0.0512821, 0] 0.966136
> 6 [0.0769231, 0] 0.948718
> The program I wrote is the following (vettorex is a small vector):
> vettorex[0]=1;
> vettorex[1]=0;
> scalar_type sol_init_adv(const base_node &x)
>             {
>              return gmm::vect_sp(vettorex, x);
>             }
>
> getfem::interpolation_function(mf_u, U_old, sol_init_adv);
>
> std::fstream fv("puntiiniz.U", std::ios::out);
> for (dal::bv_visitor i (mesh.points_index());!i.finished();++i)
> fv<<i<<" "<<mesh.points()[i]<<" "<< U_old[i]<< endl;

The error comes from the fact that you have to distinguish mesh nodes and 
degrees of freedom. A correspondance could be done only for P1 finite element 
method and for a scalar problem. In fact, a numeration is made in order to 
have a band matrix with a smallest band (with a Cutill-Mc Kee like 
algorithm). So that, even for the P1 finite element method, these two 
numerations do not correspond.

The right way to write your loop would be

for (unsigned i; i < mf_u.nb_dof();++i)
   fv << i << " " << mf_u.point_of_dof(i) << " " << U_old[i] << endl;

-- 
Yves.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]