GCC Code Coverage Report


Directory: ./
File: Model/hyperElasticityModel.cpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 27 27 100.0%
Branches: 14 28 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: S. Gilles
13 //
14
15 // System includes
16
17 // External includes
18 #include "petscmat.h"
19 #include "petscsnes.h"
20
21 // Project includes
22 #include "Core/felisceTools.hpp"
23 #include "Model/hyperElasticityModel.hpp"
24 #include "Solver/linearProblemHyperElasticity.hpp"
25 #include "Core/felisce_error.hpp"
26
27 namespace felisce {
28
29 24 HyperElasticityModel::HyperElasticityModel()
30 24 : Model()
31 {
32
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 m_name = "HyperElasticity";
33
34
6/14
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
✓ Branch 10 taken 24 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 24 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
24 FEL_ASSERT(!(FelisceParam::instance().hyperElasticLaw.timeSchemeHyperelasticity != HyperelasticityNS::none && FelisceParam::instance().hyperElasticLaw.pressureData->IsCompressible()));
35 24 }
36
37 /***********************************************************************************/
38 /***********************************************************************************/
39
40 48 HyperElasticityModel::~HyperElasticityModel()
41 = default;
42
43 /***********************************************************************************/
44 /***********************************************************************************/
45
46 320 void HyperElasticityModel::forward()
47 {
48 // Write solution for postprocessing (if required)
49 320 writeSolution();
50
51 // Advance time step.
52 320 updateTime();
53
54 // Print time information
55 320 printNewTimeIterationBanner();
56
57 // Assemble the new stiffness matrix.
58
1/2
✓ Branch 1 taken 320 times.
✗ Branch 2 not taken.
320 HyperelasticLinearProblem* linear_problem_ptr = dynamic_cast<HyperelasticLinearProblem*>(m_linearProblem[0]);
59
60
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 320 times.
320 FEL_ASSERT(linear_problem_ptr);
61 320 HyperelasticLinearProblem& linear_problem = *linear_problem_ptr;
62
63 // Solve linear system.
64 320 linear_problem.iterativeSolve(MpiInfo::rankProc(), MpiInfo::numProc(), ApplyNaturalBoundaryConditions::no, FlagMatrixRHS::matrix_and_rhs);
65
66 // Update
67 320 linear_problem.endIteration();
68 320 }
69
70 /***********************************************************************************/
71 /***********************************************************************************/
72
73 16 void HyperElasticityModel::SolveDynamicProblem()
74 {
75
76
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
16 FEL_ASSERT(FelisceParam::instance().hyperElasticLaw.timeSchemeHyperelasticity != HyperelasticityNS::none);
77
78 16 SolveStaticProblem();
79
80
1/2
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
16 HyperelasticLinearProblem* linear_problem_ptr = dynamic_cast<HyperelasticLinearProblem*>(m_linearProblem[0]);
81
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 FEL_ASSERT(linear_problem_ptr);
82 16 HyperelasticLinearProblem& linear_problem = *linear_problem_ptr;
83
84 16 linear_problem.GoToDynamic(); // Make sure to call it BEFORE clearing Matrix RHS!!!
85 16 linear_problem.clearMatrixRHS();
86
87
2/2
✓ Branch 1 taken 320 times.
✓ Branch 2 taken 16 times.
336 while (!hasFinished())
88 320 forward();
89 16 }
90
91 } // namespace Elasticity
92