straightforward is we would like, however, it is not so
difficult that we can not talk about it. That said, we cannot
discuss every possible choice of parameters, because this is too
- involved and we would much rather be doing something productive
- with the interface in <acronym>deal.II</acronym>. Thus we give
- only a short walk-through mentioning the most important
- parameters needed for successful compliation and linking.
+ involved (and we would probably much rather be doing something
+ productive with the interface and
+ <acronym>deal.II</acronym>). Thus we give only a short
+ walk-through mentioning the most important parameters needed for
+ successful compliation and linking.
</p>
<p> The compilation scheme involves repeating the same three steps
<code>INTFACE</code> of
<acronym>BLACS</acronym>' own <code>Bmake.inc</code>. If you
are using OpenMPI this should be the
- value <code>-DAdd_</code>. Further we have to add to all
+ value <code>-DAdd_</code>.
+ </li>
+
+ <li> Finally we add the flag <code>-fPIC</code> to the
three compiler flag variables <code>OPTF</code>,
- <code>OPTC</code>, and <code>OPTL</code> the flag
- <code>-fPIC</code>. Without adding this last flag it will
- not be possible to link deal.II with MUMPS as a shared
- library.
+ <code>OPTC</code>, and <code>OPTL</code> which follow
+ imediately after the above. Without adding this last flag it
+ will not be possible to link <acronym>deal.II</acronym> with
+ <acronym>MUMPS</acronym> as a shared library.
</li>
</ul>
</p>
configure <acronym>deal.II</acronym> with the following
additional options:
<pre>
- <code>--with-mumps=path/to/mumps
- --with-blacs=path/to/blacs
- --with-scalapack=path/to/scalpack
+ <code>
+ --with-mumps=path/to/mumps
+ --with-blacs=path/to/blacs
+ --with-scalapack=path/to/scalpack
</code>
</pre>
</p>
+ <p>
+ Note: Throughout this description of the compilation process
+ of <acronym>MUMPS</acronym> we have emphasised adding the
+ compiler flag <code>-fPIC</code>. This is a definate requirement
+ if we are compiling <acronym>deal.II</acronym> with shared
+ libraries (which is the default). If we had preferred to be
+ compiling <acronym>deal.II</acronym> without shared libraries,
+ that's ok too; in that case we would do exactly the same thing
+ as described above, but this time omitting
+ the <code>-fPIC</code> flag from the scheme.
+ </p>
+
</body>
</html>
* Exception
*/
DeclException0 (ExcInitializeAlreadyCalled);
- /**
- * Exception
- */
- DeclException0 (ExcInitializeNotCalled);
+
/**
* Exception
*/
DeclException0 (ExcFactorizeNotCalled);
+
/**
* Exception
*/
DeclException0 (ExcDifferentSparsityPatterns);
+
/**
* Exception
*/
* Exception
*/
DeclException0 (ExcInitializeAlreadyCalled);
+
/**
* Exception
*/
DeclException0 (ExcFactorizeNotCalled);
+
/**
* Exception
*/
DeclException0 (ExcCantFactorizeAgain);
+
/**
* Exception
*/
DMUMPS_STRUC_C id;
- double *a;
- double *rhs;
-
+ double *a;
+ double *rhs;
unsigned int *irn;
unsigned int *jcn;
unsigned int n;
bool initialize_called;
public:
-
+
/**
* Constructor
*/
* Destructor
*/
~SparseDirectMUMPS ();
+
+ /**
+ * Exception
+ */
+ DeclException0 (ExcInitializeAlreadyCalled);
/**
* This function initializes a MUMPS instance
// stdin
pipe(detached_mode_data->server_client_pipe);
pipe(detached_mode_data->client_server_pipe);
+
// fflush(NULL) is said to be a
// good idea before fork()
std::fflush(NULL);
// process
detached_mode_data->child_pid = fork();
if (detached_mode_data->child_pid == 0)
- // child process starts here
+ // child process starts here
{
// copy read end of input
// pipe to stdin, and
#ifdef DEAL_II_USE_MUMPS
SparseDirectMUMPS::SparseDirectMUMPS ()
+ :
+ initialize_called (false)
{}
SparseDirectMUMPS::~SparseDirectMUMPS ()
void SparseDirectMUMPS::initialize (const SparseMatrix<double>& matrix,
const Vector<double> & vector)
{
+ // Check we haven't been here before:
+ Assert (initialize_called == false, ExcInitializeAlreadyCalled());
// Initialize MUMPS instance:
id.job = -1;
a = new double[nz];
// matrix indices pointing to the row and
- // column dimensions of the matrix
- // respectively: iw. a[k] is the matrix
- // element (irn[k],jcn[k])
+ // column dimensions respectively of the
+ // matrix representation above (a): ie. a[k]
+ // is the matrix element (irn[k], jcn[k])
irn = new unsigned int[nz];
jcn = new unsigned int[nz];
void SparseDirectMUMPS::solve (Vector<double>& vector)
{
+ // Check that the solver has been initialized
+ // by the routine above:
+ Assert (initialize_called == true, ExcNotInitialized());
+
+ // and that the matrix has at least one
+ // nonzero element:
+ Assert (nz != 0, ExcNotInitialized());
// Start solver
id.job = 6;
dmumps_c (&id);
-
id.job = -2;
dmumps_c (&id);
InstantiateUMFPACK(BlockSparseMatrix<double>);
InstantiateUMFPACK(BlockSparseMatrix<float>);
-#ifdef DEAL_II_USE_MUMPS
// explicit instantiations for SparseDirectMUMPS
+#ifdef DEAL_II_USE_MUMPS
template <class Matrix>
void SparseDirectMUMPS::initialize (const SparseMatrix<double>& matrix,
const Vector<double> & vector);