Loading...
Searching...
No Matches
PETScNestMatrix.h
// Copyright (C) 2016 Chris Richardson
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef __PETSC_NESTMATRIX_H
#define __PETSC_NESTMATRIX_H
#ifdef HAS_PETSC
#include <petscmat.h>
#include <petscsys.h>
#include "PETScMatrix.h"
namespace dolfin
{
class GenericMatrix;
class GenericVector;
class FunctionSpace;
class PETScNestMatrix : public PETScMatrix
{
public:
PETScNestMatrix();
explicit PETScNestMatrix
(std::vector<std::shared_ptr<GenericMatrix>> mats);
virtual ~PETScNestMatrix();
virtual void mult(const GenericVector& x, GenericVector& y) const;
void init_vectors(GenericVector& z_out,
std::vector<std::shared_ptr<GenericVector>> z_in) const;
void get_block_dofs(std::vector<dolfin::la_index>& dofs, std::size_t idx) const;
std::size_t size(std::size_t dim) const
{ return PETScBaseMatrix::size(dim); }
virtual std::string str(bool verbose) const;
};
}
#endif
#endif
dolfin::FunctionSpace
Definition FunctionSpace.h:54
dolfin::GenericMatrix
This class defines a common interface for matrices.
Definition GenericMatrix.h:47
dolfin::GenericVector
This class defines a common interface for vectors.
Definition GenericVector.h:48
dolfin::PETScBaseMatrix::size
std::pair< std::int64_t, std::int64_t > size() const
Definition PETScBaseMatrix.cpp:79
dolfin::PETScMatrix::PETScMatrix
PETScMatrix()
Create empty matrix (on MPI_COMM_WORLD).
Definition PETScMatrix.cpp:57
dolfin::PETScNestMatrix::str
virtual std::string str(bool verbose) const
Definition PETScNestMatrix.cpp:96
dolfin::PETScNestMatrix::~PETScNestMatrix
virtual ~PETScNestMatrix()
Destructor.
Definition PETScNestMatrix.cpp:91
dolfin::PETScNestMatrix::size
std::size_t size(std::size_t dim) const
Definition PETScNestMatrix.h:75
dolfin::PETScNestMatrix::PETScNestMatrix
PETScNestMatrix()
Create empty matrix.
Definition PETScNestMatrix.cpp:36
dolfin::PETScNestMatrix::get_block_dofs
void get_block_dofs(std::vector< dolfin::la_index > &dofs, std::size_t idx) const
Definition PETScNestMatrix.cpp:179
dolfin::PETScNestMatrix::mult
virtual void mult(const GenericVector &x, GenericVector &y) const
Definition PETScNestMatrix.cpp:118
dolfin::PETScNestMatrix::init_vectors
void init_vectors(GenericVector &z_out, std::vector< std::shared_ptr< GenericVector > > z_in) const
Definition PETScNestMatrix.cpp:144
dolfin
Definition adapt.h:30