/usr/lib/x86_64-linux-gnu/scilab-getfem++/macros/gf_plot_1D.sci is in scilab-getfem++ 4.2.1~beta1~svn4635~dfsg-3+b1.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | function [hline, hdof] = gf_plot_1D(mf,U, varargin)
// function h=gf_plot_1D(mf,U,...)
// this function plots a 1D finite element field.
//
// Available options are specified as pairs of 'option name'/'option value'
// 'style', 'bo-' : line style and dof marker style (same
// syntax as in the Scilab command 'plot');
// 'color', '' : override line color (by a given color name);
// 'dof_color', '' : override color of dof markers;
// 'width', 2 : line width.
opts = build_options_list(varargin(:));
try
gf_workspace('push', 'gf_plot_1D');
[hline, hdof] = gf_plot_1D_aux(mf,U, opts);
catch
[str,n,line,func]=lasterror();
disp('error in gf_plot_1D: ' + str);
disp(sprintf('error %d in %s at line %d\n', n, func, line));
error('');
end
gf_workspace('pop');
endfunction
function [hline, hdof] = gf_plot_1D_aux(mf, U, opts)
[opt_style,err] = get_param(opts,'style','bo-');
[opt_color,err] = get_param(opts,'color','');
[opt_dof_color,err] = get_param(opts,'dof_color','');
[opt_width,err] = get_param(opts,'width',2);
// remove eventual markers from the line style
s = opt_style;
opt_style = '';
opt_dof_marker = '';
for i = 1:length(s)
if (isempty(strindex('ox+*.sdv^<>p', part(s, i)))) then
opt_style = opt_style + part(s, i);
elseif i == 1 then
opt_dof_marker = part(s, i);
elseif '-.' == part(s, [i-1,i]) then
opt_style = opt_style + '.';
else opt_dof_marker = part(s, i);
end
end
// save graphical context
cax = gcf();
nbd = gf_mesh_fem_get(mf, 'nbdof');
if (nbd < 100) then
REFINE = 32;
elseif (nbd < 1000) then
REFINE = 6;
else
REFINE = 2;
end
m = gf_mesh_fem_get(mf, 'linked_mesh');
sl = gf_slice(list('none'),m, REFINE);
Usl = gf_compute(mf,U,'interpolate on', sl);
D = unique(gf_mesh_fem_get(mf, 'basic dof nodes'));
slD = gf_slice('points', m, D);
UD = gf_compute(mf,U,'interpolate on',slD);
X = gf_slice_get(sl, 'pts');
Y = Usl;
plot(X, Y, opt_style);
hline = gce();
hline.children.thickness = opt_width;
if (~isempty(opt_color)) then
hline.children.foreground = color(opt_color);
end
hdof = [];
if (~isempty(opt_dof_marker)) then
// add color to the marker if it is given in opt_style
for i = 1:length(opt_style)
if (~isempty(strindex('rgbcmykw', part(opt_style, i)))) then
opt_dof_marker = part(s, i) + opt_dof_marker;
end
end
plot(gf_slice_get(slD, 'pts'), UD, opt_dof_marker);
hdof = gce();
if (~isempty(opt_color)) then
hdof.children.mark_foreground = color(opt_dof_color);
end
end
endfunction
|