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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 615 - (show annotations)
Wed Mar 22 02:12:00 2006 UTC (13 years, 6 months ago) by elspeth
File MIME type: text/plain
File size: 3902 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
15 #if !defined escript_AbstractSystemMatrix_20040628_H
16 #define escript_AbstractSystemMatrix_20040628_H
17
18 #include "FunctionSpace.h"
19 #include "SystemMatrixException.h"
20
21 #include <boost/python/dict.hpp>
22
23 //
24 // Forward declaration
25 class Data;
26
27 namespace escript {
28
29 /**
30 \brief
31 Give a short description of what AbstractSystemMatrix does.
32
33 Description:
34 Give a detailed description of AbstractSystemMatrix
35
36 Template Parameters:
37 For templates describe any conditions that the parameters used in the
38 template must satisfy
39 */
40 class AbstractSystemMatrix {
41
42 public:
43
44 /**
45 \brief
46 Default constructor for AbstractSystemMatrix
47
48 Description:
49 Default constructor for AbstractSystemMatrix
50
51 Preconditions:
52 Describe any preconditions
53
54 Throws:
55 Describe any exceptions thrown
56 */
57 AbstractSystemMatrix();
58
59 AbstractSystemMatrix(const int row_blocksize,
60 const FunctionSpace& row_functionspace,
61 const int column_blocksize,
62 const FunctionSpace& column_functionspace);
63 /**
64 \brief
65 Destructor.
66 */
67 virtual ~AbstractSystemMatrix();
68
69 /**
70 \brief
71 matrix*vector multiplication
72 */
73 Data vectorMultiply(Data& right) const;
74
75 /**
76 \brief
77 returns true if the matrix is empty
78 */
79 int isEmpty() const;
80
81 /**
82 \brief
83 returns the column function space
84 */
85 inline FunctionSpace getColumnFunctionSpace() const
86 {
87 if (isEmpty())
88 throw SystemMatrixException("Error - Matrix is empty.");
89 return m_column_functionspace;
90 }
91
92 /**
93 \brief
94 returns the row function space
95 */
96 inline FunctionSpace getRowFunctionSpace() const
97 {
98 if (isEmpty())
99 throw SystemMatrixException("Error - Matrix is empty.");
100 return m_row_functionspace;
101 }
102
103 /**
104 \brief
105 returns the row block size
106 */
107 inline int getRowBlockSize() const
108 {
109 if (isEmpty())
110 throw SystemMatrixException("Error - Matrix is empty.");
111 return m_row_blocksize;
112 }
113
114 /**
115 \brief
116 returns the column block size
117 */
118 inline int getColumnBlockSize() const
119 {
120 if (isEmpty())
121 throw SystemMatrixException("Error - Matrix is empty.");
122 return m_column_blocksize;
123 }
124
125 /**
126 \brief
127 returns the solution u of the linear system this*u=in
128 */
129 Data solve(Data& in,const boost::python::dict& options) const;
130
131 /**
132 \brief writes the matrix to a file using the Matrix Market file format
133 */
134 virtual void saveMM(const std::string& fileName) const;
135
136 /**
137 \brief writes the matrix to a file using the Harwell-Boeing file format
138 */
139 virtual void saveHB(const std::string& fileName) const;
140
141 /**
142 \brief resets the matrix entries
143 */
144 virtual void resetValues() const;
145
146 protected:
147
148 private:
149
150 /**
151 \brief
152 solves the linear system this*out=in
153 */
154 virtual void setToSolution(Data& out,Data& in,const boost::python::dict& options) const;
155
156 /**
157 \brief
158 performs y+=this*x
159 */
160 virtual void ypAx(Data& y,Data& x) const;
161
162 int m_empty;
163 int m_column_blocksize;
164 int m_row_blocksize;
165 FunctionSpace m_column_functionspace;
166 FunctionSpace m_row_functionspace;
167
168 };
169
170 Data operator*(const AbstractSystemMatrix& left,const Data& right) ;
171
172
173
174 } // end of namespace
175 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26