<h3>Specific improvements</h3>
<ol>
+ <li> New: There are now functions Triangulation::has_hanging_nodes()
+ and parallel::distributed::Triangulation::has_hanging_nodes().
+ <br>
+ (Denis Davydov, 2014/06/15)
+ </li>
+
<li> New: There is now a class FEEvaluationQ_DG0 that does
optimized matrix-free evaluation for FE_Q_DG0 elements.
<br>
// ---------------------------------------------------------------------
// $Id$
//
-// Copyright (C) 2008 - 2013 by the deal.II authors
+// Copyright (C) 2008 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
*/
virtual unsigned int n_global_levels () const;
+ /**
+ * Returns true if the triangulation has hanging nodes.
+ *
+ * In the context of parallel distributed triangulations, every
+ * processor stores only that part of the triangulation it
+ * locally owns. However, it also stores the entire coarse
+ * mesh, and to guarantee the 2:1 relationship between cells,
+ * this may mean that there are hanging nodes between cells that
+ * are not locally owned or ghost cells (i.e., between ghost cells
+ * and artificial cells, or between artificial and artificial cells;
+ * see @ref GlossArtificialCell "the glossary").
+ * One is not typically interested in this case, so the function
+ * returns whether there are hanging nodes between any two cells
+ * of the "global" mesh, i.e., the union of locally owned cells
+ * on all processors.
+ */
+ virtual
+ bool has_hanging_nodes() const;
+
/**
* Return the number of active cells owned by each of the MPI
* processes that contribute to this triangulation. The element
// ---------------------------------------------------------------------
// $Id$
//
-// Copyright (C) 1998 - 2013 by the deal.II authors
+// Copyright (C) 1998 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
* n_levels() over all processors for a parallel::distributed::Triangulation
* and therefore can be larger than n_levels().
*/
- virtual unsigned int n_global_levels () const;
+ virtual
+ unsigned int n_global_levels () const;
+
+ /**
+ * Return true if the triangulation has hanging nodes.
+ *
+ * The function is made virtual since the result can be interpreted in different
+ * ways, depending on whether the triangulation lives only on a single processor,
+ * or may be distributed as done in the parallel::distributed::Triangulation
+ * class (see there for a description of what the function is supposed to do in the
+ * parallel context).
+ */
+ virtual
+ bool has_hanging_nodes() const;
/**
* Return the total number of
// ---------------------------------------------------------------------
// $Id$
//
-// Copyright (C) 2008 - 2013 by the deal.II authors
+// Copyright (C) 2008 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
update_number_cache ();
}
+ template <int dim, int spacedim>
+ bool
+ Triangulation<dim,spacedim>::has_hanging_nodes () const
+ {
+ // if there are any active cells with level less than n_global_levels()-1, then
+ // there is obviously also one with level n_global_levels()-1, and
+ // consequently there must be a hanging node somewhere.
+ //
+ // the problem is that we cannot just ask for the first active cell, but
+ // instead need to filter over locally owned cells
+ bool res_local = false;
+ for (typename Triangulation<dim, spacedim>::active_cell_iterator cell = this->begin_active();
+ (cell != this->end()) && (cell->level() < (int)(n_global_levels()-1));
+ cell++)
+ if (cell->is_locally_owned())
+ {
+ res_local = true;
+ break;
+ }
+
+ // reduce over MPI
+ bool res;
+ MPI_Allreduce(&res_local, &res, 1, MPI::BOOL, MPI_LOR, mpi_communicator);
+ return res;
+ }
+
template <int dim, int spacedim>
}
+template <int dim, int spacedim>
+bool Triangulation<dim, spacedim>::has_hanging_nodes () const
+{
+ for (unsigned int lvl = 0; lvl<n_global_levels()-1;lvl++)
+ if (n_active_cells(lvl) != 0)
+ return true;
+
+ return false;
+}
+
template <int dim, int spacedim>
unsigned int Triangulation<dim, spacedim>::n_lines () const