GCC Code Coverage Report


Directory: ./
File: Solver/RISModel.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 0 6 0.0%
Branches: 0 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.Smaldone
13 //
14
15 #ifndef _RISModel_HPP
16 #define _RISModel_HPP
17
18 // System includes
19
20 // External includes
21 #include "Core/NoThirdPartyWarning/Petsc/vec.hpp"
22
23 // Project includes
24 #include "Core/felisceParam.hpp"
25 #include "Core/felisceTransient.hpp"
26 #include "Solver/linearProblem.hpp"
27
28 namespace felisce {
29 class RISModel {
30
31 public:
32 RISModel(FelisceTransient::Pointer fstransient , std::vector<LinearProblem*> linearProblem); // constructor
33 ~RISModel() = default; // destructor
34
35 // two main methods called with Navier-Stokes in this order: UpdateResistances, forward and CheckValveStatus. If admissibility of the model is 0, Navier-Stokes is computed again
36 void UpdateResistances(); // updates resistances of closed and open surfaces and print them
37 void CheckValveStatus(); // check the admissibility status of each valve depending on their current configuration and update the admissibility status of the whole model
38
39 // getters
40 inline felInt admissibleStatus() {
41 return m_ModelAdmissibleStatus;
42 }
43 inline const double & resistance(felInt label) const {
44 return m_resistances[label];
45 }
46 inline double & resistance(felInt label) {
47 return m_resistances[label];
48 }
49 inline int valve_is_closed() {
50 return m_valveClosedFlag[0]; // used in CardiacCycle class and applied to 1 valve case. Returns 1 is the first RIS couple is in closed configuration, 0 if not
51 }
52
53 int areAllValvesClosed() const; // return 1 if all valves are closed, 0 if not
54 void write(std::string) const; // write resistance values of closed and open surfaces in a file whose name is std::string
55
56 //TODO : fuse those two ?
57 std::vector<felInt> mitralRegurgitationElements;
58 std::map<felInt, double*> mitralRegMap;
59
60 private:
61 // methods
62 void variables_initialization(); // initialisation of attributes for the general RIS model
63 void RIS_models_initialization(int rs); // initialisation of the resistance values of all open, closed and fake surfaces
64
65 void check_opening_condition(int rs, std::vector<double> pressure_surf); // resistances of closed valves std::set to R_inactive if opening conditions are satisfied + save opening_time
66 void check_closing_condition(int rs, std::vector<double> flux_surf); // resistances of closed valves std::set to R_active if closing conditions are satisfied + save closing_time
67 bool preventValvesFromOpeningTooFast(int rs); // return true if a valve has recently closed whereas another valve would meet the conditions to open
68
69 void two_valve_case(int rs);
70
71 void update_open_surf(int rs); // std::set resistance of open surfaces to R_active if valve is open, to R_inactive if valve is closed
72 void update_closed_surf(int rs); // std::set resistance of closed valve to R_inactive if valve is open, to R_active if valve is closed
73
74 void check_closed_status(int rs); // check if the closed surfaces are in adequation with the fluid and open them if not
75 void check_open_status(int rs); // check if the open surfaces are in adequation with the fluid and close them if not
76
77 void print() const; // print status and resistance values of each closed and open surfaces
78
79 // attributes
80 FelisceTransient::Pointer m_fstransient; // FelisceTransient
81 std::vector<LinearProblem*> m_linearProblem; // linearProblem
82
83 felInt m_ModelAdmissibleStatus; // admissibility of the model = product of valve admissible status (0 if not correct, 1 if correct)
84 std::vector<felInt> m_ValveAdmissibleStatus; // admissibility values of the valve (0 if not correct, 1 if correct)
85 std::vector<double> m_resistances; // resistance values of all the surfaces (closed + fake + open)
86 std::vector<felInt> m_closedLabels; // labels of the current considered couple of closed labels
87 std::vector<int> m_closed_surf; // labels of the closed surfaces
88 std::vector<int> m_open_surf; // labels of the open surfaces
89 std::vector<int> m_fake_surf; // labels of the fake surfaces
90 std::vector<double> m_flow_ref; // size = m_RISModelNum. If size == 1 -> 1e-2. If size == 2 -> -2 and 0
91 felInt m_RISModelNum; // number of couple of closed surfaces
92 felInt m_cycl_RIS; // number of RIS cycles
93 felInt m_verboseRIS; // verbose for the RIS model
94
95 std::vector<int> m_valveClosedFlag; // status of the valve. If 0: open, if 1: closed
96 std::vector<double> m_closingTime; // time of closing of each RISModel
97 std::vector<double> m_openingTime; // time of opening of each RISModel
98
99 felInt m_num_closed_surfs; // number of closed surfaces
100 felInt m_num_open_surfs; // number of open surfaces
101 felInt m_num_fake_surfs; // number of fake surfaces
102
103 double m_R_active_surf; // resistance of closed valve
104 double m_R_inactive_surf; // resistance of open valve
105 double m_R_activeClosed_TwoValves_Intermediate; // resistance of closed valve just after the closing - only used for two valves
106 double m_R_activeClosed_TwoValves_Final; // final resistance of closed valve after several iterations after the closing - only used for two valves
107 double m_R_FirstValve_ClosingSpeed; // rate of speed for the evolution of the resistance of the closed surface of the first valve from R_Intermediate to R_Final - only used for two valves
108 double m_R_SecondValve_ClosingSpeed; // rate of speed for the evolution of the resistance of the closed surface of the second valve from R_Intermediate to R_Final - only used for two valves
109 double m_tps; // current time
110 int m_nbTimeSteps_refractory_time; // number of time steps used for defining the refractory time
111 double m_refractory_time; // refractory time: time lap during the valve can not change its configuration
112 double m_rate_linear_transition; // rate of linear evolution
113 double m_rate_linear_transition_firstValve; // rate of linear evolution first valve
114 double m_rate_linear_transition_secondValve; // rate of linear evolution second valve
115 bool m_linear_evolution_valves; // linear evolution in the value of the resistances of the valves
116
117 };
118 }
119
120 #endif
121