Feellgood
linear_algebra.h
Go to the documentation of this file.
1 #ifndef linear_algebra_h
2 #define linear_algebra_h
3 
10 #include <random>
11 #pragma GCC diagnostic push
12 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
13 #include <execution>
14 #pragma GCC diagnostic pop
15 
16 #include "config.h"
17 
18 #include "settings.h"
19 #include "solver.h"
20 #include "node.h"
21 #include "tetra.h"
22 
24 const int DIM_PB_MAG = 2;
25 
34 class LinAlgebra : public solver<DIM_PB_MAG>
35  {
36 public:
41  : solver<DIM_PB_MAG>(
42  my_msh, s.paramTetra, s.paramTriangle, "bicg_dir", s.TOL, s.verbose, s.MAXITER,
43  [this](const Mesh::Edge edge){ return msh->magNode[edge.first] && msh->magNode[edge.second]; }
44  ),
45  verbose(s.verbose),
46  extSpaceField(my_msh.extSpaceField)
47  {
48  Xw.resize(2*NOD);
50  if (!s.recenter)
51  { idx_dir = Nodes::IDX_UNDEF; }
52  else
53  { idx_dir = s.recentering_direction; }
54 
55  for (int i=0;i<NOD;i++)
56  {
57  if(!my_msh.magNode[i])
58  {
59  lvd.push_back(2*i);
60  lvd.push_back(2*i+1);
61  }
62  }
63  lvd.shrink_to_fit();
64  }
65 
67  void checkBoundaryConditions(void) const override {}
68 
75  void prepareElements(const Eigen::Vector3d &Hext ,
76  const timing &t_prm ) const;
77 
84  void prepareElements(const double A_Hext ,
86  const timing &t_prm ) const;
87 
89  void buildInitGuess(std::vector<double> &G) const;
90 
94  bool solve(const timing &t_prm );
95 
97  inline void set_DW_vz(const double vz ) { DW_vz = vz; }
98 
100  inline double get_v_max(void) const { return v_max; }
101 
105 
107  void base_projection() const;
108 
109 private:
112 
114  std::vector<double> Xw;
115 
117  const int verbose;
118 
120  double DW_vz;
121 
123  double v_max;
124 
126  const std::vector< Eigen::Matrix<double,Nodes::DIM,Tetra::NPI> >& extSpaceField;
127 
129  std::vector<int> lvd;
130  };// end class linAlgebra
131 #endif
Definition: linear_algebra.h:35
LinAlgebra(Settings &s, Mesh::mesh &my_msh)
Definition: linear_algebra.h:40
double DW_vz
Definition: linear_algebra.h:120
void setExtSpaceField(Settings &s)
Nodes::index idx_dir
Definition: linear_algebra.h:111
void base_projection() const
Definition: linear_algebra.cpp:3
double v_max
Definition: linear_algebra.h:123
void prepareElements(const Eigen::Vector3d &Hext, const timing &t_prm) const
Definition: linear_algebra.cpp:26
void set_DW_vz(const double vz)
Definition: linear_algebra.h:97
void buildInitGuess(std::vector< double > &G) const
Definition: linear_algebra.cpp:13
std::vector< int > lvd
Definition: linear_algebra.h:129
std::vector< double > Xw
Definition: linear_algebra.h:114
const std::vector< Eigen::Matrix< double, Nodes::DIM, Tetra::NPI > > & extSpaceField
Definition: linear_algebra.h:126
bool solve(const timing &t_prm)
Definition: solver.cpp:6
void checkBoundaryConditions(void) const override
Definition: linear_algebra.h:67
double get_v_max(void) const
Definition: linear_algebra.h:100
const int verbose
Definition: linear_algebra.h:117
Definition: mesh.h:32
std::vector< bool > magNode
Definition: mesh.h:355
Container for all the settings provided by the user, with conversions to/from YAML.
Definition: settings.h:70
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
const int NOD
Definition: solver.h:51
Definition: time_integration.h:7
const int DIM_PB_MAG
Definition: linear_algebra.h:24
index
Definition: node.h:33
header to define struct Node
many settings to give some parameters to the solver, boundary conditions for the problem,...
two templates to fill matrix and vectors in various dimensionnality situations. DIM_PROBLEM = 1 is us...
namespace Tetra header containing Tet class, some constants, and integrales