Loading...
Searching...
No Matches
matrixops.hpp
Go to the documentation of this file.
//==============================================================================
//==============================================================================
#ifndef MATRIXOPS_HPP_
#define MATRIXOPS_HPP_
#include <opm/common/utility/platform_dependent/disable_warnings.h>
#include <dune/common/fmatrix.hh>
#include <dune/common/dynmatrix.hh>
#include <dune/istl/bcrsmatrix.hh>
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
namespace Opm {
namespace Elasticity {
typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > Matrix;
typedef std::vector< std::set<int> > AdjacencyPattern;
typedef Dune::BlockVector<Dune::FieldVector<double,1> > Vector;
class MatrixOps {
public:
static void fromAdjacency(Matrix& A, const AdjacencyPattern& adj,
int rows, int cols);
static Matrix fromDense(const Dune::DynamicMatrix<double>& T);
static void print(const Matrix& A);
static Matrix Axpy(const Matrix& A, const Matrix& B, double alpha);
static Matrix augment(const Matrix& A, const Matrix& B,
size_t r0, size_t c0, bool symmetric);
static Matrix extractDiagonal(const Matrix& A);
static Matrix diagonal(size_t N);
static Matrix extractBlock(const Matrix& A,
size_t r0, size_t N, size_t c0, size_t M);
static void saveAsc(const Matrix& A, const std::string& file);
};
}
}
#endif
Opm::Elasticity::MatrixOps
Helper class with some matrix operations.
Definition matrixops.hpp:36
Opm::Elasticity::MatrixOps::print
static void print(const Matrix &A)
Print a matrix to stdout.
Definition matrixops.cpp:73
Opm::Elasticity::MatrixOps::fromDense
static Matrix fromDense(const Dune::DynamicMatrix< double > &T)
Create a sparse matrix from a dense matrix.
Definition matrixops.cpp:49
Opm::Elasticity::MatrixOps::fromAdjacency
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
Opm::Elasticity::MatrixOps::augment
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
Opm::Elasticity::MatrixOps::diagonal
static Matrix diagonal(size_t N)
Returns a diagonal matrix.
Definition matrixops.cpp:198
Opm::Elasticity::MatrixOps::saveAsc
static void saveAsc(const Matrix &A, const std::string &file)
Save a matrix as a dense asc file.
Definition matrixops.cpp:210
Opm::Elasticity::MatrixOps::extractDiagonal
static Matrix extractDiagonal(const Matrix &A)
Extract the diagonal of a matrix into a new matrix.
Definition matrixops.cpp:184
Opm::Elasticity::MatrixOps::extractBlock
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
Opm::Elasticity::MatrixOps::Axpy
static Matrix Axpy(const Matrix &A, const Matrix &B, double alpha)
axpy like operation - returns A+alpha*B
Definition matrixops.cpp:87
Opm::Elasticity::Matrix
Dune::BCRSMatrix< Dune::FieldMatrix< double, 1, 1 > > Matrix
A sparse matrix holding our operator.
Definition matrixops.hpp:27
Opm::Elasticity::Vector
Dune::BlockVector< Dune::FieldVector< double, 1 > > Vector
A vector holding our RHS.
Definition matrixops.hpp:33
Opm::Elasticity::AdjacencyPattern
std::vector< std::set< int > > AdjacencyPattern
For storing matrix adjacency/sparsity patterns.
Definition matrixops.hpp:30
Opm
Inverting small matrices.
Definition ImplicitAssembly.hpp:43