Mercurial > forge
comparison extra/fpl/deprecated/FPL3dxoutputfield.m @ 12671:20e8aca47b2c octave-forge
prepare for release
author | cdf |
---|---|
date | Mon, 17 Aug 2015 10:19:39 +0000 |
parents | extra/fpl/inst/deprecated/FPL3dxoutputfield.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} {} FPL3dxoutputfield( @var{filename}, @ | |
32 ## @var{meshfilename}, @var{dep}, @var{u}, @var{attr_name}, @var{attr_rank}, @ | |
33 ## @var{attr_shape}, @var{endfile} ) | |
34 ## | |
35 ## Outputs data in DX form. | |
36 ## | |
37 ## Variable must be a scalar, vector or tensor of doubles | |
38 ## | |
39 ## @itemize @minus | |
40 ## @item @var{filename} = name of file to save (type string) | |
41 ## @item @var{meshfilename} = name of mesh file (type string) | |
42 ## @item @var{dep} = "positions" for node data, "connections" for element data | |
43 ## @item @var{field} = field data to be saved | |
44 ## @item @var{attr_name} = name of the variable (type string) | |
45 ## @item @var{attr_rank} = rank of variable data (0 for scalar, 1 for vector, etc.) | |
46 ## @item @var{attr_shape} = number of components of variable data (assumed 1 for scalar) | |
47 ## @end itemize | |
48 ## @end deftypefn | |
49 | |
50 function FPL3dxoutputfield(filename,meshfilename,dep,field,attr_name,attr_rank,attr_shape) | |
51 | |
52 fid = fopen (filename,"w"); | |
53 nnodes = size(field,1); | |
54 | |
55 if ((attr_rank==0) && (min(size(field))==1)) | |
56 fprintf(fid,"object ""%s.data""\nclass array type double rank 0 items %d data follows",attr_name,nnodes); | |
57 fprintf(fid,"\n %e",field); | |
58 else | |
59 fprintf(fid,"object ""%s.data""\nclass array type double rank %d shape %d items %d data follows",attr_name,attr_rank,attr_shape,nnodes); | |
60 for ii = 1:nnodes | |
61 fprintf(fid,"\n"); | |
62 fprintf(fid," %e",field(ii,:)); | |
63 endfor | |
64 endif | |
65 fprintf(fid,"\nattribute ""dep"" string ""%s""\n\n",dep); | |
66 fprintf(fid,"object ""%s"" class field\n",attr_name); | |
67 fprintf(fid,"component ""positions"" file %s ""pos""\n",meshfilename); | |
68 fprintf(fid,"component ""connections"" file %s ""con""\n",meshfilename); | |
69 fprintf(fid,"component ""data"" value ""%s.data""\n",attr_name); | |
70 | |
71 fprintf(fid,"\nend\n"); | |
72 fclose (fid); | |
73 | |
74 endfunction | |
75 | |
76 |