// ---------------------- inline and template functions --------------------
-namespace PatternsTools {
+namespace PatternsTools
+{
namespace internal
{
/**
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+#include "../tests.h"
+#include <deal.II/base/patterns_tools.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/point.h>
+#include <deal.II/base/numbers.h>
+#include <boost/core/demangle.hpp>
+
+#include <memory>
+
+using namespace dealii;
+using namespace PatternsTools;
+
+// Try conversion on elementary types
+
+template<class T>
+void test(T t)
+{
+ deallog << "Type : " << boost::core::demangle(typeid(T).name()) << std::endl;
+ auto p = Convert<T>::to_pattern();
+ deallog << "Pattern : " << p->description() << std::endl;
+ auto s = Convert<T>::to_string(t);
+ deallog << "To String: " << s << std::endl;
+ deallog << "To value : " << Convert<T>::to_string(Convert<T>::to_value(s)) << std::endl;
+
+}
+
+int main()
+{
+ initlog();
+
+ int t0 = 1;
+ unsigned int t1 = 2;
+ types::boundary_id t2 = 3;
+ std::string t3 = "Ciao";
+ double t4 = 4.0;
+
+ test(t0);
+ test(t1);
+ test(t2);
+ test(t3);
+ test(t4);
+
+ return 0;
+}
--- /dev/null
+
+DEAL::Type : int
+DEAL::Pattern : [Integer range -2147483648...2147483647 (inclusive)]
+DEAL::To String: 1
+DEAL::To value : 1
+DEAL::Type : unsigned int
+DEAL::Pattern : [Integer]
+DEAL::To String: 2
+DEAL::To value : 2
+DEAL::Type : unsigned char
+DEAL::Pattern : [Integer range 0...255 (inclusive)]
+DEAL::To String: 3
+DEAL::To value : 3
+DEAL::Pattern : [Anything]
+DEAL::To String: Ciao
+DEAL::To value : Ciao
+DEAL::Type : double
+DEAL::Pattern : [Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]
+DEAL::To String: 4.000000
+DEAL::To value : 4.000000
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+#include "../tests.h"
+#include <deal.II/base/patterns_tools.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/point.h>
+#include <deal.II/base/numbers.h>
+#include <boost/core/demangle.hpp>
+
+#include <memory>
+
+using namespace dealii;
+using namespace PatternsTools;
+
+// Try conversion on non elementary types
+
+template<class T>
+void test(T t)
+{
+ auto p = Convert<T>::to_pattern();
+ deallog << "Pattern : " << p->description() << std::endl;
+ auto s = Convert<T>::to_string(t);
+ deallog << "To String: " << s << std::endl;
+ deallog << "To value : " << Convert<T>::to_string(Convert<T>::to_value(s)) << std::endl;
+
+}
+
+int main()
+{
+ initlog();
+
+ Point<1> t0(1);
+ Point<2> t1(2,3);
+ Point<3> t2(3,4,5);
+
+ Tensor<1,1> t3;
+ Tensor<1,2> t4;
+ Tensor<1,3> t5;
+
+ Tensor<2,1> t32;
+ Tensor<2,2> t42;
+ Tensor<2,3> t52;
+
+ Tensor<3,1> t33;
+ Tensor<3,2> t43;
+ Tensor<3,3> t53;
+
+ std::complex<double> t6(1,2);
+
+ test(t0);
+ test(t1);
+ test(t2);
+ test(t3);
+ test(t4);
+ test(t5);
+ test(t6);
+ test(t32);
+ test(t42);
+ test(t52);
+ test(t33);
+ test(t43);
+ test(t53);
+
+ return 0;
+}
--- /dev/null
+
+DEAL::Pattern : [List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 1...1 (inclusive)]
+DEAL::To String: 1.000000
+DEAL::To value : 1.000000
+DEAL::Pattern : [List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 2...2 (inclusive)]
+DEAL::To String: 2.000000, 3.000000
+DEAL::To value : 2.000000, 3.000000
+DEAL::Pattern : [List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 3...3 (inclusive)]
+DEAL::To String: 3.000000, 4.000000, 5.000000
+DEAL::To value : 3.000000, 4.000000, 5.000000
+DEAL::Pattern : [List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 1...1 (inclusive)]
+DEAL::To String: 0.000000
+DEAL::To value : 0.000000
+DEAL::Pattern : [List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 2...2 (inclusive)]
+DEAL::To String: 0.000000, 0.000000
+DEAL::To value : 0.000000, 0.000000
+DEAL::Pattern : [List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 3...3 (inclusive)]
+DEAL::To String: 0.000000, 0.000000, 0.000000
+DEAL::To value : 0.000000, 0.000000, 0.000000
+DEAL::Pattern : [List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 2...2 (inclusive)]
+DEAL::To String: 1.000000, 2.000000
+DEAL::To value : 1.000000, 2.000000
+DEAL::Pattern : [List of <[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 1...1 (inclusive)]> of length 1...1 (inclusive) separated by <;>]
+DEAL::To String: 0.000000
+DEAL::To value : 0.000000
+DEAL::Pattern : [List of <[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 2...2 (inclusive)]> of length 2...2 (inclusive) separated by <;>]
+DEAL::To String: 0.000000, 0.000000; 0.000000, 0.000000
+DEAL::To value : 0.000000, 0.000000; 0.000000, 0.000000
+DEAL::Pattern : [List of <[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 3...3 (inclusive)]> of length 3...3 (inclusive) separated by <;>]
+DEAL::To String: 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000
+DEAL::To value : 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000
+DEAL::Pattern : [List of <[List of <[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 1...1 (inclusive)]> of length 1...1 (inclusive) separated by <;>]> of length 1...1 (inclusive) separated by <|>]
+DEAL::To String: 0.000000
+DEAL::To value : 0.000000
+DEAL::Pattern : [List of <[List of <[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 2...2 (inclusive)]> of length 2...2 (inclusive) separated by <;>]> of length 2...2 (inclusive) separated by <|>]
+DEAL::To String: 0.000000, 0.000000; 0.000000, 0.000000| 0.000000, 0.000000; 0.000000, 0.000000
+DEAL::To value : 0.000000, 0.000000; 0.000000, 0.000000| 0.000000, 0.000000; 0.000000, 0.000000
+DEAL::Pattern : [List of <[List of <[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 3...3 (inclusive)]> of length 3...3 (inclusive) separated by <;>]> of length 3...3 (inclusive) separated by <|>]
+DEAL::To String: 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000| 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000| 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000
+DEAL::To value : 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000| 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000| 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000; 0.000000, 0.000000, 0.000000
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+#include "../tests.h"
+#include <deal.II/base/patterns_tools.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/point.h>
+#include <deal.II/base/numbers.h>
+#include <boost/core/demangle.hpp>
+
+#include <memory>
+
+using namespace dealii;
+using namespace PatternsTools;
+
+// Try conversion on container types
+
+template<class T>
+void test(T t)
+{
+ auto p = Convert<T>::to_pattern();
+ deallog << "Pattern : " << p->description() << std::endl;
+ auto s = Convert<T>::to_string(t);
+ deallog << "To String: " << s << std::endl;
+ deallog << "To value : " << Convert<T>::to_string(Convert<T>::to_value(s)) << std::endl;
+
+}
+
+int main()
+{
+ initlog();
+
+ int t0 = 1;
+ unsigned int t1 = 2;
+ types::boundary_id t2 = 3;
+ std::string t3 = "Ciao";
+ double t4 = 4.0;
+
+ std::vector<int > t10(2, t0);
+ std::vector<unsigned int > t11(2, t1);
+ std::vector<types::boundary_id > t12(2, t2);
+ std::vector<std::string > t13(2, t3);
+ std::vector<double > t14(2, t4);
+
+ test(t10);
+ test(t11);
+ test(t12);
+ test(t13);
+ test(t14);
+
+ return 0;
+}
--- /dev/null
+
+DEAL::Pattern : [List of <[Integer range -2147483648...2147483647 (inclusive)]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 1, 1
+DEAL::To value : 1, 1
+DEAL::Pattern : [List of <[Integer]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 2, 2
+DEAL::To value : 2, 2
+DEAL::Pattern : [List of <[Integer range 0...255 (inclusive)]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 3, 3
+DEAL::To value : 3, 3
+DEAL::Pattern : [List of <[Anything]> of length 0...4294967295 (inclusive)]
+DEAL::To String: Ciao, Ciao
+DEAL::To value : Ciao, Ciao
+DEAL::Pattern : [List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 4.000000, 4.000000
+DEAL::To value : 4.000000, 4.000000
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+#include "../tests.h"
+#include <deal.II/base/patterns_tools.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/point.h>
+#include <deal.II/base/numbers.h>
+#include <boost/core/demangle.hpp>
+
+#include <memory>
+
+using namespace dealii;
+using namespace PatternsTools;
+
+// Try conversion on map types
+
+template<class T>
+void test(T t)
+{
+ auto p = Convert<T>::to_pattern();
+ deallog << "Pattern : " << p->description() << std::endl;
+ auto s = Convert<T>::to_string(t);
+ deallog << "To String: " << s << std::endl;
+ deallog << "To value : " << Convert<T>::to_string(Convert<T>::to_value(s)) << std::endl;
+
+}
+
+int main()
+{
+ initlog();
+
+ int t0 = 1;
+ unsigned int t1 = 2;
+ types::boundary_id t2 = 3;
+ std::string t3 = "Ciao";
+ double t4 = 4.0;
+
+ std::map<unsigned int, int > t10;
+ std::map<unsigned int, unsigned int > t11;
+ std::map<unsigned int, types::boundary_id > t12;
+ std::map<unsigned int, std::string > t13;
+ std::map<unsigned int, double > t14;
+
+ t10[0] = t0;
+ t11[0] = t1;
+ t12[0] = t2;
+ t13[0] = t3;
+ t14[0] = t4;
+
+ t10[2] = t0;
+ t11[2] = t1;
+ t12[2] = t2;
+ t13[2] = t3;
+ t14[2] = t4;
+
+ test(t10);
+ test(t11);
+ test(t12);
+ test(t13);
+ test(t14);
+
+ return 0;
+}
--- /dev/null
+
+DEAL::Pattern : [Map of <[Integer]>:<[Integer range -2147483648...2147483647 (inclusive)]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 0:1, 2:1
+DEAL::To value : 0:1, 2:1
+DEAL::Pattern : [Map of <[Integer]>:<[Integer]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 0:2, 2:2
+DEAL::To value : 0:2, 2:2
+DEAL::Pattern : [Map of <[Integer]>:<[Integer range 0...255 (inclusive)]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 0:3, 2:3
+DEAL::To value : 0:3, 2:3
+DEAL::Pattern : [Map of <[Integer]>:<[Anything]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 0:Ciao, 2:Ciao
+DEAL::To value : 0:Ciao, 2:Ciao
+DEAL::Pattern : [Map of <[Integer]>:<[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 0...4294967295 (inclusive)]
+DEAL::To String: 0:4.000000, 2:4.000000
+DEAL::To value : 0:4.000000, 2:4.000000
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+#include "../tests.h"
+#include <deal.II/base/patterns_tools.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/point.h>
+#include <deal.II/base/numbers.h>
+#include <boost/core/demangle.hpp>
+
+#include <memory>
+
+using namespace dealii;
+using namespace PatternsTools;
+
+// Try conversion on complex map types
+
+template<class T>
+void test(T t)
+{
+ auto p = Convert<T>::to_pattern();
+ deallog << "Pattern : " << p->description() << std::endl;
+ auto s = Convert<T>::to_string(t);
+ deallog << "To String: " << s << std::endl;
+ deallog << "To value : " << Convert<T>::to_string(Convert<T>::to_value(s)) << std::endl;
+
+}
+
+int main()
+{
+ initlog();
+
+ Point<3> t0(1,2,3);
+ std::complex<double> t1(4,5);
+ std::vector<Point<3>> t2(2,t0);
+ std::vector<std::complex<double>> t3(2,t1);
+
+ std::map<unsigned int, Point<3> > t10;
+ std::map<unsigned int, std::complex<double> > t11;
+ std::map<unsigned int, std::vector<Point<3>> > t12;
+ std::map<unsigned int, std::vector<std::complex<double>> > t13;
+
+ t10[0] = t0;
+ t11[0] = t1;
+ t12[0] = t2;
+ t13[0] = t3;
+
+ t10[2] = t0;
+ t11[2] = t1;
+ t12[2] = t2;
+ t13[2] = t3;
+
+ test(t10);
+ test(t11);
+ test(t12);
+ test(t13);
+
+ return 0;
+}
--- /dev/null
+
+DEAL::Pattern : [Map of <[Integer]>:<[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 3...3 (inclusive)]> of length 0...4294967295 (inclusive) separated by <;>]
+DEAL::To String: 0:1.000000, 2.000000, 3.000000; 2:1.000000, 2.000000, 3.000000
+DEAL::To value : 0:1.000000, 2.000000, 3.000000; 2:1.000000, 2.000000, 3.000000
+DEAL::Pattern : [Map of <[Integer]>:<[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 2...2 (inclusive)]> of length 0...4294967295 (inclusive) separated by <;>]
+DEAL::To String: 0:4.000000, 5.000000; 2:4.000000, 5.000000
+DEAL::To value : 0:4.000000, 5.000000; 2:4.000000, 5.000000
+DEAL::Pattern : [Map of <[Integer]>:<[List of <[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 3...3 (inclusive)]> of length 0...4294967295 (inclusive) separated by <;>]> of length 0...4294967295 (inclusive) separated by <|>]
+DEAL::To String: 0:1.000000, 2.000000, 3.000000; 1.000000, 2.000000, 3.000000| 2:1.000000, 2.000000, 3.000000; 1.000000, 2.000000, 3.000000
+DEAL::To value : 0:1.000000, 2.000000, 3.000000; 1.000000, 2.000000, 3.000000| 2:1.000000, 2.000000, 3.000000; 1.000000, 2.000000, 3.000000
+DEAL::Pattern : [Map of <[Integer]>:<[List of <[List of <[Double -MAX_DOUBLE...MAX_DOUBLE (inclusive)]> of length 2...2 (inclusive)]> of length 0...4294967295 (inclusive) separated by <;>]> of length 0...4294967295 (inclusive) separated by <|>]
+DEAL::To String: 0:4.000000, 5.000000; 4.000000, 5.000000| 2:4.000000, 5.000000; 4.000000, 5.000000
+DEAL::To value : 0:4.000000, 5.000000; 4.000000, 5.000000| 2:4.000000, 5.000000; 4.000000, 5.000000