Feellgood
linear_algebra.h
Go to the documentation of this file.
1 #ifndef linear_algebra_h
2 #define linear_algebra_h
3 
9 #include <random>
10 #pragma GCC diagnostic push
11 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
12 #include <execution>
13 #pragma GCC diagnostic pop
14 
15 #include "config.h"
16 
17 #include "facette.h"
18 #include "feellgoodSettings.h"
19 #include "solver.h"
20 #include "meshUtils.h"
21 #include "node.h"
22 #include "tetra.h"
23 
24 #include "algebra/algebra.h"
25 
27 const int DIM_PB_MAG = 2;
28 
37 class LinAlgebra : public solver<DIM_PB_MAG>
38  {
39 public:
44  : solver<DIM_PB_MAG>(
45  my_msh, s.paramTetra, s.paramFacette, "bicg_dir", s.TOL, s.verbose, s.MAXITER,
46  [this](Mesh::Edge edge){ return msh->magNode[edge.first] && msh->magNode[edge.second]; }
47  ),
48  verbose(s.verbose),
49  extSpaceField(my_msh.extSpaceField)
50  {
51  Xw.resize(2*NOD);
53  if (!s.recenter)
54  { idx_dir = Nodes::IDX_UNDEF; }
55  else
56  { idx_dir = s.recentering_direction; }
57 
58  for (int i=0;i<NOD;i++)
59  {
60  if(!my_msh.magNode[i])
61  {
62  lvd.push_back(2*i);
63  lvd.push_back(2*i+1);
64  }
65  }
66  lvd.shrink_to_fit();
67  }
68 
70  void checkBoundaryConditions(void) const {}
71 
75  void prepareElements(Eigen::Vector3d const &Hext , timing const &t_prm );
76 
80  void prepareElements(double const A_Hext , timing const &t_prm );
81 
83  void buildInitGuess(std::vector<double> &G) const;
84 
87  bool solve(timing const &t_prm );
88 
90  inline void set_DW_vz(double vz ) { DW_vz = vz; }
91 
93  inline double get_v_max(void) { return v_max; }
94 
97 
99  void base_projection();
100 
101 private:
104 
106  std::vector<double> Xw;
107 
109  const int verbose;
110 
112  double DW_vz;
113 
115  double v_max;
116 
118  const std::vector< Eigen::Matrix<double,Nodes::DIM,Tetra::NPI> >& extSpaceField;
119 
121  std::vector<int> lvd;
122  };// end class linAlgebra
123 #endif
set of class to handle sparse matrix operations for gradient conjugate algorithms a sparse vector cla...
Definition: linear_algebra.h:38
LinAlgebra(Settings &s, Mesh::mesh &my_msh)
Definition: linear_algebra.h:43
double DW_vz
Definition: linear_algebra.h:112
double get_v_max(void)
Definition: linear_algebra.h:93
void setExtSpaceField(Settings &s)
Nodes::index idx_dir
Definition: linear_algebra.h:103
double v_max
Definition: linear_algebra.h:115
void prepareElements(Eigen::Vector3d const &Hext, timing const &t_prm)
Definition: linear_algebra.cpp:26
void set_DW_vz(double vz)
Definition: linear_algebra.h:90
void buildInitGuess(std::vector< double > &G) const
Definition: linear_algebra.cpp:13
std::vector< int > lvd
Definition: linear_algebra.h:121
std::vector< double > Xw
Definition: linear_algebra.h:106
void checkBoundaryConditions(void) const
Definition: linear_algebra.h:70
const std::vector< Eigen::Matrix< double, Nodes::DIM, Tetra::NPI > > & extSpaceField
Definition: linear_algebra.h:118
void base_projection()
Definition: linear_algebra.cpp:3
bool solve(timing const &t_prm)
Definition: solver.cpp:6
const int verbose
Definition: linear_algebra.h:109
Definition: mesh.h:30
std::vector< bool > magNode
Definition: mesh.h:336
Container for all the settings provided by the user, with conversions to/from YAML.
Definition: feellgoodSettings.h:73
template class for the different solvers template parameter DIM_PROBLEM: dimensionnality of the probl...
Definition: solver.h:21
Mesh::mesh * msh
Definition: solver.h:45
const int NOD
Definition: solver.h:48
Definition: time_integration.h:6
contains namespace Facette header containing Fac class, and some constants and a less_than operator t...
many settings to give some parameters to the solver, boundary conditions for the problem,...
const int DIM_PB_MAG
Definition: linear_algebra.h:27
index
Definition: node.h:34
header to define struct Node
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