getfem-users
[Top][All Lists]

## Re: [Getfem-users] Scalar interpolation with Matlab interface

 From: Yves Renard Subject: Re: [Getfem-users] Scalar interpolation with Matlab interface Date: Tue, 29 Apr 2014 13:08:37 +0200 (CEST)

```
Dear Stephan,

Your are right. There were an error in the file interface/src/gf_compute.cc of
the matlab interface. The line 148
size_type N = mf.get_qdim();
should be replaced by
size_type N = mf.linked_mesh().dim();

I commited the fix.
Thank you for your bug report.

Yves.

----- Original Message -----
From: "Stephan Gekle" <address@hidden>
Sent: Tuesday, April 29, 2014 9:54:40 AM
Subject: [Getfem-users] Scalar interpolation with Matlab interface

Dear all,

sorry for bothering you with simple questions, but here is another one
which I just don't understand.
The 'interpolate on' function of the Matlab interface seems to work only
for vectors with the same dimension as the mesh, not for scalars. The
following code works fine:

m = gf_mesh('cartesian', [1:1:10], [1:1:10]);
mfu=gf_mesh_fem(m, 2);
gf_mesh_fem_set(mfu, 'classical fem', 2);
U = zeros(1, gf_mesh_fem_get(mfu, 'nbdof'));
Ui = gf_compute(mfu, U, 'interpolate on', [2,2]');

However, the following code:

m = gf_mesh('cartesian', [1:1:10], [1:1:10]);
mfd=gf_mesh_fem(m, 1);
gf_mesh_fem_set(mfd, 'classical fem', 2);
d = zeros(1, gf_mesh_fem_get(mfd, 'nbdof'));
di = gf_compute(mfd, d, 'interpolate on', [2,2]');

produces an error:

logic_error exception caught
Error using gf_matlab
Error in getfem/bgeot_small_vector.h, line 175 T&
bgeot::small_vector<T>::operator[](bgeot::size_type) [with
T = double]:
out of range

Error in gf_compute (line 152)
[varargout{1:nargout}]=gf_matlab('compute', varargin{:});

Error in searchBug (line 30)
di = gf_compute(mfd, d, 'interpolate on', [2,2]');

Why is this so? And how can I interpolate a scalar quantity on the mesh
points?
Any hints would be greatly appreciated!

Thanks a lot,

Stephan

_______________________________________________
Getfem-users mailing list