suanPan
IntegrationPlan.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (C) 2017-2022 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 
66 enum class IntegrationType {
67  GAUSS,
68  HERMITE,
69  CHEBYSHEV,
70  LOBATTO,
71  RADAU,
72  LAGUERRE,
73  IRONS,
74  TRIANGLE
75 };
76 
77 class IntegrationPlan final {
78  arma::mat int_pts;
79 
80  template<IntegrationType> void generate(unsigned, unsigned) { throw std::invalid_argument("not supported"); }
81 
82 public:
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 
95 template<> void IntegrationPlan::generate<IntegrationType::GAUSS>(unsigned, unsigned);
96 template<> void IntegrationPlan::generate<IntegrationType::HERMITE>(unsigned, unsigned);
97 template<> void IntegrationPlan::generate<IntegrationType::CHEBYSHEV>(unsigned, unsigned);
98 template<> void IntegrationPlan::generate<IntegrationType::LOBATTO>(unsigned, unsigned);
99 template<> void IntegrationPlan::generate<IntegrationType::RADAU>(unsigned, unsigned);
100 template<> void IntegrationPlan::generate<IntegrationType::LAGUERRE>(unsigned, unsigned);
101 template<> void IntegrationPlan::generate<IntegrationType::IRONS>(unsigned, unsigned);
102 template<> 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:1122
IntegrationPlan(unsigned, unsigned, IntegrationType)
Definition: IntegrationPlan.cpp:1091
const arma::mat & get_data() const
Definition: IntegrationPlan.cpp:1120
void print() const
Definition: IntegrationPlan.cpp:1124
const unsigned n_rows
Definition: IntegrationPlan.h:83
const unsigned n_cols
Definition: IntegrationPlan.h:84
IntegrationType
Definition: IntegrationPlan.h:66