]> https://gitweb.dealii.org/ - dealii.git/commitdiff
periodic_neighbor in MeshWorker
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 31 Mar 2016 17:57:56 +0000 (19:57 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 18 Apr 2016 17:10:19 +0000 (19:10 +0200)
include/deal.II/meshworker/loop.h

index 8afdd4e50ed4ba2a5ae6784c2f6bf5884b67d9ff..002a8adfaf611271bed13b958de3d4e07566d16e 100644 (file)
@@ -209,7 +209,7 @@ namespace MeshWorker
       for (unsigned int face_no=0; face_no < GeometryInfo<ITERATOR::AccessorType::Container::dimension>::faces_per_cell; ++face_no)
         {
           typename ITERATOR::AccessorType::Container::face_iterator face = cell->face(face_no);
-          if (cell->at_boundary(face_no))
+          if (cell->at_boundary(face_no) && !cell->has_periodic_neighbor(face_no))
             {
               // only integrate boundary faces of own cells
               if (integrate_boundary && own_cell)
@@ -223,7 +223,7 @@ namespace MeshWorker
           else if (integrate_interior_face)
             {
               // Interior face
-              TriaIterator<typename ITERATOR::AccessorType> neighbor = cell->neighbor(face_no);
+              TriaIterator<typename ITERATOR::AccessorType> neighbor = cell->neighbor_or_periodic_neighbor(face_no);
 
               types::subdomain_id neighbid = numbers::artificial_subdomain_id;
               if (neighbor->is_level_cell())
@@ -247,17 +247,12 @@ namespace MeshWorker
               if (own_cell != own_neighbor && loop_control.faces_to_ghost==LoopControl::never)
                 continue;
 
-              // Deal with
-              // refinement edges
-              // from the refined
-              // side. Assuming
-              // one-irregular
-              // meshes, this
-              // situation should
-              // only occur if
-              // both cells are
-              // active.
-              if (cell->neighbor_is_coarser(face_no))
+              // Deal with refinement edges from the refined side. Assuming one-irregular
+              // meshes, this situation should only occur if both cells are active.
+              const bool periodic_neighbor = cell->has_periodic_neighbor(face_no);
+
+              if ((!periodic_neighbor && cell->neighbor_is_coarser(face_no))
+                  ||(periodic_neighbor && cell->periodic_neighbor_is_coarser(face_no)))
                 {
                   Assert(!cell->has_children(), ExcInternalError());
                   Assert(!neighbor->has_children(), ExcInternalError());
@@ -269,7 +264,9 @@ namespace MeshWorker
                     continue;
 
                   const std::pair<unsigned int, unsigned int> neighbor_face_no
-                    = cell->neighbor_of_coarser_neighbor(face_no);
+                    = periodic_neighbor?
+                      cell->periodic_neighbor_of_coarser_periodic_neighbor(face_no):
+                      cell->neighbor_of_coarser_neighbor(face_no);
                   const typename ITERATOR::AccessorType::Container::face_iterator nface
                     = neighbor->face(neighbor_face_no.first);
 
@@ -321,8 +318,10 @@ namespace MeshWorker
                       && (neighbid < csid))
                     continue;
 
-                  const unsigned int neighbor_face_no = cell->neighbor_face_no(face_no);
-                  Assert (neighbor->face(neighbor_face_no) == face, ExcInternalError());
+                  const unsigned int neighbor_face_no = periodic_neighbor?
+                                                        cell->periodic_neighbor_face_no(face_no):
+                                                        cell->neighbor_face_no(face_no);
+                  Assert (periodic_neighbor || neighbor->face(neighbor_face_no) == face, ExcInternalError());
                   // Regular interior face
                   dof_info.interior_face_available[face_no] = true;
                   dof_info.exterior_face_available[face_no] = true;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.