30 typedef const fem<bgeot::polynomial_composite> *
ppolycompfem;
32 static pfem composite_fe_method(
const bgeot::mesh_precomposite &mp,
33 const mesh_fem &mf, bgeot::pconvex_ref cr) {
35 GMM_ASSERT1(!mf.is_reduced(),
36 "Sorry, does not work for reduced mesh_fems");
37 auto p = std::make_shared<fem<bgeot::polynomial_composite>>();
38 p->mref_convex() = cr;
39 p->dim() = cr->structure()->dim();
40 p->is_polynomialcomp() = p->is_equivalent() = p->is_standard() =
true;
41 p->is_polynomial() =
false;
42 p->is_lagrange() =
true;
43 p->estimated_degree() = 0;
46 std::vector<bgeot::polynomial_composite> base(mf.nb_basic_dof());
47 std::fill(base.begin(), base.end(), bgeot::polynomial_composite(mp));
48 std::vector<pdof_description> dofd(mf.nb_basic_dof());
50 for (dal::bv_visitor cv(mf.convex_index()); !cv.finished(); ++cv) {
51 pfem pf1 = mf.fem_of_element(cv);
52 if (!pf1->is_lagrange()) p->is_lagrange() =
false;
53 if (!(pf1->is_equivalent() && pf1->is_polynomial())) {
54 GMM_ASSERT1(
false,
"Only for polynomial and equivalent fem.");
57 p->estimated_degree() = std::max(p->estimated_degree(),
58 pf->estimated_degree());
59 for (
size_type k = 0; k < pf->nb_dof(cv); ++k) {
60 size_type igl = mf.ind_basic_dof_of_element(cv)[k];
61 base_poly fu = pf->base()[k];
62 base[igl].set_poly_of_subelt(cv, fu);
63 dofd[igl] = pf->dof_types()[k];
66 p->base().resize(mf.nb_basic_dof());
67 for (
size_type k = 0; k < mf.nb_basic_dof(); ++k) {
68 p->add_node(dofd[k], mf.point_of_basic_dof(k));
69 p->base()[k] = base[k];
74 typedef dal::naming_system<virtual_fem>::param_list fem_param_list;
76 pfem structured_composite_fem_method(fem_param_list ¶ms,
77 std::vector<dal::pstatic_stored_object> &dependencies) {
78 GMM_ASSERT1(params.size() == 2,
"Bad number of parameters : " 79 << params.size() <<
" should be 2.");
80 GMM_ASSERT1(params[0].type() == 1 && params[1].type() == 0,
81 "Bad type of parameters");
82 pfem pf = params[0].method();
83 int k = int(::floor(params[1].num() + 0.01));
84 GMM_ASSERT1(((pf->is_polynomial()) || !(pf->is_equivalent())) && k > 0
85 && k <= 150 && double(k) == params[1].num(),
"Bad parameters");
86 bgeot::pbasic_mesh pm;
87 bgeot::pmesh_precomposite pmp;
93 mf.set_finite_element(pm->convex_index(), pf);
94 pfem p = composite_fe_method(*pmp, mf, pf->ref_convex(0));
95 dependencies.push_back(p->ref_convex(0));
96 dependencies.push_back(p->node_tab(0));
100 pfem PK_composite_hierarch_fem(fem_param_list ¶ms,
101 std::vector<dal::pstatic_stored_object> &) {
102 GMM_ASSERT1(params.size() == 3,
"Bad number of parameters : " 103 << params.size() <<
" should be 3.");
104 GMM_ASSERT1(params[0].type() == 0 && params[1].type() == 0 &&
105 params[2].type() == 0,
"Bad type of parameters");
106 int n = int(::floor(params[0].num() + 0.01));
107 int k = int(::floor(params[1].num() + 0.01));
108 int s = int(::floor(params[2].num() + 0.01)), t;
109 GMM_ASSERT1(n > 0 && n < 100 && k > 0 && k <= 150 && s > 0 && s <= 150 &&
110 (!(s & 1) || (s == 1)) &&
double(s) == params[2].num() &&
111 double(n) == params[0].num() &&
double(k) == params[1].num(),
113 std::stringstream name;
115 name <<
"FEM_STRUCTURED_COMPOSITE(FEM_PK(" << n <<
"," << k <<
"),1)";
117 for (t = 2; t <= s; ++t)
if ((s % t) == 0)
break;
118 name <<
"FEM_GEN_HIERARCHICAL(FEM_PK_HIERARCHICAL_COMPOSITE(" << n
119 <<
"," << k <<
"," << s/t <<
"), FEM_STRUCTURED_COMPOSITE(FEM_PK(" 120 << n <<
"," << k <<
")," << s <<
"))";
125 pfem PK_composite_full_hierarch_fem(fem_param_list ¶ms,
126 std::vector<dal::pstatic_stored_object> &) {
127 GMM_ASSERT1(params.size() == 3,
"Bad number of parameters : " 128 << params.size() <<
" should be 3.");
129 GMM_ASSERT1(params[0].type() == 0 && params[1].type() == 0 &&
130 params[2].type() == 0,
"Bad type of parameters");
131 int n = int(::floor(params[0].num() + 0.01));
132 int k = int(::floor(params[1].num() + 0.01));
133 int s = int(::floor(params[2].num() + 0.01)), t;
134 GMM_ASSERT1(n > 0 && n < 100 && k > 0 && k <= 150 && s > 0 && s <= 150 &&
135 (!(s & 1) || (s == 1)) &&
double(s) == params[2].num() &&
136 double(n) == params[0].num() &&
double(k) == params[1].num(),
138 std::stringstream name;
140 name <<
"FEM_STRUCTURED_COMPOSITE(FEM_PK_HIERARCHICAL(" << n <<
"," 143 for (t = 2; t <= s; ++t)
if ((s % t) == 0)
break;
144 name <<
"FEM_GEN_HIERARCHICAL(FEM_PK_FULL_HIERARCHICAL_COMPOSITE(" << n
145 <<
"," << k <<
"," << s/t
146 <<
"), FEM_STRUCTURED_COMPOSITE(FEM_PK_HIERARCHICAL(" 147 << n <<
"," << k <<
")," << s <<
"))";
157 struct P1bubbletriangle__ :
public fem<bgeot::polynomial_composite> {
159 bgeot::mesh_precomposite mp;
160 P1bubbletriangle__(
void);
163 P1bubbletriangle__::P1bubbletriangle__(
void) {
166 size_type i0 = m.add_point(base_node(1.0/3.0, 1.0/3.0));
167 size_type i1 = m.add_point(base_node(0.0, 0.0));
168 size_type i2 = m.add_point(base_node(1.0, 0.0));
169 size_type i3 = m.add_point(base_node(0.0, 1.0));
170 m.add_triangle(i0, i2, i3);
171 m.add_triangle(i0, i3, i1);
172 m.add_triangle(i0, i1, i2);
173 mp = bgeot::mesh_precomposite(m);
175 std::stringstream s(
"1-x-y;1-x-y;1-x-y;x;x;x;y;y;y;3-3*x-3*y;3*x;3*y;");
179 dim() = cr->structure()->dim();
180 is_polynomialcomp() =
true;
181 is_equivalent() =
true;
184 is_standard() =
true;
185 estimated_degree() = 3;
188 base()=std::vector<bgeot::polynomial_composite>
189 (4, bgeot::polynomial_composite(mp,
false));
195 base_node pt(0.0, 0.0);
196 if (i) pt[i-1] = 1.0;
200 add_node(bubble1_dof(2), base_node(1.0/3.0, 1.0/3.0));
204 pfem P1bubbletriangle_fem
205 (fem_param_list ¶ms,
206 std::vector<dal::pstatic_stored_object> &dependencies) {
207 GMM_ASSERT1(params.size() == 0,
"Bad number of parameters : " 208 << params.size() <<
" should be 0.");
209 pfem p = std::make_shared<P1bubbletriangle__>();
210 dependencies.push_back(p->ref_convex(0));
211 dependencies.push_back(p->node_tab(0));
219 struct HCT_triangle__ :
public fem<bgeot::polynomial_composite> {
220 virtual void mat_trans(base_matrix &M,
const base_matrix &G,
224 mutable bgeot::mesh_precomposite mp;
225 mutable bgeot::pgeotrans_precomp pgp;
226 mutable pfem_precomp pfp;
228 mutable base_matrix K;
230 HCT_triangle__(
void);
233 void HCT_triangle__::mat_trans(base_matrix &M,
const base_matrix &G,
236 dim_type N = dim_type(G.nrows());
238 GMM_ASSERT1(N == 2,
"Sorry, this version of HCT " 239 "element works only on dimension two.");
240 if (pgt != pgt_stored) {
242 pgp = bgeot::geotrans_precomp(pgt, node_tab(0), 0);
243 pfp =
fem_precomp(std::make_shared<HCT_triangle__>(), node_tab(0), 0);
245 gmm::copy(gmm::identity_matrix(), M);
247 gmm::mult(G, pgp->grad(0), K);
249 if (i && !(pgt->is_linear())) gmm::mult(G, pgp->grad(3*i), K);
250 gmm::copy(K, gmm::sub_matrix(M, gmm::sub_interval(1+3*i, 2)));
254 static base_matrix W(3, 12);
255 base_small_vector norient(M_PI, M_PI * M_PI);
256 if (pgt->is_linear()) gmm::lu_inverse(K);
257 for (
unsigned i = 9; i < 12; ++i) {
258 if (!(pgt->is_linear()))
259 { gmm::mult(G, pgp->grad(i), K); gmm::lu_inverse(K); }
261 gmm::mult(gmm::transposed(K), cvr->normals()[i-9], n);
264 scalar_type ps = gmm::vect_sp(n, norient);
265 if (ps < 0) n *= scalar_type(-1);
266 true_normals[i-9] = n;
268 if (gmm::abs(ps) < 1E-8)
269 GMM_WARNING2(
"HCT_triangle : " 270 "The normal orientation may be not correct");
272 const bgeot::base_tensor &t = pfp->grad(i);
274 for (
unsigned j = 0; j < 12; ++j)
275 W(i-9, j) = t(j, 0, 0) * v[0] + t(j, 0, 1) * v[1];
278 static base_matrix A(3, 3);
279 static bgeot::base_vector w(3), coeff(3);
280 static gmm::sub_interval SUBI(9, 3), SUBJ(0, 3);
281 gmm::copy(gmm::sub_matrix(W, SUBJ, SUBI), A);
283 gmm::copy(gmm::transposed(A), gmm::sub_matrix(M, SUBI));
285 for (
unsigned j = 0; j < 9; ++j) {
286 gmm::mult(W, gmm::mat_row(M, j), w);
287 gmm::mult(A, gmm::scaled(w, -1.0), coeff);
288 gmm::copy(coeff, gmm::sub_vector(gmm::mat_row(M, j), SUBI));
292 HCT_triangle__::HCT_triangle__(
void) : pgt_stored(0), K(2, 2) {
295 size_type i0 = m.add_point(base_node(1.0/3.0, 1.0/3.0));
296 size_type i1 = m.add_point(base_node(0.0, 0.0));
297 size_type i2 = m.add_point(base_node(1.0, 0.0));
298 size_type i3 = m.add_point(base_node(0.0, 1.0));
299 m.add_triangle(i0, i2, i3);
300 m.add_triangle(i0, i3, i1);
301 m.add_triangle(i0, i1, i2);
302 mp = bgeot::mesh_precomposite(m);
306 (
"-1 + 9*x + 9*y - 15*x^2 - 30*x*y - 15*y^2 + 7*x^3 + 21*x^2*y + 21*x*y^2 + 7*y^3;" 307 "1 - 3*x^2 - 3*y^2 + 3*x^3 - 3*x^2*y + 2*y^3;" 308 "1 - 3*x^2 - 3*y^2 + 2*x^3 - 3*x*y^2 + 3*y^3;" 309 "-1/6 + 5/2*x - 9/2*x^2 - 4*x*y + 1/2*y^2 + 13/6*x^3 + 4*x^2*y + 3/2*x*y^2 - 1/3*y^3;" 310 "x - 1/2*x^2 - 3*x*y - 7/6*x^3 + 2*x^2*y + 2*x*y^2;" 311 "x - 2*x^2 - 3/2*y^2 + x^3 - 1/2*x*y^2 + 7/3*y^3;" 312 "-1/6 + 5/2*y + 1/2*x^2 - 4*x*y - 9/2*y^2 - 1/3*x^3 + 3/2*x^2*y + 4*x*y^2 + 13/6*y^3;" 313 "y - 3/2*x^2 - 2*y^2 + 7/3*x^3 - 1/2*x^2*y + y^3;" 314 "y - 3*x*y - 1/2*y^2 + 2*x^2*y + 2*x*y^2 - 7/6*y^3;" 315 "1 - 9/2*x - 9/2*y + 9*x^2 + 15*x*y + 6*y^2 - 9/2*x^3 - 21/2*x^2*y - 21/2*x*y^2 - 5/2*y^3;" 316 "3*x^2 - 5/2*x^3 + 3/2*x^2*y;" 317 "3*x^2 - 2*x^3 + 3/2*x*y^2 - 1/2*y^3;" 318 "-1/6 + 3/4*x + 3/4*y - 2*x^2 - 5/2*x*y - y^2 + 17/12*x^3 + 7/4*x^2*y + 7/4*x*y^2 + 5/12*y^3;" 319 "-x^2 + 13/12*x^3 - 1/4*x^2*y;" 320 "-x^2 + x^3 - 1/4*x*y^2 + 1/12*y^3;" 321 "2/3 - 13/4*x - 11/4*y + 9/2*x^2 + 19/2*x*y + 7/2*y^2 - 23/12*x^3 - 23/4*x^2*y - 25/4*x*y^2 - 17/12*y^3;" 322 "-1/2*x^2 + 5/12*x^3 + 9/4*x^2*y;" 323 "-x*y + 1/2*y^2 + 2*x^2*y + 7/4*x*y^2 - 13/12*y^3;" 324 "1 - 9/2*x - 9/2*y + 6*x^2 + 15*x*y + 9*y^2 - 5/2*x^3 - 21/2*x^2*y - 21/2*x*y^2 - 9/2*y^3;" 325 "3*y^2 - 1/2*x^3 + 3/2*x^2*y - 2*y^3;" 326 "3*y^2 + 3/2*x*y^2 - 5/2*y^3;" 327 "2/3 - 11/4*x - 13/4*y + 7/2*x^2 + 19/2*x*y + 9/2*y^2 - 17/12*x^3 - 25/4*x^2*y - 23/4*x*y^2 - 23/12*y^3;" 328 "1/2*x^2 - x*y - 13/12*x^3 + 7/4*x^2*y + 2*x*y^2;" 329 "-1/2*y^2 + 9/4*x*y^2 + 5/12*y^3;" 330 "-1/6 + 3/4*x + 3/4*y - x^2 - 5/2*x*y - 2*y^2 + 5/12*x^3 + 7/4*x^2*y + 7/4*x*y^2 + 17/12*y^3;" 331 "-y^2 + 1/12*x^3 - 1/4*x^2*y + y^3;" 332 "-y^2 - 1/4*x*y^2 + 13/12*y^3;" 333 "-sqrt(2)*2/3 + sqrt(2)*3*x + sqrt(2)*3*y - sqrt(2)*4*x^2 - sqrt(2)*10*x*y - sqrt(2)*4*y^2 + sqrt(2)*5/3*x^3 + sqrt(2)*7*x^2*y + sqrt(2)*7*x*y^2 + sqrt(2)*5/3*y^3;" 334 "sqrt(2)*1/3*x^3 - sqrt(2)*x^2*y;" 335 "-sqrt(2)*x*y^2 + sqrt(2)*1/3*y^3;" 336 "2/3 - 2*x - 4*y + 2*x^2 + 8*x*y + 6*y^2 - 2/3*x^3 - 4*x^2*y - 6*x*y^2 - 8/3*y^3;" 337 "2*x^2 - 4*x*y - 10/3*x^3 + 4*x^2*y + 4*x*y^2;" 338 "-2*y^2 + 2*x*y^2 + 8/3*y^3;" 339 "2/3 - 4*x - 2*y + 6*x^2 + 8*x*y + 2*y^2 - 8/3*x^3 - 6*x^2*y - 4*x*y^2 - 2/3*y^3;" 340 "-2*x^2 + 8/3*x^3 + 2*x^2*y;" 341 "-4*x*y + 2*y^2 + 4*x^2*y + 4*x*y^2 - 10/3*y^3;");
345 dim() = cr->structure()->dim();
346 is_polynomialcomp() =
true;
347 is_equivalent() =
false;
348 is_polynomial() =
false;
349 is_lagrange() =
false;
350 is_standard() =
false;
351 estimated_degree() = 5;
354 base()=std::vector<bgeot::polynomial_composite>
355 (12, bgeot::polynomial_composite(mp,
false));
361 base_node pt(0.0, 0.0);
362 if (i) pt[i-1] = 1.0;
373 pfem HCT_triangle_fem
374 (fem_param_list ¶ms,
375 std::vector<dal::pstatic_stored_object> &dependencies) {
376 GMM_ASSERT1(params.size() == 0,
"Bad number of parameters : " 377 << params.size() <<
" should be 0.");
378 pfem p = std::make_shared<HCT_triangle__>();
379 dependencies.push_back(p->ref_convex(0));
380 dependencies.push_back(p->node_tab(0));
389 struct reduced_HCT_triangle__ :
public fem<bgeot::polynomial_composite> {
390 const HCT_triangle__ *HCT;
391 virtual void mat_trans(base_matrix &M,
const base_matrix &G,
394 mutable base_matrix P, Mhct;
395 reduced_HCT_triangle__(
void);
398 void reduced_HCT_triangle__::mat_trans(base_matrix &M,
const base_matrix &G,
400 HCT->mat_trans(Mhct, G, pgt);
402 P(10, 1)=HCT->true_normals[1][0]*0.5; P(11, 1)=HCT->true_normals[2][0]*0.5;
403 P(10, 2)=HCT->true_normals[1][1]*0.5; P(11, 2)=HCT->true_normals[2][1]*0.5;
405 P( 9, 4)=HCT->true_normals[0][0]*0.5; P(11, 4)=HCT->true_normals[2][0]*0.5;
406 P( 9, 5)=HCT->true_normals[0][1]*0.5; P(11, 5)=HCT->true_normals[2][1]*0.5;
408 P( 9, 7)=HCT->true_normals[0][0]*0.5; P(10, 7)=HCT->true_normals[1][0]*0.5;
409 P( 9, 8)=HCT->true_normals[0][1]*0.5; P(10, 8)=HCT->true_normals[1][1]*0.5;
411 gmm::mult(gmm::transposed(P), Mhct, M);
414 reduced_HCT_triangle__::reduced_HCT_triangle__(
void)
415 : P(12, 9), Mhct(12, 12) {
416 HCT =
dynamic_cast<const HCT_triangle__ *
> 421 dim() = cr->structure()->dim();
422 is_polynomialcomp() =
true;
423 is_equivalent() =
false;
424 is_polynomial() =
false;
425 is_lagrange() =
false;
426 is_standard() =
false;
427 estimated_degree() = 5;
428 base() = HCT->base();
430 gmm::copy(gmm::identity_matrix(), P);
434 base_node pt(0.0, 0.0);
435 if (i) pt[i-1] = 1.0;
443 pfem reduced_HCT_triangle_fem
444 (fem_param_list ¶ms,
445 std::vector<dal::pstatic_stored_object> &dependencies) {
446 GMM_ASSERT1(params.size() == 0,
"Bad number of parameters : " 447 << params.size() <<
" should be 0.");
448 pfem p = std::make_shared<reduced_HCT_triangle__>();
449 dependencies.push_back(p->ref_convex(0));
450 dependencies.push_back(p->node_tab(0));
459 struct quadc1p3__ :
public fem<bgeot::polynomial_composite> {
460 virtual void mat_trans(base_matrix &M,
const base_matrix &G,
463 mutable bgeot::mesh_precomposite mp;
464 mutable bgeot::pgeotrans_precomp pgp;
465 mutable pfem_precomp pfp;
467 mutable base_matrix K;
472 void quadc1p3__::mat_trans(base_matrix &M,
const base_matrix &G,
475 dim_type N = dim_type(G.nrows());
477 GMM_ASSERT1(N == 2,
"Sorry, this version of reduced HCT " 478 "element works only on dimension two.");
479 if (pgt != pgt_stored) {
481 pgp = bgeot::geotrans_precomp(pgt, node_tab(0), 0);
482 pfp =
fem_precomp(std::make_shared<quadc1p3__>(), node_tab(0), 0);
484 gmm::copy(gmm::identity_matrix(), M);
486 gmm::mult(G, pgp->grad(0), K);
488 if (i && !(pgt->is_linear())) gmm::mult(G, pgp->grad(3*i), K);
489 gmm::copy(K, gmm::sub_matrix(M, gmm::sub_interval(1+3*i, 2)));
493 static base_matrix W(4, 16);
494 base_small_vector norient(M_PI, M_PI * M_PI);
495 if (pgt->is_linear()) gmm::lu_inverse(K);
496 for (
unsigned i = 12; i < 16; ++i) {
497 if (!(pgt->is_linear()))
498 { gmm::mult(G, pgp->grad(i), K); gmm::lu_inverse(K); }
500 gmm::mult(gmm::transposed(K), cvr->normals()[i-12], n);
503 scalar_type ps = gmm::vect_sp(n, norient);
504 if (ps < 0) n *= scalar_type(-1);
505 true_normals[i-12] = n;
506 if (gmm::abs(ps) < 1E-8)
507 GMM_WARNING2(
"FVS_quadrilateral : " 508 "The normal orientation may be not correct");
510 const bgeot::base_tensor &t = pfp->grad(i);
511 for (
unsigned j = 0; j < 16; ++j)
512 W(i-12, j) = t(j, 0, 0) * v[0] + t(j, 0, 1) * v[1];
515 static base_matrix A(4, 4);
516 static bgeot::base_vector w(4), coeff(4);
517 static gmm::sub_interval SUBI(12, 4), SUBJ(0, 4);
518 gmm::copy(gmm::sub_matrix(W, SUBJ, SUBI), A);
520 gmm::copy(gmm::transposed(A), gmm::sub_matrix(M, SUBI));
522 for (
unsigned j = 0; j < 12; ++j) {
523 gmm::mult(W, gmm::mat_row(M, j), w);
524 gmm::mult(A, gmm::scaled(w, -1.0), coeff);
525 gmm::copy(coeff, gmm::sub_vector(gmm::mat_row(M, j), SUBI));
529 quadc1p3__::quadc1p3__(
void) : pgt_stored(0), K(2, 2) {
532 size_type i0 = m.add_point(base_node(0.0, 0.0));
533 size_type i1 = m.add_point(base_node(1.0, 0.0));
534 size_type i2 = m.add_point(base_node(0.0, 1.0));
535 size_type i3 = m.add_point(base_node(1.0, 1.0));
536 size_type i4 = m.add_point(base_node(0.5, 0.5));
537 m.add_triangle(i1, i3, i4);
538 m.add_triangle(i2, i0, i4);
539 m.add_triangle(i3, i2, i4);
540 m.add_triangle(i0, i1, i4);
541 mp = bgeot::mesh_precomposite(m);
544 (
"2 - 3*x - 3*y + 6*x*y + x^3 - 3*x^2*y;" 545 "1 - 3*x^2 - 3*y^2 + x^3 + 3*x^2*y + 2*y^3;" 546 "2 - 3*x - 3*y + 6*x*y - 3*x*y^2 + y^3;" 547 "1 - 3*x^2 - 3*y^2 + 2*x^3 + 3*x*y^2 + y^3;" 548 "1/6 + 1/2*x - y - 3/2*x^2 + 2*x*y + 5/6*x^3 - x^2*y;" 549 "x - 1/2*x^2 - 3*x*y + 1/6*x^3 + x^2*y + 2*x*y^2;" 550 "1/6 + 1/2*x - y - x*y + 3/2*y^2 + 1/2*x*y^2 - 2/3*y^3;" 551 "x - 2*x^2 - 3/2*y^2 + x^3 + 3/2*x*y^2 + 2/3*y^3;" 552 "1/6 - x + 1/2*y + 3/2*x^2 - x*y - 2/3*x^3 + 1/2*x^2*y;" 553 "y - 3/2*x^2 - 2*y^2 + 2/3*x^3 + 3/2*x^2*y + y^3;" 554 "1/6 - x + 1/2*y + 2*x*y - 3/2*y^2 - x*y^2 + 5/6*y^3;" 555 "y - 3*x*y - 1/2*y^2 + 2*x^2*y + x*y^2 + 1/6*y^3;" 556 "-1 + 3*x + 3*y - 6*x*y - 3*y^2 - x^3 + 3*x^2*y + 2*y^3;" 557 "3*x^2 - x^3 - 3*x^2*y;" 558 "-1 + 3*x + 3*y - 6*x*y - 3*y^2 + 3*x*y^2 + y^3;" 559 "3*x^2 - 2*x^3 - 3*x*y^2 + y^3;" 560 "-2/3 + 1/2*x + 2*y - x*y - 2*y^2 + 1/6*x^3 - x^2*y + 2*x*y^2;" 561 "-x^2 + 5/6*x^3 + x^2*y;" 562 "-2/3 + 1/2*x + 2*y - x*y - 2*y^2 + 1/2*x*y^2 + 2/3*y^3;" 563 "-x^2 + x^3 + 3/2*x*y^2 - 2/3*y^3;" 564 "-5/6 + x + 5/2*y + 1/2*x^2 - 3*x*y - 2*y^2 - 2/3*x^3 + 3/2*x^2*y + y^3;" 565 "-1/2*x^2 + 2/3*x^3 + 1/2*x^2*y;" 566 "-5/6 + x + 5/2*y - 2*x*y - 5/2*y^2 + x*y^2 + 5/6*y^3;" 567 "-x*y + 1/2*y^2 + 2*x^2*y - x*y^2 + 1/6*y^3;" 568 "-1 + 3*x + 3*y - 3*x^2 - 6*x*y + x^3 + 3*x^2*y;" 569 "3*y^2 + x^3 - 3*x^2*y - 2*y^3;" 570 "-1 + 3*x + 3*y - 3*x^2 - 6*x*y + 2*x^3 + 3*x*y^2 - y^3;" 571 "3*y^2 - 3*x*y^2 - y^3;" 572 "-5/6 + 5/2*x + y - 5/2*x^2 - 2*x*y + 5/6*x^3 + x^2*y;" 573 "1/2*x^2 - x*y + 1/6*x^3 - x^2*y + 2*x*y^2;" 574 "-5/6 + 5/2*x + y - 2*x^2 - 3*x*y + 1/2*y^2 + x^3 + 3/2*x*y^2 - 2/3*y^3;" 575 "-1/2*y^2 + 1/2*x*y^2 + 2/3*y^3;" 576 "-2/3 + 2*x + 1/2*y - 2*x^2 - x*y + 2/3*x^3 + 1/2*x^2*y;" 577 "-y^2 - 2/3*x^3 + 3/2*x^2*y + y^3;" 578 "-2/3 + 2*x + 1/2*y - 2*x^2 - x*y + 2*x^2*y - x*y^2 + 1/6*y^3;" 579 "-y^2 + x*y^2 + 5/6*y^3;" 580 "1 - 3*x - 3*y + 3*x^2 + 6*x*y + 3*y^2 - x^3 - 3*x^2*y - 2*y^3;" 582 "1 - 3*x - 3*y + 3*x^2 + 6*x*y + 3*y^2 - 2*x^3 - 3*x*y^2 - y^3;" 584 "-2/3 + 3/2*x + 2*y - x^2 - 3*x*y - 2*y^2 + 1/6*x^3 + x^2*y + 2*x*y^2;" 586 "-2/3 + 3/2*x + 2*y - x^2 - 3*x*y - 2*y^2 + x^3 + 3/2*x*y^2 + 2/3*y^3;" 587 "1/2*x*y^2 - 2/3*y^3;" 588 "-2/3 + 2*x + 3/2*y - 2*x^2 - 3*x*y - y^2 + 2/3*x^3 + 3/2*x^2*y + y^3;" 589 "-2/3*x^3 + 1/2*x^2*y;" 590 "-2/3 + 2*x + 3/2*y - 2*x^2 - 3*x*y - y^2 + 2*x^2*y + x*y^2 + 1/6*y^3;" 592 "4/3 - 2*x - 4*y + 4*x*y + 4*y^2 + 2/3*x^3 - 4*x*y^2;" 594 "4/3 - 2*x - 4*y + 4*x*y + 4*y^2 - 2*x*y^2 - 4/3*y^3;" 595 "-2*x*y^2 + 4/3*y^3;" 596 "-2/3 + 2*x - 2*x^2 + 2/3*x^3;" 597 "2*x^2 - 4*x*y - 2/3*x^3 + 4*x*y^2;" 598 "-2/3 + 2*x - 4*x*y + 2*y^2 + 2*x*y^2 - 4/3*y^3;" 599 "-2*y^2 + 2*x*y^2 + 4/3*y^3;" 600 "4/3 - 4*x - 2*y + 4*x^2 + 4*x*y - 4/3*x^3 - 2*x^2*y;" 602 "4/3 - 4*x - 2*y + 4*x^2 + 4*x*y - 4*x^2*y + 2/3*y^3;" 604 "-2/3 + 2*y + 2*x^2 - 4*x*y - 4/3*x^3 + 2*x^2*y;" 605 "-2*x^2 + 4/3*x^3 + 2*x^2*y;" 606 "-2/3 + 2*y - 2*y^2 + 2/3*y^3;" 607 "-4*x*y + 2*y^2 + 4*x^2*y - 2/3*y^3;");
611 dim() = cr->structure()->dim();
612 is_polynomialcomp() =
true;
613 is_equivalent() =
false;
614 is_polynomial() =
false;
615 is_lagrange() =
false;
616 is_standard() =
false;
617 estimated_degree() = 5;
620 base()=std::vector<bgeot::polynomial_composite>
621 (16, bgeot::polynomial_composite(mp,
false));
627 base_node pt(0.0, 0.0);
628 if (i & 1) pt[0] = 1.0;
629 if (i & 2) pt[1] = 1.0;
643 (fem_param_list ¶ms,
644 std::vector<dal::pstatic_stored_object> &dependencies) {
645 GMM_ASSERT1(params.size() == 0,
"Bad number of parameters : " 646 << params.size() <<
" should be 0.");
647 pfem p = std::make_shared<quadc1p3__>();
648 dependencies.push_back(p->ref_convex(0));
649 dependencies.push_back(p->node_tab(0));
657 struct reduced_quadc1p3__ :
public fem<bgeot::polynomial_composite> {
658 const quadc1p3__ *HCT;
659 virtual void mat_trans(base_matrix &M,
const base_matrix &G,
662 mutable base_matrix P, Mhct;
663 reduced_quadc1p3__(
void);
666 void reduced_quadc1p3__::mat_trans(base_matrix &M,
const base_matrix &G,
668 HCT->mat_trans(Mhct, G, pgt);
670 P(13, 1)=HCT->true_normals[1][0]*0.5; P(15, 1)=HCT->true_normals[3][0]*0.5;
671 P(13, 2)=HCT->true_normals[1][1]*0.5; P(15, 2)=HCT->true_normals[3][1]*0.5;
673 P(12, 4)=HCT->true_normals[0][0]*0.5; P(15, 4)=HCT->true_normals[3][0]*0.5;
674 P(12, 5)=HCT->true_normals[0][1]*0.5; P(15, 5)=HCT->true_normals[3][1]*0.5;
676 P(13, 7)=HCT->true_normals[1][0]*0.5; P(14, 7)=HCT->true_normals[2][0]*0.5;
677 P(13, 8)=HCT->true_normals[1][1]*0.5; P(14, 8)=HCT->true_normals[2][1]*0.5;
679 P(12,10)=HCT->true_normals[0][0]*0.5; P(14,10)=HCT->true_normals[2][0]*0.5;
680 P(12,11)=HCT->true_normals[0][1]*0.5; P(14,11)=HCT->true_normals[2][1]*0.5;
682 gmm::mult(gmm::transposed(P), Mhct, M);
685 reduced_quadc1p3__::reduced_quadc1p3__(
void)
686 : P(16, 12), Mhct(16, 16) {
687 HCT =
dynamic_cast<const quadc1p3__ *
> 692 dim() = cr->structure()->dim();
693 is_polynomialcomp() =
true;
694 is_equivalent() =
false;
695 is_polynomial() =
false;
696 is_lagrange() =
false;
697 is_standard() =
false;
698 estimated_degree() = 5;
699 base() = HCT->base();
701 gmm::copy(gmm::identity_matrix(), P);
705 base_node pt(0.0, 0.0);
706 if (i & 1) pt[0] = 1.0;
707 if (i & 2) pt[1] = 1.0;
715 pfem reduced_quadc1p3_fem
716 (fem_param_list ¶ms,
717 std::vector<dal::pstatic_stored_object> &dependencies) {
718 GMM_ASSERT1(params.size() == 0,
"Bad number of parameters : " 719 << params.size() <<
" should be 0.");
720 pfem p = std::make_shared<reduced_quadc1p3__>();
721 dependencies.push_back(p->ref_convex(0));
722 dependencies.push_back(p->node_tab(0));
base_poly read_base_poly(short_type n, std::istream &f)
read a base_poly on the stream ist.
Handle composite polynomials.
dim_type dim() const
dimension of the reference element.
pfem fem_descriptor(const std::string &name)
get a fem descriptor from its string name.
const std::vector< bgeot::polynomial_composite > & base() const
Gives the array of basic functions (components).
Define the getfem::mesh_fem class.
Integration methods (exact and approximated) on convexes.
number_traits< typename linalg_traits< V >::value_type >::magnitude_type vect_norm2(const V &v)
Euclidean norm of a vector.
size_t size_type
used as the common size type in the library
void structured_mesh_for_convex(pconvex_ref cvr, short_type k, pbasic_mesh &pm, pmesh_precomposite &pmp, bool force_simplexification)
This function returns a mesh in pm which contains a refinement of the convex cvr if force_simplexific...
pdof_description derivative_dof(dim_type d, dim_type r)
Description of a unique dof of derivative type.
void add_node(const pdof_description &d, const base_node &pt, const dal::bit_vector &faces)
internal function adding a node to an element for the creation of a finite element method...
const fem< bgeot::base_poly > * ppolyfem
Classical polynomial FEM.
GEneric Tool for Finite Element Methods.
pdof_description lagrange_dof(dim_type d)
Description of a unique dof of lagrange type (value at the node).
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
bool is_lagrange() const
true if the base functions are such that
const fem< bgeot::polynomial_composite > * ppolycompfem
Polynomial composite FEM.
gmm::uint16_type short_type
used as the common short type integer in the library
pdof_description normal_derivative_dof(dim_type d)
Description of a unique dof of normal derivative type (normal derivative at the node, regarding a face).
pfem_precomp fem_precomp(pfem pf, bgeot::pstored_point_tab pspt, dal::pstatic_stored_object dep)
Handles precomputations for FEM.
pconvex_ref parallelepiped_of_reference(dim_type nc, dim_type k)
parallelepiped of reference of dimension nc (and degree 1)
pconvex_ref simplex_of_reference(dim_type nc, short_type K)
returns a simplex of reference of dimension nc and degree k
std::shared_ptr< const bgeot::geometric_trans > pgeometric_trans
pointer type for a geometric transformation
bool is_polynomial() const
true if the base functions are polynomials