/[escript]/trunk/escript/src/AbstractSystemMatrix.cpp
ViewVC logotype

Diff of /trunk/escript/src/AbstractSystemMatrix.cpp

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

trunk/esys2/escript/src/Data/AbstractSystemMatrix.cpp revision 100 by jgs, Wed Dec 15 03:48:48 2004 UTC trunk/escript/src/AbstractSystemMatrix.cpp revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
1  /*  
2   ******************************************************************************  /* $Id$ */
3   *                                                                            *  
4   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *  /*******************************************************
5   *                                                                            *   *
6   * This software is the property of ACcESS. No part of this code              *   *           Copyright 2003-2007 by ACceSS MNRF
7   * may be copied in any form or by any means without the expressed written    *   *       Copyright 2007 by University of Queensland
8   * consent of ACcESS.  Copying, use or modification of this software          *   *
9   * by any unauthorised person is illegal unless that person has a software    *   *                http://esscc.uq.edu.au
10   * license agreement with ACcESS.                                             *   *        Primary Business: Queensland, Australia
11   *                                                                            *   *  Licensed under the Open Software License version 3.0
12   ******************************************************************************   *     http://www.opensource.org/licenses/osl-3.0.php
13  */   *
14     *******************************************************/
15  #include "escript/Data/AbstractSystemMatrix.h"  
16  #include "escript/Data/FunctionSpace.h"  #include "AbstractSystemMatrix.h"
17  #include "escript/Data/DataException.h"  #include "DataException.h"
18  #include "escript/Data/DataArrayView.h"  #include "DataArrayView.h"
19    #include "Data.h"
20    
21  namespace escript {  namespace escript {
22    
# Line 48  int AbstractSystemMatrix::isEmpty() cons Line 49  int AbstractSystemMatrix::isEmpty() cons
49     return m_empty;     return m_empty;
50  }  }
51    
52  Data operator*(const AbstractSystemMatrix& left, const Data& right)  Data operator*(const AbstractSystemMatrix& left,const Data& right)
53  {  {
54        return left.vectorMultiply(right);        Data tmp=(Data) right;
55          return left.vectorMultiply(tmp);
56  }  }
57    
58  Data AbstractSystemMatrix::vectorMultiply(const Data& right) const  Data AbstractSystemMatrix::vectorMultiply(Data& right) const
59  {  {
60       if (isEmpty())       if (isEmpty())
61            throw SystemMatrixException("Error - Matrix is empty.");            throw SystemMatrixException("Error - Matrix is empty.");
      if (right.getFunctionSpace()!=getColumnFunctionSpace())  
           throw SystemMatrixException("Error - column function space and function space of input data do not match.");  
62       if (right.getDataPointSize()!=getColumnBlockSize())       if (right.getDataPointSize()!=getColumnBlockSize())
63            throw SystemMatrixException("Error - column block size and input data size do not match.");            throw SystemMatrixException("Error - column block size and input data size do not match.");
64       DataArrayView::ShapeType shape;       DataArrayView::ShapeType shape;
65       if (getRowBlockSize()>1) shape.push_back(getRowBlockSize());       if (getRowBlockSize()>1) shape.push_back(getRowBlockSize());
66    
67       Data out=Data(0.,shape,getRowFunctionSpace(),true);       Data out=Data(0.,shape,getRowFunctionSpace(),true);
68       ypAx(out,right);       Data in=Data(right,getColumnFunctionSpace());
69         ypAx(out,in);
70       return out;       return out;
71  }  }
72    
73  void AbstractSystemMatrix::ypAx(Data& y,const Data& x) const  void AbstractSystemMatrix::ypAx(Data& y,Data& x) const
74  {  {
75      throw SystemMatrixException("Error - ypAx not available");      throw SystemMatrixException("Error - ypAx not available");
76  }  }
77    
78  Data AbstractSystemMatrix::solve(const Data& in,const boost::python::dict& options) const  Data AbstractSystemMatrix::solve(Data& in,const boost::python::dict& options) const
79  {  {
80       if (isEmpty())       if (isEmpty())
81            throw SystemMatrixException("Error - Matrix is empty.");            throw SystemMatrixException("Error - Matrix is empty.");
# Line 88  Data AbstractSystemMatrix::solve(const D Line 89  Data AbstractSystemMatrix::solve(const D
89       setToSolution(out,in,options);       setToSolution(out,in,options);
90       return out;       return out;
91  }  }
92  void AbstractSystemMatrix::setToSolution(Data& out,const Data& in,const boost::python::dict& options) const  void AbstractSystemMatrix::setToSolution(Data& out,Data& in,const boost::python::dict& options) const
93  {  {
94      throw SystemMatrixException("Error - setToSolution not available");      throw SystemMatrixException("Error - setToSolution not available");
95  }  }
96    void AbstractSystemMatrix::saveMM(const std::string& fileName) const
97    {
98        throw SystemMatrixException("Error - Matrix Market interface not available.");
99    }
100    void AbstractSystemMatrix::saveHB(const std::string& fileName) const
101    {
102        throw SystemMatrixException("Error - Harwell-Boeing interface not available.");
103    }
104    void AbstractSystemMatrix::resetValues() const
105    {
106        throw SystemMatrixException("Error - setValue is not implemented.");
107    }
108    
109  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.100  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26