main_test.cpp 1.41 KB
Newer Older
1
2
3
4
5
6
7
8
//
//  main_test_model.cpp
//  HappyHeart
//
//  Created by Sebastien Gilles on 1/23/13.
//
//

9
#include <cstdlib>
10
11
#include <iostream>

12
13
14

#include "ThirdParty/Wrappers/Petsc/Petsc.hpp"

15
#include "ModelInstances/UnderDevelopment/Poromechanics/Crtp/FluidmassData.hpp"
16

17

18
19
using namespace HappyHeart;

20

21
22


23
24
int main(int argc, char ** argv)
{
25
26
27
28
29
30
31
32
33
34
    Wrappers::Mpi::InitEnvironment(argc, argv);
    
    Wrappers::Mpi mpi(0, Wrappers::MpiNS::Comm::World);
    Wrappers::Petsc::Petsc petsc(__FILE__, __LINE__);
    
    std::vector<std::vector<PetscInt>> nnz
    {
        { 0 },
        { 1, 2 },
        { 3 },
35
        { 2 }
36
37
38
39
40
41
    };
    
    
    Wrappers::Petsc::MatrixPattern pattern(nnz);
    
    Wrappers::Petsc::Matrix matrix;
42
    
43
44
45
46
    matrix.InitSequentialMatrix(4, 4,
                                pattern,
                                mpi,
                                __FILE__, __LINE__);
47
    
48
49
50
51
52
    matrix.View(mpi, __FILE__, __LINE__);
    
    std::vector<PetscInt> row { 1, 3 };
    std::vector<PetscInt> col { 1, 2 };
    
53
    std::vector<PetscScalar> val { 1., 1., 0., 1. };
54
55
56
57
58
    
    matrix.SetValues(row,
                     col,
                     val.data(),
                     INSERT_VALUES,
59
60
                     __FILE__, __LINE__,
                     Wrappers::Petsc::ignore_zero_entries::yes);
61
62
63
64
65
    
    matrix.Assembly(__FILE__, __LINE__);
    
    matrix.View(mpi, __FILE__, __LINE__);

66
    
67
    return EXIT_SUCCESS;
68
}
69
70
71
72
73
74