AbstractSystemMatrix.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2017 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014 by Centre for Geoscience Computing (GeoComp)
*
*****************************************************************************/
#ifndef __ESCRIPT_ABSTRACTSYSTEMMATRIX_H__
#define __ESCRIPT_ABSTRACTSYSTEMMATRIX_H__
#include "system_dep.h"
#include "FunctionSpace.h"
#include "Pointers.h"
#include "SystemMatrixException.h"
#include <boost/python/object.hpp>
namespace escript {
//
// Forward declaration
class AbstractSystemMatrix;
class Data;
typedef POINTER_WRAPPER_CLASS(AbstractSystemMatrix) ASM_ptr;
typedef POINTER_WRAPPER_CLASS(const AbstractSystemMatrix) const_ASM_ptr;
class ESCRIPT_DLL_API AbstractSystemMatrix: public REFCOUNT_BASE_CLASS(AbstractSystemMatrix)
{
public:
AbstractSystemMatrix() : m_empty(true) {}
AbstractSystemMatrix(int row_blocksize,
const FunctionSpace& row_functionspace,
int column_blocksize,
const FunctionSpace& column_functionspace);
virtual ~AbstractSystemMatrix() {}
ASM_ptr getPtr();
const_ASM_ptr getPtr() const;
Data vectorMultiply(const Data& right) const;
bool isEmpty() const { return m_empty; }
inline FunctionSpace getColumnFunctionSpace() const
{
if (isEmpty())
throw SystemMatrixException("Error - Matrix is empty.");
return m_column_functionspace;
}
inline FunctionSpace getRowFunctionSpace() const
{
if (isEmpty())
throw SystemMatrixException("Error - Matrix is empty.");
return m_row_functionspace;
}
inline int getRowBlockSize() const
{
if (isEmpty())
throw SystemMatrixException("Error - Matrix is empty.");
return m_row_blocksize;
}
inline int getColumnBlockSize() const
{
if (isEmpty())
throw SystemMatrixException("Error - Matrix is empty.");
return m_column_blocksize;
}
Data solve(const Data& in, boost::python::object& options) const;
virtual void nullifyRowsAndCols(Data& row_q, Data& col_q, double mdv);
virtual void saveMM(const std::string& filename) const;
virtual void saveHB(const std::string& filename) const;
virtual void resetValues(bool preserveSolverData = false);
private:
virtual void setToSolution(Data& out, Data& in,
boost::python::object& options) const;
virtual void ypAx(Data& y, Data& x) const;
bool m_empty;
int m_column_blocksize;
int m_row_blocksize;
FunctionSpace m_row_functionspace;
FunctionSpace m_column_functionspace;
};
ESCRIPT_DLL_API
Data operator*(const AbstractSystemMatrix& left, const Data& right);
} // end of namespace
#endif // __ESCRIPT_ABSTRACTSYSTEMMATRIX_H__
escript::FunctionSpace
Definition: FunctionSpace.h:34
POINTER_WRAPPER_CLASS
#define POINTER_WRAPPER_CLASS(x)
Definition: Pointers.h:32
escript::AbstractSystemMatrix::m_column_blocksize
int m_column_blocksize
Definition: AbstractSystemMatrix.h:178
SystemMatrixException.h
escript
Definition: AbstractContinuousDomain.cpp:22
escript::AbstractSystemMatrix::isEmpty
bool isEmpty() const
returns true if the matrix is empty
Definition: AbstractSystemMatrix.h:85
REFCOUNT_BASE_CLASS
#define REFCOUNT_BASE_CLASS(x)
Definition: Pointers.h:30
escript::const_ASM_ptr
boost::shared_ptr< const AbstractSystemMatrix > const_ASM_ptr
Definition: AbstractSystemMatrix.h:35
escript::SystemMatrixException
SystemMatrixException exception class.
Definition: SystemMatrixException.h:34
escript::AbstractSystemMatrix::m_column_functionspace
FunctionSpace m_column_functionspace
Definition: AbstractSystemMatrix.h:181
escript::AbstractSystemMatrix::m_empty
bool m_empty
Definition: AbstractSystemMatrix.h:177
system_dep.h
Pointers.h
Typedefs and macros for reference counted storage.
FunctionSpace.h
escript::AbstractSystemMatrix::AbstractSystemMatrix
AbstractSystemMatrix()
Default constructor for AbstractSystemMatrix.
Definition: AbstractSystemMatrix.h:50
escript::AbstractSystemMatrix::m_row_blocksize
int m_row_blocksize
Definition: AbstractSystemMatrix.h:179
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:63
escript::AbstractSystemMatrix::~AbstractSystemMatrix
virtual ~AbstractSystemMatrix()
Destructor.
Definition: AbstractSystemMatrix.h:61
escript::AbstractSystemMatrix::getRowFunctionSpace
FunctionSpace getRowFunctionSpace() const
returns the row function space
Definition: AbstractSystemMatrix.h:102
escript::AbstractSystemMatrix::m_row_functionspace
FunctionSpace m_row_functionspace
Definition: AbstractSystemMatrix.h:180
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:29
escript::operator*
Data operator*(const AbstractSystemMatrix &left, const Data &right)
Definition: AbstractSystemMatrix.cpp:59
escript::AbstractSystemMatrix
Base class for escript system matrices.
Definition: AbstractSystemMatrix.h:42
escript::AbstractSystemMatrix::getRowBlockSize
int getRowBlockSize() const
returns the row block size
Definition: AbstractSystemMatrix.h:113
escript::ASM_ptr
boost::shared_ptr< AbstractSystemMatrix > ASM_ptr
Definition: AbstractSystemMatrix.h:32
escript::AbstractSystemMatrix::getColumnFunctionSpace
FunctionSpace getColumnFunctionSpace() const
returns the column function space
Definition: AbstractSystemMatrix.h:91
escript::AbstractSystemMatrix::getColumnBlockSize
int getColumnBlockSize() const
returns the column block size
Definition: AbstractSystemMatrix.h:124