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: E. Schenone |
13 |
|
|
// |
14 |
|
|
|
15 |
|
|
#ifndef _LinearProblemBidomainThorax_HPP |
16 |
|
|
#define _LinearProblemBidomainThorax_HPP |
17 |
|
|
|
18 |
|
|
// System includes |
19 |
|
|
#include <vector> |
20 |
|
|
|
21 |
|
|
// External includes |
22 |
|
|
|
23 |
|
|
// Project includes |
24 |
|
|
#include "Solver/linearProblem.hpp" |
25 |
|
|
#include "Solver/cardiacFunction.hpp" |
26 |
|
|
#include "Core/felisceParam.hpp" |
27 |
|
|
#include "DegreeOfFreedom/boundaryCondition.hpp" |
28 |
|
|
#include "FiniteElement/elementMatrix.hpp" |
29 |
|
|
#ifdef FELISCE_WITH_CVGRAPH |
30 |
|
|
#include "Model/cvgMainSlave.hpp" |
31 |
|
|
#endif |
32 |
|
|
|
33 |
|
|
namespace felisce { |
34 |
|
|
/*! |
35 |
|
|
\class LinearProblemBidomainThorax |
36 |
|
|
\authors E. Schenone |
37 |
|
|
\date 05/03/2012 |
38 |
|
|
\brief Manage the diffusion probleme in the thorax : useful to calculate the heart-torso (transpose) transfer matrix |
39 |
|
|
*/ |
40 |
|
|
class LinearProblemBidomainThorax: |
41 |
|
|
public LinearProblem { |
42 |
|
|
public: |
43 |
|
|
LinearProblemBidomainThorax(); |
44 |
|
|
~LinearProblemBidomainThorax() override; |
45 |
|
|
void initialize(std::vector<GeometricMeshRegion::Pointer>& mesh, FelisceTransient::Pointer fstransient, MPI_Comm& comm, bool doUseSNES) override; |
46 |
|
|
void initPerElementType(ElementType eltType, FlagMatrixRHS flagMatrixRHS = FlagMatrixRHS::matrix_and_rhs) override; |
47 |
|
✗ |
void initPerDomain(int label, FlagMatrixRHS flagMatrixRHS = FlagMatrixRHS::matrix_and_rhs) override { |
48 |
|
✗ |
m_currentLabel=label; |
49 |
|
|
IGNORE_UNUSED_FLAG_MATRIX_RHS; |
50 |
|
|
} |
51 |
|
|
void computeElementArray(const std::vector<Point*>& elemPoint, const std::vector<felInt>& elemIdPoint, felInt& iel, FlagMatrixRHS flagMatrixRHS = FlagMatrixRHS::matrix_and_rhs) override; |
52 |
|
|
|
53 |
|
|
void readData(IO& io) override; |
54 |
|
|
void writeSolution(int rank, std::vector<IO::Pointer>& io, double& time, int iteration) override; |
55 |
|
|
|
56 |
|
|
void finalizeEssBCTransientDerivedProblem() override; |
57 |
|
|
void allocateVectorBoundaryConditionDerivedLinPb() override; |
58 |
|
|
void userElementComputeNaturalBoundaryCondition(const std::vector<Point*>& elemPoint, const std::vector<felInt>& elemIdPoint,felInt& iel, int label) override; |
59 |
|
|
void readElectrodesNode(bool flagTranspos=true); |
60 |
|
|
void calculateRHS(); |
61 |
|
|
felInt readMatch(std::vector<felInt>& matchNode, std::string matchFileName); |
62 |
|
|
void readHeartValue(std::vector<double>& scalarValue); |
63 |
|
|
|
64 |
|
|
virtual void calculateRes(); |
65 |
|
|
inline const PetscVector& residual() const { |
66 |
|
|
return m_thoraxRes; |
67 |
|
|
} |
68 |
|
|
inline PetscVector& residual() { |
69 |
|
|
return m_thoraxRes; |
70 |
|
|
} |
71 |
|
|
inline const PetscVector& robinVec() const { |
72 |
|
|
return m_robinVec; |
73 |
|
|
} |
74 |
|
|
inline PetscVector& robinVec() { |
75 |
|
|
return m_robinVec; |
76 |
|
|
} |
77 |
|
|
void computeElementArrayBoundaryCondition(const std::vector<Point*>& elemPoint, const std::vector<felInt>& /*elemIdPoint*/, felInt& iel, FlagMatrixRHS /*flagMatrixRHS*/) override; |
78 |
|
|
#ifdef FELISCE_WITH_CVGRAPH |
79 |
|
|
void initMassBoundaryForCVG(); |
80 |
|
|
void massMatrixComputer(felInt ielSupportDof); |
81 |
|
|
void initPerETMass(); |
82 |
|
|
void updateFE(const std::vector<Point*>& elemPoint, const std::vector<int>&); |
83 |
|
|
#endif |
84 |
|
|
public: |
85 |
|
|
#ifdef FELISCE_WITH_CVGRAPH |
86 |
|
|
void readData() override; |
87 |
|
|
void sendData(); |
88 |
|
|
void initMatrix(); |
89 |
|
|
void addCurrentToRHS(); |
90 |
|
|
virtual void cvgAddRobinToRHS(); |
91 |
|
|
#endif |
92 |
|
|
|
93 |
|
|
|
94 |
|
|
template <class Templ_functor> void evalFunctionOnElem(const Templ_functor& func, double& value, int& label); |
95 |
|
|
private: |
96 |
|
|
CurrentFiniteElement* m_fePotThorax; |
97 |
|
|
felInt m_ipotThorax; |
98 |
|
|
// PetscMatrix _RomBasisMatrix; |
99 |
|
|
protected: |
100 |
|
|
double* m_potThoraxRes; |
101 |
|
|
int m_numBcNodeThorax; |
102 |
|
|
felInt* _ECGnode; |
103 |
|
|
felInt m_numSourceNode; |
104 |
|
|
std::vector<felInt> m_thoraxMatchNode; |
105 |
|
|
std::vector<felInt> m_heartMatchNode; |
106 |
|
|
PetscVector m_thoraxRes; |
107 |
|
|
PetscVector m_robinVec; |
108 |
|
|
CurvilinearFiniteElement* m_curvFe; |
109 |
|
|
}; |
110 |
|
|
|
111 |
|
✗ |
template <class Templ_functor> void LinearProblemBidomainThorax::evalFunctionOnElem(const Templ_functor& func, double& value, int& label) { |
112 |
|
✗ |
value = func(label); |
113 |
|
|
} |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
#endif |
117 |
|
|
|