#include <base/config.h>
#include <base/exceptions.h>
#include <base/subscriptor.h>
+#include <base/thread_management.h>
#include <lac/vector.h>
#include <lac/sparse_matrix.h>
* active. You have to synchronise your calls to the functions
* provided by this class using mutexes (see the @ref{Threads}
* namespace for such classes) to avoid multiple active calls at the
- * same time if you use multithreading.
+ * same time if you use multithreading. Since you may use this class
+ * in different parts of your program, and may not want to use a
+ * global variable for locking, this class has a lock as static member
+ * variable, which may be accessed using the
+ * @p{get_synchronisation_lock} function. Note however, that this
+ * class does not perform the synchronisation for you within its
+ * member functions. The reason is that you will usually want to
+ * synchronise over the calls to @p{initialize} and @p{factorize},
+ * since there should probably not be a call to one of these function
+ * with another matrix between the calls for one matrix. (The author
+ * does not really know whether this is true, but it is probably safe
+ * to assume that.) Since such cross-function synchronisation can only
+ * be performed from outside, it is left to the user of this class to
+ * do so.
*
* @author Wolfgang Bangerth, 2000, 2001
*/
*/
unsigned int memory_consumption () const;
+ /**
+ * Get a reference to the
+ * synchronisation lock which can
+ * be used for this class. See
+ * the general description of
+ * this class for more
+ * information.
+ */
+ Threads::ThreadMutex & get_synchronisation_lock () const;
+
/**
* Exception.
*/
*/
int IFLAG;
+ /**
+ * Mutex for synchronising access
+ * to this class.
+ */
+ static Threads::ThreadMutex synchronisation_lock;
+
/**
* Fill the @p{A} array from the
* symmetric part of the given
* active. You have to synchronise your calls to the functions
* provided by this class using mutexes (see the @ref{Threads}
* namespace for such classes) to avoid multiple active calls at the
- * same time if you use multithreading.
+ * same time if you use multithreading. Since you may use this class
+ * in different parts of your program, and may not want to use a
+ * global variable for locking, this class has a lock as static member
+ * variable, which may be accessed using the
+ * @p{get_synchronisation_lock} function. Note however, that this
+ * class does not perform the synchronisation for you within its
+ * member functions. The reason is that you will usually want to
+ * synchronise over the calls to @p{initialize} and @p{factorize},
+ * since there should probably not be a call to one of these function
+ * with another matrix between the calls for one matrix. (The author
+ * does not really know whether this is true, but it is probably safe
+ * to assume that.) Since such cross-function synchronisation can only
+ * be performed from outside, it is left to the user of this class to
+ * do so.
*
* @author Wolfgang Bangerth, 2000, 2001
*/
*/
unsigned int memory_consumption () const;
+ /**
+ * Get a reference to the
+ * synchronisation lock which can
+ * be used for this class. See
+ * the general description of
+ * this class for more
+ * information.
+ */
+ Threads::ThreadMutex & get_synchronisation_lock () const;
+
/**
* Exception.
*/
std::vector<unsigned int> KEEP;
std::vector<unsigned int> IW1;
+ /**
+ * Mutex for synchronising access
+ * to this class.
+ */
+ static Threads::ThreadMutex synchronisation_lock;
+
/**
* Fill the @p{A} array from the
* symmetric part of the given
/* -------------------------- MA27 ---------------------------- */
+Threads::ThreadMutex SparseDirectMA27::synchronisation_lock;
+
+
SparseDirectMA27::SparseDirectMA27 (const double LIW_factor_1,
const double LIW_factor_2,
const double LA_factor,
+Threads::ThreadMutex &
+SparseDirectMA27::get_synchronisation_lock () const
+{
+ return synchronisation_lock;
+};
+
+
+
void
SparseDirectMA27::fill_A (const SparseMatrix<double> &matrix)
{
/* -------------------------- MA47 ---------------------------- */
-
+Threads::ThreadMutex SparseDirectMA47::synchronisation_lock;
SparseDirectMA47::SparseDirectMA47 (const double LIW_factor_1,
+Threads::ThreadMutex &
+SparseDirectMA47::get_synchronisation_lock () const
+{
+ return synchronisation_lock;
+};
+
+
+
void
SparseDirectMA47::fill_A (const SparseMatrix<double> &matrix)
{