GCC Code Coverage Report


Directory: ./
File: Model/elasticStringModel.cpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 26 26 100.0%
Branches: 5 10 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:
13 //
14
15 // System includes
16
17 // External includes
18
19 // Project includes
20 #include "Model/elasticStringModel.hpp"
21
22 namespace felisce{
23
2/4
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
8 ElasticStringModel::ElasticStringModel():Model() {
24
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 m_name = "Elastic String Model";
25 8 }
26
27
28 16 ElasticStringModel::~ElasticStringModel() = default;
29
30
31 8 void ElasticStringModel::initializeDerivedModel() {
32 // Here, std::set the initial condition for example
33 8 }
34
35
36 240 void ElasticStringModel::forward() {
37 // Write solution for postprocessing (if required)
38 240 writeSolution();
39
40 // Advance time step.
41 240 updateTime();
42
43 // Print time information
44 240 printNewTimeIterationBanner();
45
46 // rhs for the first iteration
47 // if (m_fstransient->iteration == 1)
48 // m_linearProblem[0]->vector().set(-10.);
49
50 // Assembly loop on elements.
51 240 m_linearProblem[0]->assembleMatrixRHSBD(MpiInfo::rankProc());
52
53 // Apply boundary conditions.
54 240 m_linearProblem[0]->finalizeEssBCTransient();
55 240 m_linearProblem[0]->applyBC(FelisceParam::instance().essentialBoundaryConditionsMethod, MpiInfo::rankProc());
56
57 // Set the displacement velocity to d^{n-1}
58 240 m_dispTimeRHS.copyFrom(m_linearProblem[0]->solution());
59
60
61 // Solve the linear system
62 240 m_linearProblem[0]->solve(MpiInfo::rankProc(), MpiInfo::numProc());
63
64 // Compute the displacement time rhs -> (2 * d^n - d^{n-1})
65 240 m_dispTimeRHS.axpby(2., -1, m_linearProblem[0]->solution());
66
67 // Gather the solutions
68 240 m_linearProblem[0]->gatherSolution();
69 240 m_linearProblem[0]->gatherVector(m_dispTimeRHS, m_seqDispTimeRHS);
70 240 }
71
72
73 8 void ElasticStringModel::setExternalVec() {
74 // allocate the parallel displacement velocity
75 8 m_dispTimeRHS.duplicateFrom(m_linearProblem[0]->solution());
76
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 m_dispTimeRHS.set(0.);
77
78 // allocate the serial displacement velocity
79 8 m_seqDispTimeRHS.duplicateFrom(m_linearProblem[0]->sequentialSolution());
80
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 m_seqDispTimeRHS.set(0.);
81
82 // communicate the serial displacement velocity to the linear problem
83 8 m_linearProblem[0]->pushBackExternalVec(m_seqDispTimeRHS);
84 8 }
85 }
86