/[escript]/branches/diaplayground/ripley/src/RipleySystemMatrix.h
ViewVC logotype

Contents of /branches/diaplayground/ripley/src/RipleySystemMatrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4941 - (show annotations)
Thu May 15 01:49:48 2014 UTC (5 years, 1 month ago) by caltinay
File MIME type: text/plain
File size: 2004 byte(s)
first proof of concept - self-contained ripley system matrix with diagonal
storage, CG solver, no preconditioner, no MPI, no blocks, quite a few
quick'n'dirty hacks.
Solves poisson faster than paso :-)


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 #ifndef __RIPLEY_SYSTEMMATRIX_H__
18 #define __RIPLEY_SYSTEMMATRIX_H__
19
20 #include <escript/AbstractSystemMatrix.h>
21 #include <escript/FunctionSpace.h>
22
23 #include <ripley/Ripley.h>
24
25 namespace ripley {
26
27 class SystemMatrix : public escript::AbstractSystemMatrix
28 {
29 public:
30
31 SystemMatrix();
32
33 SystemMatrix(int row_blocksize, const escript::FunctionSpace& row_fs,
34 int col_blocksize, const escript::FunctionSpace& col_fs,
35 int nRows, const IndexVector& diagonalOffsets);
36
37 virtual ~SystemMatrix() {}
38
39 virtual void nullifyRowsAndCols(escript::Data& row_q,
40 escript::Data& col_q,
41 double mdv);
42
43 virtual void saveMM(const std::string& filename) const;
44
45 virtual void saveHB(const std::string& filename) const;
46
47 virtual void resetValues();
48
49 void add(const IndexVector& rowIndex, const std::vector<double>& array);
50
51 void matrixVector(const double* x, double beta, double* y) const;
52
53 private:
54 void cg(double* x, const double* b) const;
55
56 virtual void setToSolution(escript::Data& out, escript::Data& in,
57 boost::python::object& options) const;
58
59 virtual void ypAx(escript::Data& y, escript::Data& x) const;
60
61 int numRows;
62 std::vector<int> offsets;
63 std::vector<double> values;
64
65 };
66
67 } // namespace ripley
68
69 #endif // __RIPLEY_SYSTEMMATRIX_H__
70

  ViewVC Help
Powered by ViewVC 1.1.26