// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* The boolean field @p selected
* allows restricting this
* operation to certain
- * components. In this case,
- * @p vector will only have as
- * many blocks as there are true
+ * components. In this case, @p
+ * vector will only have as many
+ * blocks as there are true
* values in @p selected (no
* blocks of length zero are
- * padded in).
+ * padded in). If this argument
+ * is omitted, all blocks will be
+ * considered.
*
* Degrees of freedom must be
* sorted by component in order
*
* The argument
* @p target_component allows to
- * re-sort and groupt components
+ * re-sort and group components
* as in
- * @p DoFRenumbering::component_wise.
+ * DoFRenumbering::component_wise.
+ *
+ *
*/
template <int dim, typename number>
static void
reinit_vector (const MGDoFHandler<dim>& mg_dof,
MGLevelObject<BlockVector<number> >& v,
- const std::vector<bool>& selected,
- const std::vector<unsigned int>& target_component);
+ const std::vector<bool> selected = std::vector<bool>(),
+ const std::vector<unsigned int> target_component
+ = std::vector<unsigned int>());
/**
* Adjust vectors on all levels
* to correct size. Count the
* @p target_component allows to
* re-sort and groupt components
* as in
- * @p DoFRenumbering::component_wise.
+ * DoFRenumbering::component_wise.
*/
template <int dim, typename number>
static void
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
void
MGTools::reinit_vector (const MGDoFHandler<dim>& mg_dof,
MGLevelObject<BlockVector<number> >& v,
- const std::vector<bool>& selected_in,
- const std::vector<unsigned int>& target_component)
+ std::vector<bool> selected,
+ std::vector<unsigned int> target_component)
{
- // Copy selection vector to
- // non-const since we may want to
- // do some manipulations.
- std::vector<bool> selected = selected_in;
-
const unsigned int ncomp = mg_dof.get_fe().n_components();
-
+
+ // If the selected and
+ // target_component have size 0,
+ // they must be replaced by default
+ // values.
+ //
+ // Since we already made copies
+ // when this function was called,
+ // we use the arguments directly.
+ if (target_component.size() == 0)
+ {
+ target_component.resize(ncomp);
+ for (unsigned int i=0;i<ncomp;++i)
+ target_component[i] = i;
+ }
+
// If selected is an empty vector,
// all components are selected.
if (selected.size() == 0)
template void MGTools::reinit_vector<deal_II_dimension> (
const MGDoFHandler<deal_II_dimension>&,
MGLevelObject<BlockVector<double> >&,
- const std::vector<bool>&,
- const std::vector<unsigned int>&);
+ const std::vector<bool>,
+ const std::vector<unsigned int>);
template void MGTools::reinit_vector<deal_II_dimension> (
const MGDoFHandler<deal_II_dimension>&,
MGLevelObject<BlockVector<float> >&,
- const std::vector<bool>&,
- const std::vector<unsigned int>&);
+ const std::vector<bool>,
+ const std::vector<unsigned int>);
template void MGTools::reinit_vector<deal_II_dimension> (
const MGDoFHandler<deal_II_dimension>&,