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 "facette.h"
19 #include "settings.h"
20 #include "solver.h"
21 #include "meshUtils.h"
22 #include "node.h"
23 #include "tetra.h"
24 
25 #include "algebra/algebra.h"
26 
28 const int DIM_PB_MAG = 2;
29 
40 class LinAlgebra : public solver<DIM_PB_MAG>
41  {
42 public:
47  : solver<DIM_PB_MAG>(
48  my_msh, s.paramTetra, s.paramFacette, "bicg_dir", s.TOL, s.verbose, s.MAXITER,
49  [this](Mesh::Edge edge){ return msh->magNode[edge.first] && msh->magNode[edge.second]; }
50  ),
51  verbose(s.verbose),
52  extSpaceField(my_msh.extSpaceField)
53  {
54  Xw.resize(2*NOD);
56  if (!s.recenter)
57  { idx_dir = Nodes::IDX_UNDEF; }
58  else
59  { idx_dir = s.recentering_direction; }
60 
61  for (int i=0;i<NOD;i++)
62  {
63  if(!my_msh.magNode[i])
64  {
65  lvd.push_back(2*i);
66  lvd.push_back(2*i+1);
67  }
68  }
69  lvd.shrink_to_fit();
70  }
71 
73  void checkBoundaryConditions(void) const {}
74 
81  void prepareElements(Eigen::Vector3d const &Hext ,
82  timing const &t_prm );
83 
90  void prepareElements(double const A_Hext ,
92  timing const &t_prm );
93 
95  void buildInitGuess(std::vector<double> &G) const;
96 
100  bool solve(timing const &t_prm );
101 
103  inline void set_DW_vz(double vz ) { DW_vz = vz; }
104 
106  inline double get_v_max(void) { return v_max; }
107 
111 
113  void base_projection();
114 
115 private:
118 
120  std::vector<double> Xw;
121 
123  const int verbose;
124 
126  double DW_vz;
127 
129  double v_max;
130 
132  const std::vector< Eigen::Matrix<double,Nodes::DIM,Tetra::NPI> >& extSpaceField;
133 
135  std::vector<int> lvd;
136  };// end class linAlgebra
137 #endif
set of class to handle sparse matrix operations for gradient conjugate algorithms a sparse vector cla...
Definition: linear_algebra.h:41
LinAlgebra(Settings &s, Mesh::mesh &my_msh)
Definition: linear_algebra.h:46
double DW_vz
Definition: linear_algebra.h:126
double get_v_max(void)
Definition: linear_algebra.h:106
void setExtSpaceField(Settings &s)
Nodes::index idx_dir
Definition: linear_algebra.h:117
double v_max
Definition: linear_algebra.h:129
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:103
void buildInitGuess(std::vector< double > &G) const
Definition: linear_algebra.cpp:13
std::vector< int > lvd
Definition: linear_algebra.h:135
std::vector< double > Xw
Definition: linear_algebra.h:120
void checkBoundaryConditions(void) const
Definition: linear_algebra.h:73
const std::vector< Eigen::Matrix< double, Nodes::DIM, Tetra::NPI > > & extSpaceField
Definition: linear_algebra.h:132
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:123
Definition: mesh.h:32
std::vector< bool > magNode
Definition: mesh.h:334
Container for all the settings provided by the user, with conversions to/from YAML.
Definition: settings.h:73
template class for the different solvers template parameter DIM_PROBLEM: dimensionnality of the probl...
Definition: solver.h:25
Mesh::mesh * msh
Definition: solver.h:51
const int NOD
Definition: solver.h:54
Definition: time_integration.h:7
contains namespace Facette header containing Fac class, and some constants and a less_than operator t...
const int DIM_PB_MAG
Definition: linear_algebra.h:28
index
Definition: node.h:34
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