35 INTEGRATEDJACOBIPOLYNOMIAL,
37 H1TET_BERNSTEIN_BEZIER,
44 H1TRI_BERNSTEIN_BEZIER,
52 H1EDGE_BERNSTEIN_BEZIER,
61 const char *list[] = {
"legendre",
66 "h1tet_bernstein_bezier",
73 "h1tri_bernstein_bezier",
81 "h1edge_bernstein_bezier",
82 "hcurledge_ainsworth",
83 "hcurledge_demkowicz",
89 PetscInt choice_value = LEGENDREPOLYNOMIAL;
93 if (flg != PETSC_TRUE) {
102 boost::shared_ptr<MatrixDouble> base_ptr(
new MatrixDouble);
103 boost::shared_ptr<MatrixDouble> diff_base_ptr(
new MatrixDouble);
105 const double eps = 1e-3;
107 if (choice_value == LEGENDREPOLYNOMIAL) {
111 4, &diff_s, 1, base_ptr, diff_base_ptr)));
114 std::cout <<
"LegendrePolynomial\n";
115 std::cout << pts_1d << std::endl;
116 std::cout << *base_ptr << std::endl;
117 std::cout << *diff_base_ptr << std::endl;
120 std::cout << sum << std::endl;
121 std::cout << diff_sum << std::endl;
122 if (fabs(2.04688 - sum) >
eps) {
125 if (fabs(2.25 - diff_sum) >
eps) {
130 pts_1d.resize(1, 11,
false);
131 for (
int ii = 0; ii != 11; ii++) {
132 pts_1d(0, ii) = 2 * ((
double)ii / 10) - 1;
135 boost::shared_ptr<MatrixDouble> kernel_base_ptr(
new MatrixDouble);
136 boost::shared_ptr<MatrixDouble> diff_kernel_base_ptr(
new MatrixDouble);
138 if (choice_value == LOBATTOPOLYNOMIAL) {
142 7 + 2, &diff_s, 1, base_ptr, diff_base_ptr)));
147 7, &diff_s, 1, kernel_base_ptr, diff_kernel_base_ptr)));
149 for (
int ii = 0; ii != 11; ii++) {
150 double s = pts_1d(0, ii);
151 std::cerr <<
"lobatto_plot " << s <<
" " << (*base_ptr)(ii, 1) <<
" "
152 << (*diff_base_ptr)(ii, 1) <<
" " << (*kernel_base_ptr)(ii, 1)
153 <<
" " << (*diff_kernel_base_ptr)(ii, 1) <<
" "
154 << (*kernel_base_ptr)(ii, 1) * (1 - s * s) <<
" "
155 << (*kernel_base_ptr)(ii, 1) * (-2 * s) +
156 (*diff_kernel_base_ptr)(ii, 1) * (1 - s * s)
159 std::cout <<
"LobattoPolynomial\n";
160 std::cout << pts_1d << std::endl;
161 std::cout << *base_ptr << std::endl;
162 std::cout << *diff_base_ptr << std::endl;
166 std::cout << sum << std::endl;
167 std::cout << diff_sum << std::endl;
168 if (fabs(9.39466 - sum) >
eps) {
171 if (fabs(14.0774 - diff_sum) >
eps) {
177 double diff_sum =
sum_matrix(*diff_kernel_base_ptr);
178 std::cout << sum << std::endl;
179 std::cout << diff_sum << std::endl;
180 if (fabs(-13.9906 * 4 - sum) >
eps) {
183 if (fabs(-101.678 * 4 - diff_sum) >
eps) {
189 if (choice_value == JACOBIPOLYNOMIAL) {
193 pts_1d.resize(1,
n,
false);
195 for (
int ii = 0; ii !=
n; ii++) {
196 pts_1d(0, ii) = (
double)ii / (
n - 1);
201 diff_base_ptr->clear();
208 5, &diff_x, &diff_t, 1, 0, base_ptr, diff_base_ptr)));
210 for (
int ii = 0; ii !=
n; ii++) {
211 double s = pts_1d(0, ii);
212 std::cerr <<
"jacobi_plot " << s <<
" " << (*base_ptr)(ii, 4) <<
" "
213 << (*diff_base_ptr)(ii, 4) << std::endl;
215 for (
int ii = 0; ii !=
n - 1; ii++) {
216 double s = (pts_1d(0, ii) + pts_1d(0, ii + 1)) / 2;
217 std::cerr <<
"jacobi_diff_plot_fd " << s <<
" "
218 << ((*base_ptr)(ii + 1, 4) - (*base_ptr)(ii, 4)) /
222 std::cout <<
"JacobiPolynomial\n";
223 std::cout << pts_1d << std::endl;
224 std::cout << *base_ptr << std::endl;
225 std::cout << *diff_base_ptr << std::endl;
229 std::cout << sum << std::endl;
230 std::cout << diff_sum << std::endl;
231 if (fabs(23.2164 - sum) >
eps) {
234 if (fabs(167.995 - diff_sum) >
eps) {
240 if (choice_value == INTEGRATEDJACOBIPOLYNOMIAL) {
244 pts_1d.resize(1,
n,
false);
246 for (
int ii = 0; ii !=
n; ii++) {
247 pts_1d(0, ii) = (
double)ii / 20.;
248 pts_1d_t(0, ii) = 1 - pts_1d(0, ii);
252 diff_base_ptr->clear();
259 6, &diff_x, &diff_t, 1, 1, base_ptr, diff_base_ptr)));
261 for (
int ii = 0; ii !=
n; ii++) {
262 double s = pts_1d(0, ii);
263 std::cerr <<
"integrated_jacobi_plot " << s <<
" " << (
double)ii / 20.
264 <<
" " << (*base_ptr)(ii, 1) <<
" " << (*base_ptr)(ii, 2)
265 <<
" " << (*base_ptr)(ii, 3) <<
" " << (*base_ptr)(ii, 4)
266 <<
" " << (*base_ptr)(ii, 5) << endl;
270 std::cout <<
"IntegratedJacobiPolynomial\n";
271 std::cout << pts_1d << std::endl;
272 std::cout << *base_ptr << std::endl;
273 std::cout << *diff_base_ptr << std::endl;
277 std::cout << sum << std::endl;
278 std::cout << diff_sum << std::endl;
290 tet_data.spacesOnEntities[
type].set(
L2);
291 tet_data.spacesOnEntities[
type].set(
H1);
292 tet_data.spacesOnEntities[
type].set(
HDIV);
293 tet_data.spacesOnEntities[
type].set(
HCURL);
295 tet_data.dataOnEntities[MBVERTEX].resize(1);
296 tet_data.dataOnEntities[MBVERTEX][0].getOrder() = 1;
297 tet_data.dataOnEntities[MBEDGE].resize(6);
298 for (
int ee = 0; ee < 6; ee++) {
299 tet_data.dataOnEntities[MBEDGE][ee].getOrder() = 3;
300 tet_data.dataOnEntities[MBEDGE][ee].getSense() = 1;
302 tet_data.dataOnEntities[MBTRI].resize(4);
303 for (
int ff = 0; ff < 4; ff++) {
304 tet_data.dataOnEntities[MBTRI][ff].getOrder() = 4;
305 tet_data.dataOnEntities[MBTRI][ff].getSense() = 1;
307 tet_data.dataOnEntities[MBTET].resize(1);
308 tet_data.dataOnEntities[MBTET][0].getOrder() = 5;
309 tet_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().resize(4,
false);
310 std::fill(tet_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().begin(),
311 tet_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().end(), 5);
316 pts_tet.resize(3, nb_gauss_pts,
false);
317 cblas_dcopy(nb_gauss_pts, &
QUAD_3D_TABLE[tet_rule]->points[1], 4,
319 cblas_dcopy(nb_gauss_pts, &
QUAD_3D_TABLE[tet_rule]->points[2], 4,
321 cblas_dcopy(nb_gauss_pts, &
QUAD_3D_TABLE[tet_rule]->points[3], 4,
323 tet_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).resize(nb_gauss_pts, 4,
327 &*tet_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).data().begin();
328 cblas_dcopy(4 * nb_gauss_pts,
QUAD_3D_TABLE[tet_rule]->points, 1,
331 tet_data.facesNodes.resize(4, 3);
332 const int cannonical_tet_face[4][3] = {
333 {0, 1, 3}, {1, 2, 3}, {0, 3, 2}, {0, 2, 1}};
334 for (
int ff = 0; ff < 4; ff++) {
335 for (
int nn = 0; nn < 3; nn++) {
336 tet_data.facesNodes(ff, nn) = cannonical_tet_face[ff][nn];
340 if (choice_value == H1TET_AINSWORTH) {
342 tet_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).resize(nb_gauss_pts, 4,
345 &*tet_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).data().begin(),
346 &pts_tet(0, 0), &pts_tet(1, 0), &pts_tet(2, 0), nb_gauss_pts);
354 if (tet_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
355 tet_data.dataOnEntities[MBVERTEX][0]
359 "Different pointers");
362 double sum = 0, diff_sum = 0;
363 std::cout <<
"Edges\n";
364 for (
int ee = 0; ee < 6; ee++) {
365 std::cout << tet_data.dataOnEntities[MBEDGE][ee].getN(
368 std::cout << tet_data.dataOnEntities[MBEDGE][ee].getDiffN(
373 diff_sum +=
sum_matrix(tet_data.dataOnEntities[MBEDGE][ee].getDiffN(
376 std::cout <<
"Faces\n";
377 for (
int ff = 0; ff < 4; ff++) {
378 std::cout << tet_data.dataOnEntities[MBTRI][ff].getN(
381 std::cout << tet_data.dataOnEntities[MBTRI][ff].getDiffN(
386 diff_sum +=
sum_matrix(tet_data.dataOnEntities[MBTRI][ff].getDiffN(
389 std::cout <<
"Tets\n";
390 std::cout << tet_data.dataOnEntities[MBTET][0].getN(
393 std::cout << tet_data.dataOnEntities[MBTET][0].getDiffN(
400 std::cout <<
"sum " << sum << std::endl;
401 std::cout <<
"diff_sum " << diff_sum << std::endl;
402 if (fabs(1.3509 - sum) >
eps) {
405 if (fabs(0.233313 - diff_sum) >
eps) {
410 if (choice_value == H1TET_BERNSTEIN_BEZIER) {
412 tet_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).resize(nb_gauss_pts, 4,
414 CHKERR Tools::shapeFunMBTET(
415 &*tet_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).data().begin(),
416 &pts_tet(0, 0), &pts_tet(1, 0), &pts_tet(2, 0), nb_gauss_pts);
421 if (tet_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() ==
422 tet_data.dataOnEntities[MBVERTEX][0]
427 double sum = 0, diff_sum = 0;
428 std::cout <<
"Vertices\n";
429 std::cout << tet_data.dataOnEntities[MBVERTEX][0].getN(
"TEST_FIELD")
431 std::cout << tet_data.dataOnEntities[MBVERTEX][0].getDiffN(
"TEST_FIELD")
434 sum_matrix(tet_data.dataOnEntities[MBVERTEX][0].getN(
"TEST_FIELD"));
436 tet_data.dataOnEntities[MBVERTEX][0].getDiffN(
"TEST_FIELD"));
437 std::cout <<
"Edges\n";
438 for (
int ee = 0; ee < 6; ee++) {
439 std::cout << tet_data.dataOnEntities[MBEDGE][ee].getN(
"TEST_FIELD")
441 std::cout << tet_data.dataOnEntities[MBEDGE][ee].getDiffN(
"TEST_FIELD")
444 sum_matrix(tet_data.dataOnEntities[MBEDGE][ee].getN(
"TEST_FIELD"));
446 tet_data.dataOnEntities[MBEDGE][ee].getDiffN(
"TEST_FIELD"));
448 std::cout <<
"Faces\n";
449 for (
int ff = 0; ff < 4; ff++) {
450 std::cout << tet_data.dataOnEntities[MBTRI][ff].getN(
"TEST_FIELD")
452 std::cout << tet_data.dataOnEntities[MBTRI][ff].getDiffN(
"TEST_FIELD")
455 sum_matrix(tet_data.dataOnEntities[MBTRI][ff].getN(
"TEST_FIELD"));
457 tet_data.dataOnEntities[MBTRI][ff].getDiffN(
"TEST_FIELD"));
459 std::cout <<
"Tets\n";
460 std::cout << tet_data.dataOnEntities[MBTET][0].getN(
"TEST_FIELD")
462 std::cout << tet_data.dataOnEntities[MBTET][0].getDiffN(
"TEST_FIELD")
464 sum +=
sum_matrix(tet_data.dataOnEntities[MBTET][0].getN(
"TEST_FIELD"));
466 sum_matrix(tet_data.dataOnEntities[MBTET][0].getDiffN(
"TEST_FIELD"));
467 std::cout <<
"sum " << sum << std::endl;
468 std::cout <<
"diff_sum " << diff_sum << std::endl;
469 if (fabs(4.38395 - sum) >
eps) {
472 if (fabs(diff_sum) >
eps) {
477 if (choice_value == HDIVTET_AINSWORTH) {
482 double sum = 0, diff_sum = 0;
483 std::cout <<
"Faces\n";
484 for (
int ff = 0; ff < 4; ff++) {
485 std::cout << tet_data.dataOnEntities[MBTRI][ff].getN(
488 std::cout << tet_data.dataOnEntities[MBTRI][ff].getDiffN(
493 diff_sum +=
sum_matrix(tet_data.dataOnEntities[MBTRI][ff].getDiffN(
496 std::cout <<
"Tets\n";
497 std::cout << tet_data.dataOnEntities[MBTET][0].getN(
500 std::cout << tet_data.dataOnEntities[MBTET][0].getDiffN(
507 std::cout <<
"sum " << 1e8 * sum << std::endl;
508 std::cout <<
"diff_sum " << 1e8 * diff_sum << std::endl;
509 if (fabs(0.188636 - sum) >
eps) {
512 if (fabs(32.9562 - diff_sum) >
eps) {
517 if (choice_value == HDIVTET_DEMKOWICZ) {
522 double sum = 0, diff_sum = 0;
523 std::cout <<
"Faces\n";
524 for (
int ff = 0; ff < 4; ff++) {
525 std::cout << tet_data.dataOnEntities[MBTRI][ff].getN(
528 std::cout << tet_data.dataOnEntities[MBTRI][ff].getDiffN(
536 std::cout <<
"Tets\n";
539 std::cout << tet_data.dataOnEntities[MBTET][0].getDiffN(
546 std::cout <<
"sum " << sum << std::endl;
547 std::cout <<
"diff_sum " << diff_sum << std::endl;
548 const double expected_result = -2.70651;
549 const double expected_diff_result = 289.421;
550 if (fabs((expected_result - sum) / expected_result) >
eps) {
553 if (fabs((expected_diff_result - diff_sum) / expected_diff_result) >
559 if (choice_value == HCURLTET_AINSWORTH) {
564 double sum = 0, diff_sum = 0;
565 std::cout <<
"Edges\n";
566 for (
int ee = 0; ee < 6; ee++) {
567 std::cout << tet_data.dataOnEntities[MBEDGE][ee].getN(
570 std::cout << tet_data.dataOnEntities[MBEDGE][ee].getDiffN(
575 diff_sum +=
sum_matrix(tet_data.dataOnEntities[MBEDGE][ee].getDiffN(
578 std::cout <<
"Faces\n";
579 for (
int ff = 0; ff < 4; ff++) {
580 std::cout << tet_data.dataOnEntities[MBTRI][ff].getN(
583 std::cout << tet_data.dataOnEntities[MBTRI][ff].getDiffN(
588 diff_sum +=
sum_matrix(tet_data.dataOnEntities[MBTRI][ff].getDiffN(
591 std::cout <<
"Tets\n";
592 std::cout << tet_data.dataOnEntities[MBTET][0].getN(
595 std::cout << tet_data.dataOnEntities[MBTET][0].getDiffN(
602 std::cout <<
"sum " << sum << std::endl;
603 std::cout <<
"diff_sum " << diff_sum << std::endl;
604 if (fabs(-1.7798 - sum) >
eps) {
607 if (fabs(-67.1793 - diff_sum) >
eps) {
612 if (choice_value == HCURLTET_DEMKOWICZ) {
616 double sum = 0, diff_sum = 0;
617 std::cout <<
"Edges\n";
618 for (
int ee = 0; ee < 6; ee++) {
619 std::cout << tet_data.dataOnEntities[MBEDGE][ee].getN(
622 std::cout << tet_data.dataOnEntities[MBEDGE][ee].getDiffN(
627 diff_sum +=
sum_matrix(tet_data.dataOnEntities[MBEDGE][ee].getDiffN(
630 std::cout <<
"Faces\n";
631 for (
int ff = 0; ff < 4; ff++) {
632 std::cout << tet_data.dataOnEntities[MBTRI][ff].getN(
635 std::cout << tet_data.dataOnEntities[MBTRI][ff].getDiffN(
643 std::cout <<
"Tets\n";
646 std::cout << tet_data.dataOnEntities[MBTET][0].getDiffN(
653 std::cout <<
"sum " << sum << std::endl;
654 std::cout <<
"diff_sum " << diff_sum << std::endl;
655 if (fabs(7.35513 - sum) >
eps) {
658 if (fabs(62.4549 - diff_sum) >
eps) {
663 if (choice_value == L2TET) {
668 double sum = 0, diff_sum = 0;
669 std::cout <<
"Tets\n";
670 std::cout << tet_data.dataOnEntities[MBTET][0].getN(
673 std::cout << tet_data.dataOnEntities[MBTET][0].getDiffN(
680 std::cout <<
"sum " << sum << std::endl;
681 std::cout <<
"diff_sum " << diff_sum << std::endl;
682 if (fabs(3.60352 - sum) >
eps) {
685 if (fabs(-36.9994 - diff_sum) >
eps) {
692 tri_data.spacesOnEntities[
type].set(
L2);
693 tri_data.spacesOnEntities[
type].set(
H1);
694 tri_data.spacesOnEntities[
type].set(
HDIV);
695 tri_data.spacesOnEntities[
type].set(
HCURL);
697 tri_data.dataOnEntities[MBVERTEX].resize(1);
698 tri_data.dataOnEntities[MBVERTEX][0].getOrder() = 1;
699 tri_data.dataOnEntities[MBEDGE].resize(3);
700 for (
int ee = 0; ee < 3; ee++) {
701 tri_data.dataOnEntities[MBEDGE][ee].getOrder() = 3;
702 tri_data.dataOnEntities[MBEDGE][ee].getSense() = 1;
704 tri_data.dataOnEntities[MBTRI].resize(1);
705 tri_data.dataOnEntities[MBTRI][0].getOrder() = 4;
706 tri_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().resize(3,
false);
707 std::fill(tri_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().begin(),
708 tri_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().end(), 4);
713 pts_tri.resize(2, nb_gauss_pts,
false);
714 cblas_dcopy(nb_gauss_pts, &
QUAD_2D_TABLE[tri_rule]->points[1], 3,
716 cblas_dcopy(nb_gauss_pts, &
QUAD_2D_TABLE[tri_rule]->points[2], 3,
718 tri_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).resize(nb_gauss_pts, 3,
722 &*tri_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).data().begin();
723 cblas_dcopy(3 * nb_gauss_pts,
QUAD_2D_TABLE[tri_rule]->points, 1,
726 tri_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE).resize(3, 2,
false);
728 &*tri_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE).data().begin());
731 if (choice_value == H1TRI_AINSWORTH) {
735 if (tri_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
736 tri_data.dataOnEntities[MBVERTEX][0]
740 "Different pointers");
742 double sum = 0, diff_sum = 0;
743 std::cout <<
"Edges\n";
744 for (
int ee = 0; ee < 3; ee++) {
745 std::cout << tri_data.dataOnEntities[MBEDGE][ee].getN(
748 std::cout << tri_data.dataOnEntities[MBEDGE][ee].getDiffN(
753 diff_sum +=
sum_matrix(tri_data.dataOnEntities[MBEDGE][ee].getDiffN(
756 std::cout <<
"Face\n";
757 std::cout << tri_data.dataOnEntities[MBTRI][0].getN(
760 std::cout << tri_data.dataOnEntities[MBTRI][0].getDiffN(
767 std::cout <<
"sum " << sum << std::endl;
768 std::cout <<
"diff_sum " << diff_sum << std::endl;
769 if (fabs(0.805556 - sum) >
eps)
772 if (fabs(0.0833333 - diff_sum) >
eps)
776 if (choice_value == H1TRI_BERNSTEIN_BEZIER) {
781 if (tri_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() ==
782 tri_data.dataOnEntities[MBVERTEX][0]
786 "Pointers should be diffrent");
788 double sum = 0, diff_sum = 0;
789 std::cout <<
"Vertex\n";
790 std::cout << tri_data.dataOnEntities[MBVERTEX][0].getN(
"TET_FIELD")
792 std::cout << tri_data.dataOnEntities[MBVERTEX][0].getDiffN(
"TET_FIELD")
794 sum +=
sum_matrix(tri_data.dataOnEntities[MBVERTEX][0].getN(
"TET_FIELD"));
796 tri_data.dataOnEntities[MBVERTEX][0].getDiffN(
"TET_FIELD"));
797 std::cout <<
"Edges\n";
798 for (
int ee = 0; ee < 3; ee++) {
799 std::cout << tri_data.dataOnEntities[MBEDGE][ee].getN(
"TET_FIELD")
801 std::cout << tri_data.dataOnEntities[MBEDGE][ee].getDiffN(
"TET_FIELD")
804 sum_matrix(tri_data.dataOnEntities[MBEDGE][ee].getN(
"TET_FIELD"));
806 tri_data.dataOnEntities[MBEDGE][ee].getDiffN(
"TET_FIELD"));
808 std::cout <<
"Face\n";
809 std::cout << tri_data.dataOnEntities[MBTRI][0].getN(
"TET_FIELD")
811 std::cout << tri_data.dataOnEntities[MBTRI][0].getDiffN(
"TET_FIELD")
813 sum +=
sum_matrix(tri_data.dataOnEntities[MBTRI][0].getN(
"TET_FIELD"));
815 sum_matrix(tri_data.dataOnEntities[MBTRI][0].getDiffN(
"TET_FIELD"));
816 std::cout <<
"sum " << sum << std::endl;
817 std::cout <<
"diff_sum " << diff_sum << std::endl;
818 if (std::abs(3.01389 - sum) >
eps)
821 if (std::abs(diff_sum) >
eps)
823 "wrong result %3.4e != $3.4e", 0, diff_sum);
826 if (choice_value == HDIVTRI_AINSWORTH) {
830 if (tri_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
831 tri_data.dataOnEntities[MBVERTEX][0]
835 "Different pointers");
838 std::cout <<
"Face\n";
839 std::cout << tri_data.dataOnEntities[MBTRI][0].getN(
844 std::cout <<
"sum " << sum << std::endl;
845 if (fabs(1.93056 - sum) >
eps)
849 if (choice_value == HDIVTRI_DEMKOWICZ) {
854 if (tri_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
855 tri_data.dataOnEntities[MBVERTEX][0]
859 "Different pointers");
862 std::cout <<
"Face\n";
867 std::cout <<
"sum " << sum << std::endl;
868 const double expected_result = 28.25;
869 if (fabs((expected_result - sum) / expected_result) >
eps) {
874 if (choice_value == HCURLTRI_AINSWORTH) {
879 if (tri_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
880 tri_data.dataOnEntities[MBVERTEX][0]
884 "Different pointers");
887 std::cout <<
"Edges\n";
888 for (
int ee = 0; ee < 3; ee++) {
889 std::cout << tri_data.dataOnEntities[MBEDGE][ee].getN(
895 std::cout <<
"Face\n";
896 std::cout << tri_data.dataOnEntities[MBTRI][0].getN(
901 std::cout <<
"sum " << sum << std::endl;
902 if (fabs(0.333333 - sum) >
eps) {
907 if (choice_value == HCURLTRI_DEMKOWICZ) {
911 if (tri_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
912 tri_data.dataOnEntities[MBVERTEX][0]
916 "Different pointers");
919 std::cout <<
"Edges\n";
920 for (
int ee = 0; ee < 3; ee++) {
921 std::cout << tri_data.dataOnEntities[MBEDGE][ee].getN(
927 std::cout <<
"Face\n";
932 std::cout <<
"sum " << sum << std::endl;
933 if (fabs(1.04591 - sum) >
eps) {
938 if (choice_value == L2TRI) {
943 if (tri_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
944 tri_data.dataOnEntities[MBVERTEX][0]
948 "Different pointers");
951 std::cout <<
"Face\n";
952 std::cout << tri_data.dataOnEntities[MBTRI][0].getN(
957 std::cout <<
"sum " << sum << std::endl;
958 if (fabs(0.671875 - sum) >
eps) {
965 edge_data.spacesOnEntities[
type].set(
L2);
966 edge_data.spacesOnEntities[
type].set(
H1);
967 edge_data.spacesOnEntities[
type].set(
HDIV);
968 edge_data.spacesOnEntities[
type].set(
HCURL);
970 edge_data.dataOnEntities[MBVERTEX].resize(1);
971 edge_data.dataOnEntities[MBVERTEX][0].getOrder() = 1;
972 edge_data.dataOnEntities[MBEDGE].resize(1);
973 edge_data.dataOnEntities[MBEDGE][0].getOrder() = 4;
974 edge_data.dataOnEntities[MBEDGE][0].getSense() = 1;
975 edge_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().resize(2,
false);
976 std::fill(edge_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().begin(),
977 edge_data.dataOnEntities[MBVERTEX][0].getBBNodeOrder().end(), 4);
982 pts_edge.resize(2, nb_gauss_pts,
false);
983 cblas_dcopy(nb_gauss_pts, &
QUAD_1D_TABLE[edge_rule]->points[1], 2,
985 cblas_dcopy(nb_gauss_pts,
QUAD_1D_TABLE[edge_rule]->weights, 1,
988 edge_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).resize(nb_gauss_pts, 2,
992 &*edge_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).data().begin();
993 cblas_dcopy(2 * nb_gauss_pts,
QUAD_1D_TABLE[edge_rule]->points, 1,
997 if (choice_value == H1EDGE_AINSWORTH) {
1001 if (edge_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
1002 edge_data.dataOnEntities[MBVERTEX][0]
1006 "Different pointers");
1008 double sum = 0, diff_sum = 0;
1009 std::cout <<
"Edge\n";
1010 std::cout << edge_data.dataOnEntities[MBEDGE][0].getN(
1013 std::cout << edge_data.dataOnEntities[MBEDGE][0].getDiffN(
1018 diff_sum +=
sum_matrix(edge_data.dataOnEntities[MBEDGE][0].getDiffN(
1020 std::cout <<
"sum " << sum << std::endl;
1021 std::cout <<
"diff sum " << diff_sum << std::endl;
1022 if (std::abs(0.506122 - sum) >
eps)
1025 if (std::abs(2.85714 - diff_sum) >
eps)
1029 if (choice_value == H1EDGE_BERNSTEIN_BEZIER) {
1034 if (edge_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() ==
1035 edge_data.dataOnEntities[MBVERTEX][0]
1039 "Should be diffrent pointers");
1041 double sum = 0, diff_sum = 0;
1042 std::cout <<
"Vertex\n";
1043 std::cout << edge_data.dataOnEntities[MBVERTEX][0].getN(
"TET_FIELD")
1045 std::cout << edge_data.dataOnEntities[MBVERTEX][0].getDiffN(
"TET_FIELD")
1047 std::cout <<
"Edge\n";
1048 std::cout << edge_data.dataOnEntities[MBEDGE][0].getN(
"TET_FIELD")
1050 std::cout << edge_data.dataOnEntities[MBEDGE][0].getDiffN(
"TET_FIELD")
1053 sum_matrix(edge_data.dataOnEntities[MBVERTEX][0].getN(
"TET_FIELD"));
1055 edge_data.dataOnEntities[MBVERTEX][0].getDiffN(
"TET_FIELD"));
1056 sum +=
sum_matrix(edge_data.dataOnEntities[MBEDGE][0].getN(
"TET_FIELD"));
1058 sum_matrix(edge_data.dataOnEntities[MBEDGE][0].getDiffN(
"TET_FIELD"));
1059 std::cout <<
"sum " << sum << std::endl;
1060 std::cout <<
"diff sum " << diff_sum << std::endl;
1061 if (std::abs(4 - sum) >
eps)
1064 if (std::abs(diff_sum) >
eps)
1068 if (choice_value == HCURLEDGE_AINSWORTH) {
1073 if (edge_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
1074 edge_data.dataOnEntities[MBVERTEX][0]
1078 "Different pointers");
1080 std::cout << edge_data.dataOnEntities[MBEDGE][0].getN(
1086 std::cout.precision(std::numeric_limits<double>::max_digits10 - 1);
1087 std::cout <<
"sum " << sum << std::endl;
1088 if (fabs(-4.174149659863944 - sum) >
eps) {
1093 if (choice_value == HCURLEDGE_DEMKOWICZ) {
1097 if (edge_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
1098 edge_data.dataOnEntities[MBVERTEX][0]
1102 "Different pointers");
1104 std::cout << edge_data.dataOnEntities[MBEDGE][0].getN(
1109 std::cout.precision(std::numeric_limits<double>::max_digits10 - 1);
1110 std::cout <<
"sum " << sum << std::endl;
1111 if (std::fabs(4.571428571428571 - sum) >
eps) {
1116 if (choice_value == L2EDGE) {
1134 std::cout <<
"sum " << sum << std::endl;
1135 if (std::fabs(sum) >
eps) {
1138 "Difference between ainsworth and demkowicz base should be zero");
1141 auto order = edge_data.dataOnEntities[MBEDGE][0].getOrder();
1145 if (base.size1() != pts_edge.size2())
1147 "wrong number of integration points");
1150 "wrong number of base functions");
1153 for (
auto gg = 0; gg != pts_edge.size2(); ++gg) {
1154 double w = pts_edge(1, gg);
1158 ort_sum += base(gg,
i) * base(gg,
j) *
w;
1163 std::cout <<
"ort sum " << ort_sum << std::endl;
1164 if (std::fabs(ort_sum) >
eps) {
1167 "check orthogonality of base");
1172 double ort_diff_sum = 0;
1173 for (
auto gg = 0; gg != pts_edge.size2(); ++gg) {
1174 double w = pts_edge(1, gg);
1178 ort_diff_sum += diff_base(gg,
i) * diff_base(gg,
j) *
w;
1183 std::cout <<
"ort diff sum " << ort_diff_sum << std::endl;
1184 if (std::fabs(ort_diff_sum) >
eps) {
1186 "check orthogonality of diff lobatto base");
1193 quad_data.spacesOnEntities[
type].set(
H1);
1195 quad_data.dataOnEntities[MBVERTEX].resize(1);
1196 quad_data.dataOnEntities[MBVERTEX][0].getOrder() = 1;
1197 quad_data.dataOnEntities[MBEDGE].resize(4);
1198 for (
int ee = 0; ee < 4; ee++) {
1199 quad_data.dataOnEntities[MBEDGE][ee].getOrder() = 4;
1200 quad_data.dataOnEntities[MBEDGE][ee].getSense() = 1;
1202 quad_data.dataOnEntities[MBQUAD].resize(1);
1203 quad_data.dataOnEntities[MBQUAD][0].getOrder() = 6;
1208 CHKERR Tools::outerProductOfEdgeIntegrationPtsForQuad(pts_quad, rule_ksi,
1210 nb_gauss_pts = pts_quad.size2();
1211 quad_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE).resize(nb_gauss_pts, 4,
1213 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE).resize(nb_gauss_pts,
1215 for (
int i = 0;
i < nb_gauss_pts; ++
i) {
1216 quad_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE)(
i, 0) =
1218 quad_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE)(
i, 1) =
1220 quad_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE)(
i, 2) =
1222 quad_data.dataOnEntities[MBVERTEX][0].getN(
NOBASE)(
i, 3) =
1225 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE)(
i, 0) =
1227 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE)(
i, 1) =
1229 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE)(
i, 2) =
1231 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE)(
i, 3) =
1233 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE)(
i, 4) =
1235 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE)(
i, 5) =
1237 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE)(
i, 6) =
1239 quad_data.dataOnEntities[MBVERTEX][0].getDiffN(
NOBASE)(
i, 7) =
1243 if (choice_value == H1QUAD) {
1247 if (quad_data.dataOnEntities[MBVERTEX][0].getNSharedPtr(
NOBASE).get() !=
1248 quad_data.dataOnEntities[MBVERTEX][0]
1252 "Different pointers");
1254 double sum = 0, diff_sum = 0;
1255 for (
int ee = 0; ee < 4; ee++) {
1258 diff_sum +=
sum_matrix(quad_data.dataOnEntities[MBEDGE][ee].getDiffN(
1263 diff_sum +=
sum_matrix(quad_data.dataOnEntities[MBQUAD][0].getDiffN(
1266 std::cout << sum <<
" " << diff_sum << endl;
1268 if (std::abs(3.58249 - sum) >
eps)
1272 if (std::abs(-0.134694 - diff_sum) >
eps)