From: <cd...@us...> - 2012-08-08 12:20:29
|
Revision: 10841 http://octave.svn.sourceforge.net/octave/?rev=10841&view=rev Author: cdf Date: 2012-08-08 12:20:17 +0000 (Wed, 08 Aug 2012) Log Message: ----------- prepare for release (again) Modified Paths: -------------- trunk/octave-forge/extra/fpl/DESCRIPTION trunk/octave-forge/extra/fpl/INDEX trunk/octave-forge/extra/fpl/NEWS trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxappenddata.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxoutputdata.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxoutputtimeseries.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdequiver.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdeshowmesh.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdesurf.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcquiver.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcshowmesh.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcsurf.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2trspdesurf.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2trsptcsurf.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL2vtkoutputdata.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL3dxoutputfield.m trunk/octave-forge/extra/fpl/inst/deprecated/FPL3dxoutputmesh.m trunk/octave-forge/extra/fpl/inst/fpl_dx_write_field.m trunk/octave-forge/extra/fpl/inst/fpl_dx_write_series.m trunk/octave-forge/extra/fpl/inst/fpl_vtk_assemble_series.m trunk/octave-forge/extra/fpl/inst/fpl_vtk_b64_write_field.m trunk/octave-forge/extra/fpl/inst/fpl_vtk_write_field.m trunk/octave-forge/extra/fpl/inst/pdemesh.m trunk/octave-forge/extra/fpl/inst/pdesurf.m trunk/octave-forge/extra/fpl/inst/savevtk.m trunk/octave-forge/extra/fpl/inst/savevtkvector.m Added Paths: ----------- trunk/octave-forge/extra/fpl/inst/fpl_vtk_raw_write_field.m Modified: trunk/octave-forge/extra/fpl/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/fpl/DESCRIPTION 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/DESCRIPTION 2012-08-08 12:20:17 UTC (rev 10841) @@ -1,11 +1,11 @@ Name: fpl Version: 1.3.0 -Date: 2012-08-04 +Date: 2012-08-08 Author: Carlo de Falco, Massimiliano Culpo and others Maintainer: Carlo de Falco, Massimiliano Culpo Title: Fem PLotting -Description: Collection of routines to save data in different graphical formats. +Description: Collection of routines to export data produced by Finite Elements or Finite Volume Simulations in formats used by some visualization programs. Categories: Graphics Depends: octave ( >= 3.0.0 ) -License: GNU/GPL -SVNRelease: 10827 +License: GPLv3+ + Modified: trunk/octave-forge/extra/fpl/INDEX =================================================================== --- trunk/octave-forge/extra/fpl/INDEX 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/INDEX 2012-08-08 12:20:17 UTC (rev 10841) @@ -2,6 +2,7 @@ functions to save data in VTK format fpl_vtk_write_field.m fpl_vtk_b64_write_field.m + fpl_vtk_raw_write_field.m fpl_vtk_assemble_series.m savevtk savevtkvector Modified: trunk/octave-forge/extra/fpl/NEWS =================================================================== --- trunk/octave-forge/extra/fpl/NEWS 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/NEWS 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,8 +6,10 @@ * ASCII VTK Unstructured Grid (VTU) exporter has been speeded up via code vectorization +* A new function to write raw binary VTU files has been added + * A new function to write base64-encoded binary VTU files has been added - (requires Octave >= 3.7) + (requires Octave >= 3.7, will fall back to ASCII mode otherwise) * New functions to write ASCII structured grid VTK files have been added Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxappenddata.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxappenddata.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxappenddata.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxoutputdata.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxoutputdata.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxoutputdata.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxoutputtimeseries.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxoutputtimeseries.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2dxoutputtimeseries.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdequiver.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdequiver.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdequiver.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdeshowmesh.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdeshowmesh.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdeshowmesh.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdesurf.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdesurf.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2pdesurf.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcquiver.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcquiver.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcquiver.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcshowmesh.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcshowmesh.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcshowmesh.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcsurf.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcsurf.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2ptcsurf.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2trspdesurf.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2trspdesurf.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2trspdesurf.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2trsptcsurf.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2trsptcsurf.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2trsptcsurf.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL2vtkoutputdata.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL2vtkoutputdata.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL2vtkoutputdata.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -2,7 +2,7 @@ ## ## This program 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL3dxoutputfield.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL3dxoutputfield.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL3dxoutputfield.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/deprecated/FPL3dxoutputmesh.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/deprecated/FPL3dxoutputmesh.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/deprecated/FPL3dxoutputmesh.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/fpl_dx_write_field.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/fpl_dx_write_field.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/fpl_dx_write_field.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -5,7 +5,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/fpl_dx_write_series.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/fpl_dx_write_series.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/fpl_dx_write_series.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -5,7 +5,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/fpl_vtk_assemble_series.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/fpl_vtk_assemble_series.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/fpl_vtk_assemble_series.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -5,7 +5,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/fpl_vtk_b64_write_field.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/fpl_vtk_b64_write_field.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/fpl_vtk_b64_write_field.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -6,7 +6,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, @@ -50,11 +50,12 @@ ## @end example ## ## The difference between @code{fpl_vtk_write_field} and @code{fpl_vtk_b64_write_field} -## is that the former saves data in ASCII format while the former uses base64-encoded -## binary format. +## is that the former saves data in ASCII format while the latter uses base64-encoded +## binary format. To save data in un-encoded binary format use @code{fpl_vtk_raw_write_field}. ## ## @seealso{fpl_dx_write_field, fpl_dx_write_series, @ -## fpl_vtk_assemble_series, fpl_vtk_write_field} +## fpl_vtk_assemble_series, fpl_vtk_write_field, @ +## fpl_vtk_raw_write_field} ## ## @end deftypefn Added: trunk/octave-forge/extra/fpl/inst/fpl_vtk_raw_write_field.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/fpl_vtk_raw_write_field.m (rev 0) +++ trunk/octave-forge/extra/fpl/inst/fpl_vtk_raw_write_field.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -0,0 +1,236 @@ +## Copyright (C) 2012 Carlo de Falco +## Copyright (C) 2008,2009,2010 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 3 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 <http://www.gnu.org/licenses/>. +## +## author: Carlo de Falco <cdf _AT_ users.sourceforge.net> +## author: Massimiliano Culpo <culpo _AT_ users.sourceforge.net> + +## -*- texinfo -*- +## @deftypefn {Function File} {} fpl_vtk_raw_write_field (@var{basename}, @ +## @var{mesh}, @var{nodedata}, @var{celldata}) +## +## Output data field in binary serial XML-VTK UnstructuredGrid format. +## +## @var{basename} is a string containing the base-name of the (vtu) file +## where the data will be saved. +## +## @var{mesh} is a PDE-tool like mesh, like the ones generated by the +## "msh" package. +## +## @var{nodedata} and @var{celldata} are (Ndata x 2) cell arrays containing +## respectively <PointData> and <CellData> representing scalars or +## vectors: +## @itemize @minus +## @item @var{*data}@{:,1@} = variable data; +## @item @var{*data}@{:,2@} = variable names; +## @end itemize +## +## +## Example: +## @example +## %% generate msh1, node centered field nc1, cell centered field cc1 +## fpl_vtk_raw_write_field ("example", msh1, @{nc1, "temperature"@}, @{cc1, "density"@}); +## %% generate msh2, node centered field nc2 +## fpl_vtk_raw_write_field ("example", msh2, @{nc2, "temperature"@}, @{@}); +## @end example +## +## The difference between @code{fpl_vtk_write_field} and @code{fpl_vtk_raw_write_field} +## is that the former saves data in ASCII format while the latter uses raw +## binary format. To save data in b64-encoded binary format use @code{fpl_vtk_b64_write_field}. +## +## @seealso{fpl_dx_write_field, fpl_dx_write_series, @ +## fpl_vtk_assemble_series, fpl_vtk_write_field, @ +## fpl_vtk_b64_write_field} +## +## @end deftypefn + +function fpl_vtk_raw_write_field (basename, mesh, nodedata, celldata, endfile) + + ## Check input + if (nargin != 4) + print_usage (); + endif + + if (! ischar (basename)) + error ("fpl_vtk_b64_write_field: basename should be a string"); + elseif (! isstruct (mesh)) + error ("fpl_vtk_b64_write_field: mesh should be a struct"); + elseif (! (iscell (nodedata) && iscell (celldata))) + error ("fpl_vtk_b64_write_field: nodedata and celldata should be cell arrays"); + endif + + filename = [basename ".vtu"]; + + if (! exist (filename, "file")) + fid = fopen (filename, "w"); + + ## Format + fprintf (fid, "<?xml version=""1.0""?>\n"); + + ## Start file + fprintf (fid, "<VTKFile type=""UnstructuredGrid"" version=""0.1"" byte_order=""LittleEndian"">\n"); + + ## Start Header + fprintf (fid, " <UnstructuredGrid>\n"); + else + error ("fpl_vtk_b64_write_field: file %s exists", filename); + endif + + offset = 0; + data = uint8([]); + + p = mesh.p; + dim = rows (p); # 2D or 3D + + if dim == 2 + t = mesh.t (1:3,:); + elseif dim == 3 + t = mesh.t (1:4,:); + else + error ("fpl_vtk_b64_write_field: neither 2D triangle nor 3D tetrahedral mesh"); + endif + + t -= 1; + + nnodes = columns (p); + nelems = columns (t); + + ## Piece + fprintf (fid, " <Piece NumberOfPoints=""%d"" NumberOfCells=""%d"">\n", nnodes, nelems); + + ## assemble data-sets + [data, offset] = print_data_points (fid, nodedata, nnodes, data, offset); + [data, offset] = print_cell_data (fid, celldata, nelems, data, offset); + + ## assemble mesh data + [data, offset] = print_grid (fid, dim, p, nnodes, t, nelems, data, offset); + + ## End Piece + fprintf (fid, " </Piece>\n"); + + ## End Header + fprintf (fid, " </UnstructuredGrid>\n"); + + ## Write data + fprintf (fid, " <AppendedData encoding=""raw"">\n"); + fwrite (fid, "_"); + fwrite (fid, data, "uint8"); + fprintf (fid, " </AppendedData>>\n"); + + ## End file + fprintf (fid, "</VTKFile>"); + fclose (fid); + +endfunction + +## Print Points and Cells Data +function [data, offset] = print_grid (fid, dim, p, nnodes, t, nelems, data, offset) + + if dim == 2 + p = [p; zeros(1,nnodes)]; + eltype = 5; + else + eltype = 10; + endif + + ## VTK-Points (mesh nodes) + fprintf (fid, " <Points>\n"); + fprintf (fid, " <DataArray type=""Float64"" Name=""Array"" NumberOfComponents=""3"" format=""appended"" offset=""%d"" />\n", offset); + newdata = array_to_uint8 (p); + data = [data, array_to_uint8(int32 (numel (newdata))), newdata]; + offset = numel (data); + + fprintf (fid, " </Points>\n"); + + ## VTK-Cells (mesh elements) + fprintf (fid, " <Cells>\n"); + fprintf (fid, " <DataArray type=""Int32"" Name=""connectivity"" format=""appended"" offset=""%d"" />\n", offset); + newdata = array_to_uint8 (int32 (t)); + data = [data, array_to_uint8(int32 (numel (newdata))), newdata]; + offset = numel (data); + + fprintf (fid, " <DataArray type=""Int32"" Name=""offsets"" format=""appended"" offset=""%d"" />\n", offset); + tmp = (dim+1):(dim+1):((dim+1)*nelems); + newdata = array_to_uint8 (int32 (tmp)); + data = [data, array_to_uint8(int32 (numel (newdata))), newdata]; + offset = numel (data); + + fprintf (fid, " <DataArray type=""UInt8"" Name=""types"" format=""appended"" offset=""%d"" />\n", offset); + tmp = eltype*ones(nelems,1); + newdata = array_to_uint8 (uint8 (tmp)); + data = [data, array_to_uint8(int32 (numel (newdata))), newdata]; + offset = numel (data); + + fprintf (fid, " </Cells>\n"); + +endfunction + +## Print DataPoints +function [data, offset] = print_data_points (fid, nodedata, nnodes, data, offset) + + ## # of data to print in + ## <PointData> field + nvdata = size (nodedata, 1); + + if (nvdata) + fprintf (fid, " <PointData>\n"); + for ii = 1:nvdata + ndata = nodedata{ii,1}; + ndataname = nodedata{ii,2}; + nsamples = rows (ndata); + ncomp = columns (ndata); + if (nsamples != nnodes) + error ("fpl_vtk_b64_write_field: wrong number of samples in <PointData> ""%s""", ndataname); + endif + fprintf (fid, " <DataArray type=""Float64"" Name=""%s"" ", ndataname); + fprintf (fid, "NumberOfComponents=""%d"" format=""appended"" offset=""%d"" />\n", ncomp, offset); + newdata = array_to_uint8 (ndata.'); + data = [data, array_to_uint8(int32 (numel (newdata))), newdata]; + offset = numel (data); + endfor + fprintf (fid, " </PointData>\n"); + endif + +endfunction + +function [data, offset] = print_cell_data (fid, celldata, nelems, data, offset) + + ## # of data to print in + ## <CellData> field + nvdata = size (celldata, 1); + + if (nvdata) + fprintf (fid, "<CellData>\n"); + for ii = 1:nvdata + cdata = celldata{ii,1}; + cdataname = celldata{ii,2}; + nsamples = rows (cdata); + ncomp = columns (cdata); + if nsamples != nelems + error ("fpl_vtk_b64_write_field: wrong number of samples in <CellData> ""%s""", cdataname); + endif + fprintf (fid, " <DataArray type=""Float64"" Name=""%s"" ", cdataname); + fprintf (fid, "NumberOfComponents=""%d"" format=""appended"" offset=""%d"" />\n", ncomp, offset); + newdata = array_to_uint8 (cdata.'); + data = [data, array_to_uint8(int32 (numel (newdata))), newdata]; + offset = numel (data); + endfor + fprintf (fid, " </CellData>\n"); + endif + +endfunction Modified: trunk/octave-forge/extra/fpl/inst/fpl_vtk_write_field.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/fpl_vtk_write_field.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/fpl_vtk_write_field.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -5,7 +5,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, @@ -147,7 +147,7 @@ ## VTK-Points (mesh nodes) fprintf (fid, "<Points>\n"); fprintf (fid, "<DataArray type=""Float64"" Name=""Array"" NumberOfComponents=""3"" format=""ascii"">\n"); - fprintf (fid, "%g %g %g\n", p); + fprintf (fid, "%.17g %.17g %.17g\n", p); fprintf (fid, "</DataArray>\n"); fprintf (fid, "</Points>\n"); @@ -189,10 +189,8 @@ endif fprintf (fid, "<DataArray type=""Float64"" Name=""%s"" ", dataname); fprintf (fid, "NumberOfComponents=""%d"" format=""ascii"">\n", ncomp); -% for jj = 1:nsamples - fprintf (fid, "%g ", data); + fprintf (fid, "%.17g ", data); fprintf (fid, "\n"); -% endfor fprintf (fid, "</DataArray>\n"); endfor fprintf (fid, "</PointData>\n"); @@ -218,10 +216,8 @@ endif fprintf (fid, "<DataArray type=""Float64"" Name=""%s"" ", dataname); fprintf (fid, "NumberOfComponents=""%d"" format=""ascii"">\n", ncomp); -% for jj = 1:nsamples - fprintf (fid, "%g ", data); + fprintf (fid, "%.17g ", data); fprintf (fid, "\n"); -% endfor fprintf (fid, "</DataArray>\n"); endfor fprintf (fid, "</CellData>\n"); Modified: trunk/octave-forge/extra/fpl/inst/pdemesh.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/pdemesh.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/pdemesh.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -5,7 +5,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/pdesurf.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/pdesurf.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/pdesurf.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -5,7 +5,7 @@ ## ## 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## FPL is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/savevtk.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/savevtk.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/savevtk.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -2,7 +2,7 @@ ## ## This program 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, Modified: trunk/octave-forge/extra/fpl/inst/savevtkvector.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/savevtkvector.m 2012-08-07 19:48:30 UTC (rev 10840) +++ trunk/octave-forge/extra/fpl/inst/savevtkvector.m 2012-08-08 12:20:17 UTC (rev 10841) @@ -2,7 +2,7 @@ ##. ## This program 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 +## the Free Software Foundation; either version 3 of the License, or ## (at your option) any later version. ##. ## This program is distributed in the hope that it will be useful, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |