X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=octave_packages%2Ffpl-1.2.0%2FFPL2dxoutputtimeseries.m;fp=octave_packages%2Ffpl-1.2.0%2FFPL2dxoutputtimeseries.m;h=c20bc315b89759fa8dc26ebdab7cf4d470a458cd;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hp=0000000000000000000000000000000000000000;hpb=1705066eceaaea976f010f669ce8e972f3734b05;p=CreaPhase.git diff --git a/octave_packages/fpl-1.2.0/FPL2dxoutputtimeseries.m b/octave_packages/fpl-1.2.0/FPL2dxoutputtimeseries.m new file mode 100644 index 0000000..c20bc31 --- /dev/null +++ b/octave_packages/fpl-1.2.0/FPL2dxoutputtimeseries.m @@ -0,0 +1,71 @@ +## Copyright (C) 2004-2008 Carlo de Falco, Massimiliano Culpo +## +## This file is part of +## +## FPL - Fem PLotting package for octave +## +## FPL is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## FPL is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with FPL; If not, see . +## +## +## AUTHORS: +## Carlo de Falco +## +## Culpo Massimiliano +## Bergische Universitaet Wuppertal +## Fachbereich C - Mathematik und Naturwissenschaften +## Arbeitsgruppe fuer Angewandte MathematD-42119 Wuppertal Gaussstr. 20 +## D-42119 Wuppertal, Germany + +## -*- texinfo -*- +## @deftypefn {Function File} {} FPL2dxoutputtimeseries ( @var{filename}, @var{p}, @var{t}, @var{u}, @var{attr_name}, @var{attr_rank}, @var{attr_shape}, @var{time} ) +## +## Outputs a time series in DX form. +## variable must be a scalar, vector or tensor of doubles +## @itemize @minus +## @item @var{filename}= name of file to save (type string) +## @item @var{p}, @var{t} = mesh +## @item @var{u} = variable to save +## @item @var{attr_name} = name of the variable (type string) +## @item @var{attr_rank} = rank of variable data (0 for scalar, 1 for vector, etc.) +## @item @var{attr_shape} = number of components of variable data (assumed 1 for scalar) +## @item @var{time} = time instants +## @end itemize +## @end deftypefn + +function FPL2dxoutputtimeseries(filename,p,t,u,attr_name,attr_rank,attr_shape,time) + + Nsteps = length(time); + if (Nsteps<=1) + endfile = 1; + else + endfile = 0; + endif + + FPL2dxoutputdata(filename,p,t,u(:,1:attr_shape),[attr_name "1"],attr_rank,attr_shape,endfile); + + for it = 2:Nsteps + FPL2dxappenddata(filename,p,t,u(:,[1:attr_shape]+attr_shape*(it-1)),... + [attr_name num2str(it)],attr_rank,attr_shape,endfile); + endfor + + fid=fopen(filename,"a"); + + fprintf (fid, "object \"%s_series\" class series\n",attr_name); + for it = 1:Nsteps + fprintf (fid,"member %d position %g value \"%s\"\n",it-1,time(it),[attr_name num2str(it)]); + endfor + fprintf (fid, "\nend\n"); + fclose(fid); + +endfunction \ No newline at end of file