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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3981 - (hide annotations)
Fri Sep 21 02:47:54 2012 UTC (7 years, 1 month ago) by jfenwick
File size: 4096 byte(s)
First pass of updating copyright notices
1 jgs 82
2 jfenwick 3981 /*****************************************************************************
3 ksteube 1811 *
4 jfenwick 3911 * Copyright (c) 2003-2012 by University of Queensland
5 jfenwick 3981 * http://www.uq.edu.au
6 ksteube 1811 *
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 jfenwick 3981 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12     * Development since 2012 by School of Earth Sciences
13     *
14     *****************************************************************************/
15 ksteube 1312
16 ksteube 1811
17 jgs 474 #include "AbstractSystemMatrix.h"
18     #include "DataException.h"
19 jgs 480 #include "Data.h"
20 jfenwick 1796 #include "DataTypes.h"
21 jgs 82
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 jfenwick 1872 :m_row_functionspace(row_functionspace),
34     m_column_functionspace(column_functionspace)
35 jgs 82 {
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 jfenwick 1872 // m_row_functionspace=row_functionspace;
45     // m_column_functionspace=column_functionspace;
46 jgs 82 }
47    
48     AbstractSystemMatrix::~AbstractSystemMatrix() {
49     }
50    
51     int AbstractSystemMatrix::isEmpty() const {
52     return m_empty;
53     }
54    
55 jgs 153 Data operator*(const AbstractSystemMatrix& left,const Data& right)
56 jgs 82 {
57 jgs 153 Data tmp=(Data) right;
58     return left.vectorMultiply(tmp);
59 jgs 82 }
60    
61 jgs 153 Data AbstractSystemMatrix::vectorMultiply(Data& right) const
62 jgs 82 {
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 jfenwick 1796 DataTypes::ShapeType shape;
68 jgs 82 if (getRowBlockSize()>1) shape.push_back(getRowBlockSize());
69    
70     Data out=Data(0.,shape,getRowFunctionSpace(),true);
71 jgs 153 Data in=Data(right,getColumnFunctionSpace());
72     ypAx(out,in);
73 jgs 82 return out;
74     }
75    
76 jgs 153 void AbstractSystemMatrix::ypAx(Data& y,Data& x) const
77 jgs 82 {
78     throw SystemMatrixException("Error - ypAx not available");
79     }
80    
81 gross 2474 Data AbstractSystemMatrix::solve(Data& in, boost::python::object& options) const
82 jgs 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 jfenwick 1796 DataTypes::ShapeType shape;
90 jgs 82 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 gross 2474 void AbstractSystemMatrix::setToSolution(Data& out,Data& in, boost::python::object& options) const
96 jgs 82 {
97     throw SystemMatrixException("Error - setToSolution not available");
98     }
99 jfenwick 3675
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 jgs 102 void AbstractSystemMatrix::saveMM(const std::string& fileName) const
107     {
108     throw SystemMatrixException("Error - Matrix Market interface not available.");
109     }
110 jgs 123 void AbstractSystemMatrix::saveHB(const std::string& fileName) const
111     {
112     throw SystemMatrixException("Error - Harwell-Boeing interface not available.");
113     }
114 jgs 149 void AbstractSystemMatrix::resetValues() const
115 jgs 102 {
116 jgs 108 throw SystemMatrixException("Error - setValue is not implemented.");
117 jgs 102 }
118 jgs 82
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