Great thanks! I made a confusion between MeshImData and MeshIm classes. That is prefectly clear with your help now, best.
-- Edouard Oudet : http://www-ljk.imag.fr/membres/Edouard.Oudet/ IMAG - Bureau 164 700 avenue Centrale 38400 Saint Martin d'Hères +33 (0)4 57 42 17 71 (office LJK) +33 (0)4 79 68 82 06 (home) De: "Konstantinos Poulios" <[email protected]> À: "EDOUARD OUDET" <[email protected]> Cc: "Yves Renard" <[email protected]>, "getfem-users" <[email protected]> Envoyé: Vendredi 17 Novembre 2017 15:14:00 Objet: Re: [Getfem-users] gradient interpolation matrix Dear Edouard, You need a MeshImData object. You can define one for example with mim = gf.MeshIm(mesh, integration_degree) mimd1 = gf.MeshImData(mim, -1) mimd4 = gf.MeshImData(mim, -1, [4]) where mimd1 stores one value per quadrature point, while mimd4 stores a vector of 4 values. I use for example the following md.set_variable("ksi0", md.interpolation(_ksi_, mimd1, -1)) to update the value of some data "ksi0" that where defined on quadrature points: md.add_im_data("ksi0", mimd1) If you are interested in one value per element you can define a MeshIm with only 1 quadrature point. Best regards Kostas On Fri, Nov 17, 2017 at 2:37 PM, EDOUARD OUDET < [ mailto:[email protected] | [email protected] ] > wrote: Still a variation on the same question. Following the documentation, interpolation ( expr , *args ) [ http://getfem.org/python/cmdref_Model.html#getfem.Model.interpolation ] Synopsis: V = Model.interpolation(self, string expr, {MeshFem mf | MeshImd mimd | vec pts, Mesh m}[, int region[, int extrapolation[, int rg_source]]]) I tried interpolation on MeshImd: #------------------------------------------------------------------------------------- degp = 2; NX = 30 tmesh = gf.Mesh('regular_simplices', np.arange(0,1+1./NX,1./NX), np.arange(0,1+1./NX,1./NX)) tmeshfem = gf.MeshFem(tmesh, 1) tmeshfem.set_fem(gf.Fem('FEM_PK(2,' + str(degp) + ')')) tmeshim = gf.MeshIm(tmesh, gf.Integ('IM_TRIANGLE(6)')) U = np.random.rand(tmeshfem.nb_basic_dof()) md = gf.Model('real') md.add_fem_variable('u', tmeshfem) md.to_variables(U) GU = md.interpolation('Grad_u', tmeshim) #------------------------------------------------------------------------------------- and get Traceback (most recent call last): File "testinterpgetfem.py", line 21, in <module> GU = md.interpolation('Grad_u', tmeshim) #pts.T, tmeshi) File ".../Conda/deps/usr/lib/python2.7/site-packages/getfem/getfem.py", line 2800, in interpolation return self.get("interpolation", expr, *args) File ".../Conda/deps/usr/lib/python2.7/site-packages/getfem/getfem.py", line 2708, in get return getfem('model_get', [ http://self.id/ | self.id ] , *args) RuntimeError: (Getfem::InterfaceError) -- Argument 4 should be a DOUBLE REAL data array It is not the right way to call it perhaps..? Sorry for the noise, best regards, Edouard. -- Edouard Oudet : [ http://www-ljk.imag.fr/membres/Edouard.Oudet/ | http://www-ljk.imag.fr/membres/Edouard.Oudet/ ] IMAG - Bureau 164 [ https://maps.google.com/?q=700+avenue+Centrale+38400+Saint+Martin+d%27H%C3%A8res&entry=gmail&source=g | 700 avenue Centrale ] [ https://maps.google.com/?q=700+avenue+Centrale+38400+Saint+Martin+d%27H%C3%A8res&entry=gmail&source=g | 38400 Saint Martin d'Hères ] [ tel:+33%204%2057%2042%2017%2071 | +33 (0)4 57 42 17 71 ] (office LJK) [ tel:+33%204%2079%2068%2082%2006 | +33 (0)4 79 68 82 06 ] (home)
