Feel++ 0.91.0
|
Feel supports three different linear algebra environments that we shall call Backend .
To select a backend in order to solve a linear system, we instantiate the Backend
class associated.
#include <feel/feelalg/backend.hpp> boost::shared_ptr<Backend<double> > backend = Backend<double>::build( BACKEND_PETSC );
The backend provides an interface to solve
where is a
sparse matrix and
vectors of size
. The backend defines the types for each of these, e.g.
Backend<double>::sparse_matrix_type A; Backend<double>::vector_type x,b;
In practice, we use the boost::shared_ptr<>
shared pointer to ensure that we won't get memory leaks. The backends provide a corresponding typedef
Backend<double>::sparse_matrix_ptrtype A( backend->newMatrix( Xh, Yh ) ); Backend<double>::vector_ptrtype x( backend->newVector( Yh ) ); Backend<double>::vector_ptrtype b( backend->newVector( Xh ) );
where and
are function spaces providing the number of degrees of freedom that will define the size of the matrix and vectors thanks to the helpers functions
Backend::newMatrix()
and Backend::newVector
. In a parallel setting, the local/global processor mapping would be passed down by the function spaces.