GlobalMatrix.cpp 1.09 KB
Newer Older
1
2
3
4
5
6
7
8
//
//  GlobalMatrix.cpp
//  HappyHeart
//
//  Created by Sebastien Gilles on 27/04/15.
//  Copyright (c) 2015 Inria. All rights reserved.
//

9

10
#include "Core/LinearAlgebra/GlobalMatrix.hpp"
11
#include "Core/NumberingSubset.hpp"
12
13
14
15
16
17


namespace HappyHeart
{
    
    
18
19
    GlobalMatrix::GlobalMatrix(const NumberingSubset& row_numbering_subset,
                               const NumberingSubset& col_numbering_subset)
20
    : Crtp::NumberingSubsetForMatrix<GlobalMatrix>(row_numbering_subset, col_numbering_subset)
21
22
23
    { }
    
    
24
    GlobalMatrix::GlobalMatrix(const GlobalMatrix& rhs)
25
26
    : Petscparent(rhs),
    NumberingSubsetparent(rhs)
27
28
29
30
31
32
    { }
    
    
    
    void Swap(GlobalMatrix& A, GlobalMatrix& B)
    {
33
        // We swap the content of two matrices that share the same numbering subsets.
34
35
        assert(A.GetColNumberingSubset() == B.GetColNumberingSubset());
        assert(A.GetRowNumberingSubset() == B.GetRowNumberingSubset());
36
        
37
        using parent = GlobalMatrix::Petscparent;
38
        
39
        Swap(static_cast<parent&>(A), static_cast<parent&>(B));
40
    }
41
42
    
    
43
44

} // namespace HappyHeart