Mercurial > forge
comparison extra/fpl/deprecated/FPL2dxoutputtimeseries.m @ 12671:20e8aca47b2c octave-forge
prepare for release
author | cdf |
---|---|
date | Mon, 17 Aug 2015 10:19:39 +0000 |
parents | extra/fpl/inst/deprecated/FPL2dxoutputtimeseries.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} {} FPL2dxoutputtimeseries ( @var{filename}, @var{p}, @var{t}, @var{u}, @var{attr_name}, @var{attr_rank}, @var{attr_shape}, @var{time} ) | |
32 ## | |
33 ## Outputs a time series in DX form. | |
34 ## variable must be a scalar, vector or tensor of doubles | |
35 ## @itemize @minus | |
36 ## @item @var{filename}= name of file to save (type string) | |
37 ## @item @var{p}, @var{t} = mesh | |
38 ## @item @var{u} = variable to save | |
39 ## @item @var{attr_name} = name of the variable (type string) | |
40 ## @item @var{attr_rank} = rank of variable data (0 for scalar, 1 for vector, etc.) | |
41 ## @item @var{attr_shape} = number of components of variable data (assumed 1 for scalar) | |
42 ## @item @var{time} = time instants | |
43 ## @end itemize | |
44 ## @end deftypefn | |
45 | |
46 function FPL2dxoutputtimeseries(filename,p,t,u,attr_name,attr_rank,attr_shape,time) | |
47 | |
48 Nsteps = length(time); | |
49 if (Nsteps<=1) | |
50 endfile = 1; | |
51 else | |
52 endfile = 0; | |
53 endif | |
54 | |
55 FPL2dxoutputdata(filename,p,t,u(:,1:attr_shape),[attr_name "1"],attr_rank,attr_shape,endfile); | |
56 | |
57 for it = 2:Nsteps | |
58 FPL2dxappenddata(filename,p,t,u(:,[1:attr_shape]+attr_shape*(it-1)),... | |
59 [attr_name num2str(it)],attr_rank,attr_shape,endfile); | |
60 endfor | |
61 | |
62 fid=fopen(filename,"a"); | |
63 | |
64 fprintf (fid, "object \"%s_series\" class series\n",attr_name); | |
65 for it = 1:Nsteps | |
66 fprintf (fid,"member %d position %g value \"%s\"\n",it-1,time(it),[attr_name num2str(it)]); | |
67 endfor | |
68 fprintf (fid, "\nend\n"); | |
69 fclose(fid); | |
70 | |
71 endfunction |