class CompressedSparsityPattern;
class CompressedSetSparsityPattern;
class BlockSparsityPattern;
-class CompressedBlockSparsityPattern;
+class BlockCompressedSparsityPattern;
+class BlockCompressedSetSparsityPattern;
template <typename number> class SparseMatrix;
template <typename number> class BlockSparseMatrix;
class BlockIndices;
*/
void condense (CompressedSetSparsityPattern &sparsity) const;
- void condense_fast (CompressedSparsityPattern &sparsity) const;
-
/**
* Same function as above, but
* condenses square compressed
* sparsity patterns.
*/
- void condense (CompressedBlockSparsityPattern &sparsity) const;
+ void condense (BlockCompressedSparsityPattern &sparsity) const;
+ /**
+ * Same function as above, but
+ * condenses square compressed
+ * sparsity patterns.
+ */
+ void condense (BlockCompressedSetSparsityPattern &sparsity) const;
+
/**
* Condense a given matrix. The associated
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* on the finite element and the maximum
* number of cells meeting at a vertex.
* The number holds for the constrained
- * matrix also.
+ * matrix as well.
*
* The determination of the number of
* couplings can be done by simple
* found in the implementation of this
* function.
*
- * Note that this function is
- * most often used to determine
- * the maximal row length for
- * sparsity
- * patterns. Unfortunately, the
- * while the estimates returned
- * by this function are rather
- * accurate in 1d and 2d, they
- * are often significantly too
- * high in 3d, leading the
- * SparsityPattern class to
- * allocate much too much memory
- * in some cases. Unless someone
- * comes around to improving the
- * present function for 3d, there
- * is not very much one can do
- * about these cases. The typical
- * way to work around this
- * problem is to use an
- * intermediate compressed
- * sparsity pattern that only
- * allocates memory on
- * demand. Refer to the @ref
- * step_11 "step-11" example
- * program on how to do this.
+ * Note that this function is most often
+ * used to determine the maximal row
+ * length for sparsity
+ * patterns. Unfortunately, while the
+ * estimates returned by this function
+ * are rather accurate in 1d and 2d, they
+ * are often significantly too high in
+ * 3d, leading the SparsityPattern class
+ * to allocate much too much memory in
+ * some cases. Unless someone comes
+ * around to improving the present
+ * function for 3d, there is not very
+ * much one can do about these cases. The
+ * typical way to work around this
+ * problem is to use an intermediate
+ * compressed sparsity pattern that only
+ * allocates memory on demand. Refer to
+ * the @ref step_11 "step-11" example
+ * program on how to do this. The problem
+ * is also discussed in the documentation
+ * of the module on @ref Sparsity.
*/
unsigned int max_couplings_between_dofs () const;
* SparsityPattern,
* CompressedSparsityPattern,
* BlockSparsityPattern,
- * CompressedBlockSparsityPattern,
+ * BlockCompressedSparsityPattern,
+ * BlockCompressedSetSparsityPattern,
* or any other class that
* satisfies similar
* requirements. It is assumed
* SparsityPattern,
* CompressedSparsityPattern,
* BlockSparsityPattern,
- * CompressedBlockSparsityPattern,
+ * BlockCompressedSparsityPattern,
+ * BlockCompressedSetSparsityPattern,
* or any other class that
* satisfies similar
* requirements.
* pattern may be SparsityPattern,
* CompressedSparsityPattern,
* BlockSparsityPattern,
- * CompressedBlockSparsityPattern, or any
- * other class that satisfies similar
+ * BlockCompressedSparsityPattern,
+ * BlockCompressedSetSparsityPattern, or
+ * any other class that satisfies similar
* requirements. It is assumed that the
* size of the sparsity pattern is
* already correct.
* The number holds for the constrained
* matrix also.
*
- * The determination of the number of
- * couplings can be done by simple
- * picture drawing. An example can be
- * found in the implementation of this
- * function.
+ * As for
+ * DoFHandler::max_couplings_between_dofs(),
+ * the result of this function is often
+ * not very accurate for 3d and/or high
+ * polynomial degrees. The consequences
+ * are discussed in the documentation
+ * of the module on @ref Sparsity.
*/
unsigned int max_couplings_between_dofs () const;
}
-
-void ConstraintMatrix::condense_fast (CompressedSparsityPattern &sparsity) const
-{
- /*
- Assert (sorted == true, ExcMatrixNotClosed());
- Assert (sparsity.n_rows() == sparsity.n_cols(),
- ExcNotQuadratic());
-
- // store for each index whether it must be
- // distributed or not. If entry is
- // deal_II_numbers::invalid_unsigned_int,
- // no distribution is necessary.
- // otherwise, the number states which line
- // in the constraint matrix handles this
- // index
- std::vector<unsigned int> distribute(sparsity.n_rows(),
- deal_II_numbers::invalid_unsigned_int);
-
- for (unsigned int c=0; c<lines.size(); ++c)
- distribute[lines[c].line] = c;
-
- const unsigned int n_rows = sparsity.n_rows();
- for (unsigned int row=0; row<n_rows; ++row)
- {
- // First copy entries to local cache data structure;
- std::set<unsigned int> row_cache;
- for (unsigned int j=0; j<sparsity.row_length(row); ++j)
- row_cache.insert (sparsity.column_number(row,j));
-
- if (distribute[row] == deal_II_numbers::invalid_unsigned_int)
- {
- // regular line. loop over
- // cols. note that as we
- // proceed to distribute
- // cols, the loop may get
- // longer
- std::set<unsigned int>::iterator col_num = row_cache.begin ();
-
- for (; col_num != row_cache.end (); ++col_num)
- {
- const unsigned int column = *col_num;
-
- if (distribute[column] != deal_II_numbers::invalid_unsigned_int)
- {
- // row
- for (unsigned int q=0;
- q!=lines[distribute[column]].entries.size();
- ++q)
- {
- const unsigned int
- new_col = lines[distribute[column]].entries[q].first;
-
- sparsity.add (row, new_col);
- };
- };
- }
- }
- else
- // row must be distributed
- {
- std::set<unsigned int>::iterator col_num = row_cache.begin ();
-
- for (; col_num != row_cache.end (); ++col_num)
- {
- const unsigned int column = *col_num;
-
- if (distribute[column] == deal_II_numbers::invalid_unsigned_int)
- // distribute entry at irregular
- // row @p{row} and regular column
- // sparsity.colnums[j]
- for (unsigned int q=0;
- q!=lines[distribute[row]].entries.size(); ++q)
- sparsity.add (lines[distribute[row]].entries[q].first,
- column);
- else
- // distribute entry at irregular
- // row @p{row} and irregular column
- // sparsity.get_column_numbers()[j]
- for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p)
- for (unsigned int q=0;
- q!=lines[distribute[column]]
- .entries.size(); ++q)
- sparsity.add (lines[distribute[row]].entries[p].first,
- lines[distribute[column]]
- .entries[q].first);
- };
- }
-
- // Now copy stuff back to sparsity pattern
- std::set<unsigned int>::iterator col_num = row_cache.begin ();
- for (; col_num != row_cache.end (); ++col_num)
- {
- }
- };
- */
-}
-
-
void ConstraintMatrix::condense (CompressedSetSparsityPattern &sparsity) const
{
Assert (sorted == true, ExcMatrixNotClosed());
{
if (distribute[row] == deal_II_numbers::invalid_unsigned_int)
{
- // regular line. loop over
- // cols. note that as we
- // proceed to distribute
- // cols, the loop may get
- // longer
- CompressedSetSparsityPattern::CSSPIterator col_num = sparsity.row_begin (row);
+ // regular line. loop over
+ // cols. note that as we proceed to
+ // distribute cols, the loop may
+ // get longer
+ CompressedSetSparsityPattern::row_iterator col_num = sparsity.row_begin (row);
for (; col_num != sparsity.row_end (row); ++col_num)
{
else
// row must be distributed
{
- CompressedSetSparsityPattern::CSSPIterator col_num = sparsity.row_begin (row);
+ CompressedSetSparsityPattern::row_iterator col_num = sparsity.row_begin (row);
for (; col_num != sparsity.row_end (row); ++col_num)
{
-void ConstraintMatrix::condense (CompressedBlockSparsityPattern &sparsity) const
+void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const
{
Assert (sorted == true, ExcMatrixNotClosed());
Assert (sparsity.n_rows() == sparsity.n_cols(),
BlockSparsityPattern &,
const bool) const;
template void ConstraintMatrix::
-add_entries_local_to_global<CompressedBlockSparsityPattern> (const std::vector<unsigned int> &,
- CompressedBlockSparsityPattern &,
+add_entries_local_to_global<BlockCompressedSparsityPattern> (const std::vector<unsigned int> &,
+ BlockCompressedSparsityPattern &,
+ const bool) const;
+template void ConstraintMatrix::
+add_entries_local_to_global<BlockCompressedSetSparsityPattern> (const std::vector<unsigned int> &,
+ BlockCompressedSetSparsityPattern &,
const bool) const;
CompressedSparsityPattern &sparsity,
const ConstraintMatrix &);
template void
+DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
+ CompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension> &dof,
+ CompressedSetSparsityPattern &sparsity,
+ const ConstraintMatrix &);
+template void
DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
BlockSparsityPattern>
(const DoFHandler<deal_II_dimension> &dof,
const ConstraintMatrix &);
template void
DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
- CompressedBlockSparsityPattern>
+ BlockCompressedSparsityPattern>
(const DoFHandler<deal_II_dimension> &dof,
- CompressedBlockSparsityPattern &sparsity,
+ BlockCompressedSparsityPattern &sparsity,
+ const ConstraintMatrix &);
+template void
+DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
+ BlockCompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension> &dof,
+ BlockCompressedSetSparsityPattern &sparsity,
const ConstraintMatrix &);
template void
const ConstraintMatrix &);
template void
DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
- CompressedBlockSparsityPattern>
+ BlockCompressedSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension> &dof,
+ BlockCompressedSparsityPattern &sparsity,
+ const ConstraintMatrix &);
+template void
+DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
+ BlockCompressedSetSparsityPattern>
(const hp::DoFHandler<deal_II_dimension> &dof,
- CompressedBlockSparsityPattern &sparsity,
+ BlockCompressedSetSparsityPattern &sparsity,
const ConstraintMatrix &);
const Table<2,Coupling>&,
CompressedSparsityPattern&);
template void
+DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
+ CompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension>&,
+ const Table<2,Coupling>&,
+ CompressedSetSparsityPattern&);
+template void
DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
BlockSparsityPattern>
(const DoFHandler<deal_II_dimension>&,
BlockSparsityPattern&);
template void
DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
- CompressedBlockSparsityPattern>
+ BlockCompressedSparsityPattern>
+(const DoFHandler<deal_II_dimension>&,
+ const Table<2,Coupling>&,
+ BlockCompressedSparsityPattern&);
+template void
+DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
+ BlockCompressedSetSparsityPattern>
(const DoFHandler<deal_II_dimension>&,
const Table<2,Coupling>&,
- CompressedBlockSparsityPattern&);
+ BlockCompressedSetSparsityPattern&);
template void
const Table<2,Coupling>&,
CompressedSparsityPattern&);
template void
+DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
+ CompressedSetSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension>&,
+ const Table<2,Coupling>&,
+ CompressedSetSparsityPattern&);
+template void
DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
BlockSparsityPattern>
(const hp::DoFHandler<deal_II_dimension>&,
BlockSparsityPattern&);
template void
DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
- CompressedBlockSparsityPattern>
+ BlockCompressedSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension>&,
+ const Table<2,Coupling>&,
+ BlockCompressedSparsityPattern&);
+template void
+DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
+ BlockCompressedSetSparsityPattern>
(const hp::DoFHandler<deal_II_dimension>&,
const Table<2,Coupling>&,
- CompressedBlockSparsityPattern&);
+ BlockCompressedSetSparsityPattern&);
template void
const DoFHandler<deal_II_dimension> &dof_col,
CompressedSparsityPattern &sparsity);
template void
+DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
+ CompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension> &dof_row,
+ const DoFHandler<deal_II_dimension> &dof_col,
+ CompressedSetSparsityPattern &sparsity);
+template void
DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
BlockSparsityPattern>
(const DoFHandler<deal_II_dimension> &dof_row,
BlockSparsityPattern &sparsity);
template void
DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
- CompressedBlockSparsityPattern>
+ BlockCompressedSparsityPattern>
+(const DoFHandler<deal_II_dimension> &dof_row,
+ const DoFHandler<deal_II_dimension> &dof_col,
+ BlockCompressedSparsityPattern &sparsity);
+template void
+DoFTools::make_sparsity_pattern<DoFHandler<deal_II_dimension>,
+ BlockCompressedSetSparsityPattern>
(const DoFHandler<deal_II_dimension> &dof_row,
const DoFHandler<deal_II_dimension> &dof_col,
- CompressedBlockSparsityPattern &sparsity);
+ BlockCompressedSetSparsityPattern &sparsity);
template void
DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
const hp::DoFHandler<deal_II_dimension> &dof_col,
CompressedSparsityPattern &sparsity);
template void
+DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
+ CompressedSetSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension> &dof_row,
+ const hp::DoFHandler<deal_II_dimension> &dof_col,
+ CompressedSetSparsityPattern &sparsity);
+template void
DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
BlockSparsityPattern>
(const hp::DoFHandler<deal_II_dimension> &dof_row,
BlockSparsityPattern &sparsity);
template void
DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
- CompressedBlockSparsityPattern>
+ BlockCompressedSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension> &dof_row,
+ const hp::DoFHandler<deal_II_dimension> &dof_col,
+ BlockCompressedSparsityPattern &sparsity);
+template void
+DoFTools::make_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
+ BlockCompressedSetSparsityPattern>
(const hp::DoFHandler<deal_II_dimension> &dof_row,
const hp::DoFHandler<deal_II_dimension> &dof_col,
- CompressedBlockSparsityPattern &sparsity);
+ BlockCompressedSetSparsityPattern &sparsity);
// #if deal_II_dimension > 1
const std::vector<unsigned int> &,
CompressedSparsityPattern &);
template void
+DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int> &,
+ CompressedSetSparsityPattern &);
+template void
DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockSparsityPattern>
(const DoFHandler<deal_II_dimension>& dof,
const std::vector<unsigned int> &,
BlockSparsityPattern &);
template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedBlockSparsityPattern>
+DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
(const DoFHandler<deal_II_dimension>& dof,
const std::vector<unsigned int> &,
- CompressedBlockSparsityPattern &);
+ BlockCompressedSparsityPattern &);
+template void
+DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int> &,
+ BlockCompressedSetSparsityPattern &);
template void
DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SparsityPattern>
const std::vector<unsigned int> &,
CompressedSparsityPattern &);
template void
+DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int> &,
+ CompressedSetSparsityPattern &);
+template void
DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockSparsityPattern>
(const hp::DoFHandler<deal_II_dimension>& dof,
const std::vector<unsigned int> &,
BlockSparsityPattern &);
template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedBlockSparsityPattern>
+DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
(const hp::DoFHandler<deal_II_dimension>& dof,
const std::vector<unsigned int> &,
- CompressedBlockSparsityPattern &);
+ BlockCompressedSparsityPattern &);
+template void
+DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension>& dof,
+ const std::vector<unsigned int> &,
+ BlockCompressedSetSparsityPattern &);
template void
const std::vector<unsigned int> &dof_to_boundary_mapping,
CompressedSparsityPattern &sparsity);
template void
+DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type &boundary_indicators,
+ const std::vector<unsigned int> &dof_to_boundary_mapping,
+ CompressedSetSparsityPattern &sparsity);
+template void
DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockSparsityPattern>
(const DoFHandler<deal_II_dimension>& dof,
const FunctionMap<deal_II_dimension>::type &boundary_indicators,
const std::vector<unsigned int> &dof_to_boundary_mapping,
BlockSparsityPattern &sparsity);
template void
-DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedBlockSparsityPattern>
+DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
+(const DoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type &boundary_indicators,
+ const std::vector<unsigned int> &dof_to_boundary_mapping,
+ BlockCompressedSparsityPattern &sparsity);
+template void
+DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
(const DoFHandler<deal_II_dimension>& dof,
const FunctionMap<deal_II_dimension>::type &boundary_indicators,
const std::vector<unsigned int> &dof_to_boundary_mapping,
- CompressedBlockSparsityPattern &sparsity);
+ BlockCompressedSetSparsityPattern &sparsity);
template void
DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SparsityPattern>
const std::vector<unsigned int> &dof_to_boundary_mapping,
CompressedSparsityPattern &sparsity);
template void
+DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type &boundary_indicators,
+ const std::vector<unsigned int> &dof_to_boundary_mapping,
+ CompressedSetSparsityPattern &sparsity);
+template void
DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockSparsityPattern>
(const hp::DoFHandler<deal_II_dimension>& dof,
const FunctionMap<deal_II_dimension>::type &boundary_indicators,
const std::vector<unsigned int> &dof_to_boundary_mapping,
BlockSparsityPattern &sparsity);
template void
-DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedBlockSparsityPattern>
+DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension>& dof,
+ const FunctionMap<deal_II_dimension>::type &boundary_indicators,
+ const std::vector<unsigned int> &dof_to_boundary_mapping,
+ BlockCompressedSparsityPattern &sparsity);
+template void
+DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
(const hp::DoFHandler<deal_II_dimension>& dof,
const FunctionMap<deal_II_dimension>::type &boundary_indicators,
const std::vector<unsigned int> &dof_to_boundary_mapping,
- CompressedBlockSparsityPattern &sparsity);
+ BlockCompressedSetSparsityPattern &sparsity);
template void
(const DoFHandler<deal_II_dimension> &dof,
CompressedSparsityPattern &sparsity);
template void
+DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension> &dof,
+ CompressedSetSparsityPattern &sparsity);
+template void
DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockSparsityPattern>
(const DoFHandler<deal_II_dimension> &dof,
BlockSparsityPattern &sparsity);
template void
-DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedBlockSparsityPattern>
+DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
(const DoFHandler<deal_II_dimension> &dof,
- CompressedBlockSparsityPattern &sparsity);
+ BlockCompressedSparsityPattern &sparsity);
+template void
+DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension> &dof,
+ BlockCompressedSetSparsityPattern &sparsity);
template void
DoFTools::make_flux_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SparsityPattern>
(const hp::DoFHandler<deal_II_dimension> &dof,
CompressedSparsityPattern &sparsity);
template void
+DoFTools::make_flux_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension> &dof,
+ CompressedSetSparsityPattern &sparsity);
+template void
DoFTools::make_flux_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockSparsityPattern>
(const hp::DoFHandler<deal_II_dimension> &dof,
BlockSparsityPattern &sparsity);
template void
-DoFTools::make_flux_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,CompressedBlockSparsityPattern>
+DoFTools::make_flux_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
+(const hp::DoFHandler<deal_II_dimension> &dof,
+ BlockCompressedSparsityPattern &sparsity);
+template void
+DoFTools::make_flux_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
(const hp::DoFHandler<deal_II_dimension> &dof,
- CompressedBlockSparsityPattern &sparsity);
+ BlockCompressedSetSparsityPattern &sparsity);
#if deal_II_dimension > 1
const Table<2,Coupling>&,
const Table<2,Coupling>&);
template void
+DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedSetSparsityPattern>
+(const DoFHandler<deal_II_dimension> &dof,
+ CompressedSetSparsityPattern &,
+ const Table<2,Coupling>&,
+ const Table<2,Coupling>&);
+template void
DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockSparsityPattern>
(const DoFHandler<deal_II_dimension> &dof,
BlockSparsityPattern &,
const Table<2,Coupling>&,
const Table<2,Coupling>&);
template void
-DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,CompressedBlockSparsityPattern>
+DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSparsityPattern>
+(const DoFHandler<deal_II_dimension> &dof,
+ BlockCompressedSparsityPattern &,
+ const Table<2,Coupling>&,
+ const Table<2,Coupling>&);
+template void
+DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,BlockCompressedSetSparsityPattern>
(const DoFHandler<deal_II_dimension> &dof,
- CompressedBlockSparsityPattern &,
+ BlockCompressedSetSparsityPattern &,
const Table<2,Coupling>&,
const Table<2,Coupling>&);
#endif
#include "mg_tools.pattern.in.h"
#undef PATTERN
+#define PATTERN CompressedSetSparsityPattern
+#include "mg_tools.pattern.in.h"
+#undef PATTERN
+
#define PATTERN BlockSparsityPattern
#include "mg_tools.pattern.in.h"
#undef PATTERN
-#define PATTERN CompressedBlockSparsityPattern
+#define PATTERN BlockCompressedSparsityPattern
+#include "mg_tools.pattern.in.h"
+#undef PATTERN
+
+#define PATTERN BlockCompressedSetSparsityPattern
#include "mg_tools.pattern.in.h"
#undef PATTERN
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003, 2004, 2006 by the deal.II authors
+// Copyright (C) 2003, 2004, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
/**
* @defgroup Matrices Matrix classes
*
- * All matrices in this library have a common minimal interface, defined
- * through MATRIX (see Solver documentation). This interface consists of
- * functions for multiplication with appropriate vectors.
+ * deal.II comes with a number of different matrix classes, tailored to the
+ * various purposes for which matrices are used. For example, there are full
+ * matrices, sparse matrices using different storage schemes, matrices
+ * composed of individual blocks, and matrices implemented as interfaces to
+ * other linear algebra classes. As far as possible, all these implementations
+ * share a common interface that contains at least the operations necessary to
+ * write iterative linear solvers (see @ref Solvers), but also element-wise
+ * access to read from and write to a matrix.
*
- * We split this module into several parts. Basic matrices are all the matrix
- * classes actually storing their entries. Derived matrices use basic
- * matrices, but change the meaning of the matrix-vector multiplication.
+ * This module is split into different parts. @ref Matrix1 "Basic matrices"
+ * contains all the matrix classes actually storing entries. @ref Matrix2
+ * "Derived matrices", on the other hand, only use basic matrices, but
+ * implement certain operations on them. For example, TransposeMatrix provides
+ * a matrix-vector multiplication that acts as if the underlying matrix had
+ * been transposed, without actually ever storing a transposed matrix.
*
- * Preconditioners are matrix classes as well, since they perform linear
+ * @ref Preconditioners are matrix classes as well, since they perform linear
* operations on vectors.
*
- * @author Guido Kanschat, 2003
- *
* @ingroup LAC
*/
*
* These are the actual matrix classes provided by deal.II. It is possible to
* store values in them and retrieve them. Furthermore, they provide the full
- * interface required by linear solvers (see Solver).
+ * interface required by linear solvers (see @ref Solvers).
+ *
+ * Among the matrices in this group are full matrices, different sparse
+ * matrices, and block matrices. In addition, some of the classes in the
+ * interfaces to other linear algebra libraries (for example the
+ * PETScWrappers) are matrices.
*
- * @author Guido Kanschat, 2003
+ * Most of the deal.II sparse matrix classes are separated from their sparsity
+ * patterns, to make storing several matrices with the same sparsity pattern
+ * more efficient. See @ref Sparsity for more information.
*
* @ingroup Matrices
*/
* @defgroup Matrix2 Derived matrices
*
* These matrices are built on top of the basic matrices. They perform special
- * operations using the interface defined in Solver.
+ * operations using the interface defined in @ref Solvers.
+ *
+ * @ingroup Matrices
+ */
+
+/**
+ * @defgroup Sparsity Sparsity patterns
+ *
+ * In deal.II, sparsity patterns are typically separated from the actual
+ * sparse matrices (with the exception of the SparseMatrixEZ class and some
+ * classes from interfaces to external libraries such as PETSc). The reason is
+ * that one often has several matrices that share the same sparsity pattern;
+ * examples include the stiffness and mass matrices necessary for time
+ * stepping schemes, or the left and right hand side matrix of generalized
+ * eigenvalue problems. It would therefore be wasteful if each of them had to
+ * store their sparsity pattern separately.
+ *
+ * Consequently, deal.II has sparsity pattern classes that matrix classes
+ * build on. There are two main groups of sparsity pattern classes, as
+ * discussed below:
+ *
+ *
+ * <h4>"Static" sparsity patterns</h4>
+ *
+ * The main sparse matrix class in deal.II, SparseMatrix, only stores a value
+ * for each matrix entry, but not where these entries are located. For this,
+ * it relies on the information it gets from a sparsity pattern object
+ * associated with this matrix. This sparsity pattern object must be of type
+ * SparsityPattern.
+ *
+ * Because matrices are large objects and because it is comparatively
+ * expensive to change them, SparsityPattern objects are built in two phases:
+ * first, in a "dynamic" phase, one allocates positions where one expects
+ * matrices built on it to have nonzero entries; in a second "static" phase,
+ * the representation of these nonzero locations is "compressed" into the
+ * usual Compressed Row Storage (CSR) format. After this, no new nonzero
+ * locations can be added any more. Only after compression can a sparsity
+ * pattern be associated to a matrix, since the latter requires the efficient
+ * compressed data format of the former. Building a sparsity pattern during
+ * the dynamic phase often happens with the DoFTools:make_sparsity_pattern()
+ * function. Although this may appear a restriction, it is typically not a
+ * significant problem to first build a sparsity pattern and then to write
+ * into the matrix only in the previously allocated locations, since in finite
+ * element codes it is normally quite clear which elements of a matrix can
+ * possibly be nonzero and which are definitely zero.
+ *
+ * The advantage of this two-phase generation of a sparsity pattern is that
+ * when it is actually used with a matrix, a very efficient format is
+ * available. In particular, the locations of entries are stored in a linear
+ * array that allows for rapid access friendly to modern CPU types with deep
+ * hierarchies of caches. Consequently, the static SparsityPattern class is
+ * the only one on which deal.II's main SparseMatrix class can work.
+ *
+ * The main drawback of static sparsity patterns is that their efficient
+ * construction requires a reasonably good guess how many entries each of the
+ * rows may maximally have. During the actual construction, for example in the
+ * DoFTools:make_sparsity_pattern() function, only at most as many entries can
+ * be allocated as previously stated. This is a problem because it is often
+ * difficult to estimate the maximal number of entries per row. Consequently,
+ * a common strategy is to first build and intermediate sparsity pattern that
+ * uses a less efficient storage scheme during construction of the sparsity
+ * pattern and later copy it directly into the static, compressed form (see,
+ * for example the @ref step_11 "step-11", @ref step_18 "step-18", and @ref
+ * step_27 "step-27" tutorial programs).
+ *
+ *
+ * <h4>"Dynamic" or "compressed" sparsity patterns</h4>
+ *
+ * As explained above, it is often complicated to obtain good estimates for
+ * the maximal number of entries in each row of a sparsity
+ * pattern. Consequently, any attempts to allocate a regular SparsityPattern
+ * with bad estimates requires huge amounts of memory, almost all of which
+ * will not be used and be de-allocated upon compression.
+ *
+ * To avoid this, deal.II contains a number of "dynamic" or "compressed"
+ * sparsity patterns that only allocate as much memory as necessary to hold
+ * the currently added entries. While this saves much memory compared to the
+ * worst-case behavior mentioned above, it requires the use of less efficient
+ * storage schemes for insertion of elements, and the frequent allocation of
+ * memory often also takes significant compute time. The tradeoff to avoid
+ * excessive memory allocation cannot be avoided, however.
+ *
+ * In deal.II, the CompressedSparsityPattern and CompressedSetSparsityPattern
+ * classes implement this "dynamic" memory scheme. They use different storage
+ * schemes and appear to both have use cases where they are better than the
+ * respective other. In either case, these classes are typically used in the
+ * following way:
+ * @verbatim
+ * CompressedSparsityPattern compressed_pattern (dof_handler.n_dofs());
+ * DoFTools::make_sparsity_pattern (dof_handler,
+ * compressed_pattern);
+ * constraints.condense (compressed_pattern);
+ *
+ * SparsityPattern finaly_sparsity_pattern;
+ * final_sparsity_pattern.copy_from (compressed_pattern);
+ * @endverbatim
*
- * @author Guido Kanschat, 2003
+ * The intermediate, compressed sparsity pattern is directly copied into the
+ * "compressed" form of the final static pattern.
*
* @ingroup Matrices
*/
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003, 2004, 2006 by the deal.II authors
+// Copyright (C) 2003, 2004, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* multiplications, just like the real matrix classes.
*
* @ingroup LAC
+ * @ingroup Matrices
*/
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003, 2004, 2006 by the deal.II authors
+// Copyright (C) 2003, 2004, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* @defgroup Solvers Linear solver classes
*
* This module groups iterative and direct solvers, eigenvalue solvers, and
- * some control classes. All iterative solvers inherit from the class template
- * Solver, which provides some basic maintenance methods.
+ * some control classes. All these classes operate on objects of the
+ * @ref Matrices "matrix" and @ref Vectors "vector classes" defined in deal.II.
*
- * The number of iteration steps of iterative solvers is controlled by
- * objects of class SolverControl or its derived class
- * ReductionControl.
- *
- * All solvers receive the matrix and vector classes as template
- * arguments. Therefore, any objects defining the interface described in the
- * documentation of Solver are admissible. These requirements are listed in
- * the documentation page of the Solver class.
+ * In order to work properly, solvers that take matrix and vector classes as
+ * template arguments require that these classes satisfy a certain minimal
+ * interface that can be used from inside the solver. For iterative solvers,
+ * this interface is defined in the Solver class. In addition, solvers are
+ * controlled using objects of classes that are derived from the SolverControl
+ * class (for example its derived class ReductionControl), in order to
+ * determine the maximal number of iterations or a desired tolerance.
*
* If detected during configuration (see the ReadMe file), some sparse direct
* solvers are also supported.
<h3>lac</h3>
<ol>
+ <li> <p>Changed: The <code
+ class="class">CompressedBlockSparsityPattern</code> has been renamed to
+ <code class="class">BlockCompressedSparsityPattern</code> to be
+ consistent, since the "block" part builds on the "compressed sparsity
+ pattern", not the other way around.
+ <br>
+ (WB 2007/06/17)
+ </p>
+
+ <li> <p>New: The <code class="class">CompressedSetSparsityPattern</code>
+ class is an alternative to the <code
+ class="class">CompressedSparsityPattern</code> class that appears to be
+ better suited for problems that have many entries per row. There is also
+ a block version, <code
+ class="class">BlockCompressedSetSparsityPattern</code>. The two new
+ classes can used in all places where a regular compressed sparsity
+ pattern can also be used.
+ <br>
+ (Oliver Kayser-Herold, WB 2007/06/03)
+ </p>
+
<li> <p>Fixed: The <code class="class">SolverBicgstab</code> class
did not handle hitting on the solution early very
gracefully (it threw an exception). This is now fixed.
template <int dim>
void LaplaceProblem<dim>::run ()
{
- for (unsigned int cycle=0; cycle<30; ++cycle)
+ for (unsigned int cycle=0; cycle<3; ++cycle)
{
std::cout << "Cycle " << cycle << ':' << std::endl;
#include <base/smartpointer.h>
#include <lac/sparsity_pattern.h>
#include <lac/compressed_sparsity_pattern.h>
+#include <lac/compressed_set_sparsity_pattern.h>
#include <lac/block_indices.h>
DEAL_II_NAMESPACE_OPEN
template <typename number> class BlockSparseMatrix;
class BlockSparsityPattern;
-class CompressedBlockSparsityPattern;
+class BlockCompressedSparsityPattern;
+class BlockCompressedSetSparsityPattern;
-/*! @addtogroup Matrix1
+/*! @addtogroup Sparsity
*@{
*/
/**
- * This is the base class for block versions of the sparsity pattern
- * and compressed sparsity pattern classes. It has not much
- * functionality, but only administrates an array of sparsity pattern
- * objects and delegates work to them. It has mostly the same
- * interface as has the SparsityPattern and
- * CompressedSparsityPattern classes, and simply transforms
- * calls to its member functions to calls to the respective member
- * functions of the member sparsity patterns.
+ * This is the base class for block versions of the sparsity pattern and
+ * compressed sparsity pattern classes. It has not much functionality, but
+ * only administrates an array of sparsity pattern objects and delegates work
+ * to them. It has mostly the same interface as has the SparsityPattern,
+ * CompressedSparsityPattern, and CompressedSetSparsityPattern classes, and
+ * simply transforms calls to its member functions to calls to the respective
+ * member functions of the member sparsity patterns.
*
* The largest difference between the SparsityPattern and
* CompressedSparsityPattern classes and this class is that
* adds a few additional member functions, but the main interface
* stems from the base class, see there for more information.
*
+ * This class is an example of the "static" type of @ref Sparsity.
+ *
* @author Wolfgang Bangerth, 2000, 2001
*/
class BlockSparsityPattern : public BlockSparsityPatternBase<SparsityPattern>
/**
* Copy data from an object of
* type
- * CompressedBlockSparsityPattern,
+ * BlockCompressedSparsityPattern,
+ * i.e. resize this object to the
+ * size of the given argument,
+ * and copy over the contents of
+ * each of the
+ * subobjects. Previous content
+ * of this object is lost.
+ */
+ void copy_from (const BlockCompressedSparsityPattern &csp);
+
+ /**
+ * Copy data from an object of
+ * type
+ * BlockCompressedSetSparsityPattern,
* i.e. resize this object to the
* size of the given argument,
* and copy over the contents of
* subobjects. Previous content
* of this object is lost.
*/
- void copy_from (const CompressedBlockSparsityPattern &csp);
+ void copy_from (const BlockCompressedSetSparsityPattern &csp);
};
/**
- * This class extends the base class to implement an array of
- * compressed sparsity patterns that can be used to initialize objects
- * of type BlockSparsityPattern. It does not add additional
- * member functions, but rather acts as a @p typedef to introduce the
- * name of this class, without requiring the user to specify the
- * templated name of the base class. For information on the interface
- * of this class refer to the base class.
+ * This class extends the base class to implement an array of compressed
+ * sparsity patterns that can be used to initialize objects of type
+ * BlockSparsityPattern. It does not add additional member functions, but
+ * rather acts as a @p typedef to introduce the name of this class, without
+ * requiring the user to specify the templated name of the base class. For
+ * information on the interface of this class refer to the base class. The
+ * individual blocks are based on the CompressedSparistyPattern class.
+ *
+ * This class is an example of the "dynamic" type of @ref Sparsity.
+ *
+ * <b>Note:</b> This class used to be called
+ * CompressedBlockSparsityPattern. However, since it's a block wrapper around
+ * the CompressedSparsityPattern class, this is a misnomer and the class has
+ * been renamed.
*
* <h3>Example</h3>
* Usage of this class is very similar to CompressedSparsityPattern,
* @skipline dofs_per_block
* @until count
*
- * Now, we are ready to set up the CompressedBlockSparsityPattern.
+ * Now, we are ready to set up the BlockCompressedSparsityPattern.
*
* @until collect
*
*
* @author Wolfgang Bangerth, 2000, 2001, Guido Kanschat, 2006, 2007
*/
-class CompressedBlockSparsityPattern : public BlockSparsityPatternBase<CompressedSparsityPattern>
+class BlockCompressedSparsityPattern : public BlockSparsityPatternBase<CompressedSparsityPattern>
{
public:
* structure usable by calling
* the reinit() function.
*/
- CompressedBlockSparsityPattern ();
+ BlockCompressedSparsityPattern ();
/**
* Initialize the matrix with the
* to call collect_sizes() after
* you assign them sizes.
*/
- CompressedBlockSparsityPattern (const unsigned int n_rows,
+ BlockCompressedSparsityPattern (const unsigned int n_rows,
const unsigned int n_columns);
/**
* and then entering the index
* values.
*/
- CompressedBlockSparsityPattern (const std::vector<unsigned int>& row_block_sizes,
+ BlockCompressedSparsityPattern (const std::vector<unsigned int>& row_block_sizes,
const std::vector<unsigned int>& col_block_sizes);
/**
};
+
+/**
+ * This class extends the base class to implement an array of compressed
+ * sparsity patterns that can be used to initialize objects of type
+ * BlockSparsityPattern. It does not add additional member functions, but
+ * rather acts as a @p typedef to introduce the name of this class, without
+ * requiring the user to specify the templated name of the base class. For
+ * information on the interface of this class refer to the base class. The
+ * individual blocks are based on the CompressedSparistyPattern class.
+ *
+ * This class is an example of the "dynamic" type of @ref Sparsity.
+ *
+ * <b>Note:</b> This class used to be called
+ * CompressedBlockSparsityPattern. However, since it's a block wrapper around
+ * the CompressedSetSparsityPattern class, this is a misnomer and the class has
+ * been renamed.
+ *
+ * <h3>Example</h3>
+ * Usage of this class is very similar to CompressedSetSparsityPattern,
+ * but since the use of block indices causes some additional
+ * complications, we give a short example.
+ *
+ * @dontinclude compressed_block_sparsity_pattern.cc
+ *
+ * After the the DoFHandler <tt>dof</tt> and the ConstraintMatrix
+ * <tt>constraints</tt> have been set up with a system element, we
+ * must count the degrees of freedom in each matrix block:
+ *
+ * @skipline dofs_per_block
+ * @until count
+ *
+ * Now, we are ready to set up the BlockCompressedSetSparsityPattern.
+ *
+ * @until collect
+ *
+ * It is filled as if it were a normal pattern
+ *
+ * @until condense
+ *
+ * In the end, it is copied to a normal BlockSparsityPattern for later
+ * use.
+ *
+ * @until copy
+ *
+ * @author Wolfgang Bangerth, 2000, 2001, Guido Kanschat, 2006, 2007
+ */
+class BlockCompressedSetSparsityPattern : public BlockSparsityPatternBase<CompressedSetSparsityPattern>
+{
+ public:
+
+ /**
+ * Initialize the matrix empty,
+ * that is with no memory
+ * allocated. This is useful if
+ * you want such objects as
+ * member variables in other
+ * classes. You can make the
+ * structure usable by calling
+ * the reinit() function.
+ */
+ BlockCompressedSetSparsityPattern ();
+
+ /**
+ * Initialize the matrix with the
+ * given number of block rows and
+ * columns. The blocks themselves
+ * are still empty, and you have
+ * to call collect_sizes() after
+ * you assign them sizes.
+ */
+ BlockCompressedSetSparsityPattern (const unsigned int n_rows,
+ const unsigned int n_columns);
+
+ /**
+ * Initialize the pattern with
+ * two BlockIndices for the block
+ * structures of matrix rows and
+ * columns. This function is
+ * equivalent to calling the
+ * previous constructor with the
+ * length of the two index vector
+ * and then entering the index
+ * values.
+ */
+ BlockCompressedSetSparsityPattern (const std::vector<unsigned int>& row_block_sizes,
+ const std::vector<unsigned int>& col_block_sizes);
+
+ /**
+ * Resize the matrix to a tensor
+ * product of matrices with
+ * dimensions defined by the
+ * arguments.
+ *
+ * The matrix will have as many
+ * block rows and columns as
+ * there are entries in the two
+ * arguments. The block at
+ * position (<i>i,j</i>) will
+ * have the dimensions
+ * <tt>row_block_sizes[i]</tt>
+ * times <tt>col_block_sizes[j]</tt>.
+ */
+ void reinit (const std::vector< unsigned int > &row_block_sizes,
+ const std::vector< unsigned int > &col_block_sizes);
+
+ /**
+ * Allow the use of the reinit
+ * functions of the base class as
+ * well.
+ */
+ BlockSparsityPatternBase<CompressedSetSparsityPattern>::reinit;
+};
+
+
/*@}*/
/*---------------------- Template functions -----------------------------------*/
// $Id: compressed_sparsity_pattern.h 14038 2006-10-23 02:46:34Z bangerth $
// Version: $Name$
//
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
template <typename number> class SparseMatrix;
-/*! @addtogroup Matrix1
+/*! @addtogroup Sparsity
*@{
*/
* copy the data of this object over to an object of type
* SparsityPattern before using it in actual matrices.
*
- * Another viewpoint is that this class does not need up front
- * allocation of a certain amount of memory, but grows as necessary.
- *
- *
- * <h3>Rationale</h3>
- *
- * When constructing the sparsity pattern of a matrix, you usually
- * first have to provide an empty sparsity pattern object with a fixed
- * maximal number of entries per row. To find out about this maximal
- * row length, one usually calls the function
- * DoFHandler::max_couplings_between_dofs() which returns an estimate for
- * that quantity or DoFTools::compute_row_length_vector(), which gives
- * a better estimate for each row. While this estimate is usually
- * quite good in 2d and exact in 1d, it is often significantly too
- * large in 3d and especially for higher order elements. Furthermore,
- * normally only a small fraction of the rows of a matrix will end up
- * having the maximal number of nonzero entries per row (usually those
- * nodes adjacent to hanging nodes), most have much less. In effect,
- * the empty SparsityPattern object has allocated much too much
- * memory. Although this unnecessarily allocated memory is later freed
- * when SparsityPattern::compress() is called, this overallocation
- * has, with higher order elements and in 3d, sometimes been so large
- * that the program aborted due to lack of memory.
- *
- * This class therefore provides an alternative representation of a
- * sparsity pattern: we don't specify a maximal row length initially,
- * but store a set of column indices indicating possible nonzero
- * entries in the sparsity pattern for each row. This is very much
- * like the final "compressed" format used in the
- * SparsityPattern object after compression, but uses a less
- * compact memory storage format, since the exact number of entries
- * per row is only known a posteriori and since it may change (for the
- * SparsityPattern class, no more changes are allowed after
- * compressing it). We can therefore not store all the column indices
- * in a big array, but have to use a vector of sets. This can later be
- * used to actually initialize a SparsityPattern object with the
- * then final set of necessary indices.
+ * Another viewpoint is that this class does not need up front allocation of a
+ * certain amount of memory, but grows as necessary. An extensive description
+ * of sparsity patterns can be found in the documentation of the @ref Sparsity
+ * module.
*
+ * This class is an example of the "dynamic" type of @ref Sparsity.
*
* <h3>Interface</h3>
*
* function, and the functions inquiring properties of the sparsity
* pattern are the same.
*
- * <h3>Notes</h3>
- *
- * This class is a variation of the CompressedSparsityPattern class.
- * Instead of using sorted vectors together with a caching algorithm
- * for storing the column indices of NZ entries, the std::set
- * container is used. This solution might not be the fastest in
- * all situations, but seems to work much better than the
- * CompressedSparsityPattern in the context of hp-adaptivity.
- * On the other hand, a benchmark where NZ entries were randomly inserted
- * into the sparsity pattern revealed that this class is slower
- * by a factor 4-6 in this situation. Hence, currently the suggestion
- * is to carefully analyse which of the CompressedSparsityPattern
- * classes works best in a certain setting. An algorithm which
- * performs equally well in all situations still has to be found.
*
* <h3>Usage</h3>
*
* sp.copy_from (compressed_pattern);
* @endverbatim
*
+ * See also @ref step_11 "step-11" and @ref step_18 "step-18" for usage
+ * patterns.
+ *
+ * <h3>Notes</h3>
+ *
+ * This class is a variation of the CompressedSparsityPattern class.
+ * Instead of using sorted vectors together with a caching algorithm
+ * for storing the column indices of nonzero entries, the std::set
+ * container is used. This solution might not be the fastest in
+ * all situations, but seems to work much better than the
+ * CompressedSparsityPattern in the context of hp-adaptivity.
+ * On the other hand, a benchmark where nonzero entries were randomly inserted
+ * into the sparsity pattern revealed that this class is slower
+ * by a factor 4-6 in this situation. Hence, currently the suggestion
+ * is to carefully analyze which of the CompressedSparsityPattern
+ * classes works best in a certain setting. An algorithm which
+ * performs equally well in all situations still has to be found.
+ *
*
- * @author Wolfgang Bangerth, 2001
+ * @author Oliver Kayser-Herold, 2007
*/
class CompressedSetSparsityPattern : public Subscriptor
{
public:
- typedef std::set<unsigned int>::iterator CSSPIterator;
+ /**
+ * An iterator that can be used to
+ * iterate over the elements of a single
+ * row. The result of dereferencing such
+ * an iterator is a column index.
+ */
+ typedef std::set<unsigned int>::iterator row_iterator;
/**
* (CompressedSetSparsityPattern());</tt>,
* with @p v a vector of @p
* CompressedSetSparsityPattern objects.
- *
- * Usually, it is sufficient to
- * use the explicit keyword to
- * disallow unwanted temporaries,
- * but for the STL vectors, this
- * does not work. Since copying a
- * structure like this is not
- * useful anyway because multiple
- * matrices can use the same
- * sparsity structure, copies are
- * only allowed for empty
- * objects, as described above.
*/
CompressedSetSparsityPattern (const CompressedSetSparsityPattern &);
* @p n columns.
*/
CompressedSetSparsityPattern (const unsigned int m,
- const unsigned int n);
+ const unsigned int n);
/**
* Initialize a square matrix of
* Return the column number of
* the @p indexth entry in @p row.
*/
- CSSPIterator row_begin (const unsigned int row) const;
- CSSPIterator row_end (const unsigned int row) const;
+ row_iterator row_begin (const unsigned int row) const;
+ row_iterator row_end (const unsigned int row) const;
/**
/**
* Return the number of nonzero elements
- * of this matrix. Actually, it returns
- * the number of entries in the sparsity
- * pattern; if any of the entries should
- * happen to be zero, it is counted
- * anyway.
- *
- * This function may only be called if
- * the matrix struct is compressed. It
- * does not make too much sense otherwise
- * anyway.
+ * allocated through this sparsity pattern.
*/
unsigned int n_nonzero_elements () const;
unsigned int cols;
/**
- * Store some data for each row
- * describing which entries of this row
- * are nonzero. Data is organized as
- * follows: if an entry is added to a
- * row, it is first added to the #cache
- * variable, irrespective of whether an
- * entry with same column number has
- * already been added. Only if the cache
- * is full do we flush it by removing
- * duplicates, removing entries that are
- * already stored in the @p entries
- * array, sorting everything, and merging
- * the two arrays.
- *
- * The reasoning behind this scheme is
- * that memory allocation is expensive,
- * and we only want to do it when really
- * necessary. Previously (in deal.II
- * versions up to 5.0), we used to store
- * the column indices inside a std::set,
- * but this would allocate 20 bytes each
- * time we added an entry. Using the
- * present scheme, we only need to
- * allocate memory once for every 8 added
- * entries, and we waste a lot less
- * memory by not using a balanced tree
- * for storing column indices.
- *
- * Since some functions that are @p const
- * need to access the data of this
- * object, but need to flush caches
- * before, the flush_cache() function is
- * marked const, and the data members are
- * marked @p mutable.
- *
- * A small testseries about the size of
- * the cache showed that the run time of
- * a small program just testing the
- * compressed sparsity pattern element
- * insertion routine ran for 3.6 seconds
- * with a cache size of 8, and 4.2
- * seconds with a cache size of 16. We
- * deem even smaller cache sizes
- * undesirable, since they lead to more
- * memory allocations, while larger cache
- * sizes lead to waste of memory. The
- * original version of this class, with
- * one std::set per row took 8.2 seconds
- * on the same program.
+ * For each row of the matrix, store the
+ * allocated non-zero entries as a
+ * std::set of column indices. For a
+ * discussion of storage schemes see the
+ * CompressedSparsityPattern::Line class.
*/
struct Line
{
- std::set <unsigned int> entries;
+ std::set<unsigned int> entries;
/**
* Constructor.
/*---------------------- Inline functions -----------------------------------*/
+inline
+CompressedSetSparsityPattern::Line::Line ()
+{}
+
+
+
inline
void
CompressedSetSparsityPattern::Line::add (const unsigned int j)
inline
void
CompressedSetSparsityPattern::add (const unsigned int i,
- const unsigned int j)
+ const unsigned int j)
{
Assert (i<rows, ExcIndexRange(i, 0, rows));
Assert (j<cols, ExcIndexRange(j, 0, cols));
-inline
-CompressedSetSparsityPattern::Line::Line ()
-{}
-
-
-
inline
unsigned int
CompressedSetSparsityPattern::row_length (const unsigned int row) const
inline
-CompressedSetSparsityPattern::CSSPIterator
+CompressedSetSparsityPattern::row_iterator
CompressedSetSparsityPattern::row_begin (const unsigned int row) const
{
return (lines[row].entries.begin ());
inline
-CompressedSetSparsityPattern::CSSPIterator
+CompressedSetSparsityPattern::row_iterator
CompressedSetSparsityPattern::row_end (const unsigned int row) const
{
return (lines[row].entries.end ());
template <typename number> class SparseMatrix;
-/*! @addtogroup Matrix1
+/*! @addtogroup Sparsity
*@{
*/
* copy the data of this object over to an object of type
* SparsityPattern before using it in actual matrices.
*
- * Another viewpoint is that this class does not need up front
- * allocation of a certain amount of memory, but grows as necessary.
- *
- *
- * <h3>Rationale</h3>
- *
- * When constructing the sparsity pattern of a matrix, you usually
- * first have to provide an empty sparsity pattern object with a fixed
- * maximal number of entries per row. To find out about this maximal
- * row length, one usually calls the function
- * DoFHandler::max_couplings_between_dofs() which returns an estimate for
- * that quantity or DoFTools::compute_row_length_vector(), which gives
- * a better estimate for each row. While this estimate is usually
- * quite good in 2d and exact in 1d, it is often significantly too
- * large in 3d and especially for higher order elements. Furthermore,
- * normally only a small fraction of the rows of a matrix will end up
- * having the maximal number of nonzero entries per row (usually those
- * nodes adjacent to hanging nodes), most have much less. In effect,
- * the empty SparsityPattern object has allocated much too much
- * memory. Although this unnecessarily allocated memory is later freed
- * when SparsityPattern::compress() is called, this overallocation
- * has, with higher order elements and in 3d, sometimes been so large
- * that the program aborted due to lack of memory.
- *
- * This class therefore provides an alternative representation of a
- * sparsity pattern: we don't specify a maximal row length initially,
- * but store a set of column indices indicating possible nonzero
- * entries in the sparsity pattern for each row. This is very much
- * like the final "compressed" format used in the
- * SparsityPattern object after compression, but uses a less
- * compact memory storage format, since the exact number of entries
- * per row is only known a posteriori and since it may change (for the
- * SparsityPattern class, no more changes are allowed after
- * compressing it). We can therefore not store all the column indices
- * in a big array, but have to use a vector of sets. This can later be
- * used to actually initialize a SparsityPattern object with the
- * then final set of necessary indices.
+ * Another viewpoint is that this class does not need up front allocation of a
+ * certain amount of memory, but grows as necessary. An extensive description
+ * of sparsity patterns can be found in the documentation of the @ref Sparsity
+ * module.
*
+ * This class is an example of the "dynamic" type of @ref Sparsity.
*
* <h3>Interface</h3>
*
* sp.copy_from (compressed_pattern);
* @endverbatim
*
+ * See also @ref step_11 "step-11" and @ref step_18 "step-18" for usage
+ * patterns.
+ *
+ * <h3>Notes</h3>
+ *
+ * A variation of this class is the CompressedSetSparsityPattern class that
+ * appears to be more efficient in some situations, in particular when using
+ * hp finite elements. See for example the @ref step_27 "step-27" tutorial
+ * program.
*
* @author Wolfgang Bangerth, 2001
*/
* (CompressedSparsityPattern());</tt>,
* with @p v a vector of @p
* CompressedSparsityPattern objects.
- *
- * Usually, it is sufficient to
- * use the explicit keyword to
- * disallow unwanted temporaries,
- * but for the STL vectors, this
- * does not work. Since copying a
- * structure like this is not
- * useful anyway because multiple
- * matrices can use the same
- * sparsity structure, copies are
- * only allowed for empty
- * objects, as described above.
*/
CompressedSparsityPattern (const CompressedSparsityPattern &);
/**
* Return the number of nonzero elements
- * of this matrix. Actually, it returns
- * the number of entries in the sparsity
- * pattern; if any of the entries should
- * happen to be zero, it is counted
- * anyway.
- *
- * This function may only be called if
- * the matrix struct is compressed. It
- * does not make too much sense otherwise
- * anyway.
+ * allocated through this sparsity pattern.
*/
unsigned int n_nonzero_elements () const;
* versions up to 5.0), we used to store
* the column indices inside a std::set,
* but this would allocate 20 bytes each
- * time we added an entry. Using the
+ * time we added an entry. (A std::set
+ * based class has later been revived in
+ * form of the
+ * CompressedSetSparsityPattern class, as
+ * this turned out to be more efficient
+ * for hp finite element programs such as
+ * @ref step_27 "step-27"). Using the
* present scheme, we only need to
* allocate memory once for every 8 added
* entries, and we waste a lot less
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* matrices. For this, one has to call the collect_sizes() function, for much
* the same reason as is documented with the BlockSparsityPattern class.
*
+ * @ingroup Matrix1
* @author Wolfgang Bangerth, 2004
*/
class BlockSparseMatrix : public BlockMatrixBase<PETScWrappers::SparseMatrix>
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* this class handles the actual allocation of vectors and provides functions
* that are specific to the underlying vector type.
*
+ * @ingroup Vectors
* @author Wolfgang Bangerth, 2004
*/
class BlockVector : public BlockVectorBase<Vector>
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* virtual functions). Only the functions creating a matrix of specific type
* differ, and are implemented in this particular class.
*
+ * @ingroup Matrix1
* @author Wolfgang Bangerth, 2004
*/
class FullMatrix : public MatrixBase
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* before the matrix is actively used.
*
* @ingroup PETScWrappers
+ * @ingroup Matrix1
* @author Wolfgang Bangerth, 2004
*/
class MatrixBase : public Subscriptor
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* matrices. For this, one has to call the collect_sizes() function, for much
* the same reason as is documented with the BlockSparsityPattern class.
*
+ * @ingroup Matrix1
* @author Wolfgang Bangerth, 2004
*/
class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix>
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* constructors and reinit() functions, one therefore not only has to specify
* the sizes of the individual blocks, but also the number of elements of each
* of these blocks to be stored on the local process.
- *
+ *
+ * @ingroup Vectors
* @author Wolfgang Bangerth, 2004
*/
class BlockVector : public BlockVectorBase<Vector>
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* numbers for all processes available at all processes.
*
* @ingroup PETScWrappers
+ * @ingroup Matrix1
* @author Wolfgang Bangerth, 2004
*/
class SparseMatrix : public MatrixBase
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* necessary.
*
* @ingroup PETScWrappers
+ * @ingroup Vectors
* @author Wolfgang Bangerth, 2004
*/
class Vector : public VectorBase
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* differ, and are implemented in this particular class.
*
* @ingroup PETScWrappers
+ * @ingroup Matrix1
* @author Wolfgang Bangerth, 2004
*/
class SparseMatrix : public MatrixBase
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* functions). Only the functions creating a vector of specific type differ,
* and are implemented in this particular class.
*
+ * @ingroup Vectors
* @author Wolfgang Bangerth, 2004
*/
class Vector : public VectorBase
// $Id$
// Version: $Name$
//
-// Copyright (C) 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* A namespace in which wrapper classes for PETSc objects reside.
*
* @ingroup PETScWrappers
+ * @ingroup Vectors
* @see @ref SoftwarePETSc
* @author Wolfgang Bangerth, 2004
*/
-/*! @addtogroup Matrix1
+/*! @addtogroup Sparsity
*@{
*/
/**
* Structure representing the sparsity pattern of a sparse matrix.
- *
- * The following picture will illustrate the relation between the
- * SparsityPattern an the SparseMatrix.
*
- * @verbatim
- * SparsityPattern: \
- * |
- * _________________________ |
- * rowstart |0 | 4| 8|11|13|.... |
- * |__|__|__|__|__|__________ |
- * | \ \ |
- * | \ \__ |
- * | \ \ |
- * | \ \__ |
- * \ / \ \ |
- * | \ \__ |
- * | \ \ |
- * | \ \__ |
- * | \ \ |
- * 0___________4___________8____ \ Position
- * colnums |3 | 2| 9|17| 1| 4| 6| 8| 4|.. /
- * /__|/_|__|__|__|__|__|__|__|__ |
- * / / |
- * / \______ _____/ \_____ _____/ |
- * / \/ \/ |
- * / / row = 0 row = 1 |
- * / / |
- * / / |
- * / / |
- * / /___colnums[1] |
- * / |
- * /_________colnums[0] |
- * |
- * /
- * @endverbatim
- *
- * @verbatim
- * For row = 0
- *
- * there are: (0| 3) = colnums[0]
- * (0| 2) = colnums[1]
- * (0| 9) = colnums[2]
- * (0|17) = colnums[3]
- *
- * For row = 1
- *
- * there are: (1| 1) = colnums[4]
- * (1| 4) = colnums[5]
- * ....
- *
- * @endverbatim
- *
- * @verbatim
- * SparseMatrix: \
- * |
- * _____________________________ |
- * val | | | | | | | | | 3|.. \ Value
- * |__|__|__|__|__|__|__|__|__|__ /
- * |
- * |
- * /
- * @endverbatim
- *
- * If you want to get the <tt>3</tt> you need to get its position in
- * the table above and its value by returning the value of the element
- * on which the pointer shows, using <tt>*val</tt>. For example
- * <tt>val[8]=3</tt>. Its position is <tt>colnums[8]</tt> so
- * <tt>row=2</tt>. In other words, if you want to get the element
- * <i>a<sub>24</sub></i> you know that <tt>row=2</tt>. To get the
- * element, a search of <tt>4</tt> form <tt>colnums[rowstart[2]]</tt>
- * to <tt>colnums[rowstart[3]]</tt> is needed. Then
- * <i>a<sub>24</sub></i>=<tt>val[number of the found element] =
- * 3</tt>.
+ * This class is an example of the "static" type of @ref Sparsity.
*
+ * It uses the compressed row storage (CSR) format to store data.
*
* @author Wolfgang Bangerth, Guido Kanschat and others
*/
template class BlockSparsityPatternBase<SparsityPattern>;
template class BlockSparsityPatternBase<CompressedSparsityPattern>;
+template class BlockSparsityPatternBase<CompressedSetSparsityPattern>;
void
-BlockSparsityPattern::copy_from (const CompressedBlockSparsityPattern &csp)
+BlockSparsityPattern::copy_from (const BlockCompressedSparsityPattern &csp)
{
// delete old content, set block
// sizes anew
-CompressedBlockSparsityPattern::CompressedBlockSparsityPattern ()
+void
+BlockSparsityPattern::copy_from (const BlockCompressedSetSparsityPattern &csp)
+{
+ // delete old content, set block
+ // sizes anew
+ reinit (csp.n_block_rows(), csp.n_block_cols());
+
+ // copy over blocks
+ for (unsigned int i=0; i<rows; ++i)
+ for (unsigned int j=0; j<rows; ++j)
+ block(i,j).copy_from (csp.block(i,j));
+
+ // and finally enquire their new
+ // sizes
+ collect_sizes();
+}
+
+
+
+BlockCompressedSparsityPattern::BlockCompressedSparsityPattern ()
{}
-CompressedBlockSparsityPattern::
-CompressedBlockSparsityPattern (const unsigned int n_rows,
+BlockCompressedSparsityPattern::
+BlockCompressedSparsityPattern (const unsigned int n_rows,
const unsigned int n_columns)
:
BlockSparsityPatternBase<CompressedSparsityPattern>(n_rows,
{}
-CompressedBlockSparsityPattern::
-CompressedBlockSparsityPattern (const std::vector<unsigned int>& row_indices,
+BlockCompressedSparsityPattern::
+BlockCompressedSparsityPattern (const std::vector<unsigned int>& row_indices,
const std::vector<unsigned int>& col_indices)
:
BlockSparsityPatternBase<CompressedSparsityPattern>(row_indices.size(),
void
-CompressedBlockSparsityPattern::reinit (
+BlockCompressedSparsityPattern::reinit (
+ const std::vector< unsigned int > &row_block_sizes,
+ const std::vector< unsigned int > &col_block_sizes)
+{
+ this->reinit(row_block_sizes.size(), col_block_sizes.size());
+ for (unsigned int i=0;i<row_block_sizes.size();++i)
+ for (unsigned int j=0;j<col_block_sizes.size();++j)
+ this->block(i,j).reinit(row_block_sizes[i],col_block_sizes[j]);
+ this->collect_sizes();
+}
+
+
+
+BlockCompressedSetSparsityPattern::BlockCompressedSetSparsityPattern ()
+{}
+
+
+
+BlockCompressedSetSparsityPattern::
+BlockCompressedSetSparsityPattern (const unsigned int n_rows,
+ const unsigned int n_columns)
+ :
+ BlockSparsityPatternBase<CompressedSetSparsityPattern>(n_rows,
+ n_columns)
+{}
+
+
+BlockCompressedSetSparsityPattern::
+BlockCompressedSetSparsityPattern (const std::vector<unsigned int>& row_indices,
+ const std::vector<unsigned int>& col_indices)
+ :
+ BlockSparsityPatternBase<CompressedSetSparsityPattern>(row_indices.size(),
+ col_indices.size())
+{
+ for (unsigned int i=0;i<row_indices.size();++i)
+ for (unsigned int j=0;j<col_indices.size();++j)
+ this->block(i,j).reinit(row_indices[i],col_indices[j]);
+ this->collect_sizes();
+}
+
+
+void
+BlockCompressedSetSparsityPattern::reinit (
const std::vector< unsigned int > &row_block_sizes,
const std::vector< unsigned int > &col_block_sizes)
{
for (unsigned int row = 0; row<csp.n_rows(); ++row)
{
unsigned int *cols = &colnums[rowstart[row]] + (is_square ? 1 : 0);
- CompressedSetSparsityPattern::CSSPIterator col_num = csp.row_begin (row);
+ CompressedSetSparsityPattern::row_iterator col_num = csp.row_begin (row);
for (; col_num != csp.row_end (row); ++col_num)
{
block_sizes[0] = dof_handler.n_dofs()/3;
block_sizes[1] = dof_handler.n_dofs() - block_sizes[0];
- CompressedBlockSparsityPattern sparsity(2,2);
+ BlockCompressedSparsityPattern sparsity(2,2);
for (unsigned int i=0; i<2; ++i)
for (unsigned int j=0; j<2; ++j)
sparsity.block(i,j).reinit (block_sizes[i], block_sizes[j]);
// check
// DoFTools::
// make_sparsity_pattern (const DoFHandler<dim> &,
-// CompressedBlockSparsityPattern &);
+// BlockCompressedSparsityPattern &);
std::string output_file_name = "dof_tools_01d/output";
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
- CompressedBlockSparsityPattern sp (n_components,
+ BlockCompressedSparsityPattern sp (n_components,
n_components);
std::vector<unsigned int> dofs_per_component(n_components);
DoFTools::count_dofs_per_component (dof_handler,
// DoFTools::
// make_sparsity_pattern (const DoFHandler<dim> &,
// std::vector<std::vector<bool> > &,
-// CompressedBlockSparsityPattern &);
+// BlockCompressedSparsityPattern &);
std::string output_file_name = "dof_tools_02d/output";
return;
// create sparsity pattern
- CompressedBlockSparsityPattern sp (n_components,
+ BlockCompressedSparsityPattern sp (n_components,
n_components);
std::vector<unsigned int> dofs_per_component(n_components);
DoFTools::count_dofs_per_component (dof_handler,
// DoFTools::
// make_boundary_sparsity_pattern (const DoFHandler<dim> &,
// const std::vector<unsigned int> &
-// CompressedBlockSparsityPattern &);
+// BlockCompressedSparsityPattern &);
std::string output_file_name = "dof_tools_15d/output";
const unsigned int n_blocks = std::min (dof_handler.get_fe().n_components(),
dof_handler.n_boundary_dofs());
- CompressedBlockSparsityPattern sp (n_blocks,
+ BlockCompressedSparsityPattern sp (n_blocks,
n_blocks);
// split dofs almost arbitrarily to
// blocks
// make_boundary_sparsity_pattern (const DoFHandler<dim> &,
// const typename FunctionMap<dim>::type &
// const std::vector<unsigned int> &
-// CompressedBlockSparsityPattern &);
+// BlockCompressedSparsityPattern &);
std::string output_file_name = "dof_tools_16d/output";
const unsigned int n_boundary_dofs = dof_handler.n_boundary_dofs(boundary_ids);
const unsigned int n_blocks = std::min (dof_handler.get_fe().n_components(),
n_boundary_dofs);
- CompressedBlockSparsityPattern sp (n_blocks,
+ BlockCompressedSparsityPattern sp (n_blocks,
n_blocks);
// split dofs almost arbitrarily to
// blocks
// check
// DoFTools::
// make_flux_sparsity_pattern (const DoFHandler<dim> &,
-// CompressedBlockSparsityPattern &);
+// BlockCompressedSparsityPattern &);
std::string output_file_name = "dof_tools_17d/output";
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
- CompressedBlockSparsityPattern sp (n_components,
+ BlockCompressedSparsityPattern sp (n_components,
n_components);
std::vector<unsigned int> dofs_per_component(n_components);
DoFTools::count_dofs_per_component (dof_handler,
// check
// DoFTools::
// make_flux_sparsity_pattern (const DoFHandler<dim> &,
-// CompressedBlockSparsityPattern &);
+// BlockCompressedSparsityPattern &);
std::string output_file_name = "dof_tools_18d/output";
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
- CompressedBlockSparsityPattern sp (n_components,
+ BlockCompressedSparsityPattern sp (n_components,
n_components);
std::vector<unsigned int> dofs_per_component(n_components);
DoFTools::count_dofs_per_component (dof_handler,
sparsity_3.compress ();
BlockSparsityPattern sparsity_4;
- CompressedBlockSparsityPattern csp_4(2,2);
+ BlockCompressedSparsityPattern csp_4(2,2);
csp_4.block(0,0).reinit (n1,n1);
csp_4.block(1,0).reinit (n2,n1);
csp_4.block(0,1).reinit (n1,n2);
sparsity_3.compress ();
BlockSparsityPattern sparsity_4;
- CompressedBlockSparsityPattern csp_4(2,2);
+ BlockCompressedSparsityPattern csp_4(2,2);
csp_4.block(0,0).reinit (n1,n1);
csp_4.block(1,0).reinit (n2,n1);
csp_4.block(0,1).reinit (n1,n2);
sparsity_3.compress ();
BlockSparsityPattern sparsity_4;
- CompressedBlockSparsityPattern csp_4(2,2);
+ BlockCompressedSparsityPattern csp_4(2,2);
csp_4.block(0,0).reinit (n1,n1);
csp_4.block(1,0).reinit (n2,n1);
csp_4.block(0,1).reinit (n1,n2);