Loading...
Searching...
No Matches
PETScLinearOperator.h
// Copyright (C) 2005-2012 Anders Logg and Garth N. Wells
//
// 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/>.
//
// Modified by Andy R. Terrel 2005
//
// First added: 2005-01-17
// Last changed: 2012-12-11
#ifndef __PETSC_LINEAR_OPERATOR_H
#define __PETSC_LINEAR_OPERATOR_H
#ifdef HAS_PETSC
#include <string>
#include <dolfin/common/types.h>
#include "PETScBaseMatrix.h"
#include "GenericLinearOperator.h"
namespace dolfin
{
class PETScVector;
class PETScLinearOperator : public PETScBaseMatrix,
public GenericLinearOperator
{
public:
explicit PETScLinearOperator(MPI_Comm comm);
//--- Implementation of the GenericLinearOperator interface ---
virtual std::size_t size(std::size_t dim) const;
virtual void mult(const GenericVector& x, GenericVector& y) const;
virtual MPI_Comm mpi_comm() const
{ return PETScBaseMatrix::mpi_comm(); }
virtual std::string str(bool verbose) const;
//--- Special functions ---
virtual const GenericLinearOperator* wrapper() const;
virtual GenericLinearOperator* wrapper();
protected:
// Initialization
void init_layout(const GenericVector& x,
const GenericVector& y,
GenericLinearOperator* wrapper);
// Pointer to wrapper
GenericLinearOperator* _wrapper;
};
}
#endif
#endif
dolfin::GenericLinearOperator
Definition GenericLinearOperator.h:43
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::PETScBaseMatrix::PETScBaseMatrix
PETScBaseMatrix()
Constructor.
Definition PETScBaseMatrix.h:54
dolfin::PETScBaseMatrix::mpi_comm
MPI_Comm mpi_comm() const
Return the MPI communicator.
Definition PETScBaseMatrix.cpp:141
dolfin::PETScLinearOperator::mpi_comm
virtual MPI_Comm mpi_comm() const
Return MPI communicator.
Definition PETScLinearOperator.h:61
dolfin::PETScLinearOperator::PETScLinearOperator
PETScLinearOperator(MPI_Comm comm)
Constructor.
Definition PETScLinearOperator.cpp:63
dolfin::PETScLinearOperator::mult
virtual void mult(const GenericVector &x, GenericVector &y) const
Compute matrix-vector product y = Ax.
Definition PETScLinearOperator.cpp:76
dolfin::PETScLinearOperator::str
virtual std::string str(bool verbose) const
Return informal string representation (pretty-print).
Definition PETScLinearOperator.cpp:81
dolfin::PETScLinearOperator::wrapper
virtual const GenericLinearOperator * wrapper() const
Return pointer to wrapper (const version).
Definition PETScLinearOperator.cpp:100
dolfin::PETScLinearOperator::init_layout
void init_layout(const GenericVector &x, const GenericVector &y, GenericLinearOperator *wrapper)
Definition PETScLinearOperator.cpp:110
dolfin::PETScVector
Definition PETScVector.h:61
dolfin
Definition adapt.h:30