/**
* Convert a boost::geometry::point to a dealii::Point.
*/
- template <int dummy_dim>
+ template <std::size_t dummy_dim,
+ typename std::enable_if<(dim == dummy_dim) && (dummy_dim != 0),
+ int>::type = 0>
Point(const boost::geometry::model::
- point<Number, dummy_dim, boost::geometry::cs::cartesian> &boost_pt,
- typename std::enable_if<(dim == dummy_dim) && (dummy_dim != 0),
- int>::type = 0);
+ point<Number, dummy_dim, boost::geometry::cs::cartesian> &boost_pt);
/**
* Return a unit vector in coordinate direction <tt>i</tt>, i.e., a vector
template <int dim, typename Number>
-template <int dummy_dim>
+template <
+ std::size_t dummy_dim,
+ typename std::enable_if<(dim == dummy_dim) && (dummy_dim != 0), int>::type>
inline Point<dim, Number>::Point(
const boost::geometry::model::
- point<Number, dummy_dim, boost::geometry::cs::cartesian> &boost_pt,
- typename std::enable_if<(dim == dummy_dim) && (dummy_dim != 0), int>::type)
+ point<Number, dummy_dim, boost::geometry::cs::cartesian> &boost_pt)
{
Assert(dim <= 3, ExcNotImplemented());
this->values[0] = boost::geometry::get<0>(boost_pt);
namespace bg = boost::geometry;
-template <int dim>
void
-check()
+check3d()
{
- bg::model::point<double, dim, bg::cs::cartesian> bg_point;
+ bg::model::point<double, 3, boost::geometry::cs::cartesian> point(-1.0,
+ 2.0,
+ 0.15);
- constexpr unsigned int y_index = (spacedim < 2) ? 0 : 1;
- constexpr unsigned int z_index = (spacedim < 3) ? 0 : 2;
+ Point<3> p(point);
- bg_point.set<0>(42.0);
-
- if (dim >= 2)
- bg_point.set<y_index>(42.0 + dim);
+ for (unsigned int i = 0; i < 3; ++i)
+ deallog << p(i) << ' ';
+ deallog << std::endl;
+}
- if (dim >= 3)
- bg_point.set<z_index>(42.0 + dim + 1);
+void
+check2d()
+{
+ bg::model::point<double, 2, bg::cs::cartesian> point(2.0, 3.0);
- Point<dim> p(bg_point);
+ Point<2> p(point);
- for (unsigned int i = 0; i < dim; ++i)
+ for (unsigned int i = 0; i < 2; ++i)
deallog << p(i) << ' ';
deallog << std::endl;
}
+void
+check1d()
+{
+ bg::model::point<double, 1, bg::cs::cartesian> point(12.0);
+
+ Point<1> p(point);
+
+ deallog << p(0) << ' ';
+ deallog << std::endl;
+}
+
int
main()
{
initlog();
deallog << std::setprecision(3);
- check<1>();
- check<2>();
- check<3>();
+ check1d();
+ check2d();
+ check3d();
}