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

Contents of /trunk/escript/src/AbstractTransportProblem.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 615 - (show annotations)
Wed Mar 22 02:12:00 2006 UTC (13 years, 5 months ago) by elspeth
Original Path: trunk/escript/src/AbstractSystemMatrix.cpp
File size: 3860 byte(s)
More copyright information.

1 // $Id$
2 /*
3 ************************************************************
4 * Copyright 2006 by ACcESS MNRF *
5 * *
6 * http://www.access.edu.au *
7 * Primary Business: Queensland, Australia *
8 * Licensed under the Open Software License version 3.0 *
9 * http://www.opensource.org/licenses/osl-3.0.php *
10 * *
11 ************************************************************
12 */
13
14 #include "AbstractSystemMatrix.h"
15 #include "DataException.h"
16 #include "DataArrayView.h"
17 #include "Data.h"
18
19 namespace escript {
20
21 AbstractSystemMatrix::AbstractSystemMatrix() {
22 //std::cout << "Called default AbstractSystemMatrix constructor" << std::endl;
23 m_empty=1;
24 }
25
26 AbstractSystemMatrix::AbstractSystemMatrix(const int row_blocksize,
27 const FunctionSpace& row_functionspace,
28 const int column_blocksize,
29 const FunctionSpace& column_functionspace)
30 {
31 if (row_blocksize<=0)
32 throw DataException("Error - negative row block size of system matrix.");
33 if (column_blocksize<=0)
34 throw DataException("Error - negative column block size of system matrix.");
35
36 m_empty=0;
37 m_row_blocksize=row_blocksize;
38 m_column_blocksize=column_blocksize;
39 m_row_functionspace=row_functionspace;
40 m_column_functionspace=column_functionspace;
41 }
42
43 AbstractSystemMatrix::~AbstractSystemMatrix() {
44 }
45
46 int AbstractSystemMatrix::isEmpty() const {
47 return m_empty;
48 }
49
50 Data operator*(const AbstractSystemMatrix& left,const Data& right)
51 {
52 Data tmp=(Data) right;
53 return left.vectorMultiply(tmp);
54 }
55
56 Data AbstractSystemMatrix::vectorMultiply(Data& right) const
57 {
58 if (isEmpty())
59 throw SystemMatrixException("Error - Matrix is empty.");
60 if (right.getDataPointSize()!=getColumnBlockSize())
61 throw SystemMatrixException("Error - column block size and input data size do not match.");
62 DataArrayView::ShapeType shape;
63 if (getRowBlockSize()>1) shape.push_back(getRowBlockSize());
64
65 Data out=Data(0.,shape,getRowFunctionSpace(),true);
66 Data in=Data(right,getColumnFunctionSpace());
67 ypAx(out,in);
68 return out;
69 }
70
71 void AbstractSystemMatrix::ypAx(Data& y,Data& x) const
72 {
73 throw SystemMatrixException("Error - ypAx not available");
74 }
75
76 Data AbstractSystemMatrix::solve(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,Data& in,const boost::python::dict& options) const
91 {
92 throw SystemMatrixException("Error - setToSolution not available");
93 }
94 void AbstractSystemMatrix::saveMM(const std::string& fileName) const
95 {
96 throw SystemMatrixException("Error - Matrix Market interface not available.");
97 }
98 void AbstractSystemMatrix::saveHB(const std::string& fileName) const
99 {
100 throw SystemMatrixException("Error - Harwell-Boeing interface not available.");
101 }
102 void AbstractSystemMatrix::resetValues() const
103 {
104 throw SystemMatrixException("Error - setValue is not implemented.");
105 }
106
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