/[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 201 - (show annotations)
Wed Nov 23 04:10:21 2005 UTC (13 years, 9 months ago) by jgs
Original Path: trunk/finley/src/finley/CPPAdapter/SystemMatrixAdapter.h
File MIME type: text/plain
File size: 4009 byte(s)
copy finleyC and CPPAdapter to finley and finley/CPPAdapter to
facilitate scons builds

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 #include "finley/CPPAdapter/SystemMatrixAdapter.h"
20 #include "escript/Data/AbstractSystemMatrix.h"
21 #include "escript/Data/Data.h"
22 extern "C" {
23 #include "paso/SystemMatrix.h"
24 }
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 Wrapper for Paso_SystemMatrix.
35
36 Description:
37 Wrapper for Paso_SystemMatrix.
38 */
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 SystemMatrixAdapter(Paso_SystemMatrix* system_matrix,
54 const int row_blocksize,
55 const escript::FunctionSpace& row_functionspace,
56 const int column_blocksize,
57 const escript::FunctionSpace& colum_functionspace);
58
59
60 /**
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 Paso_SystemMatrix* getPaso_SystemMatrix() const;
72
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 nullifyRowsAndCols - calls Paso_SystemMatrix_nullifyRowsAndCols.
94 */
95 void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
96
97 /**
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 \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 \brief sets the matrix entries to zero
109 */
110 virtual void resetValues() const;
111
112 /**
113 \brief maps escript options onto Paso options:
114 */
115 static int mapOptionToPaso(const int option);
116
117 protected:
118
119 private:
120
121 /**
122 \brief
123 solves the linear system this*out=in
124 */
125 virtual void setToSolution(escript::Data& out, escript::Data& in, const boost::python::dict& options) const;
126
127 /**
128 \brief
129 performs y+=this*x
130 */
131 virtual void ypAx(escript::Data& y, escript::Data& x) const;
132
133 //
134 // pointer to the externally created finley mesh - system_matrix.
135 //
136 boost::shared_ptr<Paso_SystemMatrix> m_system_matrix;
137
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