From b36b97f79c3792d13b451339f516d677258523e9 Mon Sep 17 00:00:00 2001
From: Peter Munch <peterrmuench@gmail.com>
Date: Tue, 30 Jun 2020 20:02:47 +0200
Subject: [PATCH] Generalize line_orientation() for 2D general meshes

---
 include/deal.II/grid/tria_accessor.templates.h | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h
index a28bc8ea83..19bf9412fb 100644
--- a/include/deal.II/grid/tria_accessor.templates.h
+++ b/include/deal.II/grid/tria_accessor.templates.h
@@ -724,10 +724,18 @@ namespace internal
 
       template <int spacedim>
       inline static bool
-      line_orientation(const TriaAccessor<2, 2, spacedim> &, const unsigned int)
+      line_orientation(const TriaAccessor<2, 2, spacedim> &accessor,
+                       const unsigned int                  line)
       {
-        // quads in 2d have no non-standard orientation
-        return true;
+        if (accessor.tria->levels[accessor.present_level]
+              ->face_orientations.size() == 0)
+          return true; // quads in 2d have no non-standard orientation and
+                       // the array TriaLevel::face_orientations is left empty
+        else
+          return accessor.tria->levels[accessor.present_level]
+            ->face_orientations[accessor.present_index *
+                                  GeometryInfo<2>::faces_per_cell +
+                                line];
       }
 
 
-- 
2.39.5