FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
gauss_lobatto_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#include <kernel/util/math.hpp>
11
12namespace FEAT
13{
14 namespace Cubature
15 {
16 namespace Scalar
17 {
27 public DriverBase
28 {
29 public:
31 static constexpr bool variadic = true;
33 static constexpr int min_points = 3;
35 static constexpr int max_points = 6;
36
38 static String name()
39 {
40 return "gauss-lobatto";
41 }
42
52 template<
53 typename Weight_,
54 typename Coord_>
55 static void fill(Rule<Weight_, Coord_>& rule, int num_points)
56 {
57 // how many points do we have?
58 switch(num_points)
59 {
60 case 3:
61 rule.get_coord(0) = -Coord_(1);
62 rule.get_coord(1) = Coord_(0);
63 rule.get_coord(2) = Coord_(1);
64
65 rule.get_weight(0) = Weight_(1) / Weight_(3);
66 rule.get_weight(1) = Weight_(4) / Weight_(3);
67 rule.get_weight(2) = Weight_(1) / Weight_(3);
68 break;
69
70 case 4:
71 rule.get_coord(0) = -Coord_(1);
72 rule.get_coord(1) = -Math::sqrt(Coord_(5)) / Coord_(5);
73 rule.get_coord(2) = +Math::sqrt(Coord_(5)) / Coord_(5);
74 rule.get_coord(3) = +Coord_(1);
75
76 rule.get_weight(0) = Weight_(1) / Weight_(6);
77 rule.get_weight(1) = Weight_(5) / Weight_(6);
78 rule.get_weight(2) = Weight_(5) / Weight_(6);
79 rule.get_weight(3) = Weight_(1) / Weight_(6);
80 break;
81
82 case 5:
83 rule.get_coord(0) = -Coord_(1);
84 rule.get_coord(1) = -Math::sqrt(Coord_(21)) / Coord_(7);
85 rule.get_coord(2) = Coord_(0);
86 rule.get_coord(3) = +Math::sqrt(Coord_(21)) / Coord_(7);
87 rule.get_coord(4) = +Coord_(1);
88
89 rule.get_weight(0) = Weight_(1) / Weight_(10);
90 rule.get_weight(1) = Weight_(49) / Weight_(90);
91 rule.get_weight(2) = Weight_(32) / Weight_(45);
92 rule.get_weight(3) = Weight_(49) / Weight_(90);
93 rule.get_weight(4) = Weight_(1) / Weight_(10);
94 break;
95
96 case 6:
97 rule.get_coord(0) = -Coord_(1);
98 rule.get_coord(1) = -Math::sqrt((Coord_(7) + Math::sqrt(Coord_(28)))/ Coord_(21));
99 rule.get_coord(2) = -Math::sqrt((Coord_(7) - Math::sqrt(Coord_(28)))/ Coord_(21));
100 rule.get_coord(3) = Math::sqrt((Coord_(7) - Math::sqrt(Coord_(28)))/ Coord_(21));
101 rule.get_coord(4) = Math::sqrt((Coord_(7) + Math::sqrt(Coord_(28)))/ Coord_(21));
102 rule.get_coord(5) = Coord_(1);
103
104
105 rule.get_weight(0) = Weight_(1) / Weight_(15);
106 rule.get_weight(1) = (Weight_(14) - Math::sqrt(Weight_(7))) / Weight_(30);
107 rule.get_weight(2) = (Weight_(14) + Math::sqrt(Weight_(7))) / Weight_(30);
108 rule.get_weight(3) = (Weight_(14) + Math::sqrt(Weight_(7))) / Weight_(30);
109 rule.get_weight(4) = (Weight_(14) - Math::sqrt(Weight_(7))) / Weight_(30);
110 rule.get_weight(5) = Weight_(1) / Weight_(15);
111 break;
112 }
113 }
114 }; // class GaussLobattoDriver<...>
115 } // namespace Scalar
116 } // namespace Cubature
117} // namespace FEAT
Scalar cubature driver base class.
Definition: driver_base.hpp:23
Gauss-Lobatto Rule driver class template.
static String name()
Returns the name of the cubature rule.
static constexpr int max_points
this rule has at most 6 points
static constexpr bool variadic
this rule is variadic
static constexpr int min_points
this rule has at least 3 points
static void fill(Rule< Weight_, Coord_ > &rule, int num_points)
Fills the cubature rule structure.
Scalar Cubature Rule class template.
Definition: rule.hpp:39
String class implementation.
Definition: string.hpp:46
T_ sqrt(T_ x)
Returns the square-root of a value.
Definition: math.hpp:300
FEAT namespace.
Definition: adjactor.hpp:12