File tree Expand file tree Collapse file tree
bruskova_v_char_frequency
bruskova_v_global_optimization/tests
bruskova_v_image_smoothing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < string>
4+ #include < vector>
5+
6+ #include " bruskova_v_char_frequency/common/include/common.hpp"
7+ // #include "task/include/task.hpp"
8+
9+ namespace bruskova_v_char_frequency {
10+
11+ class BruskovaVCharFrequencyMPI : public ppc ::core::Task<InType, OutType> {
12+ public:
13+ explicit BruskovaVCharFrequencyMPI (const InType &in) : ppc::core::Task<InType, OutType>(in) {}
14+ explicit BruskovaVCharFrequencyMPI (const ppc::core::TaskData &data) : ppc::core::Task<InType, OutType>(data) {}
15+
16+ bool PreProcessingImpl () override ;
17+ bool ValidationImpl () override ;
18+ bool RunImpl () override ;
19+ bool PostProcessingImpl () override ;
20+
21+ ppc::core::TaskType GetTaskType () const override {
22+ return ppc::core::TaskType::TASK ;
23+ }
24+
25+ private:
26+ std::string input_str_;
27+ char target_char_;
28+ int result_count_ = 0 ;
29+ };
30+
31+ } // namespace bruskova_v_char_frequency
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < string>
4+ #include < vector>
5+
6+ #include " bruskova_v_char_frequency/common/include/common.hpp"
7+ #include " task/include/task.hpp"
8+
9+ namespace bruskova_v_char_frequency {
10+
11+ class BruskovaVCharFrequencySEQ : public ppc ::core::Task<InType, OutType> {
12+ public:
13+ explicit BruskovaVCharFrequencySEQ (const InType &in) : ppc::core::Task<InType, OutType>(in) {}
14+ explicit BruskovaVCharFrequencySEQ (const ppc::core::TaskData &data) : ppc::core::Task<InType, OutType>(data) {}
15+
16+ bool PreProcessingImpl () override ;
17+ bool ValidationImpl () override ;
18+ bool RunImpl () override ;
19+ bool PostProcessingImpl () override ;
20+
21+ ppc::core::TaskType GetTaskType () const override {
22+ return ppc::core::TaskType::TASK ;
23+ }
24+
25+ private:
26+ std::string input_str_;
27+ char target_char_;
28+ int result_count_ = 0 ;
29+ };
30+
31+ } // namespace bruskova_v_char_frequency
Original file line number Diff line number Diff line change 1+ InheritParentConfig : true
2+
3+ Checks : >
4+ -modernize-loop-convert,
5+ -cppcoreguidelines-avoid-goto,
6+ -cppcoreguidelines-avoid-non-const-global-variables,
7+ -misc-use-anonymous-namespace,
8+ -modernize-use-std-print,
9+ -modernize-type-traits
10+
11+ CheckOptions :
12+ - key : readability-function-cognitive-complexity.Threshold
13+ value : 50 # Relaxed for tests
Original file line number Diff line number Diff line change 1+ InheritParentConfig : true
2+
3+ Checks : >
4+ -modernize-loop-convert,
5+ -cppcoreguidelines-avoid-goto,
6+ -cppcoreguidelines-avoid-non-const-global-variables,
7+ -misc-use-anonymous-namespace,
8+ -modernize-use-std-print,
9+ -modernize-type-traits
10+
11+ CheckOptions :
12+ - key : readability-function-cognitive-complexity.Threshold
13+ value : 50 # Relaxed for tests
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < vector>
4+
5+ #include " bruskova_v_image_smoothing/common/include/common.hpp"
6+ // #include "task/include/task.hpp"
7+
8+ namespace bruskova_v_image_smoothing {
9+
10+ class BruskovaVImageSmoothingMPI : public ppc ::core::Task<InType, OutType> {
11+ public:
12+ explicit BruskovaVImageSmoothingMPI (const InType &in) : ppc::core::Task<InType, OutType>(in) {}
13+ explicit BruskovaVImageSmoothingMPI (const ppc::core::TaskData &data) : ppc::core::Task<InType, OutType>(data) {}
14+
15+ bool PreProcessingImpl () override ;
16+ bool ValidationImpl () override ;
17+ bool RunImpl () override ;
18+ bool PostProcessingImpl () override ;
19+
20+ ppc::core::TaskType GetTaskType () const override {
21+ return ppc::core::TaskType::TASK ;
22+ }
23+
24+ private:
25+ std::vector<int > input_img_;
26+ std::vector<int > result_img_;
27+ int width_ = 0 ;
28+ int height_ = 0 ;
29+ };
30+
31+ } // namespace bruskova_v_image_smoothing
Original file line number Diff line number Diff line change 1+ #include < vector>
2+
3+ #include " bruskova_v_image_smoothing/common/include/common.hpp"
4+ #include " task/include/task.hpp"
5+
6+ namespace bruskova_v_image_smoothing {
7+
8+ class BruskovaVImageSmoothingMPI : public ppc ::core::Task<InType, OutType> {
9+ public:
10+ explicit BruskovaVImageSmoothingMPI (const InType &in) : ppc::core::Task<InType, OutType>(in) {}
11+
12+ explicit BruskovaVImageSmoothingMPI (const ppc::core::TaskData &data) : ppc::core::Task<InType, OutType>(data) {}
13+
14+ bool PreProcessingImpl () override ;
15+ bool ValidationImpl () override ;
16+ bool RunImpl () override ;
17+ bool PostProcessingImpl () override ;
18+
19+ ppc::core::TaskType GetTaskType () const override {
20+ return ppc::core::TaskType::TASK ;
21+ }
22+
23+ private:
24+ std::vector<int > input_img_;
25+ std::vector<int > result_img_;
26+ int width_ = 0 , height_ = 0 ;
27+ };
28+
29+ } // namespace bruskova_v_image_smoothing
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < vector>
4+
5+ #include " bruskova_v_image_smoothing/common/include/common.hpp"
6+ #include " task/include/task.hpp"
7+
8+ namespace bruskova_v_image_smoothing {
9+
10+ class BruskovaVImageSmoothingSEQ : public ppc ::core::Task<InType, OutType> {
11+ public:
12+ explicit BruskovaVImageSmoothingSEQ (const InType &in) : ppc::core::Task<InType, OutType>(in) {}
13+ explicit BruskovaVImageSmoothingSEQ (const ppc::core::TaskData &data) : ppc::core::Task<InType, OutType>(data) {}
14+
15+ bool PreProcessingImpl () override ;
16+ bool ValidationImpl () override ;
17+ bool RunImpl () override ;
18+ bool PostProcessingImpl () override ;
19+
20+ ppc::core::TaskType GetTaskType () const override {
21+ return ppc::core::TaskType::TASK ;
22+ }
23+
24+ private:
25+ std::vector<int > input_img_;
26+ std::vector<int > result_img_;
27+ int width_ = 0 ;
28+ int height_ = 0 ;
29+ };
30+
31+ } // namespace bruskova_v_image_smoothing
Original file line number Diff line number Diff line change 1+ #include " ../include/ops_seq.hpp"
2+
3+ namespace bruskova_v_image_smoothing {
4+
5+ BruskovaVImageSmoothingSEQ::BruskovaVImageSmoothingSEQ (const InType &in) : BaseTask() {
6+ this ->GetInput () = in;
7+ }
8+
9+ bool BruskovaVImageSmoothingSEQ::ValidationImpl () {
10+ return true ;
11+ }
12+
13+ bool BruskovaVImageSmoothingSEQ::PreProcessingImpl () {
14+ const auto &in = this ->GetInput ();
15+ input_img_ = std::get<0 >(in);
16+ width_ = std::get<1 >(in);
17+ height_ = std::get<2 >(in);
18+ result_img_ = input_img_;
19+ return true ;
20+ }
21+
22+ bool BruskovaVImageSmoothingSEQ::RunImpl () {
23+ for (int y = 1 ; y < height_ - 1 ; y++) {
24+ for (int x = 1 ; x < width_ - 1 ; x++) {
25+ int sum = 0 ;
26+ for (int dy = -1 ; dy <= 1 ; dy++) {
27+ for (int dx = -1 ; dx <= 1 ; dx++) {
28+ sum += input_img_[(y + dy) * width_ + (x + dx)];
29+ }
30+ }
31+ result_img_[y * width_ + x] = sum / 9 ;
32+ }
33+ }
34+ return true ;
35+ }
36+
37+ bool BruskovaVImageSmoothingSEQ::PostProcessingImpl () {
38+ this ->GetOutput () = result_img_;
39+ return true ;
40+ }
41+
42+ } // namespace bruskova_v_image_smoothing
You can’t perform that action at this time.
0 commit comments