]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Update step-30.cc
authorJiaxin Wang <jxw.sissa@gmail.com>
Fri, 21 Sep 2018 11:57:49 +0000 (13:57 +0200)
committerJiaxin Wang <jiaxin@Jiaxins-MacBook-Pro.local>
Mon, 29 Oct 2018 17:11:59 +0000 (18:11 +0100)
examples/step-30/step-30.cc

index 4e1b19f6aac0547aa8f83db84bdc15a9d9517640..096f7a95a8928b0ec33e520d202b4d827103df4a 100644 (file)
@@ -568,13 +568,13 @@ namespace Step30
                     // situation of our cell and the neighbor we want to treat
                     // only one half, so that each face is considered only
                     // once. Thus we have the additional condition, that the
-                    // cell with the higher level does the work. In the rare
-                    // case that both cells have the same level, the cell with
-                    // lower index is selected.
-                    if (!cell->neighbor_is_coarser(face_no) &&
-                        (neighbor->level() < cell->level() ||
-                         (neighbor->index() > cell->index() &&
-                          neighbor->level() == cell->level())))
+                    // cell with the higher level does the work. In case that
+                    // both cells have the same level, the cell with lower index
+                    // is selected.
+                    if (dim>1 && cell->neighbor_is_coarser(face_no) continue;
+                        if (neighbor->level() < cell->level() ||
+                              (neighbor->index() > cell->index() &&
+                               neighbor->level() == cell->level()))
                       {
                         // Here we know, that the neighbor is not coarser so we
                         // can use the usual @p neighbor_of_neighbor
@@ -582,33 +582,33 @@ namespace Step30
                         // general @p neighbor_face_no function.
                         const unsigned int neighbor2=cell->neighbor_of_neighbor(face_no);
 
-                        ue_vi_matrix = 0;
-                        ui_ve_matrix = 0;
-                        ue_ve_matrix = 0;
-
-                        fe_v_face.reinit (cell, face_no);
-                        fe_v_face_neighbor.reinit (neighbor, neighbor2);
-
-                        dg.assemble_face_term2(fe_v_face,
-                                               fe_v_face_neighbor,
-                                               ui_vi_matrix,
-                                               ue_vi_matrix,
-                                               ui_ve_matrix,
-                                               ue_ve_matrix);
+                          ue_vi_matrix = 0;
+                          ui_ve_matrix = 0;
+                          ue_ve_matrix = 0;
 
-                        neighbor->get_dof_indices (dofs_neighbor);
+                          fe_v_face.reinit (cell, face_no);
+                          fe_v_face_neighbor.reinit (neighbor, neighbor2);
 
-                        for (unsigned int i=0; i<dofs_per_cell; ++i)
-                          for (unsigned int j=0; j<dofs_per_cell; ++j)
-                            {
-                              system_matrix.add(dofs[i], dofs_neighbor[j],
-                                                ue_vi_matrix(i,j));
-                              system_matrix.add(dofs_neighbor[i], dofs[j],
-                                                ui_ve_matrix(i,j));
-                              system_matrix.add(dofs_neighbor[i], dofs_neighbor[j],
-                                                ue_ve_matrix(i,j));
-                            }
-                      }
+                          dg.assemble_face_term2(fe_v_face,
+                                                 fe_v_face_neighbor,
+                                                 ui_vi_matrix,
+                                                 ue_vi_matrix,
+                                                 ui_ve_matrix,
+                                                 ue_ve_matrix);
+
+                          neighbor->get_dof_indices (dofs_neighbor);
+
+                          for (unsigned int i=0; i<dofs_per_cell; ++i)
+                            for (unsigned int j=0; j<dofs_per_cell; ++j)
+                              {
+                                system_matrix.add(dofs[i], dofs_neighbor[j],
+                                                  ue_vi_matrix(i,j));
+                                system_matrix.add(dofs_neighbor[i], dofs[j],
+                                                  ui_ve_matrix(i,j));
+                                system_matrix.add(dofs_neighbor[i], dofs_neighbor[j],
+                                                  ue_ve_matrix(i,j));
+                              }
+                        }
 
                     // We do not need to consider case d), as those faces are
                     // treated 'from the other side within case b).

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.