GCC Code Coverage Report


Directory: ./
File: Solver/reducedSteklov.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 0 3 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:
13 //
14
15 #ifndef _REDUCEDSTEKLOV_HPP_
16 #define _REDUCEDSTEKLOV_HPP_
17
18 // System includes
19 #include <vector>
20
21 // External includes
22
23 // Project includes
24 #include "InputOutput/io.hpp"
25 #include "Core/chrono.hpp"
26
27 namespace felisce {
28
29 // Forward declaration
30 template< class volumeProblem >
31 class LinearProblemReducedSteklov;
32
33 template< class volumeProblem >
34 class ReducedSteklov {
35
36 typename LinearProblemReducedSteklov<volumeProblem>::imgType m_imgType;
37 /// (0) Phase zero: initialization
38 public:
39 /// The constructor
40 ReducedSteklov(PetscMatrix& mass, PetscMatrix& laplacian, MPI_Comm comm, LinearProblemReducedSteklov<volumeProblem>* pb, typename LinearProblemReducedSteklov<volumeProblem>::imgType imType,ChronoInstance::Pointer);
41 private:
42 /// The communicator
43 MPI_Comm m_comm;
44 /// The mass matrix
45 PetscMatrix m_mass;
46 /// The matrix of the laplacian operator
47 PetscMatrix m_laplacian;
48 /// The linearProblem;
49 LinearProblemReducedSteklov<volumeProblem>* m_lpb;
50
51 /// (1) Phase one: the solution of the laplacian eigenProblem
52 public:
53 void solveLaplacianEP();
54 private:
55 std::vector<PetscVector> m_laplacianEVec;
56 std::vector<PetscVector> m_imgLaplacianEVec;
57 /// (2) Phase two: steklov eigenPairs
58 public:
59 void steklovEVecEstimate();
60 void applySteklovOperatorOnLEV(felInt imesh);
61 void approximateSteklovEigenVec(std::vector<PetscVector> &coefficients);
62 void assembleReducedMatrix( PetscMatrix& ReducedMatrix );
63 /// The approximated Steklov eigen-values
64 std::vector<double> m_eValues;
65 std::vector<PetscVector> m_eVecW;
66 /// (3) Phase three: online phase
67 void applyLowRankSteklov(PetscVector& in, PetscVector& out);
68 std::vector<PetscVector> m_onlineInputs;
69 std::vector<PetscVector> m_onlineOutputs;
70 /// Usefull parameters:
71 std::size_t m_offLineBasisDim;
72 std::size_t m_onLineBasisDim;
73 std::size_t m_currentBasisDim;
74 /// PostProcess
75 void exportAllEig(felInt imesh);
76 /// (4) loading/saving off-line basis
77 private:
78 bool m_loaded;
79 bool loadFromFile(std::string folder);
80 std::vector<PetscVector> m_constantResponse;
81 public:
82 inline bool loadedFromFile() { return m_loaded; }
83 void addConstantResponse(const PetscVector& cR) {
84 m_constantResponse.push_back(cR);
85 }
86 ChronoInstance:: Pointer m_chronoRS;
87 };
88 }
89 // The implementation
90 #include "Solver/reducedSteklov.hxx"
91 #endif
92