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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2474 - (hide annotations)
Tue Jun 16 06:32:15 2009 UTC (10 years, 4 months ago) by gross
File size: 3766 byte(s)
linearPDEs has is now using the SolverOptions class to talk to PASO
1 jgs 82
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4     * Copyright (c) 2003-2008 by University of Queensland
5     * Earth Systems Science Computational Center (ESSCC)
6     * http://www.uq.edu.au/esscc
7     *
8     * Primary Business: Queensland, Australia
9     * Licensed under the Open Software License version 3.0
10     * http://www.opensource.org/licenses/osl-3.0.php
11     *
12     *******************************************************/
13 ksteube 1312
14 ksteube 1811
15 jgs 474 #include "AbstractSystemMatrix.h"
16     #include "DataException.h"
17 jgs 480 #include "Data.h"
18 jfenwick 1796 #include "DataTypes.h"
19 jgs 82
20     namespace escript {
21    
22     AbstractSystemMatrix::AbstractSystemMatrix() {
23     //std::cout << "Called default AbstractSystemMatrix constructor" << std::endl;
24     m_empty=1;
25     }
26    
27     AbstractSystemMatrix::AbstractSystemMatrix(const int row_blocksize,
28     const FunctionSpace& row_functionspace,
29     const int column_blocksize,
30     const FunctionSpace& column_functionspace)
31 jfenwick 1872 :m_row_functionspace(row_functionspace),
32     m_column_functionspace(column_functionspace)
33 jgs 82 {
34     if (row_blocksize<=0)
35     throw DataException("Error - negative row block size of system matrix.");
36     if (column_blocksize<=0)
37     throw DataException("Error - negative column block size of system matrix.");
38    
39     m_empty=0;
40     m_row_blocksize=row_blocksize;
41     m_column_blocksize=column_blocksize;
42 jfenwick 1872 // m_row_functionspace=row_functionspace;
43     // m_column_functionspace=column_functionspace;
44 jgs 82 }
45    
46     AbstractSystemMatrix::~AbstractSystemMatrix() {
47     }
48    
49     int AbstractSystemMatrix::isEmpty() const {
50     return m_empty;
51     }
52    
53 jgs 153 Data operator*(const AbstractSystemMatrix& left,const Data& right)
54 jgs 82 {
55 jgs 153 Data tmp=(Data) right;
56     return left.vectorMultiply(tmp);
57 jgs 82 }
58    
59 jgs 153 Data AbstractSystemMatrix::vectorMultiply(Data& right) const
60 jgs 82 {
61     if (isEmpty())
62     throw SystemMatrixException("Error - Matrix is empty.");
63     if (right.getDataPointSize()!=getColumnBlockSize())
64     throw SystemMatrixException("Error - column block size and input data size do not match.");
65 jfenwick 1796 DataTypes::ShapeType shape;
66 jgs 82 if (getRowBlockSize()>1) shape.push_back(getRowBlockSize());
67    
68     Data out=Data(0.,shape,getRowFunctionSpace(),true);
69 jgs 153 Data in=Data(right,getColumnFunctionSpace());
70     ypAx(out,in);
71 jgs 82 return out;
72     }
73    
74 jgs 153 void AbstractSystemMatrix::ypAx(Data& y,Data& x) const
75 jgs 82 {
76     throw SystemMatrixException("Error - ypAx not available");
77     }
78    
79 gross 2474 Data AbstractSystemMatrix::solve(Data& in, boost::python::object& options) const
80 jgs 82 {
81     if (isEmpty())
82     throw SystemMatrixException("Error - Matrix is empty.");
83     if (in.getFunctionSpace()!=getRowFunctionSpace())
84     throw SystemMatrixException("Error - row function space and function space of right hand side do not match.");
85     if (in.getDataPointSize()!=getRowBlockSize())
86     throw SystemMatrixException("Error - row block size and right hand side size do not match.");
87 jfenwick 1796 DataTypes::ShapeType shape;
88 jgs 82 if (getRowBlockSize()>1) shape.push_back(getColumnBlockSize());
89     Data out=Data(0.,shape,getColumnFunctionSpace(),true);
90     setToSolution(out,in,options);
91     return out;
92     }
93 gross 2474 void AbstractSystemMatrix::setToSolution(Data& out,Data& in, boost::python::object& options) const
94 jgs 82 {
95     throw SystemMatrixException("Error - setToSolution not available");
96     }
97 jgs 102 void AbstractSystemMatrix::saveMM(const std::string& fileName) const
98     {
99     throw SystemMatrixException("Error - Matrix Market interface not available.");
100     }
101 jgs 123 void AbstractSystemMatrix::saveHB(const std::string& fileName) const
102     {
103     throw SystemMatrixException("Error - Harwell-Boeing interface not available.");
104     }
105 jgs 149 void AbstractSystemMatrix::resetValues() const
106 jgs 102 {
107 jgs 108 throw SystemMatrixException("Error - setValue is not implemented.");
108 jgs 102 }
109 jgs 82
110     } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26