26 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePA(fes)\n"
27 " is not implemented for this class.");
32 mfem_error (
"BilinearFormIntegrator::AssembleNURBSPA(fes)\n"
33 " is not implemented for this class.");
39 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePA(fes, fes)\n"
40 " is not implemented for this class.");
45 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePABoundary(fes)\n"
46 " is not implemented for this class.");
51 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePAInteriorFaces(...)\n"
52 " is not implemented for this class.");
57 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePABoundaryFaces(...)\n"
58 " is not implemented for this class.");
63 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalPA(...)\n"
64 " is not implemented for this class.");
71 MFEM_ABORT(
"BilinearFormIntegrator::AssembleEA(...)\n"
72 " is not implemented for this class.");
79 MFEM_ABORT(
"BilinearFormIntegrator::AssembleEABoundary(...)\n"
80 " is not implemented for this class.");
89 MFEM_ABORT(
"BilinearFormIntegrator::AssembleEAInteriorFaces(...)\n"
90 " is not implemented for this class.");
99 MFEM_ABORT(
"BilinearFormIntegrator::AssembleEAInteriorFaces(...)\n"
100 " is not implemented for this class.");
108 MFEM_ABORT(
"BilinearFormIntegrator::AssembleEABoundaryFaces(...)\n"
109 " is not implemented for this class.");
114 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalPA_ADAt(...)\n"
115 " is not implemented for this class.");
120 MFEM_ABORT(
"BilinearFormIntegrator:AddMultPA:(...)\n"
121 " is not implemented for this class.");
126 MFEM_ABORT(
"BilinearFormIntegrator:AddAbsMultPA:(...)\n"
127 " is not implemented for this class.");
132 MFEM_ABORT(
"BilinearFormIntegrator::AddMultNURBSPA(...)\n"
133 " is not implemented for this class.");
138 MFEM_ABORT(
"BilinearFormIntegrator::AddMultTransposePA(...)\n"
139 " is not implemented for this class.");
145 MFEM_ABORT(
"BilinearFormIntegrator::AddAbsMultTransposePA(...)\n"
146 " is not implemented for this class.");
151 MFEM_ABORT(
"BilinearFormIntegrator::AssembleMF(...)\n"
152 " is not implemented for this class.");
157 MFEM_ABORT(
"BilinearFormIntegrator::AddMultMF(...)\n"
158 " is not implemented for this class.");
163 MFEM_ABORT(
"BilinearFormIntegrator::AddMultTransposeMF(...)\n"
164 " is not implemented for this class.");
169 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalMF(...)\n"
170 " is not implemented for this class.");
177 MFEM_ABORT(
"BilinearFormIntegrator::AssembleElementMatrix(...)\n"
178 " is not implemented for this class.");
185 MFEM_ABORT(
"BilinearFormIntegrator::AssembleElementMatrix2(...)\n"
186 " is not implemented for this class.");
192 mfem_error (
"BilinearFormIntegrator::AssemblePatchMatrix(...)\n"
193 " is not implemented for this class.");
200 MFEM_ABORT(
"BilinearFormIntegrator::AssembleFaceMatrix(...)\n"
201 " is not implemented for this class.");
210 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this"
211 " Integrator class.");
219 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this"
220 " Integrator class.");
229 MFEM_ABORT(
"AssembleTraceFaceMatrix (DPG form) is not implemented for this"
230 " Integrator class.");
236 MFEM_ABORT(
"Not implemented.");
247 elmat.
Mult(elfun, elvect);
258 elmat.
Mult(elfun, elvect);
332 for (
int i = 0; i < integrators.Size(); i++)
334 integrators[i]->SetIntRule(ir);
341 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
343 integrators[0]->AssembleElementMatrix(el, Trans, elmat);
344 for (
int i = 1; i < integrators.Size(); i++)
346 integrators[i]->AssembleElementMatrix(el, Trans, elem_mat);
355 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
357 integrators[0]->AssembleElementMatrix2(el1, el2, Trans, elmat);
358 for (
int i = 1; i < integrators.Size(); i++)
360 integrators[i]->AssembleElementMatrix2(el1, el2, Trans, elem_mat);
369 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
371 integrators[0]->AssembleFaceMatrix(el1, el2, Trans, elmat);
372 for (
int i = 1; i < integrators.Size(); i++)
374 integrators[i]->AssembleFaceMatrix(el1, el2, Trans, elem_mat);
384 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
386 integrators[0]->AssembleFaceMatrix(tr_fe, te_fe1, te_fe2, Trans, elmat);
387 for (
int i = 1; i < integrators.Size(); i++)
389 integrators[i]->AssembleFaceMatrix(tr_fe, te_fe1, te_fe2, Trans, elem_mat);
396 for (
int i = 0; i < integrators.Size(); i++)
398 integrators[i]->AssemblePA(fes);
404 for (
int i = 0; i < integrators.Size(); i++)
406 integrators[i]->AssembleDiagonalPA(diag);
412 for (
int i = 0; i < integrators.Size(); i++)
414 integrators[i]->AssemblePAInteriorFaces(fes);
420 for (
int i = 0; i < integrators.Size(); i++)
422 integrators[i]->AssemblePABoundaryFaces(fes);
428 for (
int i = 0; i < integrators.Size(); i++)
430 integrators[i]->AddMultPA(x, y);
436 for (
int i = 0; i < integrators.Size(); i++)
438 integrators[i]->AddAbsMultPA(x, y);
444 for (
int i = 0; i < integrators.Size(); i++)
446 integrators[i]->AddMultTransposePA(x, y);
452 for (
int i = 0; i < integrators.Size(); i++)
454 integrators[i]->AddAbsMultTransposePA(x, y);
460 for (
int i = 0; i < integrators.Size(); i++)
462 integrators[i]->AssembleMF(fes);
468 for (
int i = 0; i < integrators.Size(); i++)
470 integrators[i]->AddMultMF(x, y);
476 for (
int i = 0; i < integrators.Size(); i++)
478 integrators[i]->AddMultTransposeMF(x, y);
484 for (
int i = 0; i < integrators.Size(); i++)
486 integrators[i]->AssembleDiagonalMF(diag);
493 for (
int i = 0; i < integrators.Size(); i++)
495 integrators[i]->AssembleEA(fes, emat,
add);
504 for (
int i = 0; i < integrators.Size(); i++)
506 integrators[i]->AssembleEAInteriorFaces(fes,ea_data_int,ea_data_ext,
add);
514 for (
int i = 0; i < integrators.Size(); i++)
516 integrators[i]->AssembleEABoundaryFaces(fes, ea_data_bdr,
add);
524 for (
int i = 0; i < integrators.Size(); i++)
526 delete integrators[i];
538 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
541#ifdef MFEM_THREAD_SAFE
542 Vector test_shape(test_nd);
556 elmat.
SetSize(test_nd, trial_nd);
579 w *=
Q->
Eval(Trans, ip);
583#ifndef MFEM_THREAD_SAFE
599 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
607 "Dimension mismatch in height of matrix coefficient.");
609 "Dimension mismatch in width of matrix coefficient.");
613 MFEM_VERIFY(trial_vdim == test_vdim,
614 "Diagonal matrix coefficient requires matching "
615 "test and trial vector dimensions.");
617 "Dimension mismatch in diagonal matrix coefficient.");
621 MFEM_VERIFY(
VQ->
GetVDim() == 3,
"Vector coefficient must have "
622 "dimension equal to three.");
625#ifdef MFEM_THREAD_SAFE
636 test_shape.SetSize(test_nd, test_vdim);
637 shape_tmp.
SetSize(test_nd, trial_vdim);
641 trial_shape.
Reset(test_shape.Data(), trial_nd, trial_vdim);
645 trial_shape.
SetSize(trial_nd, trial_vdim);
648 elmat.
SetSize(test_nd, trial_nd);
675 Mult(test_shape, M, shape_tmp);
689 for (
int j=0; j<test_nd; j++)
695 if (test_vdim == 3 && trial_vdim == 3)
697 shape_tmp(j,0) = test_shape(j,1) * V(2) -
698 test_shape(j,2) * V(1);
699 shape_tmp(j,1) = test_shape(j,2) * V(0) -
700 test_shape(j,0) * V(2);
701 shape_tmp(j,2) = test_shape(j,0) * V(1) -
702 test_shape(j,1) * V(0);
704 else if (test_vdim == 3 && trial_vdim == 2)
706 shape_tmp(j,0) = test_shape(j,1) * V(2) -
707 test_shape(j,2) * V(1);
708 shape_tmp(j,1) = test_shape(j,2) * V(0) -
709 test_shape(j,0) * V(2);
711 else if (test_vdim == 3 && trial_vdim == 1)
713 shape_tmp(j,0) = test_shape(j,1) * V(2) -
714 test_shape(j,2) * V(1);
716 else if (test_vdim == 2 && trial_vdim == 3)
718 shape_tmp(j,0) = test_shape(j,1) * V(2);
719 shape_tmp(j,1) = -test_shape(j,0) * V(2);
720 shape_tmp(j,2) = test_shape(j,0) * V(1) -
721 test_shape(j,1) * V(0);
723 else if (test_vdim == 2 && trial_vdim == 2)
725 shape_tmp(j,0) = test_shape(j,1) * V(2);
726 shape_tmp(j,1) = -test_shape(j,0) * V(2);
728 else if (test_vdim == 1 && trial_vdim == 3)
730 shape_tmp(j,0) = 0.0;
731 shape_tmp(j,1) = -test_shape(j,0) * V(2);
732 shape_tmp(j,2) = test_shape(j,0) * V(1);
734 else if (test_vdim == 1 && trial_vdim == 1)
736 shape_tmp(j,0) = 0.0;
745 w *=
Q -> Eval (Trans, ip);
757#ifndef MFEM_THREAD_SAFE
772 MFEM_VERIFY(
VQ,
"MixedScalarVectorIntegrator: "
773 "VectorCoefficient must be set");
779 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
780 int sca_nd = sca_fe->
GetDof();
781 int vec_nd = vec_fe->
GetDof();
785 MFEM_VERIFY(
VQ->
GetVDim() == vdim,
"MixedScalarVectorIntegrator: "
786 "Dimensions of VectorCoefficient and Vector-valued basis "
787 "functions must match");
789#ifdef MFEM_THREAD_SAFE
793 Vector vshape_tmp(vec_nd);
804 elmat.
SetSize(test_nd, trial_nd);
835 vshape.
Mult(V,vshape_tmp);
846 int trial_dof = trial_fe.
GetDof();
847 int test_dof = test_fe.
GetDof();
851 dshape.
SetSize(trial_dof, dim);
852 gshape.
SetSize(trial_dof, dim);
855 elmat.
SetSize(dim * test_dof, trial_dof);
860 elmat_comp.
SetSize(test_dof, trial_dof);
872 Mult(dshape, Jadj, gshape);
877 c *=
Q->
Eval(Trans, ip);
881 for (
int d = 0; d < dim; ++d)
884 MultVWt(shape, d_col, elmat_comp);
885 for (
int jj = 0; jj < trial_dof; ++jj)
887 for (
int ii = 0; ii < test_dof; ++ii)
889 elmat(d * test_dof + ii, jj) += elmat_comp(ii, jj);
908 Q(nullptr), VQ(nullptr), MQ(nullptr), maps(nullptr), geom(nullptr)
941 bool square = (dim == spaceDim);
947 "Unexpected dimension for VectorCoefficient");
952 "Unexpected width for MatrixCoefficient");
954 "Unexpected height for MatrixCoefficient");
957#ifdef MFEM_THREAD_SAFE
958 DenseMatrix dshape(nd, dim), dshapedxt(nd, spaceDim);
964 dshapedxt.
SetSize(nd, spaceDim);
965 dshapedxt_m.
SetSize(nd,
MQ ? spaceDim : 0);
966 M.SetSize(
MQ ? spaceDim : 0);
980 w = ip.
weight / (square ? w : w*w*w);
988 Mult(dshapedxt, M, dshapedxt_m);
1001 w *=
Q->
Eval(Trans, ip);
1012 int tr_nd = trial_fe.
GetDof();
1013 int te_nd = test_fe.
GetDof();
1016 bool square = (dim == spaceDim);
1022 "Unexpected dimension for VectorCoefficient");
1027 "Unexpected width for MatrixCoefficient");
1029 "Unexpected height for MatrixCoefficient");
1032#ifdef MFEM_THREAD_SAFE
1033 DenseMatrix dshape(tr_nd, dim), dshapedxt(tr_nd, spaceDim);
1034 DenseMatrix te_dshape(te_nd, dim), te_dshapedxt(te_nd, spaceDim);
1041 dshapedxt.
SetSize(tr_nd, spaceDim);
1042 te_dshape.
SetSize(te_nd, dim);
1043 te_dshapedxt.
SetSize(te_nd, spaceDim);
1044 invdfdx.
SetSize(dim, spaceDim);
1045 dshapedxt_m.
SetSize(te_nd,
MQ ? spaceDim : 0);
1046 M.SetSize(
MQ ? spaceDim : 0);
1062 w = ip.
weight / (square ? w : w*w*w);
1063 Mult(dshape, invdfdx, dshapedxt);
1064 Mult(te_dshape, invdfdx, te_dshapedxt);
1070 Mult(te_dshapedxt, M, dshapedxt_m);
1083 w *=
Q->
Eval(Trans, ip);
1103 "Unexpected dimension for VectorCoefficient");
1108 "Unexpected width for MatrixCoefficient");
1110 "Unexpected height for MatrixCoefficient");
1113#ifdef MFEM_THREAD_SAFE
1114 DenseMatrix dshape(nd,dim), invdfdx(dim, spaceDim), M(
MQ ? spaceDim : 0);
1118 invdfdx.
SetSize(dim, spaceDim);
1146 w *=
Q->
Eval(Tr, ip);
1156 M.
Mult(vecdxt, pointflux);
1161 for (
int j=0; j<spaceDim; ++j)
1163 pointflux[j] = D[j] * vecdxt[j];
1168 invdfdx.
Mult(pointflux, vec);
1178 int nd, spaceDim, fnd;
1187 "Unexpected dimension for VectorCoefficient");
1192 "Unexpected width for MatrixCoefficient");
1194 "Unexpected height for MatrixCoefficient");
1197#ifdef MFEM_THREAD_SAFE
1198 DenseMatrix dshape(nd,dim), invdfdx(dim, spaceDim);
1203 invdfdx.
SetSize(dim, spaceDim);
1216 flux.
SetSize( fnd * spaceDim );
1218 for (
int i = 0; i < fnd; i++)
1234 vecdxt *=
Q->
Eval(Trans,ip);
1236 for (
int j = 0; j < spaceDim; j++)
1238 flux(fnd*j+i) = vecdxt(j);
1246 M.
Mult(vecdxt, pointflux);
1251 for (
int j=0; j<spaceDim; ++j)
1253 pointflux[j] = D[j] * vecdxt[j];
1256 for (
int j = 0; j < spaceDim; j++)
1258 flux(fnd*j+i) = pointflux(j);
1264 for (
int j = 0; j < spaceDim; j++)
1266 flux(fnd*j+i) = vecdxt(j);
1276 int nd = fluxelem.
GetDof();
1280#ifdef MFEM_THREAD_SAFE
1289 if (d_energy) { vec.
SetSize(spaceDim); }
1292 int order = 2 * fluxelem.
GetOrder();
1295 if (d_energy) { *d_energy = 0.0; }
1304 for (
int k = 0; k < spaceDim; k++)
1306 for (
int j = 0; j < nd; j++)
1308 pointflux(k) += flux(k*nd+j)*shape(j);
1323 energy += w * (D * pointflux);
1327 real_t e = (pointflux * pointflux);
1328 if (
Q) { e *=
Q->
Eval(Trans, ip); }
1336 for (
int k = 0; k < dim; k++)
1338 (*d_energy)[k] += w * vec[k] * vec[k];
1388#ifdef MFEM_THREAD_SAFE
1407 w *=
Q -> Eval(Trans, ip);
1418 int tr_nd = trial_fe.
GetDof();
1419 int te_nd = test_fe.
GetDof();
1422#ifdef MFEM_THREAD_SAFE
1442 w *=
Q -> Eval(Trans, ip);
1469 MFEM_ASSERT(Trans.
Elem2No < 0,
1470 "support for interior faces is not implemented");
1475#ifdef MFEM_THREAD_SAFE
1502 w *=
Q -> Eval(Trans, ip);
1515#ifdef MFEM_THREAD_SAFE
1517 Vector shape, vec2, BdFidxT;
1536 Q->
Eval(Q_ir, Trans, *ir);
1550 adjJ.
Mult(vec1, vec2);
1551 dshape.
Mult(vec2, BdFidxT);
1589 Mult(dshape, adjJ, grad);
1594 for (
int k = 0; k < nd; k++)
1597 for (
int l = 0; l < nd; l++)
1600 for (
int s = 0; s <
dim; s++)
1602 a += Q_nodal(s,k)*grad(l,s);
1604 elmat(k,l) += wsk*
a;
1635 vdim = (vdim == -1) ? spaceDim : vdim;
1678 VQ->
Eval(vec, Trans, ip);
1679 for (
int k = 0; k < vdim; k++)
1686 MQ->
Eval(mcoeff, Trans, ip);
1687 for (
int i = 0; i < vdim; i++)
1688 for (
int j = 0; j < vdim; j++)
1700 for (
int k = 0; k < vdim; k++)
1712 int tr_nd = trial_fe.
GetDof();
1713 int te_nd = test_fe.
GetDof();
1720 elmat.
SetSize(te_nd*vdim, tr_nd*vdim);
1723 partelmat.
SetSize(te_nd, tr_nd);
1738 Trans.
OrderW() + Q_order);
1760 MultVWt(te_shape, shape, partelmat);
1764 VQ->
Eval(vec, Trans, ip);
1765 for (
int k = 0; k < vdim; k++)
1772 MQ->
Eval(mcoeff, Trans, ip);
1773 for (
int i = 0; i < vdim; i++)
1774 for (
int j = 0; j < vdim; j++)
1776 elmat.
AddMatrix(
norm*mcoeff(i,j), partelmat, te_nd*i, tr_nd*j);
1786 for (
int k = 0; k < vdim; k++)
1788 elmat.
AddMatrix(partelmat, te_nd*k, tr_nd*k);
1798 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1800#ifdef MFEM_THREAD_SAFE
1801 Vector divshape(trial_nd), shape(test_nd);
1807 elmat.
SetSize(test_nd, trial_nd);
1827 w *=
Q->
Eval(Trans, ip);
1838 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1844 "Trial space must be H(Curl) and test space must be H_1");
1846#ifdef MFEM_THREAD_SAFE
1858 elmat.
SetSize(test_nd, trial_nd);
1900 Mult(dshape, invdfdx, dshapedxt);
1908 w *=
Q->
Eval(Trans, ip);
1920 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1922 int dimc = (
dim == 3) ? 3 : 1;
1926 "At least one of the finite elements must be in H(Curl)");
1928 int curl_nd, vec_nd;
1940#ifdef MFEM_THREAD_SAFE
1951 elmat.
SetSize(test_nd, trial_nd);
1998 w *=
Q->
Eval(Trans, ip);
2004 AddMultABt(vshapeTest, curlshapeTrial_dFT, elmat);
2008 AddMultABt(curlshapeTrial_dFT, vshapeTest, elmat);
2020#ifdef MFEM_THREAD_SAFE
2044 w *= Q->
Eval(Tr, ip);
2057 int tr_nd = trial_fe.
GetDof();
2058 int te_nd = test_fe.
GetDof();
2061#ifdef MFEM_THREAD_SAFE
2088 w *= Q->
Eval(Tr, ip);
2103 int trial_nd = trial_fe.
GetDof();
2104 int test_nd = test_fe.
GetDof();
2110 elmat.
SetSize (test_nd,trial_nd);
2112 dshapedxt.
SetSize(trial_nd, spaceDim);
2150 Mult (dshape, invdfdx, dshapedxt);
2154 for (l = 0; l < trial_nd; l++)
2156 dshapedxi(l) = dshapedxt(l,xi);
2173#ifdef MFEM_THREAD_SAFE
2214 Mult(curlshape_dFt, M, curlshape);
2225 w *=
Q->
Eval(Trans, ip);
2240 int tr_nd = trial_fe.
GetDof();
2241 int te_nd = test_fe.
GetDof();
2246#ifdef MFEM_THREAD_SAFE
2292 Mult(te_curlshape_dFt, M, te_curlshape);
2293 AddMultABt(te_curlshape, curlshape_dFt, elmat);
2299 AddMultADBt(te_curlshape_dFt,D,curlshape_dFt,elmat);
2305 w *=
Q->
Eval(Trans, ip);
2308 AddMultABt(te_curlshape_dFt, curlshape_dFt, elmat);
2313void CurlCurlIntegrator
2318#ifdef MFEM_THREAD_SAFE
2322 MFEM_VERIFY(ir == NULL,
"Integration rule (ir) must be NULL")
2327 projcurl.
Mult(
u, flux);
2336 int nd = fluxelem.
GetDof();
2339#ifdef MFEM_THREAD_SAFE
2346 int order = 2 * fluxelem.
GetOrder();
2350 if (d_energy) { *d_energy = 0.0; }
2369 real_t e = w * (pointflux * pointflux);
2378#if ANISO_EXPERIMENTAL
2398#if ANISO_EXPERIMENTAL
2402 int n = (int) round(pow(ir.
GetNPoints(), 1.0/3.0));
2406 for (
int k = 0; k < n; k++)
2407 for (
int l = 0; l < n; l++)
2408 for (
int m = 0; m < n; m++)
2410 Vector &vec = pfluxes[(k*n + l)*n + m];
2413 tmp = vec; tmp -= pfluxes[(k*n + l)*n + (m-1)];
2414 (*d_energy)[0] += (tmp * tmp);
2418 tmp = vec; tmp -= pfluxes[(k*n + (l-1))*n + m];
2419 (*d_energy)[1] += (tmp * tmp);
2423 tmp = vec; tmp -= pfluxes[((k-1)*n + l)*n + m];
2424 (*d_energy)[2] += (tmp * tmp);
2442 int cld = (
dim*(
dim-1))/2;
2444#ifdef MFEM_THREAD_SAFE
2474 Mult(dshape_hat, Jadj, dshape);
2479 w *=
Q->
Eval(Trans, ip);
2492#ifdef MFEM_THREAD_SAFE
2518 MultAtB(elfun_mat, dshape_hat, grad_hat);
2524 Mult(grad_hat, Jadj, grad);
2528 real_t curl = grad(0,1) - grad(1,0);
2533 real_t curl_x = grad(2,1) - grad(1,2);
2534 real_t curl_y = grad(0,2) - grad(2,0);
2535 real_t curl_z = grad(1,0) - grad(0,1);
2536 w *= curl_x * curl_x + curl_y * curl_y + curl_z * curl_z;
2541 w *=
Q->
Eval(Tr, ip);
2549 return 0.5 * energy;
2557 int trial_dof = trial_fe.
GetDof();
2558 int test_dof = test_fe.
GetDof();
2559 int dimc = (
dim == 3) ? 3 : 1;
2563 "Trial finite element must be either 2D/3D H(Curl) or 2D H1");
2566 "Test finite element must be in H1/L2");
2579 elmat_comp.
SetSize(test_dof, trial_dof);
2612 c *=
Q->
Eval(Trans, ip);
2616 for (
int d = 0; d <
dimc; ++d)
2619 for (
int jj = 0; jj < trial_dof; ++jj)
2621 for (
int ii = 0; ii < test_dof; ++ii)
2623 elmat(d * test_dof + ii, jj) += shape(ii) * curldata[jj];
2642#ifdef MFEM_THREAD_SAFE
2647 trial_vshape.
SetSize(dof, vdim);
2677 Mult(trial_vshape,K,tmp);
2690 w *=
Q -> Eval (Trans, ip);
2708 int vdim = std::max(spaceDim, trial_fe.
GetRangeDim());
2709 int trial_dof = trial_fe.
GetDof();
2710 int test_dof = test_fe.
GetDof();
2713#ifdef MFEM_THREAD_SAFE
2719 trial_vshape.
SetSize(trial_dof, spaceDim);
2725 elmat.
SetSize(vdim*test_dof, trial_dof);
2747 for (
int d = 0; d < vdim; d++)
2749 for (
int j = 0; j < test_dof; j++)
2751 for (
int k = 0; k < trial_dof; k++)
2753 elmat(d * test_dof + j, k) +=
2754 shape(j) * D(d) * trial_vshape(k, d);
2763 for (
int d = 0; d < vdim; d++)
2765 for (
int j = 0; j < test_dof; j++)
2767 for (
int k = 0; k < trial_dof; k++)
2770 for (
int vd = 0; vd < spaceDim; vd++)
2772 Kv += K(d, vd) * trial_vshape(k, vd);
2774 elmat(d * test_dof + j, k) += shape(j) * Kv;
2783 w *=
Q->
Eval(Trans, ip);
2785 for (
int d = 0; d < vdim; d++)
2787 for (
int j = 0; j < test_dof; j++)
2789 for (
int k = 0; k < trial_dof; k++)
2791 elmat(d * test_dof + j, k) +=
2792 w * shape(j) * trial_vshape(k, d);
2804 int trial_vdim = std::max(spaceDim, trial_fe.
GetRangeDim());
2805 int test_vdim = std::max(spaceDim, test_fe.
GetRangeDim());
2806 int trial_dof = trial_fe.
GetDof();
2807 int test_dof = test_fe.
GetDof();
2810#ifdef MFEM_THREAD_SAFE
2816 trial_vshape.
SetSize(trial_dof,trial_vdim);
2817 test_vshape.
SetSize(test_dof,test_vdim);
2823 elmat.
SetSize (test_dof, trial_dof);
2846 Mult(test_vshape,K,tmp);
2859 w *=
Q -> Eval (Trans, ip);
2867 MFEM_ABORT(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
2868 " is not implemented for given trial and test bases.");
2880 int trial_dof = trial_fe.
GetDof();
2881 int test_dof = test_fe.
GetDof();
2884 dshape.
SetSize (trial_dof, dim);
2885 gshape.
SetSize (trial_dof, sdim);
2887 divshape.
SetSize (sdim*trial_dof);
2890 elmat.
SetSize (test_dof, sdim*trial_dof);
2896 for (
int i = 0; i < ir -> GetNPoints(); i++)
2907 Mult (dshape, Jadj, gshape);
2912 if (dim != sdim) { c /= Trans.
Weight(); }
2915 c *=
Q -> Eval (Trans, ip);
2942#ifdef MFEM_THREAD_SAFE
2963 for (
int i = 0; i < ir -> GetNPoints(); i++)
2974 c *=
Q -> Eval (Trans, ip);
2988 int tr_nd = trial_fe.
GetDof();
2989 int te_nd = test_fe.
GetDof();
2992#ifdef MFEM_THREAD_SAFE
2994 Vector te_divshape(te_nd);
3004 int order = 2 * max(test_fe.
GetOrder(),
3011 for (
int i = 0; i < ir -> GetNPoints(); i++)
3023 c *=
Q -> Eval (Trans, ip);
3036 const int dof = el.
GetDof();
3041 vdim = (vdim <= 0) ?
sdim : vdim;
3042 const bool square = (
dim ==
sdim);
3067 for (
int i = 0; i < ir -> GetNPoints(); i++)
3074 w = ip.
weight / (square ? w : w*w*w);
3081 VQ->
Eval(vcoeff, Trans, ip);
3082 for (
int k = 0; k < vdim; ++k)
3090 MQ->
Eval(mcoeff, Trans, ip);
3091 for (
int ii = 0; ii < vdim; ++ii)
3093 for (
int jj = 0; jj < vdim; ++jj)
3095 Mult_a_AAt(w*mcoeff(ii,jj), dshapedxt, pelmat);
3096 elmat.
AddMatrix(pelmat, dof*ii, dof*jj);
3102 if (
Q) { w *=
Q->
Eval(Trans, ip); }
3104 for (
int k = 0; k < vdim; ++k)
3116 const int dof = el.
GetDof();
3121 vdim = (vdim <= 0) ?
sdim : vdim;
3122 const bool square = (
dim ==
sdim);
3160 w = ip.
weight / (square ? w : w*w*w);
3166 VQ->
Eval(vcoeff, Tr, ip);
3167 for (
int k = 0; k < vdim; ++k)
3171 pelmat.
AddMult_a(w*vcoeff(k), vec_in, vec_out);
3176 MQ->
Eval(mcoeff, Tr, ip);
3177 for (
int ii = 0; ii < vdim; ++ii)
3180 for (
int jj = 0; jj < vdim; ++jj)
3183 pelmat.
AddMult_a(w*mcoeff(ii,jj), vec_in, vec_out);
3189 if (
Q) { w *=
Q->
Eval(Tr, ip); }
3191 for (
int k = 0; k < vdim; ++k)
3195 pelmat.
AddMult(vec_in, vec_out);
3217#ifdef MFEM_THREAD_SAFE
3268 for (
int d = 0; d <
dim; d++)
3270 for (
int k = 0; k < dof; k++)
3271 for (
int l = 0; l < dof; l++)
3273 elmat (dof*d+k, dof*d+l) += (M * w) * pelmat(k, l);
3276 for (
int ii = 0; ii <
dim; ii++)
3277 for (
int jj = 0; jj <
dim; jj++)
3279 for (
int kk = 0; kk < dof; kk++)
3280 for (
int ll = 0; ll < dof; ll++)
3282 elmat(dof*ii+kk, dof*jj+ll) +=
3283 (M * w) * gshape(kk, jj) * gshape(ll, ii);
3295 const int dof = el.
GetDof();
3297 const int tdim =
dim*(
dim+1)/2;
3300 MFEM_ASSERT(
dim == 2 ||
dim == 3,
3301 "dimension is not supported: dim = " <<
dim);
3306#ifdef MFEM_THREAD_SAFE
3312 real_t gh_data[9], grad_data[9];
3324 for (
int i = 0; i < fnd; i++)
3328 MultAtB(loc_data_mat, dshape, gh);
3349 L *= (grad(0,0) + grad(1,1));
3351 flux(i+fnd*0) = M2*grad(0,0) + L;
3352 flux(i+fnd*1) = M2*grad(1,1) + L;
3353 flux(i+fnd*2) = M*(grad(0,1) + grad(1,0));
3357 L *= (grad(0,0) + grad(1,1) + grad(2,2));
3359 flux(i+fnd*0) = M2*grad(0,0) + L;
3360 flux(i+fnd*1) = M2*grad(1,1) + L;
3361 flux(i+fnd*2) = M2*grad(2,2) + L;
3362 flux(i+fnd*3) = M*(grad(0,1) + grad(1,0));
3363 flux(i+fnd*4) = M*(grad(0,2) + grad(2,0));
3364 flux(i+fnd*5) = M*(grad(1,2) + grad(2,1));
3373 const int dof = fluxelem.
GetDof();
3375 const int tdim =
dim*(
dim+1)/2;
3380 MFEM_ASSERT(d_energy == NULL,
"anisotropic estimates are not supported");
3381 MFEM_ASSERT(flux.
Size() == dof*tdim,
"invalid 'flux' vector");
3383#ifndef MFEM_THREAD_SAFE
3388 real_t pointstress_data[6];
3389 Vector pointstress(pointstress_data, tdim);
3401 int order = 2 * Trans.
OrderGrad(&fluxelem);
3440 const real_t *s = pointstress_data;
3444 const real_t tr_e = (s[0] + s[1])/(2*(M + L));
3446 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + 2*s[2]*s[2]);
3451 const real_t tr_e = (s[0] + s[1] + s[2])/(2*M + 3*L);
3453 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + s[2]*(s[2] - L) +
3454 2*(s[3]*s[3] + s[4]*s[4] + s[5]*s[5]));
3526 nor(0) = 2*eip1.
x - 1.0;
3535 b =
beta * fabs(un);
3543 if (un >= 0.0 && ndof2)
3558 for (
int i = 0; i < ndof1; i++)
3559 for (
int j = 0; j < ndof1; j++)
3561 elmat(i, j) += w * shape1(i) * shape1(j);
3570 for (
int i = 0; i < ndof2; i++)
3571 for (
int j = 0; j < ndof1; j++)
3573 elmat(ndof1+i, j) -= w * shape2(i) * shape1(j);
3579 for (
int i = 0; i < ndof2; i++)
3580 for (
int j = 0; j < ndof2; j++)
3582 elmat(ndof1+i, ndof1+j) += w * shape2(i) * shape2(j);
3585 for (
int i = 0; i < ndof1; i++)
3586 for (
int j = 0; j < ndof2; j++)
3588 elmat(i, ndof1+j) -= w * shape1(i) * shape2(j);
3602 int tr_ndof1, te_ndof1, tr_ndof2, te_ndof2;
3607 tr_ndof1 = trial_fe1.
GetDof();
3608 te_ndof1 = test_fe1.
GetDof();
3613 tr_ndof2 = trial_fe2.
GetDof();
3614 te_ndof2 = test_fe2.
GetDof();
3626 elmat.
SetSize(te_ndof1 + te_ndof2, tr_ndof1 + tr_ndof2);
3655 if (tr_ndof2 && te_ndof2)
3669 nor(0) = 2*eip1.
x - 1.0;
3678 b =
beta * fabs(un);
3686 if (un >= 0.0 && tr_ndof2 && te_ndof2)
3702 for (
int i = 0; i < te_ndof1; i++)
3703 for (
int j = 0; j < tr_ndof1; j++)
3705 elmat(i, j) += w * te_shape1(i) * tr_shape1(j);
3709 if (tr_ndof2 && te_ndof2)
3715 for (
int i = 0; i < te_ndof2; i++)
3716 for (
int j = 0; j < tr_ndof1; j++)
3718 elmat(te_ndof1+i, j) -= w * te_shape2(i) * tr_shape1(j);
3724 for (
int i = 0; i < te_ndof2; i++)
3725 for (
int j = 0; j < tr_ndof2; j++)
3727 elmat(te_ndof1+i, tr_ndof1+j) += w * te_shape2(i) * tr_shape2(j);
3730 for (
int i = 0; i < te_ndof1; i++)
3731 for (
int j = 0; j < tr_ndof2; j++)
3733 elmat(i, tr_ndof1+j) -= w * te_shape1(i) * tr_shape2(j);
3756 int ndof1, ndof2, ndofs;
3757 bool kappa_is_nonzero = (
kappa != 0.);
3787 ndofs = ndof1 + ndof2;
3790 if (kappa_is_nonzero)
3799 const int order = (ndof2) ? max(el1.
GetOrder(),
3820 nor(0) = 2*eip1.
x - 1.0;
3850 if (kappa_is_nonzero)
3866 for (
int i = 0; i < ndof1; i++)
3867 for (
int j = 0; j < ndof1; j++)
3893 if (kappa_is_nonzero)
3900 for (
int i = 0; i < ndof1; i++)
3901 for (
int j = 0; j < ndof2; j++)
3906 for (
int i = 0; i < ndof2; i++)
3907 for (
int j = 0; j < ndof1; j++)
3912 for (
int i = 0; i < ndof2; i++)
3913 for (
int j = 0; j < ndof2; j++)
3919 if (kappa_is_nonzero)
3923 for (
int i = 0; i < ndof1; i++)
3926 for (
int j = 0; j <= i; j++)
3933 for (
int i = 0; i < ndof2; i++)
3935 const int i2 = ndof1 + i;
3937 for (
int j = 0; j < ndof1; j++)
3941 for (
int j = 0; j <= i; j++)
3951 if (kappa_is_nonzero)
3953 for (
int i = 0; i < ndofs; i++)
3955 for (
int j = 0; j < i; j++)
3957 real_t aij = elmat(i,j), aji = elmat(j,i), mij =
jmat(i,j);
3958 elmat(i,j) =
sigma*aji - aij + mij;
3959 elmat(j,i) =
sigma*aij - aji + mij;
3961 elmat(i,i) = (
sigma - 1.)*elmat(i,i) +
jmat(i,i);
3966 for (
int i = 0; i < ndofs; i++)
3968 for (
int j = 0; j < i; j++)
3970 real_t aij = elmat(i,j), aji = elmat(j,i);
3971 elmat(i,j) =
sigma*aji - aij;
3972 elmat(j,i) =
sigma*aij - aji;
3974 elmat(i,i) *= (
sigma - 1.);
3995 const int dim,
const int row_ndofs,
const int col_ndofs,
3996 const int row_offset,
const int col_offset,
4002 for (
int jm = 0, j = col_offset; jm <
dim; ++jm)
4004 for (
int jdof = 0; jdof < col_ndofs; ++jdof, ++j)
4006 const real_t t2 = col_dshape_dnM(jdof);
4007 for (
int im = 0, i = row_offset; im <
dim; ++im)
4009 const real_t t1 = col_dshape(jdof, jm) * col_nL(im);
4010 const real_t t3 = col_dshape(jdof, im) * col_nM(jm);
4011 const real_t tt = t1 + ((im == jm) ? t2 : 0.0) + t3;
4012 for (
int idof = 0; idof < row_ndofs; ++idof, ++i)
4014 elmat(i, j) += row_shape(idof) * tt;
4020 if (jmatcoef == 0.0) {
return; }
4022 for (
int d = 0; d <
dim; ++d)
4024 const int jo = col_offset + d*col_ndofs;
4025 const int io = row_offset + d*row_ndofs;
4026 for (
int jdof = 0, j = jo; jdof < col_ndofs; ++jdof, ++j)
4028 const real_t sj = jmatcoef * col_shape(jdof);
4029 for (
int i = max(io,j), idof = i - io; idof < row_ndofs; ++idof, ++i)
4031 jmat(i, j) += row_shape(idof) * sj;
4041#ifdef MFEM_THREAD_SAFE
4055 const int ndofs1 = el1.
GetDof();
4057 const int nvdofs =
dim*(ndofs1 + ndofs2);
4067 const bool kappa_is_nonzero = (
kappa != 0.0);
4068 if (kappa_is_nonzero)
4101 for (
int pind = 0; pind < ir->
GetNPoints(); ++pind)
4121 nor(0) = 2*eip1.
x - 1.0;
4142 wLM = (wL2 + 2.0*wM2);
4157 wLM += (wL1 + 2.0*wM1);
4165 dim, ndofs1, ndofs1, 0, 0, jmatcoef,
nL1,
nM1,
4168 if (ndofs2 == 0) {
continue; }
4175 dim, ndofs1, ndofs2, 0,
dim*ndofs1, jmatcoef,
nL2,
nM2,
4179 dim, ndofs2, ndofs1,
dim*ndofs1, 0, jmatcoef,
nL1,
nM1,
4188 if (kappa_is_nonzero)
4190 for (
int i = 0; i < nvdofs; ++i)
4192 for (
int j = 0; j < i; ++j)
4194 real_t aij = elmat(i,j), aji = elmat(j,i), mij =
jmat(i,j);
4195 elmat(i,j) =
alpha*aji - aij + mij;
4196 elmat(j,i) =
alpha*aij - aji + mij;
4198 elmat(i,i) = (
alpha - 1.)*elmat(i,i) +
jmat(i,i);
4203 for (
int i = 0; i < nvdofs; ++i)
4205 for (
int j = 0; j < i; ++j)
4207 real_t aij = elmat(i,j), aji = elmat(j,i);
4208 elmat(i,j) =
alpha*aji - aij;
4209 elmat(j,i) =
alpha*aij - aji;
4211 elmat(i,i) *= (
alpha - 1.);
4222 int i, j, face_ndof, ndof1, ndof2;
4227 face_ndof = trial_face_fe.
GetDof();
4228 ndof1 = test_fe1.
GetDof();
4230 face_shape.
SetSize(face_ndof);
4235 ndof2 = test_fe2.
GetDof();
4243 elmat.
SetSize(ndof1 + ndof2, face_ndof);
4273 trial_face_fe.
CalcShape(ip, face_shape);
4287 for (i = 0; i < ndof1; i++)
4288 for (j = 0; j < face_ndof; j++)
4290 elmat(i, j) += shape1(i) * face_shape(j);
4295 for (i = 0; i < ndof2; i++)
4296 for (j = 0; j < face_ndof; j++)
4298 elmat(ndof1+i, j) -= shape2(i) * face_shape(j);
4309 int i, j, face_ndof, ndof1, ndof2,
dim;
4314 face_ndof = trial_face_fe.
GetDof();
4315 ndof1 = test_fe1.
GetDof();
4318 face_shape.
SetSize(face_ndof);
4325 ndof2 = test_fe2.
GetDof();
4334 elmat.
SetSize(ndof1 + ndof2, face_ndof);
4357 trial_face_fe.
CalcShape(ip, face_shape);
4363 shape1.
Mult(normal, shape1_n);
4371 shape2.
Mult(normal, shape2_n);
4374 for (i = 0; i < ndof1; i++)
4375 for (j = 0; j < face_ndof; j++)
4377 elmat(i, j) += shape1_n(i) * face_shape(j);
4382 for (i = 0; i < ndof2; i++)
4383 for (j = 0; j < face_ndof; j++)
4385 elmat(ndof1+i, j) -= shape2_n(i) * face_shape(j);
4398 "TraceIntegrator::AssembleTraceFaceMatrix: Test space should be H1");
4400 "TraceIntegrator::AssembleTraceFaceMatrix: Trial space should be RT trace");
4402 int i, j, face_ndof, ndof;
4405 face_ndof = trial_face_fe.
GetDof();
4408 face_shape.
SetSize(face_ndof);
4411 elmat.
SetSize(ndof, face_ndof);
4425 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4429 if (iel != elem) { scale = -1.; }
4444 for (i = 0; i < ndof; i++)
4446 for (j = 0; j < face_ndof; j++)
4448 elmat(i, j) += shape(i) * face_shape(j);
4460 int i, j, face_ndof, ndof,
dim;
4464 "NormalTraceIntegrator::AssembleTraceFaceMatrix: Test space should be RT");
4466 "NormalTraceIntegrator::AssembleTraceFaceMatrix: Trial space should be H1 (trace)");
4468 face_ndof = trial_face_fe.
GetDof();
4472 face_shape.
SetSize(face_ndof);
4477 elmat.
SetSize(ndof, face_ndof);
4491 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4495 if (iel != elem) { scale = -1.; }
4505 shape.
Mult(normal, shape_n);
4506 face_shape *= ip.
weight*scale;
4508 for (i = 0; i < ndof; i++)
4510 for (j = 0; j < face_ndof; j++)
4512 elmat(i, j) += shape_n(i) * face_shape(j);
4526 "TangentTraceIntegrator::AssembleTraceFaceMatrix: Test space should be ND");
4528 int face_ndof, ndof,
dim;
4534 "Trial space should be ND face trace and test space should be a ND vector field in 3D ";
4536 trial_face_fe.
GetDim() == 2 && test_fe.
GetDim() == 3, msg);
4541 "Trial space should be H1 edge trace and test space should be a ND vector field in 2D";
4543 trial_face_fe.
GetDim() == 1 && test_fe.
GetDim() == 2, msg);
4545 face_ndof = trial_face_fe.
GetDof();
4548 int dimc = (
dim == 3) ? 3 : 1;
4556 elmat.
SetSize(ndof, face_ndof);
4570 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4574 if (iel != elem) { scale = -1.; }
4595 cross_product(normal, shape, shape_n);
4611 for (
int i = 0; i < ran_nodes.
Size(); i++)
4617 for (
int j = 0; j < shape.
Size(); j++)
4619 for (
int d = 0; d < spaceDim; d++)
4621 elmat(i, j+d*shape.
Size()) = shape(j)*n(d);
4642 void Eval(Vector &V, ElementTransformation &T,
4643 const IntegrationPoint &ip)
override
4659 internal::ShapeCoefficient dom_shape_coeff(*
Q, dom_fe);
4665 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
4694 VShapeCoefficient dom_shape_coeff(*
Q, dom_fe, Trans.
GetSpaceDim());
4720 vc(width), shape(height) { }
4732 VecShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4761 using VectorCoefficient::Eval;
4768 for (
int k = 0; k < vdim; k++)
4770 V(k) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
4775 VCrossVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4781 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
4801 vshape(height, width), vc(width)
4803 MFEM_ASSERT(width == 3,
"");
4812 for (
int k = 0; k < height; k++)
4814 M(k,0) = vc(1) * vshape(k,2) - vc(2) * vshape(k,1);
4815 M(k,1) = vc(2) * vshape(k,0) - vc(0) * vshape(k,2);
4816 M(k,2) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
4821 VCrossVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4855 void Eval(Vector &V, ElementTransformation &T,
4856 const IntegrationPoint &ip)
override
4874 internal::VDotVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4880 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
int Size() const
Return the logical size of the array.
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
static const IntegrationRule & GetRule(const FiniteElement &el, const ElementTransformation &Trans)
void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL) override
Virtual method required for Zienkiewicz-Zhu type error estimators.
DiagonalMatrixCoefficient * DQ
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
const IntegrationRule & GetRule(int order, FaceElementTransformations &T)
static void AssembleBlock(const int dim, const int row_ndofs, const int col_ndofs, const int row_offset, const int col_offset, const real_t jmatcoef, const Vector &col_nL, const Vector &col_nM, const Vector &row_shape, const Vector &col_shape, const Vector &col_dshape_dnM, const DenseMatrix &col_dshape, DenseMatrix &elmat, DenseMatrix &jmat)
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
static const IntegrationRule & GetRule(Geometry::Type geom, int order, const FaceElementTransformations &T)
const FaceGeometricFactors * geom
Not owned.
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
Data type dense matrix using column-major storage.
void AddMult_a(real_t a, const Vector &x, Vector &y) const
y += a * A.x
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
void MultTranspose(const real_t *x, real_t *y) const
Multiply a vector with the transpose matrix.
void Transpose()
(*this) = (*this)^t
void GetColumnReference(int c, Vector &col)
real_t InnerProduct(const real_t *x, const real_t *y) const
Compute y^t A x.
real_t * Data() const
Returns the matrix data array. Warning: this method casts away constness.
real_t * GetData() const
Returns the matrix data array. Warning: this method casts away constness.
void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const override
y += a * A.x
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
void Reset(real_t *d, int h, int w)
Change the data array and the size of the DenseMatrix.
void Invert()
Replaces the current matrix with its inverse.
void AddMatrix(DenseMatrix &A, int ro, int co)
Perform (ro+i,co+j)+=A(i,j) for 0<=i.
void GradToCurl(DenseMatrix &curl)
void GetColumn(int c, Vector &col) const
void GradToVectorCurl2D(DenseMatrix &curl)
void GradToDiv(Vector &div)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe)
real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL) override
Virtual method required for Zienkiewicz-Zhu type error estimators.
DiffusionIntegrator(const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with coefficient Q = 1.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect) override
Perform the local action of the BilinearFormIntegrator.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true, const IntegrationRule *ir=NULL) override
Virtual method required for Zienkiewicz-Zhu type error estimators.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
ElasticityComponentIntegrator(ElasticityIntegrator &parent_, int i_, int j_)
Given an ElasticityIntegrator, create an integrator that represents the th component block.
void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true, const IntegrationRule *ir=NULL) override
real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Tr, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Abstract class for all finite elements.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void ProjectMatrixCoefficient(MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
Given a matrix coefficient and a transformation, compute an approximation ("projection") in the local...
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
void CalcPhysDShape(ElementTransformation &Trans, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in physical space at the poi...
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
int GetDim() const
Returns the reference space dimension for the finite element.
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
int Space() const
Returns the type of FunctionSpace on the element.
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
void CalcPhysVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Equivalent to the CalcVShape() method with the same arguments.
int GetCurlDim() const
Returns the dimension of the curl for vector-valued finite elements.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto 'this' FiniteElement....
virtual void CalcPhysCurlShape(ElementTransformation &Trans, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in physical space at the point de...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
void CalcPhysShape(ElementTransformation &Trans, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in physical space at the point ...
@ Pk
Polynomials of order k.
@ Uk
Rational polynomials of order k.
@ rQk
Refined tensor products of polynomials of order k.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &Trans)
void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &) override
Given a particular Finite Element computes the element matrix elmat.
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
const IntegrationRule * GetIntegrationRule() const
Equivalent to GetIntRule, but retained for backward compatibility with applications.
const IntegrationRule * IntRule
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &Trans)
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
MassIntegrator(const IntegrationRule *ir=nullptr)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Base class for Matrix Coefficients that optionally depend on time and space.
int GetVDim() const
For backward compatibility get the width of the matrix.
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the matrix coefficient in the element described by T at the point ip, storing the result in ...
int GetWidth() const
Get the width of the matrix.
int GetHeight() const
Get the height of the matrix.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape_)
virtual int GetVDim(const FiniteElement &vector_fe)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape_)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
virtual const char * FiniteElementTypeFailureMessage() const
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
DiagonalMatrixCoefficient * DQ
Class for standard nodal finite elements.
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleTraceFaceMatrix(int ielem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void AssembleElementMatrix2(const FiniteElement &nd_fe, const FiniteElement &l2_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add) override
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
void AddAbsMultTransposePA(const Vector &x, Vector &y) const override
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
void AddMultMF(const Vector &x, Vector &y) const override
void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add) override
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add) override
Method defining element assembly.
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AddAbsMultPA(const Vector &x, Vector &y) const override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override
void AddMultTransposeMF(const Vector &x, Vector &y) const override
void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override
void AssembleTraceFaceMatrix(int elem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat)
void AssembleTraceFaceMatrix(int elem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat)
void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Base class for vector Coefficients that optionally depend on time and space.
int GetVDim()
Returns dimension of the vector.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
void AssembleElementMatrix2(const FiniteElement &nd_fe, const FiniteElement &rt_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Assemble an element matrix.
real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun) override
Compute element energy: .
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect) override
Perform the local action of the BilinearFormIntegrator. Note that the default implementation in the b...
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &Trans)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
DiagonalMatrixCoefficient * DQ
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix2(const FiniteElement &rt_fe, const FiniteElement &l2_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void Neg()
(*this) = -(*this)
void SetDataAndSize(real_t *d, int s)
Set the Vector data and size.
Vector & Set(const real_t a, const Vector &x)
(*this) = a * x
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
void NewDataAndSize(real_t *d, int s)
Set the Vector data and size, deleting the old data, if owned.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
void CalcOrtho(const DenseMatrix &J, Vector &n)
void AddMult_a_ABt(real_t a, const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += a * A * B^t.
real_t u(const Vector &xvec)
void mfem_error(const char *msg)
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void MultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
void add(const Vector &v1, const Vector &v2, Vector &v)
void MultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
Multiply a matrix A with the transpose of a matrix B: A*Bt.
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
void AddMult_a_VWt(const real_t a, const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += a * v w^t.
void AddMult_a_VVt(const real_t a, const Vector &v, DenseMatrix &VVt)
VVt += a * v v^t.
void CalcAdjugate(const DenseMatrix &a, DenseMatrix &adja)
void AddMultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += v w^t.
void MultVVt(const Vector &v, DenseMatrix &vvt)
Make a matrix from a vector V.Vt.
void AddMultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += A * B^t.
void AddMult_a_AAt(real_t a, const DenseMatrix &A, DenseMatrix &AAt)
AAt += a * A * A^t.
void MultAAt(const DenseMatrix &a, DenseMatrix &aat)
Calculate the matrix A.At.
void AddMultADBt(const DenseMatrix &A, const Vector &D, const DenseMatrix &B, DenseMatrix &ADBt)
ADBt = A D B^t, where D is diagonal.
ComplexDenseMatrix * MultAtB(const ComplexDenseMatrix &A, const ComplexDenseMatrix &B)
Multiply the complex conjugate transpose of a matrix A with a matrix B. A^H*B.
void Mult_a_AAt(real_t a, const DenseMatrix &A, DenseMatrix &AAt)
AAt = a * A * A^t.
IntegrationRules RefinedIntRules(1, Quadrature1D::GaussLegendre)
A global object with all refined integration rules.
void AddMultADAt(const DenseMatrix &A, const Vector &D, DenseMatrix &ADAt)
ADAt += A D A^t, where D is diagonal.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
real_t p(const Vector &x, real_t t)
MFEM_HOST_DEVICE real_t norm(const Complex &z)