suanPan
IntegrationPlan.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2024 Theodore Chang
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
61#ifndef INTEGRATIONPLAN_H
62#define INTEGRATIONPLAN_H
63
64#include <armadillo/armadillo>
65
66enum class IntegrationType {
67 GAUSS,
68 HERMITE,
70 LOBATTO,
71 RADAU,
73 IRONS,
75};
76
77class IntegrationPlan final {
78 arma::mat int_pts;
79
80 template<IntegrationType> void generate(unsigned, unsigned) { throw std::invalid_argument("not supported"); }
81
82public:
83 const unsigned n_rows = 0;
84 const unsigned n_cols = 0;
85
86 explicit IntegrationPlan(unsigned, unsigned, IntegrationType);
87
88 [[nodiscard]] const arma::mat& get_data() const;
89
90 double operator()(unsigned, unsigned) const;
91
92 void print() const;
93};
94
95template<> void IntegrationPlan::generate<IntegrationType::GAUSS>(unsigned, unsigned);
96template<> void IntegrationPlan::generate<IntegrationType::HERMITE>(unsigned, unsigned);
97template<> void IntegrationPlan::generate<IntegrationType::CHEBYSHEV>(unsigned, unsigned);
98template<> void IntegrationPlan::generate<IntegrationType::LOBATTO>(unsigned, unsigned);
99template<> void IntegrationPlan::generate<IntegrationType::RADAU>(unsigned, unsigned);
100template<> void IntegrationPlan::generate<IntegrationType::LAGUERRE>(unsigned, unsigned);
101template<> void IntegrationPlan::generate<IntegrationType::IRONS>(unsigned, unsigned);
102template<> void IntegrationPlan::generate<IntegrationType::TRIANGLE>(unsigned, unsigned);
103
104#endif
105
An IntegrationPlan class.
Definition: IntegrationPlan.h:77
double operator()(unsigned, unsigned) const
Definition: IntegrationPlan.cpp:1846
IntegrationPlan(unsigned, unsigned, IntegrationType)
Definition: IntegrationPlan.cpp:1815
const arma::mat & get_data() const
Definition: IntegrationPlan.cpp:1844
void print() const
Definition: IntegrationPlan.cpp:1848
const unsigned n_rows
Definition: IntegrationPlan.h:83
const unsigned n_cols
Definition: IntegrationPlan.h:84
IntegrationType
Definition: IntegrationPlan.h:66