From: <cd...@us...> - 2012-08-10 12:42:53
|
Revision: 10853 http://octave.svn.sourceforge.net/octave/?rev=10853&view=rev Author: cdf Date: 2012-08-10 12:42:46 +0000 (Fri, 10 Aug 2012) Log Message: ----------- prepare for release 1.3.1 Modified Paths: -------------- trunk/octave-forge/extra/fpl/DESCRIPTION trunk/octave-forge/extra/fpl/NEWS trunk/octave-forge/extra/fpl/inst/fpl_vtk_b64_write_field.m trunk/octave-forge/extra/fpl/inst/fpl_vtk_raw_write_field.m trunk/octave-forge/extra/fpl/src/Makefile Added Paths: ----------- trunk/octave-forge/extra/fpl/src/__array_to_uint8__.cc Removed Paths: ------------- trunk/octave-forge/extra/fpl/src/array_to_uint8.cc Modified: trunk/octave-forge/extra/fpl/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/fpl/DESCRIPTION 2012-08-10 09:30:12 UTC (rev 10852) +++ trunk/octave-forge/extra/fpl/DESCRIPTION 2012-08-10 12:42:46 UTC (rev 10853) @@ -1,11 +1,11 @@ Name: fpl -Version: 1.3.0 -Date: 2012-08-08 +Version: 1.3.1 +Date: 2012-10-08 Author: Carlo de Falco, Massimiliano Culpo and others Maintainer: Carlo de Falco, Massimiliano Culpo Title: Fem PLotting 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 ) +Depends: octave ( >= 3.4.2 ) License: GPLv3+ Modified: trunk/octave-forge/extra/fpl/NEWS =================================================================== --- trunk/octave-forge/extra/fpl/NEWS 2012-08-10 09:30:12 UTC (rev 10852) +++ trunk/octave-forge/extra/fpl/NEWS 2012-08-10 12:42:46 UTC (rev 10853) @@ -1,3 +1,8 @@ +Summary of important user-visible changes for dataframe 1.3.1: +------------------------------------------------------------------- + + * 1.3.1 is just a bugfix release to fix some issues in 1.3.0 + Summary of important user-visible changes for dataframe 1.3.0: ------------------------------------------------------------------- @@ -6,12 +11,13 @@ * 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, will fall back to ASCII mode otherwise). - As a rule of thumbs, ascii files are about 50% larger than base64 which - are 30% larger than raw files. base64 files are faster to write (about 30% faster - than raw on my machine for large meshes), ASCII files are more portable. + * 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, will fall back to ASCII mode otherwise). + As a rule of thumbs, ascii files are about 50% larger than base64 which + are 30% larger than raw files. base64 files are faster to write (about 30% faster + than raw on my machine for large meshes), ASCII files are more portable. -* New functions to write ASCII structured grid VTK files have been added + * New functions to write ASCII structured grid VTK files have been added + 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-10 09:30:12 UTC (rev 10852) +++ trunk/octave-forge/extra/fpl/inst/fpl_vtk_b64_write_field.m 2012-08-10 12:42:46 UTC (rev 10853) @@ -156,8 +156,8 @@ ## 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, base64_encode([array_to_uint8(int32 (numel (newdata)))(:); newdata])]; + newdata = __array_to_uint8__(p)(:); + data = [data, base64_encode([__array_to_uint8__(int32 (numel (newdata)))(:); newdata])]; offset = numel (data); fprintf (fid, " </Points>\n"); @@ -165,20 +165,20 @@ ## 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, base64_encode([array_to_uint8(int32 (numel (newdata)))(:); newdata])]; + newdata = __array_to_uint8__(int32 (t))(:); + data = [data, base64_encode([__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, base64_encode([array_to_uint8(int32 (numel (newdata)))(:); newdata])]; + newdata = __array_to_uint8__(int32 (tmp))(:); + data = [data, base64_encode([__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, base64_encode([array_to_uint8(int32 (numel (newdata)))(:); newdata])]; + newdata = __array_to_uint8__(uint8 (tmp))(:); + data = [data, base64_encode([__array_to_uint8__(int32 (numel (newdata)))(:); newdata])]; offset = numel (data); fprintf (fid, " </Cells>\n"); @@ -204,8 +204,8 @@ 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, base64_encode([array_to_uint8(int32 (numel (newdata)))(:); newdata])]; + newdata = __array_to_uint8__(ndata.')(:); + data = [data, base64_encode([__array_to_uint8__(int32 (numel (newdata)))(:); newdata])]; offset = numel (data); endfor fprintf (fid, " </PointData>\n"); @@ -231,8 +231,8 @@ 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, base64_encode([array_to_uint8(int32 (numel (newdata)))(:); newdata])]; + newdata = __array_to_uint8__(cdata.')(:); + data = [data, base64_encode([__array_to_uint8__(int32 (numel (newdata)))(:); newdata])]; offset = numel (data); endfor fprintf (fid, " </CellData>\n"); Modified: trunk/octave-forge/extra/fpl/inst/fpl_vtk_raw_write_field.m =================================================================== --- trunk/octave-forge/extra/fpl/inst/fpl_vtk_raw_write_field.m 2012-08-10 09:30:12 UTC (rev 10852) +++ trunk/octave-forge/extra/fpl/inst/fpl_vtk_raw_write_field.m 2012-08-10 12:42:46 UTC (rev 10853) @@ -151,8 +151,8 @@ ## 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]; + newdata = __array_to_uint8__ (p); + data = [data, __array_to_uint8__(int32 (numel (newdata))), newdata]; offset = numel (data); fprintf (fid, " </Points>\n"); @@ -160,20 +160,20 @@ ## 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]; + 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]; + 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]; + newdata = __array_to_uint8__ (uint8 (tmp)); + data = [data, __array_to_uint8__(int32 (numel (newdata))), newdata]; offset = numel (data); fprintf (fid, " </Cells>\n"); @@ -199,8 +199,8 @@ 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]; + newdata = __array_to_uint8__ (ndata.'); + data = [data, __array_to_uint8__(int32 (numel (newdata))), newdata]; offset = numel (data); endfor fprintf (fid, " </PointData>\n"); @@ -226,8 +226,8 @@ 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]; + newdata = __array_to_uint8__ (cdata.'); + data = [data, __array_to_uint8__(int32 (numel (newdata))), newdata]; offset = numel (data); endfor fprintf (fid, " </CellData>\n"); Modified: trunk/octave-forge/extra/fpl/src/Makefile =================================================================== --- trunk/octave-forge/extra/fpl/src/Makefile 2012-08-10 09:30:12 UTC (rev 10852) +++ trunk/octave-forge/extra/fpl/src/Makefile 2012-08-10 12:42:46 UTC (rev 10853) @@ -1,9 +1,9 @@ -OCTFILES := array_to_uint8.oct - +OCTFILES := __array_to_uint8__.oct +MKOCTFILE ?= mkoctfile all: $(OCTFILES) %.oct: %.cc - mkoctfile $< + $(MKOCTFILE) $< clean: -rm -f *.o core octave-core *.oct *~ Copied: trunk/octave-forge/extra/fpl/src/__array_to_uint8__.cc (from rev 10831, trunk/octave-forge/extra/fpl/src/array_to_uint8.cc) =================================================================== --- trunk/octave-forge/extra/fpl/src/__array_to_uint8__.cc (rev 0) +++ trunk/octave-forge/extra/fpl/src/__array_to_uint8__.cc 2012-08-10 12:42:46 UTC (rev 10853) @@ -0,0 +1,112 @@ +/* +Copyright (C) 2012 Carlo de Falco + +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 3 of the License, or +(at your option) any later version. + +This program 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +Author: Carlo de Falco <carlo@guglielmo.local> +Created: 2012-08-04 + +*/ + +#include <octave/oct.h> + +DEFUN_DLD(__array_to_uint8__,args,nargout,"\ +-*- texinfo -*-\n\ +@deftypefn {Function File} [@var{out}] = __array_to_uint8__ (@var{in})\n\ +UNDOCUMENTED INTERNAL FUNCTION.\n\ +@end deftypefn") +{ + octave_value_list retval; + int nargin = args.length (); + + if (nargin != 1) + print_usage (); + else + { + uint8NDArray out; + + if (! args(0).is_numeric_type ()) + error ("array_to_uint8: encoding is supported only for numeric arrays"); + else if (args(0).is_complex_type () + || args(0).is_sparse_type ()) + error ("array_to_uint8: encoding complex or sparse data is not supported"); + else if (args(0).is_integer_type ()) + { + +#define MAKE_INT_BRANCH(X) \ + if (args(0).is_ ## X ## _type ()) \ + { \ + const X##NDArray in = \ + args(0). X## _array_value (); \ + octave_idx_type len = \ + in.numel () * sizeof (X## _t) / sizeof (uint8_t); \ + if (! error_state) \ + { \ + out.resize1 (len); \ + std::copy ((uint8_t*) in.data(), \ + ((uint8_t*) in.data()) + len, \ + out.fortran_vec ()); \ + retval(0) = octave_value (out); \ + } \ + } + + MAKE_INT_BRANCH(int8) + else MAKE_INT_BRANCH(int16) + else MAKE_INT_BRANCH(int32) + else MAKE_INT_BRANCH(int64) + else MAKE_INT_BRANCH(uint8) + else MAKE_INT_BRANCH(uint16) + else MAKE_INT_BRANCH(uint32) + else MAKE_INT_BRANCH(uint64) + +#undef MAKE_INT_BRANCH + + else + panic_impossible (); + } + else if (args(0).is_single_type ()) + { + const FloatNDArray in = + args(0).float_array_value (); + octave_idx_type len = + in.numel () * sizeof (float) / sizeof (uint8_t); + if (! error_state) + { + out.resize1 (len); + std::copy ((uint8_t*) in.data(), + ((uint8_t*) in.data()) + len, + out.fortran_vec ()); + retval(0) = octave_value (out); + } + } + else + { + const Array<double> in = args(0).array_value (); + + octave_idx_type len = + in.numel () * sizeof (double) / sizeof (uint8_t); + + if (! error_state) + { + out.resize1 (len); + std::copy ((uint8_t*) in.data(), + ((uint8_t*) in.data()) + len, + out.fortran_vec ()); + retval(0) = octave_value (out); + } + } + } + return retval; +} Deleted: trunk/octave-forge/extra/fpl/src/array_to_uint8.cc =================================================================== --- trunk/octave-forge/extra/fpl/src/array_to_uint8.cc 2012-08-10 09:30:12 UTC (rev 10852) +++ trunk/octave-forge/extra/fpl/src/array_to_uint8.cc 2012-08-10 12:42:46 UTC (rev 10853) @@ -1,112 +0,0 @@ -/* -Copyright (C) 2012 Carlo de Falco - -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 3 of the License, or -(at your option) any later version. - -This program 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 Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -Author: Carlo de Falco <carlo@guglielmo.local> -Created: 2012-08-04 - -*/ - -#include <octave/oct.h> - -DEFUN_DLD(array_to_uint8,args,nargout,"\ --*- texinfo -*-\n\ -@deftypefn {Function File} [@var{out}] = array_to_uint8 (@var{in})\n\ -UNDOCUMENTED INTERNAL FUNCTION.\n\ -@end deftypefn") -{ - octave_value_list retval; - int nargin = args.length (); - - if (nargin != 1) - print_usage (); - else - { - uint8NDArray out; - - if (! args(0).is_numeric_type ()) - error ("array_to_uint8: encoding is supported only for numeric arrays"); - else if (args(0).is_complex_type () - || args(0).is_sparse_type ()) - error ("array_to_uint8: encoding complex or sparse data is not supported"); - else if (args(0).is_integer_type ()) - { - -#define MAKE_INT_BRANCH(X) \ - if (args(0).is_ ## X ## _type ()) \ - { \ - const X##NDArray in = \ - args(0). X## _array_value (); \ - octave_idx_type len = \ - in.numel () * sizeof (X## _t) / sizeof (uint8_t); \ - if (! error_state) \ - { \ - out.resize1 (len); \ - std::copy ((uint8_t*) in.data(), \ - ((uint8_t*) in.data()) + len, \ - out.fortran_vec ()); \ - retval(0) = octave_value (out); \ - } \ - } - - MAKE_INT_BRANCH(int8) - else MAKE_INT_BRANCH(int16) - else MAKE_INT_BRANCH(int32) - else MAKE_INT_BRANCH(int64) - else MAKE_INT_BRANCH(uint8) - else MAKE_INT_BRANCH(uint16) - else MAKE_INT_BRANCH(uint32) - else MAKE_INT_BRANCH(uint64) - -#undef MAKE_INT_BRANCH - - else - panic_impossible (); - } - else if (args(0).is_single_type ()) - { - const FloatNDArray in = - args(0).float_array_value (); - octave_idx_type len = - in.numel () * sizeof (float) / sizeof (uint8_t); - if (! error_state) - { - out.resize1 (len); - std::copy ((uint8_t*) in.data(), - ((uint8_t*) in.data()) + len, - out.fortran_vec ()); - retval(0) = octave_value (out); - } - } - else - { - const Array<double> in = args(0).array_value (); - - octave_idx_type len = - in.numel () * sizeof (double) / sizeof (uint8_t); - - if (! error_state) - { - out.resize1 (len); - std::copy ((uint8_t*) in.data(), - ((uint8_t*) in.data()) + len, - out.fortran_vec ()); - retval(0) = octave_value (out); - } - } - } - return retval; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |