class BlockMatrixArray : public Subscriptor
{
public:
+ /**
+ * Default constructor creating a
+ * useless object. initialize()
+ * must be called before using
+ * it.
+ */
+ BlockMatrixArray ();
+
/**
* Constructor fixing the
* dimensions.
const unsigned int n_block_cols,
VectorMemory<Vector<number> >& mem);
+ /**
+ * Initialize object
+ * completely. This is the
+ * function to call for an object
+ * created by the default
+ * constructor.
+ */
+ void initialize (const unsigned int n_block_rows,
+ const unsigned int n_block_cols,
+ VectorMemory<Vector<number> >& mem);
+
/**
* Adjust the matrix to a new
* size and delete all blocks.
: private BlockMatrixArray<number>
{
public:
+ /**
+ * Default constructor creating a
+ * useless object. initialize()
+ * must be called before using
+ * it.
+ */
+ BlockTrianglePrecondition ();
+
/**
* Constructor. This matrix must be
* block-quadratic. The additional
* parameter allows for backward
* insertion instead of forward.
*/
- BlockTrianglePrecondition(unsigned int block_rows,
- VectorMemory<Vector<number> >& mem,
- bool backward = false);
+ BlockTrianglePrecondition (unsigned int n_block_rows,
+ VectorMemory<Vector<number> >& mem,
+ bool backward = false);
+
+ /**
+ * Initialize object
+ * completely. This is the
+ * function to call for an object
+ * created by the default
+ * constructor.
+ */
+ void initialize (const unsigned int n_block_rows,
+ VectorMemory<Vector<number> >& mem,
+ bool backward = false);
+
+ /**
+ * Resize preconditioner to a new
+ * size and clear all blocks.
+ */
+ void reinit(const unsigned int n_block_rows);
+
+
/**
* Enter a block. This calls
* BlockMatrixArray::enter(). Remember
const unsigned int col,
const double prefix = 1.,
const bool transpose = false);
-
- /**
- * Resize preconditioner to a new
- * size and clear all blocks.
- */
- void reinit(const unsigned int n_block_rows);
/**
* Preconditioning.
unsigned row, unsigned int col,
double prefix, bool transpose)
{
+ Assert (mem != 0, ExcNotInitialized());
Assert(row<n_block_rows(), ExcIndexRange(row, 0, n_block_rows()));
Assert(col<n_block_cols(), ExcIndexRange(col, 0, n_block_cols()));
entries.push_back(Entry(matrix, row, col, prefix, transpose));
void
BlockMatrixArray<number>::print_latex (STREAM& out) const
{
+ Assert (mem != 0, ExcNotInitialized());
out << "\\begin{array}{"
<< std::string(n_block_cols(), 'c')
<< "}" << std::endl;
+template <typename number>
+BlockMatrixArray<number>::BlockMatrixArray ()
+ : block_rows (0),
+ block_cols (0),
+ mem(0, typeid(*this).name())
+{}
+
+
+
template <typename number>
BlockMatrixArray<number>::BlockMatrixArray (
const unsigned int n_block_rows,
{}
+template <typename number>
+void
+BlockMatrixArray<number>::initialize (
+ const unsigned int n_block_rows,
+ const unsigned int n_block_cols,
+ VectorMemory<Vector<number> >& memory)
+{
+ block_rows = n_block_rows;
+ block_cols = n_block_cols;
+ mem = &memory;
+}
+
+
+
template <typename number>
void
const unsigned int n_block_rows,
const unsigned int n_block_cols)
{
+ Assert (mem != 0, ExcNotInitialized());
clear();
block_rows = n_block_rows;
block_cols = n_block_cols;
BlockMatrixArray<number>::vmult_add (BlockVector<number>& dst,
const BlockVector<number>& src) const
{
+ Assert (mem != 0, ExcNotInitialized());
+
Assert (dst.n_blocks() == block_rows,
ExcDimensionMismatch(dst.n_blocks(), block_rows));
Assert (src.n_blocks() == block_cols,
BlockMatrixArray<number>::Tvmult_add (BlockVector<number>& dst,
const BlockVector<number>& src) const
{
+ Assert (mem != 0, ExcNotInitialized());
Assert (dst.n_blocks() == block_cols,
ExcDimensionMismatch(dst.n_blocks(), block_cols));
Assert (src.n_blocks() == block_rows,
const BlockVector<number>& u,
const BlockVector<number>& v) const
{
+ Assert (mem != 0, ExcNotInitialized());
Assert (u.n_blocks() == block_rows,
ExcDimensionMismatch(u.n_blocks(), block_rows));
Assert (v.n_blocks() == block_cols,
//---------------------------------------------------------------------------
+template <typename number>
+BlockTrianglePrecondition<number>::BlockTrianglePrecondition()
+ : BlockMatrixArray<number> (),
+ backward(false)
+{}
+
+
template <typename number>
BlockTrianglePrecondition<number>::BlockTrianglePrecondition(
unsigned int block_rows,
{}
+template <typename number>
+void
+BlockTrianglePrecondition<number>::initialize(
+ unsigned int n_block_rows,
+ VectorMemory<Vector<number> >& memory,
+ bool backward)
+{
+ BlockMatrixArray<number>::initialize(n_block_rows, n_block_rows, memory);
+ backward = backward;
+}
+
+
template <typename number>
void
BlockTrianglePrecondition<number>::reinit (
BlockMatrixArray<number>::reinit(n,n);
}
+
template <typename number>
void
BlockTrianglePrecondition<number>::do_row (