getfem-users
[Top][All Lists]

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

 From: Stephan Gekle Subject: [Getfem-users] Scalar interpolation with Matlab interface Date: Tue, 29 Apr 2014 09:54:40 +0200 User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

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