From a94dd4022731675b2cfb73e9279ff18b232089c1 Mon Sep 17 00:00:00 2001
From: Felix Schindler <felix.schindler@wwu.de>
Date: Thu, 6 Aug 2020 10:53:19 +0200
Subject: [PATCH] [grid] replace `out << intersection` by `out <<
 print(intersection)`

---
 dune/xt/grid/boundaryinfo/normalbased.hh   |  3 +-
 dune/xt/grid/filters/intersection.hh       |  7 ++--
 dune/xt/grid/functors/boundary-detector.hh |  5 +--
 python/dune/xt/grid/intersection.cc        | 40 +++++++++++++---------
 4 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/dune/xt/grid/boundaryinfo/normalbased.hh b/dune/xt/grid/boundaryinfo/normalbased.hh
index 45d026b86..79792bb1d 100644
--- a/dune/xt/grid/boundaryinfo/normalbased.hh
+++ b/dune/xt/grid/boundaryinfo/normalbased.hh
@@ -19,6 +19,7 @@
 #include <dune/xt/common/memory.hh>
 #include <dune/xt/grid/exceptions.hh>
 #include <dune/xt/grid/intersection.hh>
+#include <dune/xt/grid/print.hh>
 
 #include "interfaces.hh"
 #include <dune/xt/grid/boundaryinfo/types.hh>
@@ -198,7 +199,7 @@ public:
 
   const BoundaryType& type(const IntersectionType& intersection) const override final
   {
-    LOG_(debug) << "type(intersection=" << intersection << "):" << std::endl;
+    LOG_(debug) << "type(intersection=" << print(intersection) << "):" << std::endl;
     if (!intersection.boundary()) {
       LOG_(debug) << "  intersection.boundary() = " << intersection.boundary() << ", returning " << no_boundary
                   << std::endl;
diff --git a/dune/xt/grid/filters/intersection.hh b/dune/xt/grid/filters/intersection.hh
index 8db6ed0cb..e1c6d3b3c 100644
--- a/dune/xt/grid/filters/intersection.hh
+++ b/dune/xt/grid/filters/intersection.hh
@@ -14,12 +14,13 @@
 
 #include <functional>
 
+#include <dune/grid/common/partitionset.hh>
+
 #include <dune/xt/common/memory.hh>
 #include <dune/xt/common/timedlogging.hh>
 #include <dune/xt/grid/boundaryinfo.hh>
 #include <dune/xt/grid/type_traits.hh>
-
-#include <dune/grid/common/partitionset.hh>
+#include <dune/xt/grid/print.hh>
 
 #include "base.hh"
 
@@ -465,7 +466,7 @@ public:
 
   bool contains(const GridViewType& /*grid_layer*/, const IntersectionType& intersection) const override final
   {
-    LOG_(debug) << "contains(intersection=" << intersection
+    LOG_(debug) << "contains(intersection=" << print(intersection)
                 << "):\n  boundary_info_.type(intersection) = " << boundary_info_.type(intersection)
                 << ", *boundary_type_ = " << *boundary_type_ << ", returning "
                 << (boundary_info_.type(intersection) == *boundary_type_) << std::endl;
diff --git a/dune/xt/grid/functors/boundary-detector.hh b/dune/xt/grid/functors/boundary-detector.hh
index aaad27c00..828905f30 100644
--- a/dune/xt/grid/functors/boundary-detector.hh
+++ b/dune/xt/grid/functors/boundary-detector.hh
@@ -15,6 +15,7 @@
 #include <dune/xt/common/parallel/threadstorage.hh>
 #include <dune/xt/grid/boundaryinfo/interfaces.hh>
 #include <dune/xt/grid/intersection.hh>
+#include <dune/xt/grid/print.hh>
 
 #include "interfaces.hh"
 
@@ -80,7 +81,7 @@ public:
                          const ElementType& /*inside_element*/,
                          const ElementType& /*outside_element*/)
   {
-    LOG_(debug) << "compute_locally(intersection=" << intersection
+    LOG_(debug) << "compute_locally(intersection=" << print(intersection)
                 << "):\n  boundary_info_.type(intersection) = " << boundary_info_.type(intersection) << ", returning "
                 << size_t(boundary_info_.type(intersection) == *boundary_type_) << std::endl;
     return boundary_info_.type(intersection) == *boundary_type_;
@@ -90,7 +91,7 @@ public:
                    const ElementType& inside_element,
                    const ElementType& outside_element) override final
   {
-    LOG_(debug) << "apply_local(intersection=" << intersection << "): calling compute_locally()" << std::endl;
+    LOG_(debug) << "apply_local(intersection=" << print(intersection) << "): calling compute_locally()" << std::endl;
     found_ += compute_locally(intersection, inside_element, outside_element);
   }
 
diff --git a/python/dune/xt/grid/intersection.cc b/python/dune/xt/grid/intersection.cc
index 3af2f49ac..630100d64 100644
--- a/python/dune/xt/grid/intersection.cc
+++ b/python/dune/xt/grid/intersection.cc
@@ -18,7 +18,7 @@
 #include <dune/xt/grid/type_traits.hh>
 #include <dune/xt/grid/grids.hh>
 #include <dune/xt/grid/intersection.hh>
-#include <dune/xt/common/print.hh>
+#include <dune/xt/grid/print.hh>
 
 #include <python/dune/xt/common/fvector.hh>
 #include <python/dune/xt/grid/grids.bindings.hh>
@@ -72,30 +72,36 @@ public:
     // special methods/operators
     c.def("__str__", [](type& self) {
       std::stringstream ss;
-      ss << Common::print(self);
+      ss << print(self);
       return ss.str();
     });
     c.def("__repr__", [](type& self) {
       std::stringstream ss;
-      ss << Common::repr(self);
+      ss << repr(self);
       return ss.str();
     });
-    c.def("__eq__", [](type& self, const type& other) { return self == other; }, py::is_operator());
-    c.def("__neq__", [](type& self, const type& other) { return self != other; }, py::is_operator());
+    c.def(
+        "__eq__", [](type& self, const type& other) { return self == other; }, py::is_operator());
+    c.def(
+        "__neq__", [](type& self, const type& other) { return self != other; }, py::is_operator());
 
     // methods
-    c.def("to_global",
-          [](type& self, const LocalCoordinateType& x) { return self.geometry().global(x); },
-          "point_in_reference_intersection"_a);
-    c.def("to_local",
-          [](type& self, const GlobalCoordinateType& x) { return self.geometry().local(x); },
-          "point_in_physical_space"_a);
-    c.def("outer_normal",
-          [](type& self, const LocalCoordinateType& x) { return self.outerNormal(x); },
-          "point_in_reference_intersection"_a);
-    c.def("unit_outer_normal",
-          [](type& self, const LocalCoordinateType& x) { return self.unitOuterNormal(x); },
-          "point_in_reference_intersection"_a);
+    c.def(
+        "to_global",
+        [](type& self, const LocalCoordinateType& x) { return self.geometry().global(x); },
+        "point_in_reference_intersection"_a);
+    c.def(
+        "to_local",
+        [](type& self, const GlobalCoordinateType& x) { return self.geometry().local(x); },
+        "point_in_physical_space"_a);
+    c.def(
+        "outer_normal",
+        [](type& self, const LocalCoordinateType& x) { return self.outerNormal(x); },
+        "point_in_reference_intersection"_a);
+    c.def(
+        "unit_outer_normal",
+        [](type& self, const LocalCoordinateType& x) { return self.unitOuterNormal(x); },
+        "point_in_reference_intersection"_a);
 
     return c;
   } // ... bind(...)
-- 
GitLab