/[escript]/trunk/escript/src/AbstractSystemMatrix.cpp
ViewVC logotype

Annotation of /trunk/escript/src/AbstractSystemMatrix.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 108 - (hide annotations)
Thu Jan 27 06:21:59 2005 UTC (14 years, 8 months ago) by jgs
Original Path: trunk/esys2/escript/src/Data/AbstractSystemMatrix.cpp
File size: 4207 byte(s)
*** empty log message ***

1 jgs 102 // $Id$
2 jgs 82 /*
3     ******************************************************************************
4     * *
5     * COPYRIGHT ACcESS 2004 - All Rights Reserved *
6     * *
7     * This software is the property of ACcESS. No part of this code *
8     * may be copied in any form or by any means without the expressed written *
9     * consent of ACcESS. Copying, use or modification of this software *
10     * by any unauthorised person is illegal unless that person has a software *
11     * license agreement with ACcESS. *
12     * *
13     ******************************************************************************
14     */
15    
16     #include "escript/Data/AbstractSystemMatrix.h"
17     #include "escript/Data/FunctionSpace.h"
18     #include "escript/Data/DataException.h"
19     #include "escript/Data/DataArrayView.h"
20    
21     namespace escript {
22    
23     AbstractSystemMatrix::AbstractSystemMatrix() {
24     //std::cout << "Called default AbstractSystemMatrix constructor" << std::endl;
25     m_empty=1;
26     }
27    
28     AbstractSystemMatrix::AbstractSystemMatrix(const int row_blocksize,
29     const FunctionSpace& row_functionspace,
30     const int column_blocksize,
31     const FunctionSpace& column_functionspace)
32     {
33     if (row_blocksize<=0)
34     throw DataException("Error - negative row block size of system matrix.");
35     if (column_blocksize<=0)
36     throw DataException("Error - negative column block size of system matrix.");
37    
38     m_empty=0;
39     m_row_blocksize=row_blocksize;
40     m_column_blocksize=column_blocksize;
41     m_row_functionspace=row_functionspace;
42     m_column_functionspace=column_functionspace;
43     }
44    
45     AbstractSystemMatrix::~AbstractSystemMatrix() {
46     }
47    
48     int AbstractSystemMatrix::isEmpty() const {
49     return m_empty;
50     }
51    
52     Data operator*(const AbstractSystemMatrix& left, const Data& right)
53     {
54     return left.vectorMultiply(right);
55     }
56    
57     Data AbstractSystemMatrix::vectorMultiply(const Data& right) const
58     {
59     if (isEmpty())
60     throw SystemMatrixException("Error - Matrix is empty.");
61     if (right.getDataPointSize()!=getColumnBlockSize())
62     throw SystemMatrixException("Error - column block size and input data size do not match.");
63     DataArrayView::ShapeType shape;
64     if (getRowBlockSize()>1) shape.push_back(getRowBlockSize());
65    
66     Data out=Data(0.,shape,getRowFunctionSpace(),true);
67 jgs 108 ypAx(out,Data(right,getColumnFunctionSpace()));
68 jgs 82 return out;
69     }
70    
71     void AbstractSystemMatrix::ypAx(Data& y,const Data& x) const
72     {
73     throw SystemMatrixException("Error - ypAx not available");
74     }
75    
76     Data AbstractSystemMatrix::solve(const Data& in,const boost::python::dict& options) const
77     {
78     if (isEmpty())
79     throw SystemMatrixException("Error - Matrix is empty.");
80     if (in.getFunctionSpace()!=getRowFunctionSpace())
81     throw SystemMatrixException("Error - row function space and function space of right hand side do not match.");
82     if (in.getDataPointSize()!=getRowBlockSize())
83     throw SystemMatrixException("Error - row block size and right hand side size do not match.");
84     DataArrayView::ShapeType shape;
85     if (getRowBlockSize()>1) shape.push_back(getColumnBlockSize());
86     Data out=Data(0.,shape,getColumnFunctionSpace(),true);
87     setToSolution(out,in,options);
88     return out;
89     }
90     void AbstractSystemMatrix::setToSolution(Data& out,const Data& in,const boost::python::dict& options) const
91     {
92     throw SystemMatrixException("Error - setToSolution not available");
93     }
94 jgs 102 void AbstractSystemMatrix::saveMM(const std::string& fileName) const
95     {
96     throw SystemMatrixException("Error - Matrix Market interface not available.");
97     }
98 jgs 108 void AbstractSystemMatrix::setValue(const double value) const
99 jgs 102 {
100 jgs 108 throw SystemMatrixException("Error - setValue is not implemented.");
101 jgs 102 }
102 jgs 108 void AbstractSystemMatrix::resetSolver() const
103     {
104     throw SystemMatrixException("Error - resetSolver not implemented.");
105     }
106 jgs 82
107     } // end of namespace

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26