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

Diff of /trunk/finley/src/CPPAdapter/TransportProblemAdapter.h

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

trunk/finley/src/CPPAdapter/SystemMatrixAdapter.h revision 1362 by ksteube, Wed Nov 7 01:53:12 2007 UTC trunk/finley/src/CPPAdapter/TransportProblemAdapter.h revision 1364 by gross, Mon Dec 17 07:22:45 2007 UTC
# Line 1  Line 1 
1    /* $Id:$ */
 /* $Id$ */  
2    
3  /*******************************************************  /*******************************************************
4   *   *
  *           Copyright 2003-2007 by ACceSS MNRF  
5   *       Copyright 2007 by University of Queensland   *       Copyright 2007 by University of Queensland
6   *   *
7   *                http://esscc.uq.edu.au   *                http://esscc.uq.edu.au
# Line 13  Line 11 
11   *   *
12   *******************************************************/   *******************************************************/
13    
14  #if !defined  finley_SystemMatrixAdapter_20040610_H  #if !defined  finley_TransportProblemAdapter_H
15  #define finley_SystemMatrixAdapter_20040610_H  #define finley_TransportProblemAdapter_H
16  #include "system_dep.h"  #include "system_dep.h"
17    
18  extern "C" {  extern "C" {
19  #include "paso/SystemMatrix.h"  #include "paso/SolverFCT.h"
20  #include "paso/Options.h"  #include "paso/Options.h"
21  }  }
22    
23  #include "FinleyAdapterException.h"  #include "FinleyAdapterException.h"
24  #include "FinleyError.h"  #include "FinleyError.h"
25    
26  #include "escript/AbstractSystemMatrix.h"  #include "escript/AbstractTransportProblem.h"
27  #include "escript/Data.h"  #include "escript/Data.h"
28  #include "escript/UtilC.h"  #include "escript/UtilC.h"
29    
# Line 35  extern "C" { Line 33  extern "C" {
33    
34  namespace finley {  namespace finley {
35    
36  class SystemMatrixAdapter:public escript::AbstractSystemMatrix {  class TransportProblemAdapter:public escript::AbstractTransportProblem {
37    
38  /**  /**
39     \brief     \brief
40     Wrapper for Paso_SystemMatrix.     Wrapper for Paso_FCTransportProblem.
41    
42     Description:     Description:
43     Wrapper for Paso_SystemMatrix.     Wrapper for Paso_FCTransportProblem.
44  */  */
45    
46   public:   public:
47    
48    /**    /**
49       /brief       /brief
50       Default Constructor for SystemMatrixAdapter.       Default Constructor for TransportProblemAdapter.
51       NB: Only throws an exception.       NB: Only throws an exception.
52    */    */
53    FINLEY_DLL_API    FINLEY_DLL_API
54    SystemMatrixAdapter();    TransportProblemAdapter();
55    
56    /**    /**
57       /brief       /brief
58       Constructor for SystemMatrixAdapter.       Constructor for TransportProblemAdapter.
59    */    */
60    FINLEY_DLL_API    FINLEY_DLL_API
61    SystemMatrixAdapter(Paso_SystemMatrix* system_matrix,    TransportProblemAdapter(Paso_FCTransportProblem* transport_problem,
62                        const int row_blocksize,                            const double theta,
63                        const escript::FunctionSpace& row_functionspace,                            const double dt_max,
64                        const int column_blocksize,                            const int block_size,
65                        const escript::FunctionSpace& colum_functionspace);                            const escript::FunctionSpace& functionspace);
   
66    
67    /**    /**
68       \brief       \brief
69       Destructor for SystemMatrixAdapter. As specified in the constructor       Destructor for TransportProblemAdapter. As specified in the constructor
70       this deallocates the pointer given to the constructor.       this deallocates the pointer given to the constructor.
71    */    */
72    FINLEY_DLL_API    FINLEY_DLL_API
73    ~SystemMatrixAdapter();    ~TransportProblemAdapter();
74    
75    /**    /**
76       \brief       \brief
77       Returns the pointer to the system matrix.       Returns the pointer to the transport problem.
78    */    */
79    FINLEY_DLL_API    FINLEY_DLL_API
80    Paso_SystemMatrix* getPaso_SystemMatrix() const;    Paso_FCTransportProblem* getPaso_FCTransportProblem() const;
81    
82    /**    /**
83       \brief       \brief
84       Returns the system matrix as a const AbstractSystemMatrix&.       Returns the transport problem as a const AbstractTransportProblem&.
85    */    */
86    inline const escript::AbstractSystemMatrix& asAbstractSystemMatrix() const    inline const escript::AbstractTransportProblem& asAbstractTransportProblem() const
87    {    {
88       return dynamic_cast<const escript::AbstractSystemMatrix&>(*this);       return dynamic_cast<const escript::AbstractTransportProblem&>(*this);
89    }    }
90    
91    /**    /**
92       \brief       \brief
93       Returns a system matrix as a const SystemMatrixAdapter&.       Returns a transport problem as a const TransportProblemAdapter&.
94    */    */
95    inline static const SystemMatrixAdapter& asSystemMatrixAdapter(const AbstractSystemMatrix& systemmatrix)    inline static const TransportProblemAdapter& asTransportProblemAdapter(const AbstractTransportProblem& transportproblem)
96    {    {
97       return dynamic_cast<const SystemMatrixAdapter&>(systemmatrix);       return dynamic_cast<const TransportProblemAdapter&>(transportproblem);
98    }    }
99    
100    /**    /**
101      \brief    *      \brief resets the transport operator typically as they have been updated.
102      nullifyRowsAndCols - calls Paso_SystemMatrix_nullifyRowsAndCols.    *        */
103    */    ESCRIPT_DLL_API
104    FINLEY_DLL_API    virtual void resetTransport() const;
   void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;  
   
   /**  
      \brief writes the matrix to a file using the Matrix Market file format  
   */  
   FINLEY_DLL_API  
   virtual void saveMM(const std::string& fileName) const;  
   
   /**  
      \brief writes the matrix to a file using the Harwell-Boeing file format  
   */  
   FINLEY_DLL_API  
   virtual void saveHB(const std::string& fileName) const;  
   
   /**  
      \brief sets the matrix entries to zero  
   */  
   FINLEY_DLL_API  
   virtual void resetValues() const;  
   
   /**  
      \brief maps escript options onto Paso options:  
   */  
   FINLEY_DLL_API  
   static int mapOptionToPaso(const int option);  
   
   /**  
      \brief prints information about a system matrix  
   */  
   FINLEY_DLL_API  
   void Print_Matrix_Info(const bool) const;  
105    
106   protected:   protected:
107    
108   private:   private:
109    
110        /**
111        *      \brief
112        *           sets solution out by time step dt.
113        *             */
114        ESCRIPT_DLL_API
115        virtual void setToSolution(escript::Data& out,escript::Data& source,const double dt, const boost::python::dict& options) const;
116      
117     /**     /**
118        \brief     *      \brief
119        solves the linear system this*out=in     *           copies the initial value into the problem
120     */     *             */
121     FINLEY_DLL_API      ESCRIPT_DLL_API
122     virtual void setToSolution(escript::Data& out, escript::Data& in, const boost::python::dict& options) const;      virtual void copyInitialValue(escript::Data& u) const;
   
    /**  
        \brief  
        performs y+=this*x  
    */  
    FINLEY_DLL_API  
    virtual void ypAx(escript::Data& y, escript::Data& x) const;  
123    
124     //     //
125     // pointer to the externally created finley mesh - system_matrix.     // pointer to the externally created finley mesh - transport_problem.
126     //     //
127     boost::shared_ptr<Paso_SystemMatrix> m_system_matrix;     boost::shared_ptr<Paso_FCTransportProblem> m_transport_problem;
128    
129  };  };
130    

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

  ViewVC Help
Powered by ViewVC 1.1.26