/[escript]/branches/symbolic_from_3470/escript/src/AbstractSystemMatrix.h
ViewVC logotype

Contents of /branches/symbolic_from_3470/escript/src/AbstractSystemMatrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3789 - (show annotations)
Tue Jan 31 04:55:05 2012 UTC (7 years, 2 months ago) by caltinay
File MIME type: text/plain
File size: 4316 byte(s)
Fast forward to latest trunk revision 3788.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26