//-------------------------------------------------------------------------
/**
- * @defgroup Solvers Linear Solver classes
- *
- * Here we collect iterative solvers and some control classes. All
- * solvers inherit from the class template Solver, which provides some
- * basic maintenance methods.
+ * @defgroup Vectors Vector classes
*
- * The number of iteration steps of all solvers is controlled by
- * objects of class SolverControl or its derived class
- * ReductionControl.
+ * Here, we list all the classes that can be used as VECTOR in linear solvers
+ * (see Solver) and for matrix operations.
*/
/**
* @defgroup Matrices Matrix classes
* @{
*
- * All matrices in this library have a common minimal interface,
- * defined through MATRIX. This interface consists of functions for
- * multiplication with appropriate vectors.
+ * 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.
+ *
+ * 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.
*
+ * Preconditioners are matrix classes as well, since they perform linear
+ * operations on vectors.
+ *
+ * @author Guido Kanschat, 2003
*/
/**
* @defgroup Matrix1 Basic matrices
*
- * These are the actual matrix classes provided by deal.II. They all
- * provide some interface for allocating memory and entering values.
-*/
+ * 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).
+ *
+ * @author Guido Kanschat, 2003
+ */
/**
* @defgroup Matrix2 Derived matrices
+ *
+ * These matrices are built on top of the basic matrices. They perform special
+ * operations using the interface defined in Solver.
+ *
+ * @author Guido Kanschat, 2003
*/
/**
* @defgroup Preconditioners Preconditioners
- * @}
+ * In principle, preconditioners are matrices themselves. But, since they are
+ * only used in a special context, we put them in a separate group.
+ *
+ * @author Guido Kanschat, 2003
+ */
+
+ /*@}*/
+
+/**
+ * @defgroup Solvers Linear Solver classes
+ *
+ * Here we collect iterative solvers and some control classes. All
+ * solvers inherit from the class template Solver, which provides some
+ * basic maintenance methods.
+ *
+ * The number of iteration steps of all 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.
+ *
+ * @author Guido Kanschat, 2003
+ */
+
+/**
+ * @defgroup VMemory Vector memory management
+ *
+ * A few classes that are used to avoid allocating and deallocating vectors in
+ * iterative procedures. These methods all use an object of the base class
+ * VectorMemory to get their auxiliary vectors. Unfortunately, the
+ * intelligence put into both implementations provided right now is not
+ * overwhelming.
+ *
+ * @author Guido Kanschat, 2003
*/
#include <vector>
+/*!@addtogroup VMemory */
+/*@{*/
+//! Base class for vector memory management
/**
* Memory management base class for vectors. This is an abstract base
* class used by all iterative methods to allocate space for
*
* @author Guido Kanschat, 1998-2003
*/
-template<class Vector = ::Vector<double> >
+template<class VECTOR = ::Vector<double> >
class VectorMemory : public Subscriptor
{
public:
/**
* Return new vector from the pool.
*/
- virtual Vector* alloc() = 0;
+ virtual VECTOR* alloc() = 0;
/**
* Return a vector into the pool
* for later use.
*/
- virtual void free (const Vector * const) = 0;
+ virtual void free (const VECTOR * const) = 0;
/**
* No more available vectors.
*/
DeclException0(ExcNotAllocatedHere);
};
-
+//! Sample implementation using system memory management.
/**
* Simple memory management. This memory class is just made for
* tests. It just allocates and deletes
* vectors as needed from the global heap, i.e. performs no
* specially adapted actions to the purpose of this class.
*/
-template<class Vector = ::Vector<double> >
-class PrimitiveVectorMemory : public VectorMemory<Vector>
+template<class VECTOR = ::Vector<double> >
+class PrimitiveVectorMemory : public VectorMemory<VECTOR>
{
public:
/**
* Allocate a vector
* from the global heap.
*/
- virtual Vector* alloc()
+ virtual VECTOR* alloc()
{
- return new Vector();
+ return new VECTOR();
}
/**
* Return a vector to the global heap.
*/
- virtual void free (const Vector * const v)
+ virtual void free (const VECTOR * const v)
{
delete v;
}
};
-
+//! Keeps all vectors and avoids reallocation.
/**
* Memory keeping allocated vectors. This @p{VectorMemory} is able to
* grow infinitely (according to computer memory). A vector once
*
* @author Guido Kanschat, 1999
*/
-template<class Vector = ::Vector<double> >
-class GrowingVectorMemory : public VectorMemory<Vector>
+template<class VECTOR = ::Vector<double> >
+class GrowingVectorMemory : public VectorMemory<VECTOR>
{
public:
/**
/**
* Return new vector from the pool.
*/
- virtual Vector* alloc();
+ virtual VECTOR* alloc();
/**
* Return a vector into the pool
* for later use.
*/
- virtual void free (const Vector * const);
+ virtual void free (const VECTOR * const);
private:
/**
* vector is used, second the
* vector itself.
*/
- typedef std::pair<bool, Vector*> entry_type;
+ typedef std::pair<bool, VECTOR*> entry_type;
/**
* Array of allocated vectors.
Threads::ThreadMutex mutex;
};
+/*@}*/
+
/* --------------------- inline functions ---------------------- */
-template <typename Vector>
-GrowingVectorMemory<Vector>::GrowingVectorMemory(const unsigned int initial_size)
+template <typename VECTOR>
+GrowingVectorMemory<VECTOR>::GrowingVectorMemory(const unsigned int initial_size)
: pool(initial_size)
{
Threads::ThreadMutex::ScopedLock lock(mutex);
++i)
{
i->first = false;
- i->second = new Vector;
+ i->second = new VECTOR;
};
// no vectors yet claimed
-template<typename Vector>
-GrowingVectorMemory<Vector>::~GrowingVectorMemory()
+template<typename VECTOR>
+GrowingVectorMemory<VECTOR>::~GrowingVectorMemory()
{
Threads::ThreadMutex::ScopedLock lock(mutex);
-template<typename Vector>
-Vector *
-GrowingVectorMemory<Vector>::alloc()
+template<typename VECTOR>
+VECTOR *
+GrowingVectorMemory<VECTOR>::alloc()
{
Threads::ThreadMutex::ScopedLock lock(mutex);
++n_alloc;
}
}
- const entry_type t (true, new Vector);
+ const entry_type t (true, new VECTOR);
pool.push_back(t);
return t.second;
-template<typename Vector>
+template<typename VECTOR>
void
-GrowingVectorMemory<Vector>::free(const Vector* const v)
+GrowingVectorMemory<VECTOR>::free(const VECTOR* const v)
{
Threads::ThreadMutex::ScopedLock lock(mutex);
for (typename std::vector<entry_type>::iterator i=pool.begin();i != pool.end() ;++i)
return;
}
}
- Assert(false, typename VectorMemory<Vector>::ExcNotAllocatedHere());
+ Assert(false, typename VectorMemory<VECTOR>::ExcNotAllocatedHere());
}