Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
P1qd.cc
Go to the documentation of this file.
1// file automatically generated by "../../../rheolef/fem/lib/basis_symbolic_cxx.cc"
22#include "P1qd.h"
23#include "piola_fem_lagrange.h"
24namespace rheolef {
25using namespace std;
26template<class T>
27class basis_P1qd_q {
28public:
29 typedef basis_rep<T> base;
30 typedef typename base::size_type size_type;
31 static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
32 static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
33 static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
34};
35template<class T>
36class basis_P1qd_H {
37public:
38 typedef basis_rep<T> base;
39 typedef typename base::size_type size_type;
40 static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
41 static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
42 static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
43};
44template<class T>
45void
46basis_P1qd_q<T>::evaluate (
47 const point_basic<T>& hat_x,
48 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
49{
50 values.resize(3);
51 values[0] = hat_x[1]+5.0000000000000000e-01;
52 values[1] = -hat_x[1]+hat_x[0];
53 values[2] = -hat_x[0]+5.0000000000000000e-01;
54}
55template<class T>
56void
57basis_P1qd_q<T>::grad_evaluate (
58 const point_basic<T>& hat_x,
59 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
60{
61 values.resize(3);
62 values[0][0] = 0.0;
63 values[0][1] = 1.0;
64 values[1][0] = 1.0;
65 values[1][1] = -1.0000000000000000e+00;
66 values[2][0] = -1.0000000000000000e+00;
67 values[2][1] = 0.0;
68}
69template<class T>
70void
71basis_P1qd_q<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
72{
73 x.resize(3);
74 x[0] = point_basic<T>(5.0000000000000000e-01, 5.0000000000000000e-01);
75 x[1] = point_basic<T>(5.0000000000000000e-01, -5.0000000000000000e-01);
76 x[2] = point_basic<T>(-5.0000000000000000e-01, -5.0000000000000000e-01);
77}
78template<class T>
79void
80basis_P1qd_H<T>::evaluate (
81 const point_basic<T>& hat_x,
82 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
83{
84 values.resize(4);
85 values[0] = hat_x[2]+5.0000000000000000e-01;
86 values[1] = -hat_x[2]+hat_x[1];
87 values[2] = hat_x[0]-hat_x[1];
88 values[3] = -hat_x[0]+5.0000000000000000e-01;
89}
90template<class T>
91void
92basis_P1qd_H<T>::grad_evaluate (
93 const point_basic<T>& hat_x,
94 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
95{
96 values.resize(4);
97 values[0][0] = 0.0;
98 values[0][1] = 0.0;
99 values[0][2] = 1.0;
100 values[1][0] = 0.0;
101 values[1][1] = 1.0;
102 values[1][2] = -1.0000000000000000e+00;
103 values[2][0] = 1.0;
104 values[2][1] = -1.0000000000000000e+00;
105 values[2][2] = 0.0;
106 values[3][0] = -1.0000000000000000e+00;
107 values[3][1] = 0.0;
108 values[3][2] = 0.0;
109}
110template<class T>
111void
112basis_P1qd_H<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
113{
114 x.resize(4);
115 x[0] = point_basic<T>(5.0000000000000000e-01, 5.0000000000000000e-01, 5.0000000000000000e-01);
116 x[1] = point_basic<T>(5.0000000000000000e-01, 5.0000000000000000e-01, -5.0000000000000000e-01);
117 x[2] = point_basic<T>(5.0000000000000000e-01, -5.0000000000000000e-01, -5.0000000000000000e-01);
118 x[3] = point_basic<T>(-5.0000000000000000e-01, -5.0000000000000000e-01, -5.0000000000000000e-01);
119}
120template<class T>
122 : base(basis_option()), _hat_node()
123{
124 base::_sopt.set_continuous(false);
126 base::_name = "P1qd";
127 base::_piola_fem.piola_fem<T>::base::operator= (new_macro(piola_fem_lagrange<T>));
128}
129template<class T>
133template<class T>
136{
137 return 1;
138}
139template<class T>
140void
142 reference_element hat_K,
143 const point_basic<T>& hat_x,
144 Eigen::Matrix<T,Eigen::Dynamic,1>& values) const
145{
146 switch (hat_K.variant()) {
148 return basis_P1qd_q<T>::evaluate (hat_x, values);
149 }
151 return basis_P1qd_H<T>::evaluate (hat_x, values);
152 }
153 default : {
154 error_macro ("evaluate: unsupported `" << hat_K.name() << "' element type");
155 }
156 }
157}
158template<class T>
159void
161 reference_element hat_K,
162 const point_basic<T>& hat_x,
163 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values) const
164{
165 switch (hat_K.variant()) {
167 return basis_P1qd_q<T>::grad_evaluate (hat_x, values);
168 }
170 return basis_P1qd_H<T>::grad_evaluate (hat_x, values);
171 }
172 default : {
173 error_macro ("grad_evaluate: unsupported `" << hat_K.name() << "' element type");
174 }
175 }
176}
177template<class T>
178void
180 reference_element hat_K,
181 const Eigen::Matrix<T,Eigen::Dynamic,1>& f_xnod,
182 Eigen::Matrix<T,Eigen::Dynamic,1>& dof) const
183{
184 dof = f_xnod;
185}
186template<class T>
187void
189{
190 fatal_macro("::_initialize_cstor_sizes: not yet"); /* TODO */
191}
192template<class T>
193void
195 reference_element hat_K) const
196{
197 switch (hat_K.variant()) {
199 return basis_P1qd_q<T>::hat_node (_hat_node[hat_K.variant()]);
200 }
202 return basis_P1qd_H<T>::hat_node (_hat_node[hat_K.variant()]);
203 }
204 default : {
205 error_macro ("hat_node: unsupported `" << hat_K.name() << "' element type");
206 }
207 }
208}
209// instantiation in library:
210template class basis_P1qd<Float>;
211} // namespace rheolef
field::size_type size_type
Definition branch.cc:430
basis_rep< T > base
Definition P1qd.h:31
base::size_type size_type
Definition P1qd.h:32
void _initialize_cstor_sizes() const
Definition P1qd.cc:188
void _compute_dofs(reference_element hat_K, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &f_xnod, Eigen::Matrix< T, Eigen::Dynamic, 1 > &dof) const
Definition P1qd.cc:179
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &values) const
Definition P1qd.cc:141
size_type degree() const
Definition P1qd.cc:135
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &values) const
Definition P1qd.cc:160
void _initialize_data(reference_element hat_K) const
Definition P1qd.cc:194
see the basis_option page for the full documentation
see the reference_element page for the full documentation
static const variant_type H
static const variant_type q
variant_type variant() const
#define error_macro(message)
Definition dis_macros.h:49
#define fatal_macro(message)
Definition dis_macros.h:33
Expr1::float_type T
Definition field_expr.h:230
This file is part of Rheolef.
void evaluate(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
STL namespace.