11 #include <eigen3/Eigen/Dense>
20 template <
int DIM_PROBLEM>
26 const std::vector<Tetra::prm> & _pTetra ,
28 const std::vector<Triangle::prm> & _pTri ,
30 const std::string& name ,
45 static const int DIM_PB = DIM_PROBLEM;
79 auto add_block = [
this, &shape](
const int i,
const int j)
81 for (
int k = 0; k < DIM_PROBLEM; ++k)
83 for (
int l = 0; l < DIM_PROBLEM; ++l)
84 { shape[DIM_PROBLEM*i+k].insert(DIM_PROBLEM*j+l); }
89 for (
int i = 0; i <
NOD; ++i)
95 if (edge_filter(edge))
97 add_block(edge.first, edge.second);
98 add_block(edge.second, edge.first);
109 void buildMat(std::array<int,N> &ind, Eigen::Matrix<double,DIM_PROBLEM*N,DIM_PROBLEM*N> &Ke)
111 for (
int ie=0; ie<
N; ie++)
114 for (
int je=0; je<
N; je++)
117 for (
int di=0; di<DIM_PROBLEM; di++)
118 for (
int dj=0; dj<DIM_PROBLEM; dj++)
119 K.
add(DIM_PROBLEM*i_ + di, DIM_PROBLEM*j_ + dj, Ke(di*
N+ie,dj*
N+je));
128 void buildVect(std::array<int,N> &ind, std::vector<double> &Le)
130 for (
int ie=0; ie<
N; ie++)
133 for (
int di=0; di<DIM_PROBLEM; di++)
134 {
L_rhs[DIM_PROBLEM*i_ + di] += Le[di*
N+ie]; }
set of class to handle sparse matrix operations for gradient conjugate algorithms a sparse vector cla...
std::vector< Edge > edges
Definition: mesh.h:350
int getNbNodes(void) const
Definition: mesh.h:144
Square sparse matrix.
Definition: sparseMat.h:46
void add(const int i, const int j, const double val)
Definition: sparseMat.h:114
template class for the different solvers template parameter DIM_PROBLEM: dimensionnality of the probl...
Definition: solver.h:22
Mesh::mesh * msh
Definition: solver.h:48
virtual void checkBoundaryConditions(void) const =0
void buildMat(std::array< int, N > &ind, Eigen::Matrix< double, DIM_PROBLEM *N, DIM_PROBLEM *N > &Ke)
Definition: solver.h:109
algebra::SparseMatrix K
Definition: solver.h:68
void buildVect(std::array< int, N > &ind, std::vector< double > &Le)
Definition: solver.h:128
const int NOD
Definition: solver.h:51
const bool verbose
Definition: solver.h:62
algebra::iteration< double > iter
Definition: solver.h:65
const std::vector< Tetra::prm > & paramTet
Definition: solver.h:55
const std::vector< Triangle::prm > & paramTri
Definition: solver.h:59
algebra::MatrixShape build_shape(const std::function< bool(Mesh::Edge)> &edge_filter) const
Definition: solver.h:74
solver(Mesh::mesh &_msh, const std::vector< Tetra::prm > &_pTetra, const std::vector< Triangle::prm > &_pTri, const std::string &name, const double _tol, const bool v, const int max_iter, const std::function< bool(Mesh::Edge)> &edge_filter=[](Mesh::Edge){ return true;})
Definition: solver.h:25
static const int DIM_PB
Definition: solver.h:45
std::vector< double > L_rhs
Definition: solver.h:71
class mesh, readMesh is expecting a mesh file in gmsh format either text or binary,...
std::pair< int, int > Edge
Definition: mesh.h:25
const int N
Definition: tetra.h:25
constexpr double v[NPI]
Definition: tetra.h:58
std::vector< std::set< int > > MatrixShape
Definition: sparseMat.h:38