/**
* Return total number of used faces,
- * active or not.
- * Maps to <tt>n_lines()</tt> in two space
- * dimensions and so on.
+ * active or not. In 2d, the result
+ * equals n_lines(), while in 3d it
+ * equals n_quads(). Since there are no
+ * face objects in 1d, the function
+ * returns zero in 1d.
*/
unsigned int n_faces () const;
/**
- * Return total number of active faces.
- * Maps to <tt>n_active_lines()</tt> in two space
- * dimensions and so on.
+ * Return total number of active faces,
+ * active or not. In 2d, the result
+ * equals n_active_lines(), while in 3d
+ * it equals n_active_quads(). Since
+ * there are no face objects in 1d, the
+ * function returns zero in 1d.
*/
unsigned int n_active_faces () const;
template <> Triangulation<3>::face_iterator Triangulation<3>::last_face () const;
template <> Triangulation<3>::active_face_iterator Triangulation<3>::last_active_face () const;
template <> Triangulation<3>::raw_quad_iterator Triangulation<3>::begin_raw_quad (const unsigned int level) const;
-template <> unsigned int Triangulation<1>::n_raw_cells (const unsigned int level) const;
-template <> unsigned int Triangulation<1>::n_cells (const unsigned int level) const;
-template <> unsigned int Triangulation<1>::n_active_cells (const unsigned int level) const;
-template <> unsigned int Triangulation<2>::n_raw_cells (const unsigned int level) const;
-template <> unsigned int Triangulation<2>::n_cells (const unsigned int level) const;
-template <> unsigned int Triangulation<2>::n_active_cells (const unsigned int level) const;
-template <> unsigned int Triangulation<3>::n_raw_cells (const unsigned int level) const;
-template <> unsigned int Triangulation<3>::n_cells (const unsigned int level) const;
-template <> unsigned int Triangulation<3>::n_active_cells (const unsigned int level) const;
template <> unsigned int Triangulation<1>::n_raw_lines (const unsigned int level) const;
template <> unsigned int Triangulation<1>::n_quads () const;
template <> unsigned int Triangulation<1>::n_quads (const unsigned int level) const;
template <int dim>
unsigned int Triangulation<dim>::n_faces () const
{
- Assert (dim<=3, ExcNotImplemented());
- if (dim==2) return n_lines();
- if (dim==3) return n_quads();
+ switch (dim)
+ {
+ case 1:
+ return 0;
+ case 2:
+ return n_lines();
+ case 3:
+ return n_quads();
+ default:
+ Assert (false, ExcNotImplemented());
+ }
return 0;
}
template <int dim>
unsigned int Triangulation<dim>::n_active_faces () const
{
- Assert (dim<=3, ExcNotImplemented());
- if (dim==2) return n_active_lines();
- if (dim==3) return n_active_quads();
+ switch (dim)
+ {
+ case 1:
+ return 0;
+ case 2:
+ return n_active_lines();
+ case 3:
+ return n_active_quads();
+ default:
+ Assert (false, ExcNotImplemented());
+ }
return 0;
}
-//TODO:[GK] Implement this like above and remove specialization declaration in tria.h
-//TODO:[GK] Add a remark to Triangulation doc telling 1d-Triangulations have no face
-
-#if deal_II_dimension == 1
-
-template <>
-unsigned int Triangulation<1>::n_raw_cells (const unsigned int level) const
-{
- return n_raw_lines (level);
-}
-
-template <>
-unsigned int Triangulation<1>::n_cells (const unsigned int level) const
-{
- return n_lines (level);
-}
-
-
-template <>
-unsigned int Triangulation<1>::n_active_cells (const unsigned int level) const
-{
- return n_active_lines (level);
-}
-
-
-#endif
-
-
-#if deal_II_dimension == 2
-
-template <>
-unsigned int Triangulation<2>::n_raw_cells (const unsigned int level) const
-{
- return n_raw_quads (level);
-}
-
-
-template <>
-unsigned int Triangulation<2>::n_cells (const unsigned int level) const
-{
- return n_quads (level);
-}
-
-
-template <>
-unsigned int Triangulation<2>::n_active_cells (const unsigned int level) const
+template <int dim>
+unsigned int Triangulation<dim>::n_raw_cells (const unsigned int level) const
{
- return n_active_quads (level);
+ switch (dim)
+ {
+ case 1:
+ return n_raw_lines(level);
+ case 2:
+ return n_raw_quads(level);
+ case 3:
+ return n_raw_hexs(level);
+ default:
+ Assert (false, ExcNotImplemented());
+ }
+ return 0;
}
-#endif
-
-#if deal_II_dimension == 3
-template <>
-unsigned int Triangulation<3>::n_raw_cells (const unsigned int level) const
+template <int dim>
+unsigned int Triangulation<dim>::n_cells (const unsigned int level) const
{
- return n_raw_hexs (level);
+ switch (dim)
+ {
+ case 1:
+ return n_lines(level);
+ case 2:
+ return n_quads(level);
+ case 3:
+ return n_hexs(level);
+ default:
+ Assert (false, ExcNotImplemented());
+ }
+ return 0;
}
-template <>
-unsigned int Triangulation<3>::n_cells (const unsigned int level) const
-{
- return n_hexs (level);
-}
-
-template <>
-unsigned int Triangulation<3>::n_active_cells (const unsigned int level) const
+template <int dim>
+unsigned int Triangulation<dim>::n_active_cells (const unsigned int level) const
{
- return n_active_hexs (level);
+ switch (dim)
+ {
+ case 1:
+ return n_active_lines(level);
+ case 2:
+ return n_active_quads(level);
+ case 3:
+ return n_active_hexs(level);
+ default:
+ Assert (false, ExcNotImplemented());
+ }
+ return 0;
}
-#endif
template <int dim>