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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3981 - (show annotations)
Fri Sep 21 02:47:54 2012 UTC (6 years, 11 months ago) by jfenwick
File size: 4096 byte(s)
First pass of updating copyright notices
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2012 by University of Queensland
5 * http://www.uq.edu.au
6 *
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 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16
17 #include "AbstractSystemMatrix.h"
18 #include "DataException.h"
19 #include "Data.h"
20 #include "DataTypes.h"
21
22 namespace escript {
23
24 AbstractSystemMatrix::AbstractSystemMatrix() {
25 //std::cout << "Called default AbstractSystemMatrix constructor" << std::endl;
26 m_empty=1;
27 }
28
29 AbstractSystemMatrix::AbstractSystemMatrix(const int row_blocksize,
30 const FunctionSpace& row_functionspace,
31 const int column_blocksize,
32 const FunctionSpace& column_functionspace)
33 :m_row_functionspace(row_functionspace),
34 m_column_functionspace(column_functionspace)
35 {
36 if (row_blocksize<=0)
37 throw DataException("Error - negative row block size of system matrix.");
38 if (column_blocksize<=0)
39 throw DataException("Error - negative column block size of system matrix.");
40
41 m_empty=0;
42 m_row_blocksize=row_blocksize;
43 m_column_blocksize=column_blocksize;
44 // m_row_functionspace=row_functionspace;
45 // m_column_functionspace=column_functionspace;
46 }
47
48 AbstractSystemMatrix::~AbstractSystemMatrix() {
49 }
50
51 int AbstractSystemMatrix::isEmpty() const {
52 return m_empty;
53 }
54
55 Data operator*(const AbstractSystemMatrix& left,const Data& right)
56 {
57 Data tmp=(Data) right;
58 return left.vectorMultiply(tmp);
59 }
60
61 Data AbstractSystemMatrix::vectorMultiply(Data& right) const
62 {
63 if (isEmpty())
64 throw SystemMatrixException("Error - Matrix is empty.");
65 if (right.getDataPointSize()!=getColumnBlockSize())
66 throw SystemMatrixException("Error - column block size and input data size do not match.");
67 DataTypes::ShapeType shape;
68 if (getRowBlockSize()>1) shape.push_back(getRowBlockSize());
69
70 Data out=Data(0.,shape,getRowFunctionSpace(),true);
71 Data in=Data(right,getColumnFunctionSpace());
72 ypAx(out,in);
73 return out;
74 }
75
76 void AbstractSystemMatrix::ypAx(Data& y,Data& x) const
77 {
78 throw SystemMatrixException("Error - ypAx not available");
79 }
80
81 Data AbstractSystemMatrix::solve(Data& in, boost::python::object& options) const
82 {
83 if (isEmpty())
84 throw SystemMatrixException("Error - Matrix is empty.");
85 if (in.getFunctionSpace()!=getRowFunctionSpace())
86 throw SystemMatrixException("Error - row function space and function space of right hand side do not match.");
87 if (in.getDataPointSize()!=getRowBlockSize())
88 throw SystemMatrixException("Error - row block size and right hand side size do not match.");
89 DataTypes::ShapeType shape;
90 if (getRowBlockSize()>1) shape.push_back(getColumnBlockSize());
91 Data out=Data(0.,shape,getColumnFunctionSpace(),true);
92 setToSolution(out,in,options);
93 return out;
94 }
95 void AbstractSystemMatrix::setToSolution(Data& out,Data& in, boost::python::object& options) const
96 {
97 throw SystemMatrixException("Error - setToSolution not available");
98 }
99
100
101 void AbstractSystemMatrix::nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const
102 {
103 throw SystemMatrixException("Error - nullifyRowsAndCols interface not available.");
104 }
105
106 void AbstractSystemMatrix::saveMM(const std::string& fileName) const
107 {
108 throw SystemMatrixException("Error - Matrix Market interface not available.");
109 }
110 void AbstractSystemMatrix::saveHB(const std::string& fileName) const
111 {
112 throw SystemMatrixException("Error - Harwell-Boeing interface not available.");
113 }
114 void AbstractSystemMatrix::resetValues() const
115 {
116 throw SystemMatrixException("Error - setValue is not implemented.");
117 }
118
119 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26