*/
void reinit (const IndexSet & local_constraints = IndexSet());
+
+ /**
+ * This function copies the content of @p
+ * constraints_in with DoFs that are
+ * element of the IndexSet @p
+ * filter. Constrained dofs are
+ * transformed to local index space of
+ * the filter, and elements not present
+ * in the IndexSet are ignored.
+ *
+ * This function provides an easy way to
+ * create a ConstraintMatrix for certain
+ * vector components in a vector-valued
+ * problem from a full ConstraintMatrix,
+ * i.e. extracting a diagonal subblock
+ * from a larger ConstraintMatrix. The
+ * block is specified by the IndexSet
+ * argument.
+ */
+ void add_selected_constraints (const ConstraintMatrix &constraints_in,
+ const IndexSet &filter);
+
/**
* @name Adding constraints
* @{
// $Id$
// Version: $Name$
//
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 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
}
}
}
- else if (i>=column_start && i<column_end) // case 2: can rewrite loop
+ else if (i>=column_start && i<column_end) // case 2: can split loop
{
if (global_rows.have_indirect_rows() == false)
{
+void ConstraintMatrix::add_selected_constraints
+ (const ConstraintMatrix &constraints,
+ const IndexSet &filter)
+{
+ Assert (filter.size() > constraints.lines.back().line,
+ ExcMessage ("Filter needs to be larger than constraint matrix size."));
+ for (std::vector<ConstraintLine>::const_iterator line=constraints.lines.begin();
+ line!=constraints.lines.end(); ++line)
+ if (filter.is_element(line->line))
+ {
+ const unsigned int row = filter.index_within_set (line->line);
+ add_line (row);
+ set_inhomogeneity (row, line->inhomogeneity);
+ for (unsigned int i=0; i<line->entries.size(); ++i)
+ if (filter.is_element(line->entries[i].first))
+ add_entry (row, filter.index_within_set (line->entries[i].first),
+ line->entries[i].second);
+ }
+}
+
+
+
void ConstraintMatrix::close ()
{
if (sorted == true)