/[escript]/trunk/esys2/finley/src/CPPAdapter/SystemMatrixAdapter.h
ViewVC logotype

Annotation of /trunk/esys2/finley/src/CPPAdapter/SystemMatrixAdapter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 149 - (hide annotations)
Thu Sep 1 03:31:39 2005 UTC (14 years, 1 month ago) by jgs
File MIME type: text/plain
File size: 3939 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-01

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     #include "finley/CPPAdapter/SystemMatrixAdapter.h"
20     #include "escript/Data/AbstractSystemMatrix.h"
21     #include "escript/Data/Data.h"
22     extern "C" {
23     #include "finley/finleyC/System.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 Finley_SystemMatrix.
35    
36     Description:
37     Wrapper for Finley_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 jgs 102 SystemMatrixAdapter(Finley_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     Finley_SystemMatrix* getFinley_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 Finley_SystemMatrix_nullifyRowsAndCols.
94     */
95     void nullifyRowsAndCols(const escript::Data& row_q, const escript::Data& col_q, const double mdv) const;
96    
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 82 protected:
113    
114     private:
115    
116     /**
117     \brief
118     solves the linear system this*out=in
119     */
120     virtual void setToSolution(escript::Data& out, const escript::Data& in, const boost::python::dict& options) const;
121    
122     /**
123     \brief
124     performs y+=this*x
125     */
126     virtual void ypAx(escript::Data& y, const escript::Data& x) const;
127    
128     //
129     // pointer to the externally created finley mesh - system_matrix.
130     //
131     boost::shared_ptr<Finley_SystemMatrix> m_system_matrix;
132    
133     };
134    
135     } // end of namespace
136     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26