Chi-Tech
ags_context.cc
Go to the documentation of this file.
1
#include "
ags_context.h
"
2
3
#include "
A_LBSSolver/lbs_solver.h
"
4
#include "
wgs_context.h
"
5
6
#include <petscksp.h>
7
8
#define GetGSContextPtr(x) \
9
std::dynamic_pointer_cast<WGSContext<Mat,Vec,KSP>>(x)
10
11
namespace
lbs
12
{
13
14
template
<>
15
std::pair<int64_t,int64_t>
AGSContext<Mat,Vec,KSP>::SystemSize
()
16
{
17
const
size_t
local_node_count = lbs_solver_.LocalNodeCount();
18
const
size_t
globl_node_count = lbs_solver_.GlobalNodeCount();
19
20
std::set<int> groupset_list_group_ids;
21
for
(
auto
& wgs_solver : sub_solvers_list_)
22
{
23
auto
gs_context_ptr =
GetGSContextPtr
(wgs_solver->GetContext());
24
for
(
const
auto
& group : gs_context_ptr->groupset_.groups_)
25
groupset_list_group_ids.insert(group.id_);
26
}
27
28
const
size_t
gslist_num_groups = groupset_list_group_ids.size();
29
30
const
size_t
num_moments = lbs_solver_.NumMoments();
31
32
const
size_t
local_size = local_node_count * gslist_num_groups * num_moments;
33
const
size_t
globl_size = globl_node_count * gslist_num_groups * num_moments;
34
35
return
{
static_cast<
int64_t
>
(local_size),
36
static_cast<
int64_t
>
(globl_size)};
37
}
38
39
template
<>
40
void
AGSContext<Mat,Vec,KSP>::SetPreconditioner
(KSP& solver)
41
{
42
43
}
44
45
template
<>
46
int
AGSContext<Mat,Vec,KSP>::MatrixAction
(
Mat
& matrix,
47
Vec
& vector,
48
Vec
& action)
49
{
50
51
return
0;
52
}
53
54
}
//namespace lbs
GetGSContextPtr
#define GetGSContextPtr(x)
Definition:
ags_context.cc:8
ags_context.h
lbs_solver.h
lbs
Definition:
acceleration.cc:10
Mat
struct _p_Mat * Mat
Definition:
petsc_forward_declarations.h:10
Vec
struct _p_Vec * Vec
Definition:
petsc_forward_declarations.h:9
lbs::AGSContext::SystemSize
std::pair< int64_t, int64_t > SystemSize()
lbs::AGSContext::SetPreconditioner
virtual void SetPreconditioner(SolverType &solver)
lbs::AGSContext::MatrixAction
int MatrixAction(MatType &matrix, VecType &vector, VecType &action) override
wgs_context.h
modules
LinearBoltzmannSolvers
A_LBSSolver
IterativeMethods
ags_context.cc
Generated by
1.9.3