Chi-Tech
ags_context.cc
Go to the documentation of this file.
1#include "ags_context.h"
2
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
11namespace lbs
12{
13
14template<>
15std::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
39template<>
41{
42
43}
44
45template<>
47 Vec& vector,
48 Vec& action)
49{
50
51 return 0;
52}
53
54}//namespace lbs
#define GetGSContextPtr(x)
Definition: ags_context.cc:8
struct _p_Mat * Mat
struct _p_Vec * Vec
std::pair< int64_t, int64_t > SystemSize()
virtual void SetPreconditioner(SolverType &solver)
int MatrixAction(MatType &matrix, VecType &vector, VecType &action) override