/[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 757 - (show annotations)
Mon Jun 26 13:12:56 2006 UTC (13 years, 2 months ago) by woo409
File MIME type: text/plain
File size: 3917 byte(s)
+ Merge of intelc_win32 branch (revision 741:755) with trunk. Tested on iVEC altix (run_tests and py_tests all pass)

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26