| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "lopatin_a_trapezoidal_integration/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include "lopatin_a_trapezoidal_integration/common/include/common.hpp" | ||
| 4 | |||
| 5 | namespace lopatin_a_trapezoidal_integration { | ||
| 6 | |||
| 7 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | LopatinATrapezoidalIntegrationSEQ::LopatinATrapezoidalIntegrationSEQ(const InType &in) { |
| 8 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 9 | GetInput() = in; | ||
| 10 | ✗ | } | |
| 11 | |||
| 12 | 40 | bool LopatinATrapezoidalIntegrationSEQ::ValidationImpl() { | |
| 13 | const auto &input = GetInput(); | ||
| 14 |
4/8✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 40 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 40 times.
|
40 | return (input.b > input.a) && (input.d > input.c) && (input.f != nullptr) && (input.n > 0); |
| 15 | } | ||
| 16 | |||
| 17 | 40 | bool LopatinATrapezoidalIntegrationSEQ::PreProcessingImpl() { | |
| 18 | 40 | GetOutput() = 0.0; | |
| 19 | 40 | return GetOutput() == 0.0; | |
| 20 | } | ||
| 21 | |||
| 22 | 40 | bool LopatinATrapezoidalIntegrationSEQ::RunImpl() { | |
| 23 | const auto &input = GetInput(); | ||
| 24 | const auto &f = input.f; | ||
| 25 | auto &output = GetOutput(); | ||
| 26 | |||
| 27 | 40 | double h = (input.b - input.a) / input.n; | |
| 28 | 40 | double k = (input.d - input.c) / input.n; | |
| 29 | |||
| 30 | double res = 0.0; | ||
| 31 |
2/2✓ Branch 0 taken 20040 times.
✓ Branch 1 taken 40 times.
|
20080 | for (int i = 0; i <= input.n; ++i) { |
| 32 | 20040 | double xi = input.a + (i * h); | |
| 33 | double wx = 1.0; | ||
| 34 |
4/4✓ Branch 0 taken 20000 times.
✓ Branch 1 taken 40 times.
✓ Branch 2 taken 40 times.
✓ Branch 3 taken 19960 times.
|
20040 | if (i == 0 || i == input.n) { |
| 35 | wx = 0.5; | ||
| 36 | } | ||
| 37 | |||
| 38 |
2/2✓ Branch 0 taken 10040040 times.
✓ Branch 1 taken 20040 times.
|
10060080 | for (int j = 0; j <= input.n; ++j) { |
| 39 | 10040040 | double yi = input.c + (j * k); | |
| 40 | double wy = 1.0; | ||
| 41 |
4/4✓ Branch 0 taken 10020000 times.
✓ Branch 1 taken 20040 times.
✓ Branch 2 taken 20040 times.
✓ Branch 3 taken 9999960 times.
|
10040040 | if (j == 0 || j == input.n) { |
| 42 | wy = 0.5; | ||
| 43 | } | ||
| 44 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10040040 times.
|
20080080 | res += wx * wy * f(xi, yi); |
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | 40 | output = h * k * res; | |
| 49 | |||
| 50 | 40 | return true; | |
| 51 | } | ||
| 52 | |||
| 53 | 40 | bool LopatinATrapezoidalIntegrationSEQ::PostProcessingImpl() { | |
| 54 | 40 | return true; | |
| 55 | } | ||
| 56 | |||
| 57 | } // namespace lopatin_a_trapezoidal_integration | ||
| 58 |