/[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 626 - (hide annotations)
Thu Mar 23 02:16:36 2006 UTC (13 years, 5 months ago) by elspeth
File MIME type: text/plain
File size: 3670 byte(s)
Copyright information inserted

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26