/[escript]/trunk/finley/src/CPPAdapter/SystemMatrixAdapter.h
ViewVC logotype

Contents of /trunk/finley/src/CPPAdapter/SystemMatrixAdapter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (10 years, 11 months ago) by ksteube
File MIME type: text/plain
File size: 4053 byte(s)
Copyright updated in all files

1
2 /*******************************************************
3 *
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
14
15 #if !defined finley_SystemMatrixAdapter_20040610_H
16 #define finley_SystemMatrixAdapter_20040610_H
17 #include "system_dep.h"
18
19 extern "C" {
20 #include "paso/SystemMatrix.h"
21 #include "paso/Options.h"
22 }
23
24 #include "FinleyAdapterException.h"
25 #include "FinleyError.h"
26
27 #include "escript/AbstractSystemMatrix.h"
28 #include "escript/Data.h"
29 #include "escript/UtilC.h"
30
31 #include <boost/python/dict.hpp>
32 #include <boost/shared_ptr.hpp>
33 #include <boost/python/extract.hpp>
34
35 namespace finley {
36
37 class SystemMatrixAdapter:public escript::AbstractSystemMatrix {
38
39 /**
40 \brief
41 Wrapper for Paso_SystemMatrix.
42
43 Description:
44 Wrapper for Paso_SystemMatrix.
45 */
46
47 public:
48
49 /**
50 /brief
51 Default Constructor for SystemMatrixAdapter.
52 NB: Only throws an exception.
53 */
54 FINLEY_DLL_API
55 SystemMatrixAdapter();
56
57 /**
58 /brief
59 Constructor for SystemMatrixAdapter.
60 */
61 FINLEY_DLL_API
62 SystemMatrixAdapter(Paso_SystemMatrix* system_matrix,
63 const int row_blocksize,
64 const escript::FunctionSpace& row_functionspace,
65 const int column_blocksize,
66 const escript::FunctionSpace& colum_functionspace);
67
68
69 /**
70 \brief
71 Destructor for SystemMatrixAdapter. As specified in the constructor
72 this deallocates the pointer given to the constructor.
73 */
74 FINLEY_DLL_API
75 ~SystemMatrixAdapter();
76
77 /**
78 \brief
79 Returns the pointer to the system matrix.
80 */
81 FINLEY_DLL_API
82 Paso_SystemMatrix* getPaso_SystemMatrix() const;
83
84 /**
85 \brief
86 Returns the system matrix as a const AbstractSystemMatrix&.
87 */
88 inline const escript::AbstractSystemMatrix& asAbstractSystemMatrix() const
89 {
90 return dynamic_cast<const escript::AbstractSystemMatrix&>(*this);
91 }
92
93 /**
94 \brief
95 Returns a system matrix as a const SystemMatrixAdapter&.
96 */
97 inline static const SystemMatrixAdapter& asSystemMatrixAdapter(const AbstractSystemMatrix& systemmatrix)
98 {
99 return dynamic_cast<const SystemMatrixAdapter&>(systemmatrix);
100 }
101
102 /**
103 \brief
104 nullifyRowsAndCols - calls Paso_SystemMatrix_nullifyRowsAndCols.
105 */
106 FINLEY_DLL_API
107 void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
108
109 /**
110 \brief writes the matrix to a file using the Matrix Market file format
111 */
112 FINLEY_DLL_API
113 virtual void saveMM(const std::string& fileName) const;
114
115 /**
116 \brief writes the matrix to a file using the Harwell-Boeing file format
117 */
118 FINLEY_DLL_API
119 virtual void saveHB(const std::string& fileName) const;
120
121 /**
122 \brief sets the matrix entries to zero
123 */
124 FINLEY_DLL_API
125 virtual void resetValues() const;
126
127 /**
128 \brief maps escript options onto Paso options:
129 */
130 FINLEY_DLL_API
131 static int mapOptionToPaso(const int option);
132
133 /**
134 \brief extract paso options from a dictionary
135 */
136
137 FINLEY_DLL_API
138 static void dictToPasoOptions(Paso_Options* paso_options, const boost::python::dict& options);
139
140 /**
141 \brief prints information about a system matrix
142 */
143 FINLEY_DLL_API
144 void Print_Matrix_Info(const bool) const;
145
146 protected:
147
148 private:
149
150 /**
151 \brief
152 solves the linear system this*out=in
153 */
154 FINLEY_DLL_API
155 virtual void setToSolution(escript::Data& out, escript::Data& in, const boost::python::dict& options) const;
156
157 /**
158 \brief
159 performs y+=this*x
160 */
161 FINLEY_DLL_API
162 virtual void ypAx(escript::Data& y, escript::Data& x) const;
163
164 //
165 // pointer to the externally created finley mesh - system_matrix.
166 //
167 boost::shared_ptr<Paso_SystemMatrix> m_system_matrix;
168
169 };
170
171 } // end of namespace
172 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26