~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to dolfin/la/Matrix.h

  • Committer: Kent-Andre Mardal
  • Date: 2008-05-19 14:21:52 UTC
  • mfrom: (2668.5.1 trunk)
  • mto: (2668.1.16 trunk)
  • mto: This revision was merged to the branch mainline in revision 2670.
  • Revision ID: kent-and@simula.no-20080519142152-7zb7r4htl7111izh
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
// Modified by Martin Sandve Alnes, 2008.
7
7
//
8
8
// First added:  2006-05-15
9
 
// Last changed: 2008-05-15
 
9
// Last changed: 2008-05-17
10
10
 
11
11
#ifndef __MATRIX_H
12
12
#define __MATRIX_H
13
13
 
14
 
#include "default_la_types.h"
 
14
#include <dolfin/common/Variable.h>
 
15
#include "DefaultFactory.h"
15
16
#include "GenericMatrix.h"
16
17
 
17
18
namespace dolfin
25
26
  public:
26
27
 
27
28
    /// Create empty matrix
28
 
    Matrix() : Variable("A", "DOLFIN matrix"),
29
 
               matrix(new DefaultMatrix())
30
 
    {}
 
29
    Matrix() : Variable("A", "DOLFIN matrix"), matrix(0)
 
30
    { DefaultFactory factory; matrix = factory.createMatrix(); }
31
31
 
32
32
    /// Create M x N matrix
33
 
    Matrix(uint M, uint N) : Variable("A", "DOLFIN matrix"),
34
 
                             matrix(new DefaultMatrix(M, N))
35
 
    {}
 
33
    Matrix(uint M, uint N) : Variable("A", "DOLFIN matrix"), matrix(0)
 
34
    { DefaultFactory factory; matrix = factory.createMatrix(); matrix->init(M, N); }
36
35
 
37
36
    /// Copy constructor
38
37
    explicit Matrix(const Matrix& A) : Variable("A", "DOLFIN matrix"),
39
 
                                       matrix(new DefaultMatrix((*A.matrix).down_cast<DefaultMatrix>()))
 
38
                                       matrix(A.matrix->copy())
40
39
    {}
41
40
 
42
41
    /// Destructor