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: M.A. Fernandez & J.Foulon |
13 |
|
|
// |
14 |
|
|
|
15 |
|
|
/*! |
16 |
|
|
\file dof.hpp |
17 |
|
|
\authors M.A. Fernandez & J.Foulon |
18 |
|
|
\date 07/10/2010 |
19 |
|
|
\brief File where is define the class to manage degrees of freedom (dof) of the mathematical problem. |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
#ifndef DOF_HPP |
23 |
|
|
#define DOF_HPP |
24 |
|
|
|
25 |
|
|
// System includes |
26 |
|
|
#include <vector> |
27 |
|
|
|
28 |
|
|
// External includes |
29 |
|
|
#include <boost/numeric/ublas/matrix.hpp> |
30 |
|
|
|
31 |
|
|
// Project includes |
32 |
|
|
#include "Core/felisceParam.hpp" |
33 |
|
|
#include "DegreeOfFreedom/csrmatrixpattern.hpp" |
34 |
|
|
#include "DegreeOfFreedom/listUnknown.hpp" |
35 |
|
|
#include "DegreeOfFreedom/listVariable.hpp" |
36 |
|
|
#include "DegreeOfFreedom/supportDofMesh.hpp" |
37 |
|
|
#include "FiniteElement/currentFiniteElement.hpp" |
38 |
|
|
#include "Geometry/geometricMeshRegion.hpp" |
39 |
|
|
|
40 |
|
|
namespace felisce { |
41 |
|
|
/*! |
42 |
|
|
\class Dof |
43 |
|
|
\authors M.A. Fernandez & J.Foulon |
44 |
|
|
\date 07/10/2010 |
45 |
|
|
\brief Manage degrees of freedom of the finite element problem. |
46 |
|
|
*/ |
47 |
|
|
class Dof { |
48 |
|
|
public: |
49 |
|
|
// Constructor |
50 |
|
|
// ============ |
51 |
|
|
Dof(); |
52 |
|
|
void setDof(const ListUnknown& unknown, const ListVariable& variable, |
53 |
|
|
const std::vector<SupportDofMesh*>& pSupportDofUnknown); |
54 |
|
|
|
55 |
|
|
void loc2glob(felInt iEle, int iLocDof, int iVar, std::size_t iComp, felInt& numGlobalDof) const; |
56 |
|
|
|
57 |
|
|
void loc2glob(felInt iEle, int numLocDof, int iVar, std::size_t numComp, std::vector<felInt>& numGlobalDof) const; |
58 |
|
|
|
59 |
|
|
void loc2glob(felInt iEle, std::vector<int>& iLocDof, int iVar, std::vector<std::size_t>& iComp, std::vector<felInt>& numGlobalDof) const; |
60 |
|
|
|
61 |
|
|
void supportDofToDof(felInt idSupportDof, std::vector<felInt>& idDof) const; |
62 |
|
|
|
63 |
|
|
void identifyDofBySupport(int iVar, std::vector<felInt>& listSuppDof, |
64 |
|
|
std::vector<felInt>& listDofAssociated) const; |
65 |
|
|
|
66 |
|
|
int getNumGlobComp(std::size_t iUnknown, int iComp) const ; |
67 |
|
|
// void buildPattern(); |
68 |
|
|
void initializePattern(int sizeProc, int rankProc); |
69 |
|
|
void buildPattern(int rankProc,const felInt* dofRepartition); |
70 |
|
|
void print(int verbose = 0, std::ostream& outstr = std::cout) const; |
71 |
|
|
void mergeGlobalPattern(const std::vector<felInt>& iCSRc_new, const std::vector<felInt>& jCSRc_new); |
72 |
|
|
void mergeLocalCompPattern(MPI_Comm mpiComm, felInt numProc, felInt rankProc, const std::vector<felInt>& dofRepartition); |
73 |
|
|
|
74 |
|
|
// Access Function |
75 |
|
|
//================ |
76 |
|
|
|
77 |
|
11 |
inline void clearPattern() { |
78 |
|
11 |
m_pattern.clear(); |
79 |
|
11 |
} |
80 |
|
|
|
81 |
|
21 |
inline void clearPatternC() { |
82 |
|
21 |
m_patternC.clear(); |
83 |
|
21 |
m_patternIsChanged = false; |
84 |
|
21 |
} |
85 |
|
|
|
86 |
|
|
inline void resizePattern(std::size_t numRows,std::size_t numNonzeros) { |
87 |
|
|
m_pattern.resize(numRows,numNonzeros); |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
inline CSRMatrixPattern const & pattern() const { |
91 |
|
|
return m_pattern; |
92 |
|
|
} |
93 |
|
|
|
94 |
|
80248 |
inline CSRMatrixPattern & pattern() { |
95 |
|
80248 |
return m_pattern; |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
inline CSRMatrixPattern const & patternC() const { |
99 |
|
|
return m_patternC; |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
inline CSRMatrixPattern & patternC() { |
103 |
|
|
return m_patternC; |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
inline const ListUnknown & listUnknown() const { |
107 |
|
|
return m_unknown; |
108 |
|
|
} |
109 |
|
|
inline const ListVariable & listVariable() const { |
110 |
|
|
return m_variable; |
111 |
|
|
} |
112 |
|
|
|
113 |
|
|
// inline const std::vector<SupportDofMesh>& supportDofUnknown() const { |
114 |
|
|
// return m_supportDofUnknown; |
115 |
|
|
// } |
116 |
|
|
|
117 |
|
|
inline const felInt & numDof() const { |
118 |
|
|
return m_numDof; |
119 |
|
|
} |
120 |
|
7832908 |
inline felInt & numDof() { |
121 |
|
7832908 |
return m_numDof; |
122 |
|
|
} |
123 |
|
|
|
124 |
|
|
inline const std::vector<felInt> & numDofPerUnknown() const { |
125 |
|
|
return m_numDofPerUnknown; |
126 |
|
|
} |
127 |
|
845 |
inline std::vector<felInt> & numDofPerUnknown() { |
128 |
|
845 |
return m_numDofPerUnknown; |
129 |
|
|
} |
130 |
|
525 |
inline bool patternIsChanged() { |
131 |
|
525 |
return m_patternIsChanged; |
132 |
|
|
} |
133 |
|
|
void getNeighbourhood( felInt node, std::vector<felInt> & neighbourhood ) const; |
134 |
|
|
private: |
135 |
|
|
//! list of unknowns associated to the problem. |
136 |
|
|
ListUnknown m_unknown; |
137 |
|
|
//! list of variables associated to the problem. |
138 |
|
|
ListVariable m_variable; |
139 |
|
|
//! all support of dof object for every variable. |
140 |
|
|
std::vector<SupportDofMesh*> m_pSupportDofUnknown; |
141 |
|
|
|
142 |
|
|
// matrix pattern (CSR format) |
143 |
|
|
CSRMatrixPattern m_pattern; |
144 |
|
|
|
145 |
|
|
// matrix complementary pattern |
146 |
|
|
CSRMatrixPattern m_patternC; |
147 |
|
|
|
148 |
|
|
//! indicate the number of dof |
149 |
|
|
felInt m_numDof; |
150 |
|
|
//! indicate the number of dof by variable for the problem. |
151 |
|
|
std::vector<felInt> m_numDofPerUnknown; |
152 |
|
|
//! tells if pattern is changed due to merge operation |
153 |
|
|
bool m_patternIsChanged; |
154 |
|
|
}; |
155 |
|
|
} |
156 |
|
|
|
157 |
|
|
#endif |
158 |
|
|
|
159 |
|
|
|