# Diff of /branches/arrexp_2137_win_merge/escript/src/AbstractTransportProblem.h

trunk/escript/src/AbstractSystemMatrix.h revision 474 by jgs, Mon Jan 30 04:23:44 2006 UTC trunk/escript/src/AbstractTransportProblem.h revision 1364 by gross, Mon Dec 17 07:22:45 2007 UTC
# Line 1  Line 1
1  // \$Id\$
2  /*  /* \$Id:\$ */
3   ******************************************************************************
4   *                                                                            *  /*******************************************************
6   *                                                                            *   *       Copyright 2007 by University of Queensland
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    *   *                http://esscc.uq.edu.au
9   * consent of ACcESS.  Copying, use or modification of this software          *   *        Primary Business: Queensland, Australia
10   * by any unauthorised person is illegal unless that person has a software    *   *  Licensed under the Open Software License version 3.0
12   *                                                                            *   *
13   ******************************************************************************   *******************************************************/
14  */
15                                                                              #if !defined  escript_AbstractTransportProblem_H
16  #if !defined  escript_AbstractSystemMatrix_20040628_H  #define escript_AbstractTransportProblem_H
17  #define escript_AbstractSystemMatrix_20040628_H  #include "system_dep.h"
18
19  #include "FunctionSpace.h"  #include "FunctionSpace.h"
20  #include "SystemMatrixException.h"  #include "TransportProblemException.h"
#include "Data.h"
21
22  #include <boost/python/dict.hpp>  #include <boost/python/dict.hpp>
23
24    //
25    // Forward declaration
26    class Data;
27
28  namespace escript {  namespace escript {
29
30  /**  /**
31     \brief     \brief
32     Give a short description of what AbstractSystemMatrix does.     Give a short description of what AbstractTransportProblem does.
33
34     Description:     Description:
35     Give a detailed description of AbstractSystemMatrix     Give a detailed description of AbstractTransportProblem
36
37     Template Parameters:     Template Parameters:
38     For templates describe any conditions that the parameters used in the     For templates describe any conditions that the parameters used in the
39     template must satisfy     template must satisfy
40  */  */
41  class AbstractSystemMatrix {  class AbstractTransportProblem {
42
43   public:   public:
44
45    /**    /**
46       \brief       \brief
47       Default constructor for AbstractSystemMatrix       Default constructor for AbstractTransportProblem
48
49       Description:       Description:
50       Default constructor for AbstractSystemMatrix       Default constructor for AbstractTransportProblem
51
52       Preconditions:       Preconditions:
53       Describe any preconditions       Describe any preconditions
# Line 52  class AbstractSystemMatrix { Line 55  class AbstractSystemMatrix {
55       Throws:       Throws:
56       Describe any exceptions thrown       Describe any exceptions thrown
57    */    */
58    AbstractSystemMatrix();    ESCRIPT_DLL_API
59      AbstractTransportProblem();
60
61    AbstractSystemMatrix(const int row_blocksize,    ESCRIPT_DLL_API
62                         const FunctionSpace& row_functionspace,    AbstractTransportProblem(const double theta,
63                         const int column_blocksize,                             const double dt_max,
64                         const FunctionSpace& column_functionspace);                             const int blocksize,
65    /**                             const FunctionSpace& functionspace);
\brief
Destructor.
*/
virtual ~AbstractSystemMatrix();
66
67    /**    /**
68      \brief      \brief
69      matrix*vector multiplication      Destructor.
70    */    */
71    Data vectorMultiply(Data& right) const;    ESCRIPT_DLL_API
72      virtual ~AbstractTransportProblem();
73
74    /**    ESCRIPT_DLL_API
\brief
returns true if the matrix is empty
*/
75    int isEmpty() const;    int isEmpty() const;
76
77    /**    /**
78      \brief      \brief
79      returns the column function space      returns the column function space
80    */    */
81    inline FunctionSpace getColumnFunctionSpace() const    ESCRIPT_DLL_API
82      inline FunctionSpace getFunctionSpace() const
83    {    {
84         if (isEmpty())         if (isEmpty())
85              throw SystemMatrixException("Error - Matrix is empty.");              throw TransportProblemException("Error - Matrix is empty.");
86         return m_column_functionspace;         return m_functionspace;
87    }    }
88
89    /**    /**
90      \brief      \brief
91      returns the row function space      returns the block size
92    */    */
93    inline FunctionSpace getRowFunctionSpace() const    ESCRIPT_DLL_API
94      inline int getBlockSize() const
95    {    {
96         if (isEmpty())         if (isEmpty())
97              throw SystemMatrixException("Error - Matrix is empty.");              throw TransportProblemException("Error - Matrix is empty.");
98         return m_row_functionspace;         return m_blocksize;
}

/**
\brief
returns the row block size
*/
inline int getRowBlockSize() const
{
if (isEmpty())
throw SystemMatrixException("Error - Matrix is empty.");
return m_row_blocksize;
}

/**
\brief
returns the column block size
*/
inline int getColumnBlockSize() const
{
if (isEmpty())
throw SystemMatrixException("Error - Matrix is empty.");
return m_column_blocksize;
99    }    }
100
101    /**    /**
102       \brief       \brief
103       returns the solution u of the linear system this*u=in       returns the solution u for a time step dt>0
*/
Data solve(Data& in,const boost::python::dict& options) const;

/**
\brief writes the matrix to a file using the Matrix Market file format
104    */    */
105    virtual void saveMM(const std::string& fileName) const;    ESCRIPT_DLL_API
106      Data solve(Data& source, const double dt, const boost::python::dict& options) const;
107
108    /**    /**
109       \brief writes the matrix to a file using the Harwell-Boeing file format       \brief
110         sets the value for u at time t=0.
111    */    */
112    virtual void saveHB(const std::string& fileName) const;    ESCRIPT_DLL_API
113      void setInitialValue(Data& u) const;
114    /**    /**
115       \brief resets the matrix entries       \brief resets the transport operator typically as they have been updated.
116    */    */
117    virtual void resetValues() const;    ESCRIPT_DLL_API
118      virtual void resetTransport() const;
119
120   protected:   protected:
121
# Line 147  class AbstractSystemMatrix { Line 123  class AbstractSystemMatrix {
123
124    /**    /**
125       \brief       \brief
126       solves the linear system this*out=in       sets solution out by time step dt.
127    */    */
128    virtual void setToSolution(Data& out,Data& in,const boost::python::dict& options) const;    ESCRIPT_DLL_API
129      virtual void setToSolution(Data& out,Data& source,const double dt, const boost::python::dict& options) const;
130
131    /**    /**
132       \brief       \brief
133       performs y+=this*x       copies the initial value into the problem
134    */    */
135    virtual void ypAx(Data& y,Data& x) const;    ESCRIPT_DLL_API
136      virtual void copyInitialValue(Data& u) const;
137
138    int m_empty;    int m_empty;
139    int m_column_blocksize;    int m_blocksize;
140    int m_row_blocksize;    double m_theta;
141    FunctionSpace m_column_functionspace;    double m_dt_max;
142    FunctionSpace m_row_functionspace;    FunctionSpace m_functionspace;
143
144  };  };
145
Data operator*(const AbstractSystemMatrix& left,const Data& right) ;

146
147  } // end of namespace  } // end of namespace
148  #endif  #endif

Legend:
 Removed from v.474 changed lines Added in v.1364