Mercurial > forge
comparison extra/fpl/deprecated/FPL2pdequiver.m @ 12671:20e8aca47b2c octave-forge
prepare for release
author | cdf |
---|---|
date | Mon, 17 Aug 2015 10:19:39 +0000 |
parents | extra/fpl/inst/deprecated/FPL2pdequiver.m@2748190086ad |
children |
comparison
equal
deleted
inserted
replaced
12670:d68da2f2417b | 12671:20e8aca47b2c |
---|---|
1 ## Copyright (C) 2004-2008 Carlo de Falco, Massimiliano Culpo | |
2 ## | |
3 ## This file is part of | |
4 ## | |
5 ## FPL - Fem PLotting package for octave | |
6 ## | |
7 ## FPL is free software; you can redistribute it and/or modify | |
8 ## it under the terms of the GNU General Public License as published by | |
9 ## the Free Software Foundation; either version 3 of the License, or | |
10 ## (at your option) any later version. | |
11 ## | |
12 ## FPL is distributed in the hope that it will be useful, | |
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ## GNU General Public License for more details. | |
16 ## | |
17 ## You should have received a copy of the GNU General Public License | |
18 ## along with FPL; If not, see <http://www.gnu.org/licenses/>. | |
19 ## | |
20 ## | |
21 ## AUTHORS: | |
22 ## Carlo de Falco <cdf _AT_ users.sourceforge.net> | |
23 ## | |
24 ## Culpo Massimiliano | |
25 ## Bergische Universitaet Wuppertal | |
26 ## Fachbereich C - Mathematik und Naturwissenschaften | |
27 ## Arbeitsgruppe fuer Angewandte MathematD-42119 Wuppertal Gaussstr. 20 | |
28 ## D-42119 Wuppertal, Germany | |
29 | |
30 ## -*- texinfo -*- | |
31 ## @deftypefn {Function File} {} FPL2pdequiver (@var{mesh}, @ | |
32 ## @var{vx}, @var{vy}, [ @var{property}, @var{value} ...]) | |
33 ## | |
34 ## Plots the 2D vector field @var{vx}, @var{vy} | |
35 ## defined on the triangulation @var{mesh} using opendx. | |
36 ## | |
37 ## Options (default values): | |
38 ## @var{sample_density} (100) | |
39 ## | |
40 ## @seealso{FPL2pdesurf, FPL2ptcsurf, FPL2ptcquiver} | |
41 ## @end deftypefn | |
42 | |
43 function FPL2pdequiver(mesh,vecfieldx,vecfieldy,varargin); | |
44 | |
45 sample_density = "100"; | |
46 | |
47 if( (nargin >= 3) && (rem(nargin,2)==1) ) | |
48 for ii=1:2:length(varargin) | |
49 [ varargin{ii} " = " varargin{ii+1} ";" ] | |
50 eval([ varargin{ii} " = """ varargin{ii+1} """;" ]); | |
51 endfor | |
52 else | |
53 error(["wrong number of parameters " num2str (nargin)]) | |
54 endif | |
55 | |
56 JX = sum(vecfieldx,1)'/3; | |
57 JY = sum(vecfieldy,1)'/3; | |
58 | |
59 dataname = mktemp("/tmp",".dx"); | |
60 scriptname = mktemp("/tmp",".net"); | |
61 | |
62 FPL2dxoutputdata(dataname,mesh.p,mesh.t,[ JX JY],'J',1,2,1); | |
63 | |
64 showmesh = file_in_path(path,"FPL2pdequiver.net"); | |
65 | |
66 system (["cp " showmesh " " scriptname]); | |
67 system (["sed -i \'s|__FILE__DX__|" dataname "|g\' " scriptname]); | |
68 system (["sed -i \'s|__SAMPLE__DENSITY__|" sample_density "|g\' " scriptname]); | |
69 | |
70 command = ["dx -noConfirmedQuit -program " scriptname " -execute -image >& /dev/null & "]; | |
71 | |
72 system(command); | |
73 | |
74 | |
75 endfunction | |
76 | |
77 function filename = mktemp (direct,ext); | |
78 | |
79 if (~exist(direct,"dir")) | |
80 error("trying to save temporary file to non existing directory") | |
81 endif | |
82 | |
83 done=false; | |
84 | |
85 while ~done | |
86 filename = [direct,"/FPL.",num2str(floor(rand*1e7)),ext]; | |
87 if ~exist(filename,"file") | |
88 done =true; | |
89 endif | |
90 endwhile | |
91 | |
92 endfunction |