FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
newton_cotes_open_driver.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
9#include <kernel/cubature/scalar/driver_base.hpp>
10
11namespace FEAT
12{
13 namespace Cubature
14 {
15 namespace Scalar
16 {
26 public DriverBase
27 {
28 public:
30 static constexpr bool variadic = true;
32 static constexpr int min_points = 1;
34 static constexpr int max_points = 7;
35
37 static String name()
38 {
39 return "newton-cotes-open";
40 }
41
51 template<
52 typename Weight_,
53 typename Coord_>
54 static void fill(Rule<Weight_, Coord_>& rule, int num_points)
55 {
56 // how many points do we have?
57 switch(num_points)
58 {
59 case 1:
60 rule.get_coord(0) = Coord_(0);
61
62 rule.get_weight(0) = Weight_(2);
63 break;
64
65 case 2:
66 rule.get_coord(0) = -Coord_(1) / Coord_(3);
67 rule.get_coord(1) = Coord_(1) / Coord_(3);
68
69 rule.get_weight(0) = Weight_(1);
70 rule.get_weight(1) = Weight_(1);
71 break;
72
73 case 3:
74 rule.get_coord(0) = -Coord_(1) / Coord_(2);
75 rule.get_coord(1) = Coord_(0);
76 rule.get_coord(2) = Coord_(1) / Coord_(2);
77
78 rule.get_weight(0) = Weight_(4) / Weight_(3);
79 rule.get_weight(1) = - Weight_(2) / Weight_(3);
80 rule.get_weight(2) = Weight_(4) / Weight_(3);
81 break;
82
83 case 4:
84 rule.get_coord(0) = -Coord_(3) / Coord_(5);
85 rule.get_coord(1) = -Coord_(1) / Coord_(5);
86 rule.get_coord(2) = Coord_(1) / Coord_(5);
87 rule.get_coord(3) = Coord_(3) / Coord_(5);
88
89 rule.get_weight(0) = Weight_(11) / Weight_(12);
90 rule.get_weight(1) = Weight_(1) / Weight_(12);
91 rule.get_weight(2) = Weight_(1) / Weight_(12);
92 rule.get_weight(3) = Weight_(11) / Weight_(12);
93 break;
94
95 case 5:
96 rule.get_coord(0) = -Coord_(2) / Coord_(3);
97 rule.get_coord(1) = -Coord_(1) / Coord_(3);
98 rule.get_coord(2) = Coord_(0);
99 rule.get_coord(3) = Coord_(1) / Coord_(3);
100 rule.get_coord(4) = Coord_(2) / Coord_(3);
101
102 rule.get_weight(0) = Weight_(11) / Weight_(10);
103 rule.get_weight(1) = - Weight_(14) / Weight_(10);
104 rule.get_weight(2) = Weight_(26) / Weight_(10);
105 rule.get_weight(3) = - Weight_(14) / Weight_(10);
106 rule.get_weight(4) = Weight_(11) / Weight_(10);
107 break;
108
109 case 6:
110 rule.get_coord(0) = -Coord_(5) / Coord_(7);
111 rule.get_coord(1) = -Coord_(3) / Coord_(7);
112 rule.get_coord(2) = -Coord_(1) / Coord_(7);
113 rule.get_coord(3) = Coord_(1) / Coord_(7);
114 rule.get_coord(4) = Coord_(3) / Coord_(7);
115 rule.get_coord(5) = Coord_(5) / Coord_(7);
116
117 rule.get_weight(0) = Weight_(611) / Weight_(720);
118 rule.get_weight(1) = -Weight_(453) / Weight_(720);
119 rule.get_weight(2) = Weight_(562) / Weight_(720);
120 rule.get_weight(3) = Weight_(562) / Weight_(720);
121 rule.get_weight(4) = -Weight_(453) / Weight_(720);
122 rule.get_weight(5) = Weight_(611) / Weight_(720);
123 break;
124
125 case 7:
126 rule.get_coord(0) = -Coord_(3) / Coord_(4);
127 rule.get_coord(1) = -Coord_(1) / Coord_(2);
128 rule.get_coord(2) = -Coord_(1) / Coord_(4);
129 rule.get_coord(3) = Coord_(0);
130 rule.get_coord(4) = Coord_(1) / Coord_(4);
131 rule.get_coord(5) = Coord_(1) / Coord_(2);
132 rule.get_coord(6) = Coord_(3) / Coord_(4);
133
134 rule.get_weight(0) = Weight_(920) / Weight_(945);
135 rule.get_weight(1) = -Weight_(1908) / Weight_(945);
136 rule.get_weight(2) = Weight_(4392) / Weight_(945);
137 rule.get_weight(3) = -Weight_(4918) / Weight_(945);
138 rule.get_weight(4) = Weight_(4392) / Weight_(945);
139 rule.get_weight(5) = -Weight_(1908) / Weight_(945);
140 rule.get_weight(6) = Weight_(920) / Weight_(945);
141 break;
142 }
143 }
144 }; // class NewtonCotesOpenDriver<...>
145 } // namespace Scalar
146 } // namespace Cubature
147} // namespace FEAT
Scalar cubature driver base class.
Definition: driver_base.hpp:23
Open Newton-Cotes Rule driver class template.
static constexpr bool variadic
this rule is variadic
static String name()
Returns the name of the cubature rule.
static void fill(Rule< Weight_, Coord_ > &rule, int num_points)
Fills the cubature rule structure.
static constexpr int min_points
this rule has at least 1 point
static constexpr int max_points
this rule has at most 7 points
Scalar Cubature Rule class template.
Definition: rule.hpp:39
String class implementation.
Definition: string.hpp:47
FEAT namespace.
Definition: adjactor.hpp:12