/[escript]/branches/arrexp_2137_win_merge/escript/src/AbstractTransportProblem.h
ViewVC logotype

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

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

trunk/escript/src/Data/AbstractSystemMatrix.h revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC branches/arrexp_2137_win_merge/escript/src/AbstractTransportProblem.h revision 2219 by jfenwick, Wed Jan 14 04:31:34 2009 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /*******************************************************
3   ******************************************************************************  *
4   *                                                                            *  * Copyright (c) 2003-2008 by University of Queensland
5   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *  * Earth Systems Science Computational Center (ESSCC)
6   *                                                                            *  * http://www.uq.edu.au/esscc
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    *  * Primary Business: Queensland, Australia
9   * consent of ACcESS.  Copying, use or modification of this software          *  * Licensed under the Open Software License version 3.0
10   * by any unauthorised person is illegal unless that person has a software    *  * http://www.opensource.org/licenses/osl-3.0.php
11   * license agreement with ACcESS.                                             *  *
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 "escript/Data/FunctionSpace.h"  #include "FunctionSpace.h"
20  #include "escript/Data/SystemMatrixException.h"  #include "TransportProblemException.h"
21  #include "escript/Data/Data.h"  
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 51  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 int blocksize,
64                         const FunctionSpace& column_functionspace);                             const FunctionSpace& functionspace);
   /**  
     \brief  
     Destructor.  
   */  
   virtual ~AbstractSystemMatrix();  
65    
66    /**    /**
67      \brief      \brief
68      matrix*vector multiplication      Destructor.
69    */    */
70    Data vectorMultiply(Data& right) const;    ESCRIPT_DLL_API
71      virtual ~AbstractTransportProblem();
72    
73    /**    ESCRIPT_DLL_API
     \brief  
     returns true if the matrix is empty  
   */  
74    int isEmpty() const;    int isEmpty() const;
75    
76    /**    /**
77      \brief      \brief
78      returns the column function space      returns the column function space
79    */    */
80    inline FunctionSpace getColumnFunctionSpace() const    ESCRIPT_DLL_API
81      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    inline FunctionSpace getRowFunctionSpace() const    ESCRIPT_DLL_API
93      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
   */  
   inline int getRowBlockSize() const  
   {  
        if (isEmpty())  
             throw SystemMatrixException("Error - Matrix is empty.");  
        return m_row_blocksize;  
   }  
   
   /**  
     \brief  
     returns the column block size  
103    */    */
104    inline int getColumnBlockSize() const    ESCRIPT_DLL_API
105    {    Data solve(Data& source, const double dt, const boost::python::dict& options) const;
        if (isEmpty())  
             throw SystemMatrixException("Error - Matrix is empty.");  
        return m_column_blocksize;  
   }  
106    
107    /**    /**
108       \brief       \brief
109       returns the solution u of the linear system this*u=in       sets the value for u at time t=0.
110    */    */
111    Data solve(Data& in,const boost::python::dict& options) const;    ESCRIPT_DLL_API
112      void setInitialValue(Data& u) const;
113    
114    /**    /**
115       \brief writes the matrix to a file using the Matrix Market file format       \brief resets the transport operator typically as they have been updated.
116    */    */
117    virtual void saveMM(const std::string& fileName) const;    ESCRIPT_DLL_API
118      virtual void resetTransport() const;
119    
120    /**    /**
121       \brief writes the matrix to a file using the Harwell-Boeing file format       \brief
122         inserts constraint u_{,t}=r where q>0  into the problem using a weighting factor
123    */    */
124    virtual void saveHB(const std::string& fileName) const;    ESCRIPT_DLL_API
125      void insertConstraint(Data& source, Data& q, Data& r, const double factor) const;
126      /*
127       *      \brief returns a safe time step size.
128       */
129      ESCRIPT_DLL_API
130      virtual double getSafeTimeStepSize() const;
131      /*
132       *      \brief returns the value for unlimited time step size.
133       */
134      ESCRIPT_DLL_API
135      virtual double getUnlimitedTimeStepSize() const;
136    
   /**  
      \brief resets the matrix entries  
   */  
   virtual void resetValues() const;  
137    
138   protected:   protected:
139    
# Line 146  class AbstractSystemMatrix { Line 141  class AbstractSystemMatrix {
141    
142    /**    /**
143       \brief       \brief
144       solves the linear system this*out=in       sets solution out by time step dt.
145    */    */
146    virtual void setToSolution(Data& out,Data& in,const boost::python::dict& options) const;    ESCRIPT_DLL_API
147      virtual void setToSolution(Data& out,Data& source,const double dt, const boost::python::dict& options) const;
148    
149    /**    /**
150       \brief       \brief
151       performs y+=this*x       copies the initial value into the problem
152      */
153      ESCRIPT_DLL_API
154      virtual void copyInitialValue(Data& u) const;
155      /**
156         \brief
157         copy constraint u_{,t}=r where q>0  into the problem
158         it can be assumed that q and r are not empty and have  
159         appropriate shape and function space.
160    */    */
161    virtual void ypAx(Data& y,Data& x) const;    ESCRIPT_DLL_API
162      virtual void copyConstraint(Data& source, Data& q, Data& r, const double factor) const;
163    
164    int m_empty;    int m_empty;
165    int m_column_blocksize;    int m_blocksize;
166    int m_row_blocksize;    double m_theta;
167    FunctionSpace m_column_functionspace;    FunctionSpace m_functionspace;
   FunctionSpace m_row_functionspace;  
168    
169  };  };
170    
 Data operator*(const AbstractSystemMatrix& left,const Data& right) ;  
   
   
171    
172  } // end of namespace  } // end of namespace
173  #endif  #endif

Legend:
Removed from v.155  
changed lines
  Added in v.2219

  ViewVC Help
Powered by ViewVC 1.1.26