Loading...
Searching...
No Matches
serial.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * PlanewaveSerialExecutionPolicy — serial implementation of PlanewaveExecutionPolicy.
5 *
6 * Inherits band-group ops from SerialExecutionPolicy.
7 * All pool-level operations are no-ops: in a single-process run every process
8 * already holds the complete charge density and k-point grid.
9 */
10
14
15namespace q3 {
16namespace execution {
17
20 public:
21 /**
22 * Band-group ops inherited from SerialExecutionPolicy:
23 * dot_product, add_scaled_vector, norm
24 */
25
26 /**
27 * No-op: single process already holds the full charge density.
28 */
29 int number_of_pools() const override {
30 return 1;
31 }
32 bool one_process_owns_complete_state() const override {
33 return true;
34 }
35 /// The single process holds every k-point whole.
36 bool each_process_owns_whole_kpoints() const override {
37 return true;
38 }
39 /// Identity: the single process holds the global k-point grid in order.
40 int global_kpoint_index(int local_kpoint_index) const override {
41 return local_kpoint_index;
42 }
43 void reduce_charge_density(std::vector<std::vector<Real>>& /*charge_density*/) const override {}
44
45 /**
46 * No-op: single process already holds the full scalar value.
47 */
48 void reduce_scalar(Real& /*value*/) const override {}
49 void reduce_vector(std::vector<Real>& /*values*/) const override {}
50 void reduce_scalar_max(int& /*value*/) const override {}
51 void reduce_scalar_max(Real& /*value*/) const override {}
52 void reduce_scalar_min(Real& /*value*/) const override {}
53 void reduce_band_group_scalar_min(int& /*value*/) const override {}
54
55 /**
56 * No-op: single process owns all grid slabs (no slab decomposition).
57 */
58 void reduce_within_pool_scalar(Real& /*value*/) const override {}
59 void reduce_within_pool_vector(std::vector<Real>& /*values*/) const override {}
60
61 /**
62 * Identity: return the global grid unchanged.
63 */
64 KPointsGrid local_kpoint_grid(const KPointsGrid& global_kpoint_grid) const override {
65 return global_kpoint_grid;
66 }
67
68 std::vector<Real>
69 assemble_global_kpoint_state_data(const std::vector<Real>& local_data,
70 int /*local_number_of_physical_kpoints*/,
71 int /*number_of_spin_components*/,
72 int /*number_of_values_per_state*/) const override {
73 return local_data;
74 }
75
76 std::unique_ptr<FFTGrid> create_fft_grid() const override {
77 return std::make_unique<SerialFFTGrid>();
78 }
79};
80
81} // namespace execution
82} // namespace q3
void reduce_scalar_max(int &) const override
Definition serial.hpp:50
std::unique_ptr< FFTGrid > create_fft_grid() const override
Definition serial.hpp:76
std::vector< Real > assemble_global_kpoint_state_data(const std::vector< Real > &local_data, int, int, int) const override
Definition serial.hpp:69
int global_kpoint_index(int local_kpoint_index) const override
Identity: the single process holds the global k-point grid in order.
Definition serial.hpp:40
void reduce_charge_density(std::vector< std::vector< Real > > &) const override
Definition serial.hpp:43
void reduce_scalar_max(Real &) const override
Definition serial.hpp:51
void reduce_vector(std::vector< Real > &) const override
Definition serial.hpp:49
bool one_process_owns_complete_state() const override
Definition serial.hpp:32
bool each_process_owns_whole_kpoints() const override
The single process holds every k-point whole.
Definition serial.hpp:36
void reduce_scalar(Real &) const override
Definition serial.hpp:48
void reduce_within_pool_scalar(Real &) const override
Definition serial.hpp:58
void reduce_within_pool_vector(std::vector< Real > &) const override
Definition serial.hpp:59
void reduce_band_group_scalar_min(int &) const override
Definition serial.hpp:53
void reduce_scalar_min(Real &) const override
Definition serial.hpp:52
KPointsGrid local_kpoint_grid(const KPointsGrid &global_kpoint_grid) const override
Definition serial.hpp:64
double Real