// $Id$
// Version: $Name$
//
-// Copyright (C) 2005, 2006, 2007, 2008 by the deal.II authors
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* Go through the triangulation and
* distribute the degrees of freedoms
* needed for the given finite element
- * according to the given distribution
- * method.
+ * according to the current distribution
+ * of active fe indices.
*
* A pointer of the transferred
* finite element is
*/
virtual void distribute_dofs (const hp::FECollection<dim,spacedim> &fe);
+ /**
+ * Go through the triangulation and set
+ * the active FE indices of all active
+ * cells to the values given in @p
+ * active_fe_indices.
+ */
+ void set_active_fe_indices (const std::vector<unsigned int>& active_fe_indices);
+
+ /**
+ * Go through the triangulation and
+ * store the active FE indices of all
+ * active cells to the vector @p
+ * active_fe_indices. This vector is
+ * resized, if necessary.
+ */
+ void get_active_fe_indices (std::vector<unsigned int>& active_fe_indices) const;
+
/**
* Clear all data of this object and
* especially delete the lock this object
* Store the number of dofs
* created last time.
*/
- unsigned int used_dofs;
+ unsigned int used_dofs;
/**
* Array to store the indices
}
}
+
+
+ template <int dim, int spacedim>
+ void DoFHandler<dim,spacedim>::set_active_fe_indices (const std::vector<unsigned int>& active_fe_indices)
+ {
+ Assert(active_fe_indices.size()==get_tria().n_active_cells(),
+ ExcDimensionMismatch(active_fe_indices.size(), get_tria().n_active_cells()));
+
+ create_active_fe_table ();
+ // we could set the values directly, since
+ // they are stored as protected data of
+ // this object, but for simplicity we use
+ // the cell-wise access. this way we also
+ // have to pass some debug-mode tests which
+ // we would have to duplicate ourselves
+ // otherwise
+ active_cell_iterator cell=begin_active(),
+ endc=end();
+ for (unsigned int i=0; cell!=endc; ++cell, ++i)
+ cell->set_active_fe_index(active_fe_indices[i]);
+ }
+
+
+
+ template <int dim, int spacedim>
+ void DoFHandler<dim,spacedim>::get_active_fe_indices (std::vector<unsigned int>& active_fe_indices) const
+ {
+ active_fe_indices.resize(get_tria().n_active_cells());
+
+ // we could try to extract the values directly, since
+ // they are stored as protected data of
+ // this object, but for simplicity we use
+ // the cell-wise access.
+ active_cell_iterator cell=begin_active(),
+ endc=end();
+ for (unsigned int i=0; cell!=endc; ++cell, ++i)
+ active_fe_indices[i]=cell->active_fe_index();
+ }
<h3>deal.II</h3>
<ol>
+ <li>
+ <p>
+ New: The new hp::DoFHandler::set_active_fe_indices function allows
+ to distribute all active FE indices at once based on a given
+ vector. This might be useful if this information is stored
+ somewhere and has to be reconstructed or else if two DoFHandler
+ objects with the same FE index distribution should be created.
+ There is now also a corresponding
+ hp::DoFHandler::get_active_fe_indices function.
+ <br>
+ (Tobias Leicht, RH 2009/06/12)
+ </p>
+ </li>
+
<li>
<p>
Fix: The projection of quadrature points to subfaces in