/[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 1384 - (hide annotations)
Fri Jan 11 02:29:38 2008 UTC (11 years, 8 months ago) by phornby
Original Path: temp_trunk_copy/finley/src/CPPAdapter/SystemMatrixAdapter.h
File MIME type: text/plain
File size: 4088 byte(s)
Make a temp copy of the trunk before checking in the windows changes


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26