/usr/share/octave/packages/bim-1.1.5/bim3c_intrp.m is in octave-bim 1.1.5-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | ## Copyright (C) 2011, 2012 Carlo de Falco
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Octave; see the file COPYING. If not, see
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
##
## @deftypefn {Function File} {@var{data}} = bim3c_intrp (@var{msh}, @var{n_data}, @var{e_data}, @var{points})
##
## Compute interpolated values of node centered multicomponent node centered field @var{n_data} and
## cell centered field @var{n_data} at an arbitrary set of points whos coordinates are given in the
## n_by_3 matrix @var{points}.
##
## @end deftypefn
## Author: Carlo de Falco <carlo@guglielmo.local>
## Created: 2012-10-01
function data = bim3c_intrp (msh, n_data, e_data, p)
%% for each point, find the enclosing tetrahedron
[t_list, b_list] = tsearchn (msh.p.', msh.t(1:4, :)', p);
%% only keep points within tetrahedra
invalid = isnan (t_list);
t_list = t_list (! invalid);
ntl = numel (t_list);
b_list = b_list(! invalid, :);
points(invalid,:) = [];
data = [];
if (! isempty (n_data))
data = cat (1, data, squeeze (
sum (reshape (n_data(msh.t(1:4, t_list), :),
[4, ntl, (columns (n_data))]) .*
repmat (b_list.', [1, 1, (columns (n_data))]), 1)));
endif
if (! isempty (e_data))
data = cat (1, data, e_data(t_list, :));
endif
endfunction
%!test
%! msh = bim3c_mesh_properties (msh3m_structured_mesh (linspace (0, 1, 11), linspace (0, 1, 9), linspace (0, 1, 13), 1, 1:6));
%! x = y = z = linspace (0, 1, 100).';
%! u = msh.p(1, :).';
%! ui = bim3c_intrp (msh, u, [], [x, y, z]);
%! assert (ui, linspace (0, 1, 100), 10*eps);
|