GCC Code Coverage Report


Directory: ./
File: PETScInterface/petscVector_friend.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 22 26 84.6%
Branches: 7 14 50.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 PETSCVECTOR_HPP
16 #error Include petscVector.hpp instead of petscVector_friend.hpp
17 #endif
18
19 // System includes
20
21 // External includes
22
23 // Project includes
24 #include "Core/felisce.hpp"
25
26 namespace felisce
27 {
28
29 195 inline PetscErrorCode waxpy(const PetscVector& w,PetscScalar const & alpha,const PetscVector& x,const PetscVector& y)
30 {
31 195 const PetscErrorCode code = VecWAXPY(w.m_self,alpha,x.m_self,y.m_self);
32
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 195 times.
195 CHKERRQ(code);
33 195 return code;
34 }
35
36 /***********************************************************************************/
37 /***********************************************************************************/
38
39 216 inline PetscErrorCode pointwiseMult(const PetscVector& w, const PetscVector& x,const PetscVector& y)
40 {
41 216 const PetscErrorCode code = VecPointwiseMult(w.m_self, x.m_self, y.m_self);
42
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 216 times.
216 CHKERRQ(code);
43 216 return code;
44 }
45
46 /***********************************************************************************/
47 /***********************************************************************************/
48
49 108 inline PetscErrorCode pointwiseDivide(const PetscVector& w, const PetscVector& x,const PetscVector& y)
50 {
51 108 const PetscErrorCode code = VecPointwiseDivide(w.m_self, x.m_self, y.m_self);
52
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 108 times.
108 CHKERRQ(code);
53 108 return code;
54 }
55
56 /***********************************************************************************/
57 /***********************************************************************************/
58
59 inline PetscErrorCode swap(const PetscVector& x,const PetscVector& y)
60 {
61 const PetscErrorCode code = VecSwap(x.m_self,y.m_self);
62 CHKERRQ(code);
63 return code;
64 }
65
66 /***********************************************************************************/
67 /***********************************************************************************/
68
69 191 inline PetscErrorCode dot(const PetscVector& x,const PetscVector& y,PetscScalar* val)
70 {
71 191 const PetscErrorCode code = VecDot(x.m_self,y.m_self,val);
72
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 191 times.
191 CHKERRQ(code);
73 191 return code;
74 }
75
76 /***********************************************************************************/
77 /***********************************************************************************/
78
79 inline PetscErrorCode maxPointwiseDivide(const PetscVector& x, const PetscVector& y, PetscScalar* max)
80 {
81 const PetscErrorCode code = VecMaxPointwiseDivide(x.m_self, y.m_self, max);
82 CHKERRQ(code);
83 return code;
84 }
85
86 /***********************************************************************************/
87 /***********************************************************************************/
88
89 97097 inline PetscErrorCode gatherVec(PetscVector& v, PetscVector& seqV)
90 {
91 PetscErrorCode code;
92
2/2
✓ Branch 1 taken 96972 times.
✓ Branch 2 taken 125 times.
97097 if(seqV.isNotNull())
93 96972 code= v.scatterToAllNotCreatingVector(seqV, INSERT_VALUES, SCATTER_FORWARD);
94 else
95 125 code = v.scatterToAll(seqV,INSERT_VALUES,SCATTER_FORWARD);
96
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 97097 times.
97097 CHKERRQ(code);
97 97097 return code;
98 }
99 }
100