GCC Code Coverage Report


Directory: ./
File: PETScInterface/petscMatrix_friend.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 8 20 40.0%
Branches: 2 10 20.0%

Line Branch Exec Source
1 // ______ ______ _ _ _____ ______
2 // | ____| ____| | (_)/ ____| | ____|
3 // | |__ | |__ | | _| (___ ___| |__
4 // | __| | __| | | | |\___ \ / __| __|
5 // | | | |____| |____| |____) | (__| |____
6 // |_| |______|______|_|_____/ \___|______|
7 // Finite Elements for Life Sciences and Engineering
8 //
9 // License: LGL2.1 License
10 // FELiScE default license: LICENSE in root folder
11 //
12 // Main authors: Julien Castelneau, Dominique Chapelle, Miguel Fernandez
13 //
14
15 #ifndef PETSCMATRIX_HPP
16 #error Include petscMatrix.hpp instead of petscMatrix_friend.hpp
17 #endif
18
19 // System includes
20
21 // External includes
22
23 // Project includes
24 #include "Core/felisce.hpp"
25 #include "PETScInterface/petscVector.hpp"
26
27 namespace felisce
28 {
29
30 17604 inline PetscErrorCode multAdd(const PetscMatrix& mat,const PetscVector& v1,const PetscVector& v2,PetscVector& v3)
31 {
32 17604 const PetscErrorCode code = MatMultAdd(mat.m_self,v1.m_self,v2.m_self,v3.m_self);
33
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17604 times.
17604 CHKERRQ(code);
34 17604 return code;
35 }
36
37 /***********************************************************************************/
38 /***********************************************************************************/
39
40 11007 inline PetscErrorCode mult(const PetscMatrix& mat,const PetscVector& x,PetscVector& y)
41 {
42 // y = mat * x
43 11007 const PetscErrorCode code = MatMult(mat.m_self,x.m_self,y.m_self);
44
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11007 times.
11007 CHKERRQ(code);
45 11007 return code;
46 }
47
48 /***********************************************************************************/
49 /***********************************************************************************/
50
51 inline PetscErrorCode matMult(const PetscMatrix& A,const PetscMatrix& B,MatReuse scall,PetscReal fill,PetscMatrix& C)
52 {
53 const PetscErrorCode code = MatMatMult(A.m_self,B.m_self,scall,fill,&C.m_self);
54 CHKERRQ(code);
55 return code;
56 }
57
58 /***********************************************************************************/
59 /***********************************************************************************/
60
61 inline PetscErrorCode multTranspose(const PetscMatrix& mat,const PetscVector& x,PetscVector& y)
62 {
63 const PetscErrorCode code = MatMultTranspose(mat.m_self,x.m_self,y.m_self);
64 CHKERRQ(code);
65 return code;
66 }
67
68 /***********************************************************************************/
69 /***********************************************************************************/
70
71 inline PetscErrorCode transposeMatMult(const PetscMatrix& A,const PetscMatrix& B,MatReuse scall,PetscReal fill,PetscMatrix& C)
72 {
73 const PetscErrorCode code = MatTransposeMatMult(A.m_self,B.m_self,scall,fill,&C.m_self);
74 CHKERRQ(code);
75 return code;
76 }
77
78
79 }
80