Boost logo

Boost-Commit :

From: karl.meerbergen_at_[hidden]
Date: 2007-09-12 02:58:13


Author: karlmeerbergen
Date: 2007-09-12 02:58:12 EDT (Wed, 12 Sep 2007)
New Revision: 39206
URL: http://svn.boost.org/trac/boost/changeset/39206

Log:
added mumps binding

Added:
   sandbox/boost/numeric/bindings/mumps/
   sandbox/boost/numeric/bindings/mumps/4.6.4/
   sandbox/boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp (contents, props changed)
   sandbox/boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp (contents, props changed)
   sandbox/boost/numeric/bindings/mumps/4.6.4/smumps_c.hpp (contents, props changed)
   sandbox/boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp (contents, props changed)
   sandbox/boost/numeric/bindings/mumps/mumps_driver.hpp (contents, props changed)

Added: sandbox/boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp 2007-09-12 02:58:12 EDT (Wed, 12 Sep 2007)
@@ -0,0 +1,118 @@
+#ifndef BOOST_NUMERIC_BINDINGS_MUMPS_464_CMUMPS_C_HPP
+#define BOOST_NUMERIC_BINDINGS_MUMPS_464_CMUMPS_C_HPP
+
+/*
+
+ THIS FILE IS PART OF MUMPS VERSION 4.6.4
+ This Version was built on Thu Jan 11 13:32:35 2007
+
+
+ This version of MUMPS is provided to you free of charge. It is public
+ domain, based on public domain software developed during the Esprit IV
+ European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL.
+ Since this first public domain version in 1999, the developments are
+ supported by the following institutions: CERFACS, ENSEEIHT-IRIT, and
+ INRIA.
+
+ Main contributors are Patrick Amestoy, Iain Duff, Abdou Guermouche,
+ Jacko Koster, Jean-Yves L'Excellent, and Stephane Pralet.
+
+ Up-to-date copies of the MUMPS package can be obtained
+ from the Web pages http://www.enseeiht.fr/apo/MUMPS/
+ or http://graal.ens-lyon.fr/MUMPS
+
+
+ THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
+ EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+
+
+ User documentation of any code that uses this software can
+ include this complete notice. You can acknowledge (using
+ references [1], [2], and [3] the contribution of this package
+ in any scientific publication dependent upon the use of the
+ package. You shall use reasonable endeavours to notify
+ the authors of the package of this publication.
+
+ [1] P. R. Amestoy, I. S. Duff and J.-Y. L'Excellent,
+ Multifrontal parallel distributed symmetric and unsymmetric solvers,
+ in Comput. Methods in Appl. Mech. Eng., 184, 501-520 (2000).
+
+ [2] P. R. Amestoy, I. S. Duff, J. Koster and J.-Y. L'Excellent,
+ A fully asynchronous multifrontal solver using distributed dynamic
+ scheduling, SIAM Journal of Matrix Analysis and Applications,
+ Vol 23, No 1, pp 15-41 (2001).
+
+ [3] P. R. Amestoy and A. Guermouche and J.-Y. L'Excellent and
+ S. Pralet, Hybrid scheduling for the parallel solution of linear
+ systems. Parallel Computing Vol 32 (2), pp 136-156 (2006).
+
+*/
+/* $Id$ */
+/* Mostly written in march 2002 (JYL) */
+
+// This file is modified by Karl Meerbergen for C++ users
+
+/* Complex datatypes */
+typedef struct {float r,i;} mumps_complex;
+
+/* Next line defines CMUMPS_INT, CMUMPS_DOUBLE and CMUMPS_DOUBLE2 */
+#include "cmumps_prec.h"
+/*
+ * Definition of the (simplified)
+ * MUMPS C structure
+ */
+typedef struct
+ {
+ CMUMPS_INT sym, par, job;
+ CMUMPS_INT comm_fortran; /* Fortran communicator */
+ CMUMPS_INT icntl[40];
+ CMUMPS_DOUBLE2 cntl[5];
+ CMUMPS_INT n;
+
+ CMUMPS_INT nz_alloc; /* used in matlab interface to decide if
+ we free + malloc when we have large variation */
+
+ /* Assembled entry */
+ CMUMPS_INT nz; CMUMPS_INT *irn; CMUMPS_INT *jcn; CMUMPS_DOUBLE *a;
+ /* Distributed entry */
+ CMUMPS_INT nz_loc; CMUMPS_INT *irn_loc; CMUMPS_INT *jcn_loc; CMUMPS_DOUBLE *a_loc;
+ /* Element entry */
+ CMUMPS_INT nelt; CMUMPS_INT *eltptr; CMUMPS_INT *eltvar; CMUMPS_DOUBLE *a_elt;
+
+ /* Ordering, if given by user */
+ CMUMPS_INT *perm_in;
+
+ /* Orderings returned to user */
+ /* symmetric permutation */
+ CMUMPS_INT *sym_perm;
+ /* column permutation */
+ CMUMPS_INT *uns_perm;
+
+ /* Scaling (input only in this version) */
+ CMUMPS_DOUBLE *colsca; CMUMPS_DOUBLE *rowsca;
+ /* RHS, solution, ouptput data and statistics */
+ CMUMPS_DOUBLE *rhs, *rhs_sparse, *sol_loc;
+ CMUMPS_INT *irhs_sparse, *irhs_ptr, *isol_loc;
+ CMUMPS_INT nrhs, lrhs, nz_rhs, lsol_loc;
+ CMUMPS_INT schur_mloc, schur_nloc, schur_lld;
+ CMUMPS_INT mblock, nblock, nprow, npcol;
+ CMUMPS_INT info[40],infog[40];
+ CMUMPS_DOUBLE2 rinfo[20], rinfog[20];
+ /* Null space */
+ CMUMPS_INT deficiency; CMUMPS_DOUBLE * nullspace; CMUMPS_INT * mapping;
+ /* Schur */
+ CMUMPS_INT size_schur; CMUMPS_INT *listvar_schur; CMUMPS_DOUBLE *schur;
+ /* Internal parameters */
+ CMUMPS_INT instance_number;
+ /* For out-of-core */
+ char ooc_tmpdir[151];
+ char ooc_prefix[151];
+ } CMUMPS_STRUC_C;
+
+
+extern "C" {
+ void cmumps_c(CMUMPS_STRUC_C * cmumps_par);
+}
+
+#endif
+

Added: sandbox/boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp 2007-09-12 02:58:12 EDT (Wed, 12 Sep 2007)
@@ -0,0 +1,125 @@
+#ifndef BOOST_NUMERIC_BINDINGS_MUMPS_464_DMUMPS_C_HPP
+#define BOOST_NUMERIC_BINDINGS_MUMPS_464_DMUMPS_C_HPP
+
+/*
+
+ THIS FILE IS PART OF MUMPS VERSION 4.6.4
+ This Version was built on Thu Jan 11 13:32:35 2007
+
+
+ This version of MUMPS is provided to you free of charge. It is public
+ domain, based on public domain software developed during the Esprit IV
+ European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL.
+ Since this first public domain version in 1999, the developments are
+ supported by the following institutions: CERFACS, ENSEEIHT-IRIT, and
+ INRIA.
+
+ Main contributors are Patrick Amestoy, Iain Duff, Abdou Guermouche,
+ Jacko Koster, Jean-Yves L'Excellent, and Stephane Pralet.
+
+ Up-to-date copies of the MUMPS package can be obtained
+ from the Web pages http://www.enseeiht.fr/apo/MUMPS/
+ or http://graal.ens-lyon.fr/MUMPS
+
+
+ THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
+ EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+
+
+ User documentation of any code that uses this software can
+ include this complete notice. You can acknowledge (using
+ references [1], [2], and [3] the contribution of this package
+ in any scientific publication dependent upon the use of the
+ package. You shall use reasonable endeavours to notify
+ the authors of the package of this publication.
+
+ [1] P. R. Amestoy, I. S. Duff and J.-Y. L'Excellent,
+ Multifrontal parallel distributed symmetric and unsymmetric solvers,
+ in Comput. Methods in Appl. Mech. Eng., 184, 501-520 (2000).
+
+ [2] P. R. Amestoy, I. S. Duff, J. Koster and J.-Y. L'Excellent,
+ A fully asynchronous multifrontal solver using distributed dynamic
+ scheduling, SIAM Journal of Matrix Analysis and Applications,
+ Vol 23, No 1, pp 15-41 (2001).
+
+ [3] P. R. Amestoy and A. Guermouche and J.-Y. L'Excellent and
+ S. Pralet, Hybrid scheduling for the parallel solution of linear
+ systems. Parallel Computing Vol 32 (2), pp 136-156 (2006).
+
+*/
+/* $Id$ */
+/* Mostly written in march 2002 (JYL) */
+
+// This file is modified by Karl Meerbergen for C++ users
+
+/* Complex datatypes */
+
+/* Next line defines DMUMPS_INT, DMUMPS_DOUBLE and DMUMPS_DOUBLE2 */
+#include "dmumps_prec.h"
+/*
+ * Definition of the (simplified)
+ * MUMPS C structure
+ */
+typedef struct
+ {
+ DMUMPS_INT sym, par, job;
+ DMUMPS_INT comm_fortran; /* Fortran communicator */
+ DMUMPS_INT icntl[40];
+ DMUMPS_DOUBLE2 cntl[5];
+ DMUMPS_INT n;
+
+ DMUMPS_INT nz_alloc; /* used in matlab interface to decide if
+ we free + malloc when we have large variation */
+
+ /* Assembled entry */
+ DMUMPS_INT nz; DMUMPS_INT *irn; DMUMPS_INT *jcn; DMUMPS_DOUBLE *a;
+ /* Distributed entry */
+ DMUMPS_INT nz_loc; DMUMPS_INT *irn_loc; DMUMPS_INT *jcn_loc; DMUMPS_DOUBLE *a_loc;
+ /* Element entry */
+ DMUMPS_INT nelt; DMUMPS_INT *eltptr; DMUMPS_INT *eltvar; DMUMPS_DOUBLE *a_elt;
+
+ /* Ordering, if given by user */
+ DMUMPS_INT *perm_in;
+
+ /* Orderings returned to user */
+ /* symmetric permutation */
+ DMUMPS_INT *sym_perm;
+ /* column permutation */
+ DMUMPS_INT *uns_perm;
+
+ /* Scaling (input only in this version) */
+ DMUMPS_DOUBLE *colsca; DMUMPS_DOUBLE *rowsca;
+ /* RHS, solution, ouptput data and statistics */
+ DMUMPS_DOUBLE *rhs, *rhs_sparse, *sol_loc;
+ DMUMPS_INT *irhs_sparse, *irhs_ptr, *isol_loc;
+ DMUMPS_INT nrhs, lrhs, nz_rhs, lsol_loc;
+ DMUMPS_INT schur_mloc, schur_nloc, schur_lld;
+ DMUMPS_INT mblock, nblock, nprow, npcol;
+ DMUMPS_INT info[40],infog[40];
+ DMUMPS_DOUBLE2 rinfo[20], rinfog[20];
+ /* Null space */
+ DMUMPS_INT deficiency; DMUMPS_DOUBLE * nullspace; DMUMPS_INT * mapping;
+ /* Schur */
+ DMUMPS_INT size_schur; DMUMPS_INT *listvar_schur; DMUMPS_DOUBLE *schur;
+ /* Internal parameters */
+ DMUMPS_INT instance_number;
+ /* For out-of-core */
+ char ooc_tmpdir[151];
+ char ooc_prefix[151];
+ } DMUMPS_STRUC_C;
+
+
+#define MUMPS_CALL
+#if defined(_WIN32)
+/*
+ * Next line May be needed depending on your Windows environment:
+ * #define MUMPS_CALL __stdcall
+ */
+#endif
+
+extern "C" {
+void dmumps_c(DMUMPS_STRUC_C * dmumps_par);
+}
+
+#endif
+

Added: sandbox/boost/numeric/bindings/mumps/4.6.4/smumps_c.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/numeric/bindings/mumps/4.6.4/smumps_c.hpp 2007-09-12 02:58:12 EDT (Wed, 12 Sep 2007)
@@ -0,0 +1,117 @@
+#ifndef BOOST_NUMERIC_BINDINGS_MUMPS_464_SMUMPS_C_HPP
+#define BOOST_NUMERIC_BINDINGS_MUMPS_464_SMUMPS_C_HPP
+
+/*
+
+ THIS FILE IS PART OF MUMPS VERSION 4.6.4
+ This Version was built on Thu Jan 11 13:32:35 2007
+
+
+ This version of MUMPS is provided to you free of charge. It is public
+ domain, based on public domain software developed during the Esprit IV
+ European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL.
+ Since this first public domain version in 1999, the developments are
+ supported by the following institutions: CERFACS, ENSEEIHT-IRIT, and
+ INRIA.
+
+ Main contributors are Patrick Amestoy, Iain Duff, Abdou Guermouche,
+ Jacko Koster, Jean-Yves L'Excellent, and Stephane Pralet.
+
+ Up-to-date copies of the MUMPS package can be obtained
+ from the Web pages http://www.enseeiht.fr/apo/MUMPS/
+ or http://graal.ens-lyon.fr/MUMPS
+
+
+ THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
+ EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+
+
+ User documentation of any code that uses this software can
+ include this complete notice. You can acknowledge (using
+ references [1], [2], and [3] the contribution of this package
+ in any scientific publication dependent upon the use of the
+ package. You shall use reasonable endeavours to notify
+ the authors of the package of this publication.
+
+ [1] P. R. Amestoy, I. S. Duff and J.-Y. L'Excellent,
+ Multifrontal parallel distributed symmetric and unsymmetric solvers,
+ in Comput. Methods in Appl. Mech. Eng., 184, 501-520 (2000).
+
+ [2] P. R. Amestoy, I. S. Duff, J. Koster and J.-Y. L'Excellent,
+ A fully asynchronous multifrontal solver using distributed dynamic
+ scheduling, SIAM Journal of Matrix Analysis and Applications,
+ Vol 23, No 1, pp 15-41 (2001).
+
+ [3] P. R. Amestoy and A. Guermouche and J.-Y. L'Excellent and
+ S. Pralet, Hybrid scheduling for the parallel solution of linear
+ systems. Parallel Computing Vol 32 (2), pp 136-156 (2006).
+
+*/
+/* $Id$ */
+/* Mostly written in march 2002 (JYL) */
+
+// This file is modified by Karl Meerbergen for C++ users
+
+/* Complex datatypes */
+
+/* Next line defines SMUMPS_INT, SMUMPS_DOUBLE and SMUMPS_DOUBLE2 */
+#include <smumps_prec.h>
+/*
+ * Definition of the (simplified)
+ * MUMPS C structure
+ */
+typedef struct
+ {
+ SMUMPS_INT sym, par, job;
+ SMUMPS_INT comm_fortran; /* Fortran communicator */
+ SMUMPS_INT icntl[40];
+ SMUMPS_DOUBLE2 cntl[5];
+ SMUMPS_INT n;
+
+ SMUMPS_INT nz_alloc; /* used in matlab interface to decide if
+ we free + malloc when we have large variation */
+
+ /* Assembled entry */
+ SMUMPS_INT nz; SMUMPS_INT *irn; SMUMPS_INT *jcn; SMUMPS_DOUBLE *a;
+ /* Distributed entry */
+ SMUMPS_INT nz_loc; SMUMPS_INT *irn_loc; SMUMPS_INT *jcn_loc; SMUMPS_DOUBLE *a_loc;
+ /* Element entry */
+ SMUMPS_INT nelt; SMUMPS_INT *eltptr; SMUMPS_INT *eltvar; SMUMPS_DOUBLE *a_elt;
+
+ /* Ordering, if given by user */
+ SMUMPS_INT *perm_in;
+
+ /* Orderings returned to user */
+ /* symmetric permutation */
+ SMUMPS_INT *sym_perm;
+ /* column permutation */
+ SMUMPS_INT *uns_perm;
+
+ /* Scaling (input only in this version) */
+ SMUMPS_DOUBLE *colsca; SMUMPS_DOUBLE *rowsca;
+ /* RHS, solution, ouptput data and statistics */
+ SMUMPS_DOUBLE *rhs, *rhs_sparse, *sol_loc;
+ SMUMPS_INT *irhs_sparse, *irhs_ptr, *isol_loc;
+ SMUMPS_INT nrhs, lrhs, nz_rhs, lsol_loc;
+ SMUMPS_INT schur_mloc, schur_nloc, schur_lld;
+ SMUMPS_INT mblock, nblock, nprow, npcol;
+ SMUMPS_INT info[40],infog[40];
+ SMUMPS_DOUBLE2 rinfo[20], rinfog[20];
+ /* Null space */
+ SMUMPS_INT deficiency; SMUMPS_DOUBLE * nullspace; SMUMPS_INT * mapping;
+ /* Schur */
+ SMUMPS_INT size_schur; SMUMPS_INT *listvar_schur; SMUMPS_DOUBLE *schur;
+ /* Internal parameters */
+ SMUMPS_INT instance_number;
+ /* For out-of-core */
+ char ooc_tmpdir[151];
+ char ooc_prefix[151];
+ } SMUMPS_STRUC_C;
+
+
+extern "C" {
+void smumps_c(SMUMPS_STRUC_C * smumps_par);
+}
+
+#endif
+

Added: sandbox/boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp 2007-09-12 02:58:12 EDT (Wed, 12 Sep 2007)
@@ -0,0 +1,118 @@
+#ifndef BOOST_NUMERIC_BINDINGS_MUMPS_464_ZMUMPS_C_HPP
+#define BOOST_NUMERIC_BINDINGS_MUMPS_464_ZMUMPS_C_HPP
+
+/*
+
+ THIS FILE IS PART OF MUMPS VERSION 4.6.4
+ This Version was built on Thu Jan 11 13:32:35 2007
+
+
+ This version of MUMPS is provided to you free of charge. It is public
+ domain, based on public domain software developed during the Esprit IV
+ European project PARASOL (1996-1999) by CERFACS, ENSEEIHT-IRIT and RAL.
+ Since this first public domain version in 1999, the developments are
+ supported by the following institutions: CERFACS, ENSEEIHT-IRIT, and
+ INRIA.
+
+ Main contributors are Patrick Amestoy, Iain Duff, Abdou Guermouche,
+ Jacko Koster, Jean-Yves L'Excellent, and Stephane Pralet.
+
+ Up-to-date copies of the MUMPS package can be obtained
+ from the Web pages http://www.enseeiht.fr/apo/MUMPS/
+ or http://graal.ens-lyon.fr/MUMPS
+
+
+ THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
+ EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+
+
+ User documentation of any code that uses this software can
+ include this complete notice. You can acknowledge (using
+ references [1], [2], and [3] the contribution of this package
+ in any scientific publication dependent upon the use of the
+ package. You shall use reasonable endeavours to notify
+ the authors of the package of this publication.
+
+ [1] P. R. Amestoy, I. S. Duff and J.-Y. L'Excellent,
+ Multifrontal parallel distributed symmetric and unsymmetric solvers,
+ in Comput. Methods in Appl. Mech. Eng., 184, 501-520 (2000).
+
+ [2] P. R. Amestoy, I. S. Duff, J. Koster and J.-Y. L'Excellent,
+ A fully asynchronous multifrontal solver using distributed dynamic
+ scheduling, SIAM Journal of Matrix Analysis and Applications,
+ Vol 23, No 1, pp 15-41 (2001).
+
+ [3] P. R. Amestoy and A. Guermouche and J.-Y. L'Excellent and
+ S. Pralet, Hybrid scheduling for the parallel solution of linear
+ systems. Parallel Computing Vol 32 (2), pp 136-156 (2006).
+
+*/
+/* $Id$ */
+/* Mostly written in march 2002 (JYL) */
+
+// This file is modified by Karl Meerbergen for C++ users
+
+/* Complex datatypes */
+typedef struct {double r,i;} mumps_double_complex;
+
+/* Next line defines ZMUMPS_INT, ZMUMPS_DOUBLE and ZMUMPS_DOUBLE2 */
+#include "zmumps_prec.h"
+/*
+ * Definition of the (simplified)
+ * MUMPS C structure
+ */
+typedef struct
+ {
+ ZMUMPS_INT sym, par, job;
+ ZMUMPS_INT comm_fortran; /* Fortran communicator */
+ ZMUMPS_INT icntl[40];
+ ZMUMPS_DOUBLE2 cntl[5];
+ ZMUMPS_INT n;
+
+ ZMUMPS_INT nz_alloc; /* used in matlab interface to decide if
+ we free + malloc when we have large variation */
+
+ /* Assembled entry */
+ ZMUMPS_INT nz; ZMUMPS_INT *irn; ZMUMPS_INT *jcn; ZMUMPS_DOUBLE *a;
+ /* Distributed entry */
+ ZMUMPS_INT nz_loc; ZMUMPS_INT *irn_loc; ZMUMPS_INT *jcn_loc; ZMUMPS_DOUBLE *a_loc;
+ /* Element entry */
+ ZMUMPS_INT nelt; ZMUMPS_INT *eltptr; ZMUMPS_INT *eltvar; ZMUMPS_DOUBLE *a_elt;
+
+ /* Ordering, if given by user */
+ ZMUMPS_INT *perm_in;
+
+ /* Orderings returned to user */
+ /* symmetric permutation */
+ ZMUMPS_INT *sym_perm;
+ /* column permutation */
+ ZMUMPS_INT *uns_perm;
+
+ /* Scaling (input only in this version) */
+ ZMUMPS_DOUBLE *colsca; ZMUMPS_DOUBLE *rowsca;
+ /* RHS, solution, ouptput data and statistics */
+ ZMUMPS_DOUBLE *rhs, *rhs_sparse, *sol_loc;
+ ZMUMPS_INT *irhs_sparse, *irhs_ptr, *isol_loc;
+ ZMUMPS_INT nrhs, lrhs, nz_rhs, lsol_loc;
+ ZMUMPS_INT schur_mloc, schur_nloc, schur_lld;
+ ZMUMPS_INT mblock, nblock, nprow, npcol;
+ ZMUMPS_INT info[40],infog[40];
+ ZMUMPS_DOUBLE2 rinfo[20], rinfog[20];
+ /* Null space */
+ ZMUMPS_INT deficiency; ZMUMPS_DOUBLE * nullspace; ZMUMPS_INT * mapping;
+ /* Schur */
+ ZMUMPS_INT size_schur; ZMUMPS_INT *listvar_schur; ZMUMPS_DOUBLE *schur;
+ /* Internal parameters */
+ ZMUMPS_INT instance_number;
+ /* For out-of-core */
+ char ooc_tmpdir[151];
+ char ooc_prefix[151];
+ } ZMUMPS_STRUC_C;
+
+
+extern "C" {
+void zmumps_c(ZMUMPS_STRUC_C * zmumps_par);
+}
+
+#endif
+

Added: sandbox/boost/numeric/bindings/mumps/mumps_driver.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/numeric/bindings/mumps/mumps_driver.hpp 2007-09-12 02:58:12 EDT (Wed, 12 Sep 2007)
@@ -0,0 +1,256 @@
+//
+// Copyright Karl Meerbergen 2007
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef mumps_mumps_driver_hpp
+#define mumps_mumps_driver_hpp
+
+#include <boost/numeric/bindings/mumps/4.6.4/smumps_c.hpp>
+#include <boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp>
+#include <boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp>
+#include <boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp>
+#include <boost/numeric/bindings/traits/sparse_traits.hpp>
+#include <boost/numeric/bindings/traits/matrix_traits.hpp>
+#include <boost/numeric/bindings/traits/type_traits.hpp>
+#include <boost/static_assert.hpp>
+#include <complex>
+#include <cassert>
+
+//
+// This file contains a C++ driver for MUMPS
+//
+// The templated class mumps<M> is a wrapper for the corresponding C struct.
+// The class contains constructor and destructor that call mumps with JOB=-1 and JOB=-2
+// respectively.
+//
+// The function driver() calls MUMPS. The user must set the parameters of the data manually.
+//
+// The following functions are very helpful in this respect, since they extract pointer and size
+// data using the Boost Bindings.
+//
+// void matrix_integer_data() : to set the integer data of the matrix.
+// void matrix_value_data() : to set the values of the matrix.
+// void rhs_sol_value_data() : to set the right-hand side and solution vectors in the case of a dense solution vector.
+//
+
+namespace boost { namespace numeric { namespace bindings { namespace mumps {
+
+ namespace detail {
+ //
+ // Type and Driver
+ //
+ template <class T>
+ struct mumps_type {
+ } ;
+
+ template <class T>
+ struct mumps_call {
+ } ;
+
+ template <class T>
+ struct mumps_internal_value_type {
+ typedef T type ;
+ } ;
+
+ //
+ // Specialization for float
+ //
+
+ template <>
+ struct mumps_type< float > {
+ typedef SMUMPS_STRUC_C type ;
+ } ;
+
+ template <>
+ struct mumps_call< float > {
+ void operator() ( SMUMPS_STRUC_C& struc ) const {
+ smumps_c( &struc ) ;
+ }
+ } ;
+
+ //
+ // Specialization for double
+ //
+
+ template <>
+ struct mumps_type< double > {
+ typedef DMUMPS_STRUC_C type ;
+ } ;
+
+ template <>
+ struct mumps_call< double > {
+ void operator() ( DMUMPS_STRUC_C& struc ) const {
+ dmumps_c( &struc ) ;
+ }
+ } ;
+
+ //
+ // Specialization for complex<float>
+ //
+
+ template <>
+ struct mumps_type< std::complex< float > > {
+ typedef CMUMPS_STRUC_C type ;
+ } ;
+
+ template <>
+ struct mumps_call< std::complex< float > > {
+ void operator() ( CMUMPS_STRUC_C& struc ) const {
+ cmumps_c( &struc ) ;
+ }
+ } ;
+
+ template <>
+ struct mumps_internal_value_type< std::complex<float> > {
+ typedef mumps_complex type ;
+ } ;
+
+ //
+ // Specialization for complex<double>
+ //
+
+ template <>
+ struct mumps_type< std::complex< double > > {
+ typedef ZMUMPS_STRUC_C type ;
+ } ;
+
+ template <>
+ struct mumps_call< std::complex< double > > {
+ void operator() ( ZMUMPS_STRUC_C& struc ) const {
+ zmumps_c( &struc ) ;
+ }
+ } ;
+
+ template <>
+ struct mumps_internal_value_type< std::complex<double> > {
+ typedef mumps_double_complex type ;
+ } ;
+
+ //
+ // Symmetry map
+ //
+
+ template <class T>
+ struct mumps_sym {
+ } ;
+
+ template <>
+ struct mumps_sym< boost::numeric::bindings::traits::symmetric_t > {
+ static int const value = 2 ;
+ } ;
+
+ template <>
+ struct mumps_sym< boost::numeric::bindings::traits::general_t > {
+ static int const value = 0 ;
+ } ;
+
+ //
+ // Get index pointers
+ //
+ template <typename M>
+ void indices( boost::numeric::bindings::traits::row_major_t, int*& rows, int*& cols, M const& m ) {
+ rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ;
+ cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ;
+ }
+
+ template <typename M>
+ void indices( boost::numeric::bindings::traits::column_major_t, int*& rows, int*& cols, M const& m ) {
+ cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ;
+ rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ;
+ }
+
+ } // namespace detail
+
+
+
+ //
+ // Generic MUMPS data for any value_type
+ //
+ template <typename M>
+ struct mumps
+ : detail::mumps_type< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type >::type
+ {
+ typedef typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type value_type ;
+ typedef typename detail::mumps_type< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type >::type c_struct_type ;
+
+ //
+ // Initialize MUMPS solver
+ // Pass a communicator (comm=-987654 means choose default)
+ // Pass 'par': default = 1: host is involved in factorization
+ //
+ mumps( int comm_fortran=-987654, int par=1 )
+ {
+ this->job = -1 ;
+ this->par = par ;
+ this->comm_fortran = comm_fortran ;
+ this->sym = detail::mumps_sym< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::matrix_structure >::value ;
+ detail::mumps_call<value_type>() ( *this ) ;
+ }
+
+ // Destroy the solver
+ ~mumps() {
+ this->job = -2 ;
+ detail::mumps_call<value_type>() ( *this ) ;
+ }
+ } ;
+
+
+ //
+ // Copy the matrix integer data (matrix order, structure) to the MUMPS struct
+ //
+ template <typename M>
+ void matrix_integer_data( mumps<M>& data, M& m ) {
+ BOOST_STATIC_ASSERT( (1 == boost::numeric::bindings::traits::sparse_matrix_traits<M>::index_base) ) ;
+ data.n = boost::numeric::bindings::traits::spmatrix_size1( m ) ;
+ assert( boost::numeric::bindings::traits::spmatrix_size2( m ) == data.n ) ;
+
+ data.nz = boost::numeric::bindings::traits::spmatrix_num_nonzeros( m ) ;
+ detail::indices( typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::ordering_type(), data.irn, data.jcn, m ) ;
+
+ data.nz_loc = boost::numeric::bindings::traits::spmatrix_num_nonzeros( m ) ;
+ detail::indices( typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::ordering_type(), data.irn_loc, data.jcn_loc, m ) ;
+ } // matrix_integer_data()
+
+
+ //
+ // Copy the values pointer to the MUMPS struct
+ //
+ template <typename M>
+ void matrix_value_data( mumps<M>& data, M& m ) {
+ data.a = boost::numeric::bindings::traits::spmatrix_value_storage( m ) ;
+ data.a_loc = boost::numeric::bindings::traits::spmatrix_value_storage( m ) ;
+ } // matrix_value_data()
+
+
+ //
+ // Copy the right-hand side / solution pointer to the MUMPS struct
+ // in case of a dense undistributed right-hand side and solution.
+ //
+ template <typename M, typename X>
+ void rhs_sol_value_data( mumps<M>& data, X& x ) {
+ data.rhs = boost::numeric::bindings::traits::matrix_storage( x ) ;
+ data.nrhs = boost::numeric::bindings::traits::matrix_size2( x ) ;
+ data.lrhs = boost::numeric::bindings::traits::leading_dimension( x ) ;
+ } // matrix_rhs_sol_value_data()
+
+
+ //
+ // Call the MUMPS driver for the given MUMPS struct.
+ //
+ template <typename M>
+ int driver( mumps<M>& data ) {
+ assert( data.job>=1 ? data.irn!=0 : true ) ;
+ assert( data.job>=1 ? data.jcn!=0 : true ) ;
+ assert( data.job>=2 ? data.a!=0 : true ) ;
+ assert( data.job>=3 ? data.rhs!=0 : true ) ;
+ detail::mumps_call<typename M::value_type>() ( static_cast<typename mumps<M>::c_struct_type&>( data ) ) ;
+ return data.info[0] ;
+ } // driver()
+
+} } } } // namespace boost::numeric::bindings::mumps
+
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk