1 ## Copyright (C) 2010 Carlo de Falco
3 ## This file is part of:
4 ## FPL - Fem PLotting package for octave
6 ## FPL is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2 of the License, or
9 ## (at your option) any later version.
11 ## FPL is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with FPL; If not, see <http://www.gnu.org/licenses/>.
19 ## author: Carlo de Falco <cdf _AT_ users.sourceforge.net>
22 ## @deftypefn {Function File} {@var{h} =} pdemesh (@var{p}, @var{e}, @var{t}, @var{u})
24 ## Plot a triangular mesh in 3D given a mesh structure and node data.
25 ## @var{p}, @var{t} are the mesh vertices and connectivity, @var{u} node data.
26 ## @var{e} is ignored and is accepted only for compatibiity.
28 ## @seealso{fpl_dx_write_field, fpl_vtk_write_field}
32 function h = pdemesh (p, e, t, u)
36 error("pdemesh: wrong number of input parameters");
38 u = zeros (1, columns (p));
44 error("pdemesh: wrong data size");
50 H = trimesh (t(1:3, :).', p(1,:).', p(2,:).', u(:));
65 %! msh = msh2m_structured_mesh ([0:.05:1], [0:.1:1], 1, 1:4, 'random');
66 %! x = msh.p(1,:)'; xm = sum(x(msh.t(1:3,:)),1)/3;
67 %! y = msh.p(2,:)'; ym = sum(y(msh.t(1:3,:)),1)/3;
68 %! pdemesh (msh.p, msh.t, msh.t, x.*(1-x).*y.*(1-y))