]> Creatis software - CreaPhase.git/blob - octave_packages/secs2d-0.0.8/Utilities/Updesurf.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / secs2d-0.0.8 / Utilities / Updesurf.m
1 function Updesurf(varargin); 
2
3 # Updemesh(varargin); 
4
5
6 % This file is part of 
7 %
8 %            SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator
9 %         -------------------------------------------------------------------
10 %            Copyright (C) 2004-2006  Carlo de Falco
11 %
12 %
13 %
14 %  SECS2D is free software; you can redistribute it and/or modify
15 %  it under the terms of the GNU General Public License as published by
16 %  the Free Software Foundation; either version 2 of the License, or
17 %  (at your option) any later version.
18 %
19 %  SECS2D is distributed in the hope that it will be useful,
20 %  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 %  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 %  GNU General Public License for more details.
23 %
24 %  You should have received a copy of the GNU General Public License
25 %  along with SECS2D; If not, see <http://www.gnu.org/licenses/>.
26
27
28
29 if nargin == 1
30
31         Udrawedge(varargin{1}); 
32
33 elseif nargin == 2
34
35         mesh = varargin{1};
36         u = varargin{2};
37
38         dataname = mktemp("/tmp",".dx");
39         scriptname = mktemp("/tmp",".net");
40
41         UDXoutput2Ddata(dataname,mesh.p,mesh.t,u,'u',0,1,1);
42
43         showmesh = file_in_path(path,"Ucoloredrubbersheet.net");
44         system (["cp " showmesh " " scriptname]);
45         system (["sed -i \'s|__FILE__DX__|" dataname "|g\' " scriptname]);
46
47         command = ["dx -program " scriptname " -execute -image >& /dev/null &"];
48         system(command);
49
50 else
51
52         fprintf(1,"wrong number of parameters\n\n")
53
54 end
55
56 endfunction 
57
58 function filename = mktemp (direct,ext);
59
60 if (~exist(direct,"dir"))
61   error("trying to save temporary file to non existing directory")
62 end
63
64 done=false;
65
66 while ~done
67   filename = [direct,"/SECS2D.",num2str(floor(rand*1e7)),ext];
68   if ~exist(filename,"file")
69     done =true;
70   end
71 end
72 endfunction