template <int dim>
void
- hierarchic_to_lexicographic_numbering (const FiniteElementData<dim> &fe,
- std::vector<unsigned int> &h2l)
- {
- Assert (h2l.size() == fe.dofs_per_cell,
- ExcDimensionMismatch (h2l.size(), fe.dofs_per_cell));
- h2l = hierarchic_to_lexicographic_numbering (fe);
- }
-
-
-
- template <int dim>
- std::vector<unsigned int>
- hierarchic_to_lexicographic_numbering (const FiniteElementData<dim> &fe)
+ hierarchic_to_lexicographic_numbering (unsigned int degree, std::vector<unsigned int>& h2l)
{
- Assert (fe.n_components() == 1, ExcInvalidFE());
-
- std::vector<unsigned int> h2l (fe.dofs_per_cell);
-
- const unsigned int dofs_per_cell = fe.dofs_per_cell;
- // polynomial degree
- const unsigned int degree = fe.dofs_per_line+1;
- // number of grid points in each
+ // number of support points in each
// direction
const unsigned int n = degree+1;
+
+ unsigned int dofs_per_cell = n;
+ for (unsigned int i=1;i<dim;++i)
+ dofs_per_cell *= n;
+
+ // Assert size maches degree
+ AssertDimension (h2l.size(), dofs_per_cell);
+
+ // polynomial degree
+ const unsigned int dofs_per_line = degree - 1;
// the following lines of code are
// somewhat odd, due to the way the
h2l[next_index++] = n*n-1;
// left line
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = (1+i)*n;
// right line
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = (2+i)*n-1;
// bottom line
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = 1+i;
// top line
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = n*(n-1)+i+1;
// inside quad
- Assert (fe.dofs_per_quad == fe.dofs_per_line*fe.dofs_per_line,
- ExcInternalError());
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
- for (unsigned int j=0; j<fe.dofs_per_line; ++j)
+ // Assert (fe.dofs_per_quad == fe.dofs_per_line*fe.dofs_per_line,
+ // ExcInternalError());
+ for (unsigned int i=0; i<dofs_per_line; ++i)
+ for (unsigned int j=0; j<dofs_per_line; ++j)
h2l[next_index++] = n*(i+1)+j+1;
- Assert (next_index == fe.dofs_per_cell, ExcInternalError());
+ Assert (next_index == dofs_per_cell, ExcInternalError());
break;
}
h2l[next_index++] = (n*n+n+1)*degree; // 7
// line 0
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = (i+1)*n;
// line 1
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = n-1+(i+1)*n;
// line 2
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = 1+i;
// line 3
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = 1+i+n*(n-1);
// line 4
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = (n-1)*n*n+(i+1)*n;
// line 5
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = (n-1)*(n*n+1)+(i+1)*n;
// line 6
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = n*n*(n-1)+i+1;
// line 7
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = n*n*(n-1)+i+1+n*(n-1);
// line 8
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = (i+1)*n*n;
// line 9
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = n-1+(i+1)*n*n;
// line 10
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = (i+1)*n*n+n*(n-1);
// line 11
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
h2l[next_index++] = n-1+(i+1)*n*n+n*(n-1);
// inside quads
- Assert (fe.dofs_per_quad == fe.dofs_per_line*fe.dofs_per_line,
- ExcInternalError());
+ // Assert (fe.dofs_per_quad == fe.dofs_per_line*fe.dofs_per_line,
+ // ExcInternalError());
// face 0
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
- for (unsigned int j=0; j<fe.dofs_per_line; ++j)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
+ for (unsigned int j=0; j<dofs_per_line; ++j)
h2l[next_index++] = (i+1)*n*n+n*(j+1);
// face 1
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
- for (unsigned int j=0; j<fe.dofs_per_line; ++j)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
+ for (unsigned int j=0; j<dofs_per_line; ++j)
h2l[next_index++] = (i+1)*n*n+n-1+n*(j+1);
// face 2, note the orientation!
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
- for (unsigned int j=0; j<fe.dofs_per_line; ++j)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
+ for (unsigned int j=0; j<dofs_per_line; ++j)
h2l[next_index++] = (j+1)*n*n+i+1;
// face 3, note the orientation!
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
- for (unsigned int j=0; j<fe.dofs_per_line; ++j)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
+ for (unsigned int j=0; j<dofs_per_line; ++j)
h2l[next_index++] = (j+1)*n*n+n*(n-1)+i+1;
// face 4
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
- for (unsigned int j=0; j<fe.dofs_per_line; ++j)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
+ for (unsigned int j=0; j<dofs_per_line; ++j)
h2l[next_index++] = n*(i+1)+j+1;
// face 5
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
- for (unsigned int j=0; j<fe.dofs_per_line; ++j)
+ for (unsigned int i=0; i<dofs_per_line; ++i)
+ for (unsigned int j=0; j<dofs_per_line; ++j)
h2l[next_index++] = (n-1)*n*n+n*(i+1)+j+1;
// inside hex
- Assert (fe.dofs_per_hex == fe.dofs_per_quad*fe.dofs_per_line,
- ExcInternalError());
- for (unsigned int i=0; i<fe.dofs_per_line; ++i)
- for (unsigned int j=0; j<fe.dofs_per_line; ++j)
- for (unsigned int k=0; k<fe.dofs_per_line; ++k)
+ // Assert (fe.dofs_per_hex == fe.dofs_per_quad*fe.dofs_per_line,
+ // ExcInternalError());
+ for (unsigned int i=0; i<dofs_per_line; ++i)
+ for (unsigned int j=0; j<dofs_per_line; ++j)
+ for (unsigned int k=0; k<dofs_per_line; ++k)
h2l[next_index++] = n*n*(i+1)+n*(j+1)+k+1;
- Assert (next_index == fe.dofs_per_cell, ExcInternalError());
+ Assert (next_index == dofs_per_cell, ExcInternalError());
break;
}
Assert (false, ExcNotImplemented());
}
- return h2l;
+ // return h2l;
}
+ template <int dim>
+ void
+ hierarchic_to_lexicographic_numbering (const FiniteElementData<dim> &fe,
+ std::vector<unsigned int> &h2l)
+ {
+ Assert (h2l.size() == fe.dofs_per_cell,
+ ExcDimensionMismatch (h2l.size(), fe.dofs_per_cell));
+ hierarchic_to_lexicographic_numbering (h21, fe.dofs_per_line+1);
+ }
+
+
+
+ template <int dim>
+ std::vector<unsigned int>
+ hierarchic_to_lexicographic_numbering (const FiniteElementData<dim> &fe)
+ {
+ Assert (fe.n_components() == 1, ExcInvalidFE());
+ std::vector<unsigned int> h2l(fe.dofs_per_cell);
+ hierarchic_to_lexicographic_numbering (h2l, fe.dofs_per_line+1);
+ return (h2l);
+ }
+
template <int dim>
void
lexicographic_to_hierarchic_numbering (const FiniteElementData<dim> &fe,