// $Id$
// Version: $Name$
//
-// Copyright (C) 2009 by the deal.II authors
+// Copyright (C) 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
/**
* @brief Fill the object with values
* describing level block
- * structure of the MGDoFHandler.
+ * structure of the
+ * MGDoFHandler. If
+ * <tt>levels_only</tt> is false,
+ * the other initialize() is
+ * called as well.
*
* This function will also clear
* the local() indices.
*/
template <int dim, int spacedim>
- void initialize(const MGDoFHandler<dim, spacedim>&);
+ void initialize(const MGDoFHandler<dim, spacedim>&, bool levels_only = false);
/**
* @brief Initialize block structure
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <base/config.h>
#include <base/exceptions.h>
#include <base/smartpointer.h>
+#include <dofs/block_info.h>
#include <dofs/dof_iterator_selector.h>
#include <dofs/function_map.h>
virtual void distribute_dofs (const FiniteElement<dim,spacedim> &fe,
const unsigned int offset = 0);
+ /**
+ * After disatribute_dofs() with
+ * an FESystem element, the block
+ * structure of global and level
+ * vectors is stored in a
+ * BlockInfo object accessible
+ * with block_info(). This
+ * function initializes the local
+ * block structure on each cell
+ * in the same object.
+ */
+ void initialize_local_block_info();
+
/**
* Clear all data of this object and
* especially delete the lock this object
unsigned int
n_boundary_dofs (const std::set<unsigned char> &boundary_indicators) const;
+ /**
+ * Access to an object informing
+ * of the block structure of the
+ * dof handler.
+ *
+ * If an FESystem is used in
+ * distribute_dofs(), degrees ofd
+ * freedom naturally split into
+ * several @ref GlossBlock
+ * blocks. For each base element
+ * as many blocks appear as its
+ * multiplicity.
+ *
+ * At the end of
+ * distribute_dofs(), the number
+ * of degrees of freedom in each
+ * block is counted, and stored
+ * in a BlockInfo object, which
+ * can be accessed here. In an
+ * MGDoFHandler, the same is done
+ * on each level. Additionally,
+ * the block structure on each
+ * cell can be generated in this
+ * object by calling
+ * initialize_local_block_indices().
+ */
+ const BlockInfo& block_info() const;
+
/**
* Return a constant reference to
* the selected finite element
*/
DeclException0 (ExcInvalidTriangulation);
/**
- * Exception
+ * No finite element has been
+ * assigned to this
+ * DoFHandler. Call the function
+ * DoFHandler::distribute_dofs()
+ * before you attemped to do what
+ * raised this exception.
*/
DeclException0 (ExcNoFESelected);
/**
- * Exception
+ * @todo Replace by ExcInternalError.
*/
DeclException0 (ExcRenumberingIncomplete);
/**
* this object as well, though).
*/
SmartPointer<const FiniteElement<dim,spacedim>,DoFHandler<dim,spacedim> > selected_fe;
-
+
+ BlockInfo block_info_object;
private:
/**
}
+template <int dim, int spacedim>
+inline
+const BlockInfo&
+DoFHandler<dim,spacedim>::block_info () const
+{
+ return block_info_object;
+}
+
+
#endif // DOXYGEN
template <int dim, int spacedim>
void
-BlockInfo::initialize(const MGDoFHandler<dim, spacedim>& dof)
+BlockInfo::initialize(const MGDoFHandler<dim, spacedim>& dof, bool levels_only)
{
- initialize((DoFHandler<dim, spacedim>&) dof);
+ if (!levels_only)
+ initialize((DoFHandler<dim, spacedim>&) dof);
std::vector<std::vector<unsigned int> > sizes (dof.get_tria().n_levels());
for (unsigned int i=0; i<sizes.size(); ++i)
template void BlockInfo::initialize(const DoFHandler<deal_II_dimension,deal_II_dimension>&);
-template void BlockInfo::initialize(const MGDoFHandler<deal_II_dimension,deal_II_dimension>&);
+template void BlockInfo::initialize(const MGDoFHandler<deal_II_dimension,deal_II_dimension>&, bool);
template void BlockInfo::initialize_local(const DoFHandler<deal_II_dimension,deal_II_dimension>&);
+#if deal_II_dimension==1 || deal_II_dimension==2
+template void BlockInfo::initialize(const DoFHandler<deal_II_dimension,deal_II_dimension+1>&);
+template void BlockInfo::initialize(const MGDoFHandler<deal_II_dimension,deal_II_dimension+1>&, bool);
+template void BlockInfo::initialize_local(const DoFHandler<deal_II_dimension,deal_II_dimension+1>&);
+#endif
+
DEAL_II_NAMESPACE_CLOSE
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// finally restore the user flags
const_cast<Triangulation<dim,spacedim> &>(*tria).load_user_flags(user_flags);
+
+ block_info_object.initialize(*this);
}
+template<int dim, int spacedim>
+void DoFHandler<dim,spacedim>::initialize_local_block_info ()
+{
+ block_info_object.initialize_local(*this);
+}
+
template<int dim, int spacedim>
void DoFHandler<dim,spacedim>::clear ()
std::vector<unsigned int>&, bool, std::vector<unsigned int>);
#if deal_II_dimension < 3
+template void DoFTools::extract_level_dofs<deal_II_dimension, deal_II_dimension+1>
+(const unsigned int level, const MGDoFHandler<deal_II_dimension, deal_II_dimension+1>&,
+ const std::vector<bool>&, std::vector<bool>&, bool);
+
template
void
DoFTools::count_dofs_per_component<deal_II_dimension, deal_II_dimension+1> (
const DoFHandler<deal_II_dimension, deal_II_dimension+1>&,
std::vector<Point<deal_II_dimension+1> >&);
+template
+void
+DoFTools::count_dofs_per_block<deal_II_dimension,deal_II_dimension+1> (
+ const DoFHandler<deal_II_dimension,deal_II_dimension+1>&,
+ std::vector<unsigned int>&, std::vector<unsigned int>);
+
#endif
template
// $Id$
// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#if deal_II_dimension != 3
template
+void FETools::compute_block_renumbering (
+ const FiniteElement<deal_II_dimension,deal_II_dimension+1>& element,
+ std::vector<unsigned int>&, std::vector<unsigned int>&_indices, bool);
+template
void FETools::interpolate<deal_II_dimension,deal_II_dimension+1>
(const DoFHandler<deal_II_dimension,deal_II_dimension+1> &, const Vector<double> &,
const DoFHandler<deal_II_dimension,deal_II_dimension+1> &, Vector<double> &);
// finally restore the user flags
const_cast<Triangulation<dim,spacedim> &>(*(this->tria))
.load_user_flags(user_flags);
+
+ this->block_info_object.initialize(*this, true);
}
std::vector<std::vector<unsigned int> >& dofs_per_block,
std::vector<unsigned int> target_block)
{
- const FiniteElement<dim>& fe = dof_handler.get_fe();
+ const FiniteElement<dim,spacedim>& fe = dof_handler.get_fe();
const unsigned int n_blocks = fe.n_blocks();
const unsigned int n_levels = dof_handler.get_tria().n_levels();
extract_inner_interface_dofs (const MGDoFHandler<deal_II_dimension> &mg_dof_handler,
std::vector<std::vector<bool> > &interface_dofs);
+#if deal_II_dimension < 3
+
+template void MGTools::count_dofs_per_block<deal_II_dimension,deal_II_dimension+1> (
+ const MGDoFHandler<deal_II_dimension,deal_II_dimension+1>&,
+ std::vector<std::vector<unsigned int> >&, std::vector<unsigned int>);
+
+#endif
+
DEAL_II_NAMESPACE_CLOSE
<h3>deal.II</h3>
<ol>
+
+<li><p> Improved: DoFHandler now has a BlockInfo object, automatically updated after DoFHandler::distribute_dofs() and accessible by DoFHandler::block_info(). This object can be used to initialize block vectors and obliterates the necessity to count dofs per block (or dofs per component in legacy code) in application programs.
+<br>
+(GK 2010/03/18)
+</p>
+</li>
+
<li>
<p>
New: The class MGTransferSelect is prepared for use on adaptively refined meshes.