How to use the PaStiX solver in Kratos

From KratosWiki
Revision as of 08:53, 3 January 2017 by Andreas (Talk | contribs)
Jump to: navigation, search

Contents

How to use the PaStiX solver in Kratos

The PaStiX (Parallel Sparse matriX package) is a open-source scientific library that provides a high performance parallel solver for very large sparse linear systems based on direct methods. Numerical algorithms are implemented in single or double precision (real or complex) using LLt, LDLt and LU with static pivoting (for non symmetric matrices having a symmetric pattern). This solver provides also an adaptive blockwise iLU(k) factorization that can be used as a parallel preconditioner using approximated supernodes to build a coarser block structure of the incomplete factors ([1]).

It can be linked to the Kratos by the ExternalSolversApplication. The following steps have to be made in order to use be able to use it.

Define you application name

The first thing you need to do is to indicate the compiler that you are going to allow the application to be derived. This is done by defining the name of your application with the value "EXPORT,API" in the CMakeLists.txt file. This is step is also mandatory if you want to make derivable any class in your application, even though it is not the application itself.

Add the following line in the file CMakeLists.txt of your application:

 set_target_properties(KratosFooApplication PROPERTIES COMPILE_DEFINITIONS "FOO_APPLICATION=EXPORT,API")

Export your variables

In order to make your variables visible, you will need to change its declaration with the define name from the step 1. We provide a couple of replacements for do that:

KRATOS_DEFINE_VARIABLE
KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS

will become:

KRATOS_DEFINE_APPLICATION_VARIABLE
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS

For example:

KRATOS_DEFINE_VARIABLE(int, VAR_1)

will become

KRATOS_DEFINE_APPLICATION_VARIABLE(FOO_APPLICATION, int, VAR_1)

Export your classes

Finally you will also need to indicate which classes are available to be used from other applications. In order to do it you will need to use the KRATOS_API() macro with the define name of your applications in the declaration of the class.

For example

 class myclass() {
 }

will become:

 class KRATOS_API(FOO_APPLICATION) myclass() {
 }

If your class depends on a template parameter, you will also need to instantiate such class, as no code exists in compile time and otherwise will be impossible to export:


For instance, if you want to use class myclass with double:

 temaplte<class T>
 class myclass() {
    ...
 };

becomes

 temaplte<class T>
 class KRATOS_API(FOO_APPLICATION) myclass() {
    ...
 };
 
 ...
 
 template class KRATOS_API(FOO_APPLICATION) myclass<double>;
Personal tools
Categories