Menu

A description of a MumpsSovler Visual studio solution, available in the Code tab

Dear mumps users,

in this post I will try make a thorough description of a wrapper library VS solution. The solution is available in the code tab. If you want to download it, you can check it out with svn versioning system, or use the button download snapshot.

The solution consist of six projects:
- static wrapper library,
- dynamic wrapper library,
- c++ test program with a static linking,
- c++ test program with a dynamic linking,
- c test program with a static linking,
- c test program with a dynamic linking.

The purpose of these projects is to be able to test all possible usages of the wrapper library, eg. static or dynamic linking, usage in the c or c++ programme, 32- or 64-bit environment and "Debug" or "Release" build. There are four different build configurations for each project, 32-bit debug, 64-bit debug, 32-bit release and 64-bit release. The complete solution contains only 3 source files and 2 header files. With a proper build configuration and proper preprocessor directives I have covered all different aforementioned build/usage configurations.
The explanation of the used settings and preprocessor directives will be covered in the future post.

Main part of the solution is the file MumpsLibrary.cpp. This is a wrapper library for the MUMPS driver, available by the MUMPS source code. In it are (at the time being just some) functions to the MUMPS driver. Current implementation covers next MUMPS capabilities:
- read/import matrix,
- read/import right hand side vector(s),
- add one right hand side vector,
- remove one right hand side vector,
- set/get symmetric matrix,
- set/get determinant calculation,
- set/get MUMPS intermediate output,
- set/get write MUMPS problem,
- set/get redirect standard output and/or standard error for a diagnostic purposes,
- set/get information levels (I think icntl(1 - 4), please check it),
- get local/global real/integer info (or write it to files),
- get determinant value,
- get the solution or only part of it,
- write the solution or only part of it,
- initialize MUMPS,
- fill MUMPS fields,
- run MUMPS solve algorithm,
- kill MUMPS,
- clear internal arrays.

A breif description of each function is the source code commented above the function. All argument pointers are copied using a memcpy command into internal arrays. The user must ensure the memory managment of its code and to call ClearInternalArrays after finished using the wrapper library.

In order to use the wrapper library, one should include MumpsLibrary.h (for c++) or MumpsLibrary_C.h in thier source code. Afterwards the solve procedure is simple:
- fill or read the matrix and right hand side vectors
- if matrix was filled, set the symmetricity of the matrix
- set if you would like determinant calculation, to write the problem to the disk, use the intermediate binary output and if you would like to redirect standard output/error. For the writing the problem, intermediate output and redirection of standard output/error, the corresponding string should be provided (check the library code or the test code),
- initialize MUMPS, fill it fields and run the solution algorithm (Solve command). If the MUMPS driver finds a solution it is copied into the internal array. Same holds for determinant. Now you are able to read the solution from the internal array
- kill the mumps instance. If you want the local/global real/integer info get it now, since they are not copied into the internal arrays. This does not clear the obtained solution,
- clear all internal arrays, which also clears the obtained solution.
And that is it. Hope you will be satisfied with an obtained solution.

The missing MUMPS functionalities will be implemented in the next versions, but at the moment I do not have a date. The next post will be about the testing programmes and how to use them.

Best regards,
Domen Stadler

Posted by  Domen Stadler 2014-10-02

Log in to post a comment.