GCC Code Coverage Report


Directory: ./
File: PETScInterface/AbstractPETScObjectInterface.cpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 31 39 79.5%
Branches: 19 32 59.4%

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: Vicente Mataix Ferrandiz
13 //
14
15 // System includes
16
17 // External includes
18
19 // Project includes
20 #include "Geometry/geometricMeshRegion.hpp"
21 #include "PETScInterface/AbstractPETScObjectInterface.hpp"
22
23 namespace felisce
24 {
25
26 namespace AOInterface
27 {
28
29 50262700 void RetrieveDofPositionInPetscOrdering(
30 int* pGlobalIndexes,
31 const CurBaseFiniteElement& rFE,
32 const felInt elementIndex,
33 const int idVariable,
34 const AO& rAO,
35 const Dof& rDof,
36 const int numComp
37 )
38 {
39 50262700 const int size = rFE.numDof()*numComp;
40 50262700 int cpt = 0;
41 felInt idDof;
42
2/2
✓ Branch 0 taken 138641701 times.
✓ Branch 1 taken 50262700 times.
188904401 for(int iComp = 0; iComp<numComp; iComp++) {
43
2/2
✓ Branch 1 taken 550218196 times.
✓ Branch 2 taken 138641701 times.
688859897 for(int iDof=0; iDof<rFE.numDof(); iDof++) {
44
1/2
✓ Branch 1 taken 550218196 times.
✗ Branch 2 not taken.
550218196 rDof.loc2glob(elementIndex,iDof,idVariable,iComp,idDof);
45 550218196 pGlobalIndexes[cpt] = idDof;
46 550218196 cpt++;
47 }
48 }
49
1/2
✓ Branch 1 taken 50262700 times.
✗ Branch 2 not taken.
50262700 AOApplicationToPetsc(rAO,size,pGlobalIndexes);
50 50262700 }
51
52 /***********************************************************************************/
53 /***********************************************************************************/
54
55 void RetrieveDofPositionInPetscOrderingSingleComponent(
56 int* pGlobalIndexes,
57 const CurBaseFiniteElement& rFE,
58 const felInt elementIndex,
59 const int idVariable,
60 const AO& rAO,
61 const Dof& rDof,
62 const int iComp
63 )
64 {
65 const int size = rFE.numDof();
66 int cpt = 0;
67 felInt idDof;
68 for(int iDof=0; iDof<rFE.numDof(); iDof++) {
69 rDof.loc2glob(elementIndex,iDof,idVariable,iComp,idDof);
70 pGlobalIndexes[cpt] = idDof;
71 cpt++;
72 }
73 AOApplicationToPetsc(rAO,size,pGlobalIndexes);
74 }
75
76 /***********************************************************************************/
77 /***********************************************************************************/
78
79 3060 int SearchGlobalIndexNode(
80 GeometricMeshRegion& rMesh,
81 const ListUnknown& rListUnknown,
82 const AO& rAO,
83 const Dof& rDof,
84 const PhysicalVariable& rPhysicalVariable,
85 const int iNode,
86 const int iComp,
87 const GeometricMeshRegion::ElementType& rEltType
88 )
89 {
90 3060 int iel = -1;
91 3060 int vertex_id = 0;
92
93 3060 const auto number_of_elements = rMesh.numElements(rEltType);
94
95 3060 const int number_nodes_elem = GeometricMeshRegion::m_numPointsPerElt[rEltType];
96
1/2
✓ Branch 2 taken 3060 times.
✗ Branch 3 not taken.
3060 std::vector<felInt> elem(number_nodes_elem, 0);
97
2/2
✓ Branch 0 taken 52263 times.
✓ Branch 1 taken 21 times.
52284 for (int i_elem = 0; i_elem < number_of_elements; ++i_elem) {
98
1/2
✓ Branch 1 taken 52263 times.
✗ Branch 2 not taken.
52263 rMesh.getOneElement(rEltType, i_elem, elem, false);
99
2/2
✓ Branch 0 taken 136506 times.
✓ Branch 1 taken 47791 times.
184297 for (vertex_id = 0; vertex_id < number_nodes_elem; vertex_id++) {
100
2/2
✓ Branch 1 taken 4472 times.
✓ Branch 2 taken 132034 times.
136506 if (elem[vertex_id] + 1 == iNode) {
101 4472 iel = i_elem;
102 4472 break;
103 }
104 }
105
2/2
✓ Branch 0 taken 3039 times.
✓ Branch 1 taken 49224 times.
52263 if (iel > 0) {
106 3039 break;
107 }
108 }
109
110
1/2
✓ Branch 1 taken 3060 times.
✗ Branch 2 not taken.
3060 const int i_unkown_disp = rListUnknown.getUnknownIdList(rPhysicalVariable);
111 3060 const int id_var_disp = rListUnknown.idVariable(i_unkown_disp);
112 3060 int index = 0;
113
1/2
✓ Branch 1 taken 3060 times.
✗ Branch 2 not taken.
3060 rDof.loc2glob(iel,vertex_id, id_var_disp, iComp, index);
114
1/2
✓ Branch 1 taken 3060 times.
✗ Branch 2 not taken.
3060 AOApplicationToPetsc(rAO,1,&index);
115
116 3060 return index;
117 3060 }
118
119 }
120
121 }
122