/[escript]/branches/ROBW_XPLATFORM/finley/src/CPPAdapter/SystemMatrixAdapter.h
ViewVC logotype

Annotation of /branches/ROBW_XPLATFORM/finley/src/CPPAdapter/SystemMatrixAdapter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 624 - (hide annotations)
Wed Mar 22 23:00:01 2006 UTC (17 years ago) by robwdcock
File MIME type: text/plain
File size: 4035 byte(s)
+ Finish off the header file path changes
+ The C/C++ libraries now all compile on the ivec altix (cognac) using the xplatform build system

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 jgs 472
16 jgs 82 #if !defined finley_SystemMatrixAdapter_20040610_H
17     #define finley_SystemMatrixAdapter_20040610_H
18    
19     extern "C" {
20 robwdcock 624 #include "paso/SystemMatrix.h"
21     #include "paso/Options.h"
22 jgs 82 }
23 jgs 472
24     #include "FinleyAdapterException.h"
25     #include "FinleyError.h"
26    
27 robwdcock 624 #include "escriptcpp/AbstractSystemMatrix.h"
28     #include "escriptcpp/Data.h"
29     #include "escriptcpp/UtilC.h"
30 jgs 472
31 jgs 82 #include <boost/python/dict.hpp>
32     #include <boost/shared_ptr.hpp>
33 jgs 472 #include <boost/python/extract.hpp>
34 jgs 82
35     namespace finley {
36    
37     class SystemMatrixAdapter:public escript::AbstractSystemMatrix {
38    
39     /**
40     \brief
41 jgs 150 Wrapper for Paso_SystemMatrix.
42 jgs 82
43     Description:
44 jgs 150 Wrapper for Paso_SystemMatrix.
45 jgs 82 */
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 jgs 150 SystemMatrixAdapter(Paso_SystemMatrix* system_matrix,
61 jgs 82 const int row_blocksize,
62     const escript::FunctionSpace& row_functionspace,
63     const int column_blocksize,
64     const escript::FunctionSpace& colum_functionspace);
65    
66 jgs 102
67 jgs 82 /**
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 jgs 150 Paso_SystemMatrix* getPaso_SystemMatrix() const;
79 jgs 82
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 jgs 150 nullifyRowsAndCols - calls Paso_SystemMatrix_nullifyRowsAndCols.
101 jgs 82 */
102 jgs 153 void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
103 jgs 82
104 jgs 102 /**
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 jgs 123 \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 jgs 149 \brief sets the matrix entries to zero
116 jgs 102 */
117 jgs 149 virtual void resetValues() const;
118 jgs 102
119 jgs 150 /**
120     \brief maps escript options onto Paso options:
121     */
122     static int mapOptionToPaso(const int option);
123    
124 jgs 82 protected:
125    
126     private:
127    
128     /**
129     \brief
130     solves the linear system this*out=in
131     */
132 jgs 153 virtual void setToSolution(escript::Data& out, escript::Data& in, const boost::python::dict& options) const;
133 jgs 82
134     /**
135     \brief
136     performs y+=this*x
137     */
138 jgs 153 virtual void ypAx(escript::Data& y, escript::Data& x) const;
139 jgs 82
140     //
141     // pointer to the externally created finley mesh - system_matrix.
142     //
143 jgs 150 boost::shared_ptr<Paso_SystemMatrix> m_system_matrix;
144 jgs 82
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