
* tests/io/off/load_float.cc: New test. * tests/io/off/Makefile.am (check_PROGRAMS): Add load_float. (load_float_SOURCES): New. --- milena/ChangeLog | 8 +++++ milena/tests/io/off/Makefile.am | 8 +++- milena/tests/io/off/load_float.cc | 64 +++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 milena/tests/io/off/load_float.cc diff --git a/milena/ChangeLog b/milena/ChangeLog index bb16376..a64a5a5 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,13 @@ 2008-11-12 Roland Levillain <roland@lrde.epita.fr> + Exercise mln::io::load on OFF file (with float data). + + * tests/io/off/load_float.cc: New test. + * tests/io/off/Makefile.am (check_PROGRAMS): Add load_float. + (load_float_SOURCES): New. + +2008-11-12 Roland Levillain <roland@lrde.epita.fr> + Add a loading routine for floating-point value 2-complex images. * mln/io/off/load.hh diff --git a/milena/tests/io/off/Makefile.am b/milena/tests/io/off/Makefile.am index 30f4824..aa750d8 100644 --- a/milena/tests/io/off/Makefile.am +++ b/milena/tests/io/off/Makefile.am @@ -3,10 +3,14 @@ include $(top_srcdir)/milena/tests/tests.mk check_PROGRAMS = \ - load_bin \ - load_save_bin + load_bin \ + load_save_bin \ + \ + load_float load_bin_SOURCES = load_bin.cc load_save_bin_SOURCES = load_save_bin.cc +load_float_SOURCES = load_float.cc + TESTS = $(check_PROGRAMS) diff --git a/milena/tests/io/off/load_float.cc b/milena/tests/io/off/load_float.cc new file mode 100644 index 0000000..7cbe625 --- /dev/null +++ b/milena/tests/io/off/load_float.cc @@ -0,0 +1,64 @@ +// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library 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 this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/// \file tests/io/off/load_float.cc +/// \brief Test mln::io::off::load with an mln::float_2complex_image3df. + +#include <algorithm> +#include <iterator> +#include <iostream> + +#include <mln/io/off/load.hh> + +#include "tests/data.hh" + + +int main() +{ + using namespace mln; + + typedef float_2complex_image3df ima_t; + ima_t ima; + io::off::load(ima, MLN_MESH_DIR "/cone-curv.off"); + + std::cout << ima.domain().cplx() << std::endl; + + // Iterate on 2-faces. + mln::p_n_faces_fwd_piter<2, mln_geom_(ima_t)> p(ima.domain(), 2); + for_all(p) + { + // Print psite and value. + std::cout << "ima(" << p << ") = " << ima(p) /**/ << std::endl + << " located at "; + // Print site. + typedef mln_site_(ima_t) site_t; + site_t s(p); + std::copy (s.sites.begin(), s.sites.end(), + std::ostream_iterator<site_t::location>(std::cout, " ")); + std::cout << std::endl; + } +} -- 1.6.0.1