* Return the (global) index of the
* @p ith face of this cell.
*
- * This function is not
- * implemented in 1D, and maps to
- * line_index in 2D and quad_index
- * in 3D.
+ * This function returns the
+ * vertex_index() of the adjacent
+ * vertex in 1D, and maps to
+ * line_index() in 2D and
+ * quad_index() in 3D.
*/
unsigned int
face_index (const unsigned int i) const;
{
case 1:
{
- Assert (false, ExcImpossibleInDim(1));
- return numbers::invalid_unsigned_int;
+ return this->vertex_index(i);
}
case 2:
// set neighbor to
// cell on same
// level
- first_child->set_neighbor (0, cell->neighbor(0)->child(1));
+ const unsigned int nbnb = cell->neighbor_of_neighbor (0);
+ first_child->set_neighbor (0, cell->neighbor(0)->child(nbnb));
// reset neighbor
// info of all
left_neighbor = cell->neighbor(0);
while (left_neighbor->has_children())
{
- left_neighbor = left_neighbor->child(1);
- left_neighbor->set_neighbor (1, first_child);
+ left_neighbor = left_neighbor->child(nbnb);
+ left_neighbor->set_neighbor (nbnb, first_child);
}
}
// refined same as
// above
{
- second_child->set_neighbor (1, cell->neighbor(1)->child(0));
+ const unsigned int nbnb = cell->neighbor_of_neighbor (1);
+ second_child->set_neighbor (1, cell->neighbor(1)->child(nbnb));
typename Triangulation<dim,spacedim>::cell_iterator
right_neighbor = cell->neighbor(1);
while (right_neighbor->has_children())
{
- right_neighbor = right_neighbor->child(0);
- right_neighbor->set_neighbor (0, second_child);
+ right_neighbor = right_neighbor->child(nbnb);
+ right_neighbor->set_neighbor (nbnb, second_child);
}
}
}
// cases. look up this relationship
// in the table provided by
// GeometryInfo and try it
-
const unsigned int this_face_index=face_index(neighbor);
const unsigned int neighbor_guess
--- /dev/null
+//---------------------------- extract_boundary_mesh_06.cc ---------------------------
+// $Id: bem.cc 22693 2010-11-11 20:11:47Z kanschat $
+// Version: $Name$
+//
+// Copyright (C) 2010 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------- extract_boundary_mesh_06.cc ---------------------------
+
+// another failure that had to do that in the library we assumed that
+// the left neighbor of the right neighbor of a cell is the cell
+// itself. this holds true if dim==spacedim, but not
+// otherwise. falsely making this assumption led to a strange failure
+// in refine_global().
+
+#include "../tests.h"
+
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_boundary_lib.h>
+#include <grid/grid_out.h>
+#include <grid/grid_tools.h>
+
+using namespace std;
+
+
+void test ()
+{
+ const unsigned int spacedim = 2;
+ const unsigned int dim = spacedim-1;
+
+ Triangulation<dim,spacedim> boundary_mesh;
+ map<Triangulation<dim,spacedim>::cell_iterator,Triangulation<spacedim,spacedim>::face_iterator >
+ surface_to_volume_mapping;
+ Triangulation<spacedim> volume_mesh;
+ GridGenerator::hyper_cube(volume_mesh);
+ volume_mesh.refine_global(1);
+ GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
+ surface_to_volume_mapping);
+ boundary_mesh.refine_global(1);
+
+ for (Triangulation<dim,spacedim>::active_cell_iterator
+ cell = boundary_mesh.begin_active();
+ cell != boundary_mesh.end(); ++cell)
+ {
+ deallog << "Cell=" << cell << std::endl;
+ deallog << " neighbors: " << cell->neighbor(0) << ' ' << cell->neighbor(1)
+ << std::endl;
+ }
+}
+
+
+
+int main ()
+{
+ ofstream logfile("extract_boundary_mesh_06/output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ }
--- /dev/null
+
+DEAL::Cell=2.0
+DEAL:: neighbors: 2.8 2.1
+DEAL::Cell=2.1
+DEAL:: neighbors: 2.0 2.2
+DEAL::Cell=2.2
+DEAL:: neighbors: 2.1 2.3
+DEAL::Cell=2.3
+DEAL:: neighbors: 2.2 2.12
+DEAL::Cell=2.4
+DEAL:: neighbors: 2.11 2.5
+DEAL::Cell=2.5
+DEAL:: neighbors: 2.4 2.6
+DEAL::Cell=2.6
+DEAL:: neighbors: 2.5 2.7
+DEAL::Cell=2.7
+DEAL:: neighbors: 2.6 2.15
+DEAL::Cell=2.8
+DEAL:: neighbors: 2.0 2.9
+DEAL::Cell=2.9
+DEAL:: neighbors: 2.8 2.10
+DEAL::Cell=2.10
+DEAL:: neighbors: 2.9 2.11
+DEAL::Cell=2.11
+DEAL:: neighbors: 2.10 2.4
+DEAL::Cell=2.12
+DEAL:: neighbors: 2.3 2.13
+DEAL::Cell=2.13
+DEAL:: neighbors: 2.12 2.14
+DEAL::Cell=2.14
+DEAL:: neighbors: 2.13 2.15
+DEAL::Cell=2.15
+DEAL:: neighbors: 2.14 2.7