/[escript]/trunk/escript/src/AbstractTransportProblem.h
ViewVC logotype

Diff of /trunk/escript/src/AbstractTransportProblem.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/escript/src/AbstractSystemMatrix.h revision 757 by woo409, Mon Jun 26 13:12:56 2006 UTC trunk/escript/src/AbstractTransportProblem.h revision 1417 by gross, Mon Feb 25 04:45:48 2008 UTC
# Line 1  Line 1 
 // $Id$  
 /*  
  ************************************************************  
  *          Copyright 2006 by ACcESS MNRF                   *  
  *                                                          *  
  *              http://www.access.edu.au                    *  
  *       Primary Business: Queensland, Australia            *  
  *  Licensed under the Open Software License version 3.0    *  
  *     http://www.opensource.org/licenses/osl-3.0.php       *  
  *                                                          *  
  ************************************************************  
1    
2  */  /* $Id$ */
3    
4    /*******************************************************
5     *
6     *       Copyright 2007 by University of Queensland
7     *
8     *                http://esscc.uq.edu.au
9     *        Primary Business: Queensland, Australia
10     *  Licensed under the Open Software License version 3.0
11     *     http://www.opensource.org/licenses/osl-3.0.php
12     *
13     *******************************************************/
14    
15  #if !defined  escript_AbstractSystemMatrix_20040628_H  #if !defined  escript_AbstractTransportProblem_H
16  #define escript_AbstractSystemMatrix_20040628_H  #define escript_AbstractTransportProblem_H
17  #include "system_dep.h"  #include "system_dep.h"
18    
19  #include "FunctionSpace.h"  #include "FunctionSpace.h"
20  #include "SystemMatrixException.h"  #include "TransportProblemException.h"
21    
22  #include <boost/python/dict.hpp>  #include <boost/python/dict.hpp>
23    
# Line 29  namespace escript { Line 29  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 56  class AbstractSystemMatrix { Line 56  class AbstractSystemMatrix {
56       Describe any exceptions thrown       Describe any exceptions thrown
57    */    */
58    ESCRIPT_DLL_API    ESCRIPT_DLL_API
59    AbstractSystemMatrix();    AbstractTransportProblem();
60    
61    ESCRIPT_DLL_API    ESCRIPT_DLL_API
62    AbstractSystemMatrix(const int row_blocksize,    AbstractTransportProblem(const double theta,
63                         const FunctionSpace& row_functionspace,                             const int blocksize,
64                         const int column_blocksize,                             const FunctionSpace& functionspace);
65                         const FunctionSpace& column_functionspace);  
66    /**    /**
67      \brief      \brief
68      Destructor.      Destructor.
69    */    */
70    ESCRIPT_DLL_API    ESCRIPT_DLL_API
71    virtual ~AbstractSystemMatrix();    virtual ~AbstractTransportProblem();
72    
   /**  
     \brief  
     matrix*vector multiplication  
   */  
   ESCRIPT_DLL_API  
   Data vectorMultiply(Data& right) const;  
   
   /**  
     \brief  
     returns true if the matrix is empty  
   */  
73    ESCRIPT_DLL_API    ESCRIPT_DLL_API
74    int isEmpty() const;    int isEmpty() const;
75    
# Line 89  class AbstractSystemMatrix { Line 78  class AbstractSystemMatrix {
78      returns the column function space      returns the column function space
79    */    */
80    ESCRIPT_DLL_API    ESCRIPT_DLL_API
81    inline FunctionSpace getColumnFunctionSpace() const    inline FunctionSpace getFunctionSpace() const
82    {    {
83         if (isEmpty())         if (isEmpty())
84              throw SystemMatrixException("Error - Matrix is empty.");              throw TransportProblemException("Error - Transport Problem is empty.");
85         return m_column_functionspace;         return m_functionspace;
86    }    }
87    
88    /**    /**
89      \brief      \brief
90      returns the row function space      returns the block size
91    */    */
92    ESCRIPT_DLL_API    ESCRIPT_DLL_API
93    inline FunctionSpace getRowFunctionSpace() const    inline int getBlockSize() const
94    {    {
95         if (isEmpty())         if (isEmpty())
96              throw SystemMatrixException("Error - Matrix is empty.");              throw TransportProblemException("Error - Transport Problem is empty.");
97         return m_row_functionspace;         return m_blocksize;
98    }    }
99    
100    /**    /**
101      \brief       \brief
102      returns the row block size       returns the solution u for a time step dt>0
103    */    */
104    ESCRIPT_DLL_API    ESCRIPT_DLL_API
105    inline int getRowBlockSize() const    Data solve(Data& source, const double dt, const boost::python::dict& options) const;
   {  
        if (isEmpty())  
             throw SystemMatrixException("Error - Matrix is empty.");  
        return m_row_blocksize;  
   }  
106    
107    /**    /**
108      \brief       \brief
109      returns the column block size       sets the value for u at time t=0.
110    */    */
111    ESCRIPT_DLL_API    ESCRIPT_DLL_API
112    inline int getColumnBlockSize() const    void setInitialValue(Data& u) const;
   {  
        if (isEmpty())  
             throw SystemMatrixException("Error - Matrix is empty.");  
        return m_column_blocksize;  
   }  
113    
114    /**    /**
115       \brief       \brief resets the transport operator typically as they have been updated.
      returns the solution u of the linear system this*u=in  
116    */    */
117    ESCRIPT_DLL_API    ESCRIPT_DLL_API
118    Data solve(Data& in,const boost::python::dict& options) const;    virtual void resetTransport() const;
119    
120    /**    /**
121       \brief writes the matrix to a file using the Matrix Market file format       \brief
122         inserts constraint u_{,t}=r where q>0  into the problem.
123    */    */
124    ESCRIPT_DLL_API    ESCRIPT_DLL_API
125    virtual void saveMM(const std::string& fileName) const;    void insertConstraint(Data& source, Data& q, Data& r) const;
   
126    /**    /**
127       \brief writes the matrix to a file using the Harwell-Boeing file format       \brief resets the transport operator typically as they have been updated.
128    */    */
   ESCRIPT_DLL_API  
   virtual void saveHB(const std::string& fileName) const;  
129    
130    /**    /**
131       \brief resets the matrix entries     *      \brief returns a save time step size.
132    */     *        */
133    ESCRIPT_DLL_API    ESCRIPT_DLL_API
134    virtual void resetValues() const;    virtual double getSafeTimeStepSize() const;
135    
136    
137   protected:   protected:
138    
# Line 163  class AbstractSystemMatrix { Line 140  class AbstractSystemMatrix {
140    
141    /**    /**
142       \brief       \brief
143       solves the linear system this*out=in       sets solution out by time step dt.
144    */    */
145    ESCRIPT_DLL_API    ESCRIPT_DLL_API
146    virtual void setToSolution(Data& out,Data& in,const boost::python::dict& options) const;    virtual void setToSolution(Data& out,Data& source,const double dt, const boost::python::dict& options) const;
147    
148    /**    /**
149       \brief       \brief
150       performs y+=this*x       copies the initial value into the problem
151      */
152      ESCRIPT_DLL_API
153      virtual void copyInitialValue(Data& u) const;
154      /**
155         \brief
156         copy constraint u_{,t}=r where q>0  into the problem
157         it can be assumed that q and r are not empty and have  
158         appropriate shape and function space.
159    */    */
160    ESCRIPT_DLL_API    ESCRIPT_DLL_API
161    virtual void ypAx(Data& y,Data& x) const;    virtual void copyConstraint(Data& source, Data& q, Data& r) const;
162    
163    int m_empty;    int m_empty;
164    int m_column_blocksize;    int m_blocksize;
165    int m_row_blocksize;    double m_theta;
166    FunctionSpace m_column_functionspace;    FunctionSpace m_functionspace;
   FunctionSpace m_row_functionspace;  
167    
168  };  };
169    
 ESCRIPT_DLL_API Data operator*(const AbstractSystemMatrix& left,const Data& right) ;  
   
   
170    
171  } // end of namespace  } // end of namespace
172  #endif  #endif

Legend:
Removed from v.757  
changed lines
  Added in v.1417

  ViewVC Help
Powered by ViewVC 1.1.26