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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2548 - (hide annotations)
Mon Jul 20 06:20:06 2009 UTC (10 years, 1 month ago) by jfenwick
File MIME type: text/plain
File size: 4261 byte(s)
Updating copyright notices
1 jgs 472
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4 jfenwick 2548 * Copyright (c) 2003-2009 by University of Queensland
5 ksteube 1811 * 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 82 #if !defined finley_SystemMatrixAdapter_20040610_H
16     #define finley_SystemMatrixAdapter_20040610_H
17 woo409 757 #include "system_dep.h"
18 jgs 82
19     extern "C" {
20 robwdcock 682 #include "paso/SystemMatrix.h"
21     #include "paso/Options.h"
22 jgs 82 }
23 jgs 472
24     #include "FinleyAdapterException.h"
25     #include "FinleyError.h"
26    
27 robwdcock 682 #include "escript/AbstractSystemMatrix.h"
28     #include "escript/Data.h"
29     #include "escript/UtilC.h"
30 jgs 472
31 gross 2474 #include <boost/python/object.hpp>
32 jgs 82 #include <boost/shared_ptr.hpp>
33 jgs 472 #include <boost/python/extract.hpp>
34 jgs 82
35     namespace finley {
36    
37     class SystemMatrixAdapter:public escript::AbstractSystemMatrix {
38    
39     /**
40     \brief
41 jgs 150 Wrapper for Paso_SystemMatrix.
42 jgs 82
43     Description:
44 jgs 150 Wrapper for Paso_SystemMatrix.
45 jgs 82 */
46    
47     public:
48    
49     /**
50     /brief
51     Default Constructor for SystemMatrixAdapter.
52     NB: Only throws an exception.
53     */
54 woo409 757 FINLEY_DLL_API
55 jgs 82 SystemMatrixAdapter();
56    
57     /**
58     /brief
59     Constructor for SystemMatrixAdapter.
60     */
61 woo409 757 FINLEY_DLL_API
62 jgs 150 SystemMatrixAdapter(Paso_SystemMatrix* system_matrix,
63 jgs 82 const int row_blocksize,
64     const escript::FunctionSpace& row_functionspace,
65     const int column_blocksize,
66     const escript::FunctionSpace& colum_functionspace);
67    
68 jgs 102
69 jgs 82 /**
70     \brief
71     Destructor for SystemMatrixAdapter. As specified in the constructor
72     this deallocates the pointer given to the constructor.
73     */
74 woo409 757 FINLEY_DLL_API
75 jgs 82 ~SystemMatrixAdapter();
76    
77     /**
78     \brief
79     Returns the pointer to the system matrix.
80     */
81 woo409 757 FINLEY_DLL_API
82 jgs 150 Paso_SystemMatrix* getPaso_SystemMatrix() const;
83 jgs 82
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 jgs 150 nullifyRowsAndCols - calls Paso_SystemMatrix_nullifyRowsAndCols.
105 jgs 82 */
106 woo409 757 FINLEY_DLL_API
107 jgs 153 void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
108 jgs 82
109 jgs 102 /**
110     \brief writes the matrix to a file using the Matrix Market file format
111     */
112 woo409 757 FINLEY_DLL_API
113 jgs 102 virtual void saveMM(const std::string& fileName) const;
114    
115     /**
116 jgs 123 \brief writes the matrix to a file using the Harwell-Boeing file format
117     */
118 woo409 757 FINLEY_DLL_API
119 jgs 123 virtual void saveHB(const std::string& fileName) const;
120    
121     /**
122 jgs 149 \brief sets the matrix entries to zero
123 jgs 102 */
124 woo409 757 FINLEY_DLL_API
125 jgs 149 virtual void resetValues() const;
126 jgs 102
127 jgs 150 /**
128     \brief maps escript options onto Paso options:
129     */
130 woo409 757 FINLEY_DLL_API
131 jgs 150 static int mapOptionToPaso(const int option);
132    
133 ksteube 1339 /**
134 gross 2474 \brief extract paso options from SolutionOptions class
135 gross 1364 */
136    
137     FINLEY_DLL_API
138 gross 2474 static void escriptToPasoOptions(Paso_Options* paso_options, const boost::python::object& options);
139 gross 1364
140     /**
141 gross 2474 \brief copied diagonistic data back to the solver option.
142     */
143    
144     FINLEY_DLL_API
145     static void pasoToEscriptOptions(const Paso_Options* paso_options,boost::python::object& options);
146    
147     /**
148 ksteube 1339 \brief prints information about a system matrix
149     */
150     FINLEY_DLL_API
151     void Print_Matrix_Info(const bool) const;
152    
153 jgs 82 protected:
154    
155     private:
156    
157     /**
158     \brief
159     solves the linear system this*out=in
160     */
161 woo409 757 FINLEY_DLL_API
162 gross 2474 virtual void setToSolution(escript::Data& out, escript::Data& in, boost::python::object& options) const;
163 jgs 82
164     /**
165     \brief
166     performs y+=this*x
167     */
168 woo409 757 FINLEY_DLL_API
169 jgs 153 virtual void ypAx(escript::Data& y, escript::Data& x) const;
170 jgs 82
171     //
172     // pointer to the externally created finley mesh - system_matrix.
173     //
174 jgs 150 boost::shared_ptr<Paso_SystemMatrix> m_system_matrix;
175 jgs 82
176     };
177    
178     } // end of namespace
179     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26