/[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 471 - (hide annotations)
Fri Jan 27 01:33:02 2006 UTC (13 years, 7 months ago) by jgs
File MIME type: text/plain
File size: 3986 byte(s)
reorganise finley src tree to remove inc dir and src/finley directory

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26