Chi-Tech
nl_keigen_acc_context.h
Go to the documentation of this file.
1#ifndef CHITECH_LBS_NL_KEIGEN_ACC_CONTEXT_H
2#define CHITECH_LBS_NL_KEIGEN_ACC_CONTEXT_H
3
5
6#include "diffusion_mip.h"
9
10
11#include <petscsnes.h>
12
13namespace lbs::acceleration
14{
15
17{
22
24
29 double k_l = 1.0;
30
32 LBSSolver& lbs_solver,
33 int verbosity_level) :
34 diff_solver_(diff_solver),
35 lbs_solver_(lbs_solver),
36 verbosity_level_(verbosity_level),
37 kresid_func_context_({diff_solver.TextName(), 1.0}),
39 {}
40
42 {
43 VecDbl output(diff_num_local_dofs_, 0.0);
44
45 const double* phi_raw;
46 VecGetArrayRead(phi, &phi_raw);
47 for (size_t i=0; i<diff_num_local_dofs_; ++i)
48 output[i] = phi_raw[i];
49 VecRestoreArrayRead(phi, &phi_raw);
50
51 return output;
52 }
53
54 void STLVecToPhiVec(const VecDbl& input, Vec phi) const
55 {
56 double* phi_raw;
57 VecGetArray(phi, &phi_raw);
58 for (size_t i=0; i<diff_num_local_dofs_; ++i)
59 phi_raw[i] = input[i];
60 VecRestoreArray(phi, &phi_raw);
61 }
62
63 virtual ~NLKEigenDiffContext() override = default;
64};
65
66
67}//namespace lbs::acceleration
68
69#endif //CHITECH_LBS_NL_KEIGEN_ACC_CONTEXT_H
std::string TextName() const
Definition: diffusion.cc:51
std::pair< size_t, size_t > GetNumPhiIterativeUnknowns()
Definition: diffusion.cc:73
std::vector< double > VecDbl
Definition: lbs_structs.h:18
struct _p_Vec * Vec
NLKEigenDiffContext(DiffusionMIPSolver &diff_solver, LBSSolver &lbs_solver, int verbosity_level)
virtual ~NLKEigenDiffContext() override=default
void STLVecToPhiVec(const VecDbl &input, Vec phi) const