#include <grid/tria.h>
+namespace internal
+{
/**
* Class declaring some dimension dependent numbers which are needed
* for the grid reordering class.
*
* @author Wolfgang Bangerth, 2000
*/
-template <int dim>
-class GridReorderingInfo
-{
-};
+ template <int dim>
+ class GridReorderingInfo
+ {
+ };
/**
*
* @author Wolfgang Bangerth, 2000
*/
-template <>
-class GridReorderingInfo<2>
-{
- public:
- /**
- * Number of possible valid
- * orientations of a cell. They
- * are the state in which it was
- * delivered and three possible
- * rotations in counter-clockwise
- * sense, thus a total of four.
- */
- static const unsigned int rotational_states_of_cells = 4;
-
- /**
- * Number of possible
- * orientations of a face in
- * 2d. It is the face and the
- * face with vertices exchanged,
- * thus two.
- */
- static const unsigned int rotational_states_of_faces = 2;
-};
+ template <>
+ class GridReorderingInfo<2>
+ {
+ public:
+ /**
+ * Number of possible valid
+ * orientations of a cell. They
+ * are the state in which it was
+ * delivered and three possible
+ * rotations in counter-clockwise
+ * sense, thus a total of four.
+ */
+ static const unsigned int rotational_states_of_cells = 4;
+
+ /**
+ * Number of possible
+ * orientations of a face in
+ * 2d. It is the face and the
+ * face with vertices exchanged,
+ * thus two.
+ */
+ static const unsigned int rotational_states_of_faces = 2;
+ };
*
* @author Wolfgang Bangerth, 2000
*/
-template <>
-class GridReorderingInfo<3>
-{
- public:
- /**
- * Number of possible
- * orientations of a cell in 3d,
- * i.e. in how many ways can we
- * arrange the eight vertices of
- * a cube such that the numbering
- * conventions of deal.II are
- * satisfied. Since we can put
- * the cube on each of its six
- * faces and rotate it into four
- * ways on each of these faces,
- * the total number is 24.
- */
- static const unsigned int rotational_states_of_cells = 24;
-
- /**
- * Number of possible
- * orientations of a face in
- * 2d. It is the quadrilateral
- * rotated in all four
- * orientations, and also viewed
- * from the back, i.e. vertices
- * not numbered in
- * counter-clockwise sense but in
- * the other direction.
- */
- static const unsigned int rotational_states_of_faces = 8;
-};
-
+ template <>
+ class GridReorderingInfo<3>
+ {
+ public:
+ /**
+ * Number of possible
+ * orientations of a cell in 3d,
+ * i.e. in how many ways can we
+ * arrange the eight vertices of
+ * a cube such that the numbering
+ * conventions of deal.II are
+ * satisfied. Since we can put
+ * the cube on each of its six
+ * faces and rotate it into four
+ * ways on each of these faces,
+ * the total number is 24.
+ */
+ static const unsigned int rotational_states_of_cells = 24;
+
+ /**
+ * Number of possible
+ * orientations of a face in
+ * 2d. It is the quadrilateral
+ * rotated in all four
+ * orientations, and also viewed
+ * from the back, i.e. vertices
+ * not numbered in
+ * counter-clockwise sense but in
+ * the other direction.
+ */
+ static const unsigned int rotational_states_of_faces = 8;
+ };
+
+}
* @author Wolfgang Bangerth, 2000
*/
template <int dim>
-class GridReordering : private GridReorderingInfo<dim>
+class GridReordering
{
public:
/**
* cell.
*/
typename std::map<Face,FaceData>::iterator
- faces[GridReorderingInfo<dim>::rotational_states_of_cells][GeometryInfo<dim>::faces_per_cell];
+ faces[internal::GridReorderingInfo<dim>::rotational_states_of_cells][GeometryInfo<dim>::faces_per_cell];
/**
* Cell indices of the
* algorithm.
*/
typename std::map<Face,FaceData >::const_iterator
- reverse_faces[GridReorderingInfo<dim>::rotational_states_of_faces-1];
+ reverse_faces[internal::GridReorderingInfo<dim>::rotational_states_of_faces-1];
/**
* Indices of the one or two
+namespace internal
+{
// static variables
#if deal_II_dimension == 2
-const unsigned int GridReorderingInfo<2>::rotational_states_of_cells;
-const unsigned int GridReorderingInfo<2>::rotational_states_of_faces;
+ const unsigned int GridReorderingInfo<2>::rotational_states_of_cells;
+ const unsigned int GridReorderingInfo<2>::rotational_states_of_faces;
#endif
#if deal_II_dimension == 3
-const unsigned int GridReorderingInfo<3>::rotational_states_of_cells;
-const unsigned int GridReorderingInfo<3>::rotational_states_of_faces;
+ const unsigned int GridReorderingInfo<3>::rotational_states_of_cells;
+ const unsigned int GridReorderingInfo<3>::rotational_states_of_faces;
#endif
-template <int dim>
-const unsigned int GridReordering<dim>::Cell::invalid_neighbor;
-
-template <int dim>
-const unsigned int GridReordering<dim>::FaceData::invalid_adjacent_cell;
+ template <int dim>
+ const unsigned int GridReordering<dim>::Cell::invalid_neighbor;
+ template <int dim>
+ const unsigned int GridReordering<dim>::FaceData::invalid_adjacent_cell;
+}
cell_no(c.cell_no),
track_back_to_cell(c.track_back_to_cell)
{
- for (unsigned int i=0; i<GridReorderingInfo<dim>::rotational_states_of_cells; ++i)
+ for (unsigned int i=0; i<internal::GridReorderingInfo<dim>::rotational_states_of_cells; ++i)
for (unsigned int j=0; j<GeometryInfo<dim>::faces_per_cell; ++j)
faces[i][j]=c.faces[i][j];
this->vertices[6], this->vertices[7] } },
{ { this->vertices[0], this->vertices[4],
this->vertices[7], this->vertices[3] } } };
- Face new_faces[GeometryInfo<dim>::faces_per_cell][GridReorderingInfo<dim>::rotational_states_of_faces]
+ Face new_faces[GeometryInfo<dim>::faces_per_cell][internal::GridReorderingInfo<dim>::rotational_states_of_faces]
= { { new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0],
new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0] },
{ new_faces_tmp[1], new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0],
// first do the faces in their
// usual direction
for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
- for (unsigned int rot=1; rot<GridReorderingInfo<dim>::rotational_states_of_faces/2; ++rot)
+ for (unsigned int rot=1; rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces/2; ++rot)
for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
new_faces[face][rot].vertices[v]
= new_faces[face][0].vertices[(v+rot) % GeometryInfo<dim>::vertices_per_face];
// as we only have to revert
// indices 1 and 3
for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
- for (unsigned int rot=GridReorderingInfo<dim>::rotational_states_of_faces/2;
- rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+ for (unsigned int rot=internal::GridReorderingInfo<dim>::rotational_states_of_faces/2;
+ rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
++rot)
{
for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
new_faces[face][rot].vertices[v]
= new_faces[face]
- [rot-GridReorderingInfo<dim>::rotational_states_of_faces/2].vertices[v];
+ [rot-internal::GridReorderingInfo<dim>::rotational_states_of_faces/2].vertices[v];
std::swap (new_faces[face][rot].vertices[1],
new_faces[face][rot].vertices[3]);
};
// it or not. we don't care about
// that here, though
std::map<Face,FaceData>::iterator
- new_faces_ptr[GridReorderingInfo<dim>::rotational_states_of_faces]
+ new_faces_ptr[internal::GridReorderingInfo<dim>::rotational_states_of_faces]
[GeometryInfo<dim>::faces_per_cell];
for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
for (unsigned int rot=0;
- rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+ rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
++rot)
new_faces_ptr[rot][face]
= global_faces.insert (std::make_pair(new_faces[face][rot], FaceData())).first;
// and crosslink them to each other
for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
for (unsigned int rot=0;
- rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+ rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
++rot)
for (unsigned int other_rot=0;
- other_rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+ other_rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
++other_rot)
{
if (other_rot < rot)
// used before, so we are the
// first adjacent cell
for (unsigned int rot=0;
- rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+ rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
++rot)
{
Assert (new_faces_ptr[rot][face]->second.adjacent_cells[0]
previous_neighbor = new_faces_ptr[0][face]->second.adjacent_cells[0];
// cout << " as neighbor 1 (previous: " << previous_neighbor << ")" << endl;
for (unsigned int rot=0;
- rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+ rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
++rot)
{
Assert (new_faces_ptr[rot][face]->second.adjacent_cells[0] ==
// cell (store which face and which
// orientation):
static std::pair<unsigned int, unsigned int>
- cell_orientation_faces[GridReorderingInfo<dim>::rotational_states_of_cells][GeometryInfo<dim>::faces_per_cell];
+ cell_orientation_faces[internal::GridReorderingInfo<dim>::rotational_states_of_cells][GeometryInfo<dim>::faces_per_cell];
if (already_initialized == false)
{
- for (unsigned int rot=0; rot<GridReorderingInfo<dim>::rotational_states_of_cells; ++rot)
+ for (unsigned int rot=0; rot<internal::GridReorderingInfo<dim>::rotational_states_of_cells; ++rot)
{
// initialize a standard
// cell with the vertex
for (unsigned int f=0;
(!face_found) && (f<GeometryInfo<dim>::faces_per_cell); ++f)
for (unsigned int r=0;
- r<GridReorderingInfo<dim>::rotational_states_of_faces;
+ r<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
++r)
if (standard_faces[face] == new_faces[f][r])
{
// directions to the cell in each
// of its orientations
for (unsigned int rot=0;
- rot<GridReorderingInfo<dim>::rotational_states_of_cells;
+ rot<internal::GridReorderingInfo<dim>::rotational_states_of_cells;
++rot)
for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
faces[rot][face] = new_faces_ptr
const FaceData &face = faces[rot][face_no]->second;
for (unsigned int face_rot=0;
- face_rot<GridReorderingInfo<dim>::rotational_states_of_faces-1;
+ face_rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces-1;
++face_rot)
{
const FaceData &reverse_face = face.reverse_faces[face_rot]->second;
// stack
rotation_states.pop_back();
};
- Assert (last_rotation_state < GridReorderingInfo<dim>::rotational_states_of_cells, ExcInternalError());
+ Assert (last_rotation_state < internal::GridReorderingInfo<dim>::rotational_states_of_cells, ExcInternalError());
// now we will have to find out
// whether we can try the last cell
// we have popped from the stack in
// another rotation state, or will
// have to backtrack further:
- if (last_rotation_state < GridReorderingInfo<dim>::rotational_states_of_cells-1)
+ if (last_rotation_state < internal::GridReorderingInfo<dim>::rotational_states_of_cells-1)
{
// possible. push that state to
// the stack and leave
// that have already been
// tried:
for (unsigned int neighbor_rot=old_rotation_state+1;
- neighbor_rot<GridReorderingInfo<dim>::rotational_states_of_cells; ++neighbor_rot)
+ neighbor_rot<internal::GridReorderingInfo<dim>::rotational_states_of_cells; ++neighbor_rot)
{
// first, if the
// neighbor itself does
// orientation
cells[neighbor_no].mark_faces_used (neighbor_rot);
- for (unsigned int cell_rot=0; cell_rot<GridReorderingInfo<dim>::rotational_states_of_cells; ++cell_rot)
+ for (unsigned int cell_rot=0; cell_rot<internal::GridReorderingInfo<dim>::rotational_states_of_cells; ++cell_rot)
if (cells[cell_no].check_consistency (cell_rot) == true)
{
// ah, see,
// we can rotate the top
// cell so that it works
if (rotation_states.back()+1
- < GridReorderingInfo<dim>::rotational_states_of_cells)
+ < internal::GridReorderingInfo<dim>::rotational_states_of_cells)
{
// yes, can be
// done. then do so and