12 #ifndef MATRIXOPS_HPP_
13 #define MATRIXOPS_HPP_
15 #include <opm/common/utility/platform_dependent/disable_warnings.h>
17 #include <dune/common/fmatrix.hh>
18 #include <dune/common/dynmatrix.hh>
19 #include <dune/istl/bcrsmatrix.hh>
21 #include <opm/common/utility/platform_dependent/reenable_warnings.h>
24 namespace Elasticity {
27 typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > Matrix;
30 typedef std::vector< std::set<int> > AdjacencyPattern;
33 typedef Dune::BlockVector<Dune::FieldVector<double,1> > Vector;
43 static void fromAdjacency(Matrix& A,
const AdjacencyPattern& adj,
49 static Matrix
fromDense(
const Dune::DynamicMatrix<double>& T);
53 static void print(
const Matrix& A);
60 static Matrix
Axpy(
const Matrix& A,
const Matrix& B,
double alpha);
68 static Matrix
augment(
const Matrix& A,
const Matrix& B,
69 size_t r0,
size_t c0,
bool symmetric);
84 size_t r0,
size_t N,
size_t c0,
size_t M);
90 static void saveAsc(
const Matrix& A,
const std::string& file);
static Matrix extractDiagonal(const Matrix &A)
Extract the diagonal of a matrix into a new matrix.
Definition: matrixops.cpp:184
static Matrix augment(const Matrix &A, const Matrix &B, size_t r0, size_t c0, bool symmetric)
Augment a matrix with another.
Definition: matrixops.cpp:126
static Matrix fromDense(const Dune::DynamicMatrix< double > &T)
Create a sparse matrix from a dense matrix.
Definition: matrixops.cpp:49
static void print(const Matrix &A)
Print a matrix to stdout.
Definition: matrixops.cpp:73
static void fromAdjacency(Matrix &A, const AdjacencyPattern &adj, int rows, int cols)
Create a sparse matrix from a given adjacency pattern.
Definition: matrixops.cpp:25
static Matrix diagonal(size_t N)
Returns a diagonal matrix.
Definition: matrixops.cpp:198
static void saveAsc(const Matrix &A, const std::string &file)
Save a matrix as a dense asc file.
Definition: matrixops.cpp:210
static Matrix extractBlock(const Matrix &A, size_t r0, size_t N, size_t c0, size_t M)
Extract a subblock of a matrix into a new matrix.
Definition: matrixops.cpp:240
static Matrix Axpy(const Matrix &A, const Matrix &B, double alpha)
axpy like operation - returns A+alpha*B
Definition: matrixops.cpp:87
Helper class with some matrix operations.
Definition: matrixops.hpp:36