/[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 472 - (show annotations)
Fri Jan 27 01:50:59 2006 UTC (12 years, 11 months ago) by jgs
File MIME type: text/plain
File size: 4031 byte(s)
rationalise all #includes

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26