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::AddMultNURBSPA(...)\n"
127 " is not implemented for this class.");
132 MFEM_ABORT(
"BilinearFormIntegrator::AddMultTransposePA(...)\n"
133 " is not implemented for this class.");
138 MFEM_ABORT(
"BilinearFormIntegrator::AssembleMF(...)\n"
139 " is not implemented for this class.");
144 MFEM_ABORT(
"BilinearFormIntegrator::AddMultMF(...)\n"
145 " is not implemented for this class.");
150 MFEM_ABORT(
"BilinearFormIntegrator::AddMultTransposeMF(...)\n"
151 " is not implemented for this class.");
156 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalMF(...)\n"
157 " is not implemented for this class.");
164 MFEM_ABORT(
"BilinearFormIntegrator::AssembleElementMatrix(...)\n"
165 " is not implemented for this class.");
172 MFEM_ABORT(
"BilinearFormIntegrator::AssembleElementMatrix2(...)\n"
173 " is not implemented for this class.");
179 mfem_error (
"BilinearFormIntegrator::AssemblePatchMatrix(...)\n"
180 " is not implemented for this class.");
187 MFEM_ABORT(
"BilinearFormIntegrator::AssembleFaceMatrix(...)\n"
188 " is not implemented for this class.");
197 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this"
198 " Integrator class.");
206 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this"
207 " Integrator class.");
216 MFEM_ABORT(
"AssembleTraceFaceMatrix (DPG form) is not implemented for this"
217 " Integrator class.");
223 MFEM_ABORT(
"Not implemented.");
234 elmat.
Mult(elfun, elvect);
245 elmat.
Mult(elfun, elvect);
319 for (
int i = 0; i < integrators.Size(); i++)
321 integrators[i]->SetIntRule(ir);
328 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
330 integrators[0]->AssembleElementMatrix(el, Trans, elmat);
331 for (
int i = 1; i < integrators.Size(); i++)
333 integrators[i]->AssembleElementMatrix(el, Trans, elem_mat);
342 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
344 integrators[0]->AssembleElementMatrix2(el1, el2, Trans, elmat);
345 for (
int i = 1; i < integrators.Size(); i++)
347 integrators[i]->AssembleElementMatrix2(el1, el2, Trans, elem_mat);
356 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
358 integrators[0]->AssembleFaceMatrix(el1, el2, Trans, elmat);
359 for (
int i = 1; i < integrators.Size(); i++)
361 integrators[i]->AssembleFaceMatrix(el1, el2, Trans, elem_mat);
371 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
373 integrators[0]->AssembleFaceMatrix(tr_fe, te_fe1, te_fe2, Trans, elmat);
374 for (
int i = 1; i < integrators.Size(); i++)
376 integrators[i]->AssembleFaceMatrix(tr_fe, te_fe1, te_fe2, Trans, elem_mat);
383 for (
int i = 0; i < integrators.Size(); i++)
385 integrators[i]->AssemblePA(fes);
391 for (
int i = 0; i < integrators.Size(); i++)
393 integrators[i]->AssembleDiagonalPA(diag);
399 for (
int i = 0; i < integrators.Size(); i++)
401 integrators[i]->AssemblePAInteriorFaces(fes);
407 for (
int i = 0; i < integrators.Size(); i++)
409 integrators[i]->AssemblePABoundaryFaces(fes);
415 for (
int i = 0; i < integrators.Size(); i++)
417 integrators[i]->AddMultPA(x, y);
423 for (
int i = 0; i < integrators.Size(); i++)
425 integrators[i]->AddMultTransposePA(x, y);
431 for (
int i = 0; i < integrators.Size(); i++)
433 integrators[i]->AssembleMF(fes);
439 for (
int i = 0; i < integrators.Size(); i++)
441 integrators[i]->AddMultMF(x, y);
447 for (
int i = 0; i < integrators.Size(); i++)
449 integrators[i]->AddMultTransposeMF(x, y);
455 for (
int i = 0; i < integrators.Size(); i++)
457 integrators[i]->AssembleDiagonalMF(diag);
464 for (
int i = 0; i < integrators.Size(); i++)
466 integrators[i]->AssembleEA(fes, emat,
add);
475 for (
int i = 0; i < integrators.Size(); i++)
477 integrators[i]->AssembleEAInteriorFaces(fes,ea_data_int,ea_data_ext,
add);
485 for (
int i = 0; i < integrators.Size(); i++)
487 integrators[i]->AssembleEABoundaryFaces(fes, ea_data_bdr,
add);
495 for (
int i = 0; i < integrators.Size(); i++)
497 delete integrators[i];
509 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
512#ifdef MFEM_THREAD_SAFE
513 Vector test_shape(test_nd);
527 elmat.
SetSize(test_nd, trial_nd);
550 w *=
Q->
Eval(Trans, ip);
554#ifndef MFEM_THREAD_SAFE
570 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
578 "Dimension mismatch in height of matrix coefficient.");
580 "Dimension mismatch in width of matrix coefficient.");
584 MFEM_VERIFY(trial_vdim == test_vdim,
585 "Diagonal matrix coefficient requires matching "
586 "test and trial vector dimensions.");
588 "Dimension mismatch in diagonal matrix coefficient.");
592 MFEM_VERIFY(
VQ->
GetVDim() == 3,
"Vector coefficient must have "
593 "dimension equal to three.");
596#ifdef MFEM_THREAD_SAFE
607 test_shape.SetSize(test_nd, test_vdim);
608 shape_tmp.
SetSize(test_nd, trial_vdim);
612 trial_shape.
Reset(test_shape.Data(), trial_nd, trial_vdim);
616 trial_shape.
SetSize(trial_nd, trial_vdim);
619 elmat.
SetSize(test_nd, trial_nd);
646 Mult(test_shape, M, shape_tmp);
660 for (
int j=0; j<test_nd; j++)
666 if (test_vdim == 3 && trial_vdim == 3)
668 shape_tmp(j,0) = test_shape(j,1) * V(2) -
669 test_shape(j,2) * V(1);
670 shape_tmp(j,1) = test_shape(j,2) * V(0) -
671 test_shape(j,0) * V(2);
672 shape_tmp(j,2) = test_shape(j,0) * V(1) -
673 test_shape(j,1) * V(0);
675 else if (test_vdim == 3 && trial_vdim == 2)
677 shape_tmp(j,0) = test_shape(j,1) * V(2) -
678 test_shape(j,2) * V(1);
679 shape_tmp(j,1) = test_shape(j,2) * V(0) -
680 test_shape(j,0) * V(2);
682 else if (test_vdim == 3 && trial_vdim == 1)
684 shape_tmp(j,0) = test_shape(j,1) * V(2) -
685 test_shape(j,2) * V(1);
687 else if (test_vdim == 2 && trial_vdim == 3)
689 shape_tmp(j,0) = test_shape(j,1) * V(2);
690 shape_tmp(j,1) = -test_shape(j,0) * V(2);
691 shape_tmp(j,2) = test_shape(j,0) * V(1) -
692 test_shape(j,1) * V(0);
694 else if (test_vdim == 2 && trial_vdim == 2)
696 shape_tmp(j,0) = test_shape(j,1) * V(2);
697 shape_tmp(j,1) = -test_shape(j,0) * V(2);
699 else if (test_vdim == 1 && trial_vdim == 3)
701 shape_tmp(j,0) = 0.0;
702 shape_tmp(j,1) = -test_shape(j,0) * V(2);
703 shape_tmp(j,2) = test_shape(j,0) * V(1);
705 else if (test_vdim == 1 && trial_vdim == 1)
707 shape_tmp(j,0) = 0.0;
716 w *=
Q -> Eval (Trans, ip);
728#ifndef MFEM_THREAD_SAFE
743 MFEM_VERIFY(
VQ,
"MixedScalarVectorIntegrator: "
744 "VectorCoefficient must be set");
750 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
751 int sca_nd = sca_fe->
GetDof();
752 int vec_nd = vec_fe->
GetDof();
756 MFEM_VERIFY(
VQ->
GetVDim() == vdim,
"MixedScalarVectorIntegrator: "
757 "Dimensions of VectorCoefficient and Vector-valued basis "
758 "functions must match");
760#ifdef MFEM_THREAD_SAFE
764 Vector vshape_tmp(vec_nd);
775 elmat.
SetSize(test_nd, trial_nd);
806 vshape.
Mult(V,vshape_tmp);
817 int trial_dof = trial_fe.
GetDof();
818 int test_dof = test_fe.
GetDof();
822 dshape.
SetSize(trial_dof, dim);
823 gshape.
SetSize(trial_dof, dim);
826 elmat.
SetSize(dim * test_dof, trial_dof);
831 elmat_comp.
SetSize(test_dof, trial_dof);
843 Mult(dshape, Jadj, gshape);
848 c *=
Q->
Eval(Trans, ip);
852 for (
int d = 0; d < dim; ++d)
855 MultVWt(shape, d_col, elmat_comp);
856 for (
int jj = 0; jj < trial_dof; ++jj)
858 for (
int ii = 0; ii < test_dof; ++ii)
860 elmat(d * test_dof + ii, jj) += elmat_comp(ii, jj);
879 Q(nullptr), VQ(nullptr), MQ(nullptr), maps(nullptr), geom(nullptr)
912 bool square = (dim == spaceDim);
918 "Unexpected dimension for VectorCoefficient");
923 "Unexpected width for MatrixCoefficient");
925 "Unexpected height for MatrixCoefficient");
928#ifdef MFEM_THREAD_SAFE
929 DenseMatrix dshape(nd, dim), dshapedxt(nd, spaceDim);
935 dshapedxt.
SetSize(nd, spaceDim);
936 dshapedxt_m.
SetSize(nd,
MQ ? spaceDim : 0);
937 M.SetSize(
MQ ? spaceDim : 0);
951 w = ip.
weight / (square ? w : w*w*w);
959 Mult(dshapedxt, M, dshapedxt_m);
972 w *=
Q->
Eval(Trans, ip);
983 int tr_nd = trial_fe.
GetDof();
984 int te_nd = test_fe.
GetDof();
987 bool square = (dim == spaceDim);
993 "Unexpected dimension for VectorCoefficient");
998 "Unexpected width for MatrixCoefficient");
1000 "Unexpected height for MatrixCoefficient");
1003#ifdef MFEM_THREAD_SAFE
1004 DenseMatrix dshape(tr_nd, dim), dshapedxt(tr_nd, spaceDim);
1005 DenseMatrix te_dshape(te_nd, dim), te_dshapedxt(te_nd, spaceDim);
1012 dshapedxt.
SetSize(tr_nd, spaceDim);
1013 te_dshape.
SetSize(te_nd, dim);
1014 te_dshapedxt.
SetSize(te_nd, spaceDim);
1015 invdfdx.
SetSize(dim, spaceDim);
1016 dshapedxt_m.
SetSize(te_nd,
MQ ? spaceDim : 0);
1017 M.SetSize(
MQ ? spaceDim : 0);
1033 w = ip.
weight / (square ? w : w*w*w);
1034 Mult(dshape, invdfdx, dshapedxt);
1035 Mult(te_dshape, invdfdx, te_dshapedxt);
1041 Mult(te_dshapedxt, M, dshapedxt_m);
1054 w *=
Q->
Eval(Trans, ip);
1074 "Unexpected dimension for VectorCoefficient");
1079 "Unexpected width for MatrixCoefficient");
1081 "Unexpected height for MatrixCoefficient");
1084#ifdef MFEM_THREAD_SAFE
1085 DenseMatrix dshape(nd,dim), invdfdx(dim, spaceDim), M(
MQ ? spaceDim : 0);
1089 invdfdx.
SetSize(dim, spaceDim);
1117 w *=
Q->
Eval(Tr, ip);
1127 M.
Mult(vecdxt, pointflux);
1132 for (
int j=0; j<spaceDim; ++j)
1134 pointflux[j] = D[j] * vecdxt[j];
1139 invdfdx.
Mult(pointflux, vec);
1149 int nd, spaceDim, fnd;
1158 "Unexpected dimension for VectorCoefficient");
1163 "Unexpected width for MatrixCoefficient");
1165 "Unexpected height for MatrixCoefficient");
1168#ifdef MFEM_THREAD_SAFE
1169 DenseMatrix dshape(nd,dim), invdfdx(dim, spaceDim);
1174 invdfdx.
SetSize(dim, spaceDim);
1187 flux.
SetSize( fnd * spaceDim );
1189 for (
int i = 0; i < fnd; i++)
1205 vecdxt *=
Q->
Eval(Trans,ip);
1207 for (
int j = 0; j < spaceDim; j++)
1209 flux(fnd*j+i) = vecdxt(j);
1217 M.
Mult(vecdxt, pointflux);
1222 for (
int j=0; j<spaceDim; ++j)
1224 pointflux[j] = D[j] * vecdxt[j];
1227 for (
int j = 0; j < spaceDim; j++)
1229 flux(fnd*j+i) = pointflux(j);
1235 for (
int j = 0; j < spaceDim; j++)
1237 flux(fnd*j+i) = vecdxt(j);
1247 int nd = fluxelem.
GetDof();
1251#ifdef MFEM_THREAD_SAFE
1260 if (d_energy) { vec.
SetSize(spaceDim); }
1263 int order = 2 * fluxelem.
GetOrder();
1266 if (d_energy) { *d_energy = 0.0; }
1275 for (
int k = 0; k < spaceDim; k++)
1277 for (
int j = 0; j < nd; j++)
1279 pointflux(k) += flux(k*nd+j)*shape(j);
1294 energy += w * (D * pointflux);
1298 real_t e = (pointflux * pointflux);
1299 if (
Q) { e *=
Q->
Eval(Trans, ip); }
1307 for (
int k = 0; k < dim; k++)
1309 (*d_energy)[k] += w * vec[k] * vec[k];
1359#ifdef MFEM_THREAD_SAFE
1378 w *=
Q -> Eval(Trans, ip);
1389 int tr_nd = trial_fe.
GetDof();
1390 int te_nd = test_fe.
GetDof();
1393#ifdef MFEM_THREAD_SAFE
1413 w *=
Q -> Eval(Trans, ip);
1440 MFEM_ASSERT(Trans.
Elem2No < 0,
1441 "support for interior faces is not implemented");
1446#ifdef MFEM_THREAD_SAFE
1473 w *=
Q -> Eval(Trans, ip);
1486#ifdef MFEM_THREAD_SAFE
1488 Vector shape, vec2, BdFidxT;
1507 Q->
Eval(Q_ir, Trans, *ir);
1521 adjJ.
Mult(vec1, vec2);
1522 dshape.
Mult(vec2, BdFidxT);
1560 Mult(dshape, adjJ, grad);
1565 for (
int k = 0; k < nd; k++)
1568 for (
int l = 0; l < nd; l++)
1571 for (
int s = 0; s <
dim; s++)
1573 a += Q_nodal(s,k)*grad(l,s);
1575 elmat(k,l) += wsk*
a;
1606 vdim = (vdim == -1) ? spaceDim : vdim;
1649 VQ->
Eval(vec, Trans, ip);
1650 for (
int k = 0; k < vdim; k++)
1652 elmat.
AddMatrix(norm*vec(k), partelmat, nd*k, nd*k);
1657 MQ->
Eval(mcoeff, Trans, ip);
1658 for (
int i = 0; i < vdim; i++)
1659 for (
int j = 0; j < vdim; j++)
1661 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, nd*i, nd*j);
1668 norm *=
Q->
Eval(Trans, ip);
1671 for (
int k = 0; k < vdim; k++)
1683 int tr_nd = trial_fe.
GetDof();
1684 int te_nd = test_fe.
GetDof();
1691 elmat.
SetSize(te_nd*vdim, tr_nd*vdim);
1694 partelmat.
SetSize(te_nd, tr_nd);
1709 Trans.
OrderW() + Q_order);
1731 MultVWt(te_shape, shape, partelmat);
1735 VQ->
Eval(vec, Trans, ip);
1736 for (
int k = 0; k < vdim; k++)
1738 elmat.
AddMatrix(norm*vec(k), partelmat, te_nd*k, tr_nd*k);
1743 MQ->
Eval(mcoeff, Trans, ip);
1744 for (
int i = 0; i < vdim; i++)
1745 for (
int j = 0; j < vdim; j++)
1747 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, te_nd*i, tr_nd*j);
1754 norm *=
Q->
Eval(Trans, ip);
1757 for (
int k = 0; k < vdim; k++)
1759 elmat.
AddMatrix(partelmat, te_nd*k, tr_nd*k);
1769 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1771#ifdef MFEM_THREAD_SAFE
1772 Vector divshape(trial_nd), shape(test_nd);
1778 elmat.
SetSize(test_nd, trial_nd);
1798 w *=
Q->
Eval(Trans, ip);
1809 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1815 "Trial space must be H(Curl) and test space must be H_1");
1817#ifdef MFEM_THREAD_SAFE
1829 elmat.
SetSize(test_nd, trial_nd);
1871 Mult(dshape, invdfdx, dshapedxt);
1879 w *=
Q->
Eval(Trans, ip);
1891 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1893 int dimc = (
dim == 3) ? 3 : 1;
1897 "At least one of the finite elements must be in H(Curl)");
1899 int curl_nd, vec_nd;
1911#ifdef MFEM_THREAD_SAFE
1922 elmat.
SetSize(test_nd, trial_nd);
1969 w *=
Q->
Eval(Trans, ip);
1975 AddMultABt(vshapeTest, curlshapeTrial_dFT, elmat);
1979 AddMultABt(curlshapeTrial_dFT, vshapeTest, elmat);
1991#ifdef MFEM_THREAD_SAFE
2015 w *= Q->
Eval(Tr, ip);
2028 int tr_nd = trial_fe.
GetDof();
2029 int te_nd = test_fe.
GetDof();
2032#ifdef MFEM_THREAD_SAFE
2059 w *= Q->
Eval(Tr, ip);
2074 int trial_nd = trial_fe.
GetDof();
2075 int test_nd = test_fe.
GetDof();
2081 elmat.
SetSize (test_nd,trial_nd);
2083 dshapedxt.
SetSize(trial_nd, spaceDim);
2121 Mult (dshape, invdfdx, dshapedxt);
2125 for (l = 0; l < trial_nd; l++)
2127 dshapedxi(l) = dshapedxt(l,xi);
2144#ifdef MFEM_THREAD_SAFE
2185 Mult(curlshape_dFt, M, curlshape);
2196 w *=
Q->
Eval(Trans, ip);
2211 int tr_nd = trial_fe.
GetDof();
2212 int te_nd = test_fe.
GetDof();
2217#ifdef MFEM_THREAD_SAFE
2263 Mult(te_curlshape_dFt, M, te_curlshape);
2264 AddMultABt(te_curlshape, curlshape_dFt, elmat);
2270 AddMultADBt(te_curlshape_dFt,D,curlshape_dFt,elmat);
2276 w *=
Q->
Eval(Trans, ip);
2279 AddMultABt(te_curlshape_dFt, curlshape_dFt, elmat);
2284void CurlCurlIntegrator
2289#ifdef MFEM_THREAD_SAFE
2293 MFEM_VERIFY(ir == NULL,
"Integration rule (ir) must be NULL")
2298 projcurl.
Mult(
u, flux);
2307 int nd = fluxelem.
GetDof();
2310#ifdef MFEM_THREAD_SAFE
2317 int order = 2 * fluxelem.
GetOrder();
2321 if (d_energy) { *d_energy = 0.0; }
2340 real_t e = w * (pointflux * pointflux);
2349#if ANISO_EXPERIMENTAL
2369#if ANISO_EXPERIMENTAL
2373 int n = (int) round(pow(ir.
GetNPoints(), 1.0/3.0));
2377 for (
int k = 0; k < n; k++)
2378 for (
int l = 0; l < n; l++)
2379 for (
int m = 0; m < n; m++)
2381 Vector &vec = pfluxes[(k*n + l)*n + m];
2384 tmp = vec; tmp -= pfluxes[(k*n + l)*n + (m-1)];
2385 (*d_energy)[0] += (tmp * tmp);
2389 tmp = vec; tmp -= pfluxes[(k*n + (l-1))*n + m];
2390 (*d_energy)[1] += (tmp * tmp);
2394 tmp = vec; tmp -= pfluxes[((k-1)*n + l)*n + m];
2395 (*d_energy)[2] += (tmp * tmp);
2413 int cld = (
dim*(
dim-1))/2;
2415#ifdef MFEM_THREAD_SAFE
2445 Mult(dshape_hat, Jadj, dshape);
2450 w *=
Q->
Eval(Trans, ip);
2463#ifdef MFEM_THREAD_SAFE
2489 MultAtB(elfun_mat, dshape_hat, grad_hat);
2495 Mult(grad_hat, Jadj, grad);
2499 real_t curl = grad(0,1) - grad(1,0);
2504 real_t curl_x = grad(2,1) - grad(1,2);
2505 real_t curl_y = grad(0,2) - grad(2,0);
2506 real_t curl_z = grad(1,0) - grad(0,1);
2507 w *= curl_x * curl_x + curl_y * curl_y + curl_z * curl_z;
2512 w *=
Q->
Eval(Tr, ip);
2520 return 0.5 * energy;
2528 int trial_dof = trial_fe.
GetDof();
2529 int test_dof = test_fe.
GetDof();
2530 int dimc = (
dim == 3) ? 3 : 1;
2534 "Trial finite element must be either 2D/3D H(Curl) or 2D H1");
2537 "Test finite element must be in H1/L2");
2550 elmat_comp.
SetSize(test_dof, trial_dof);
2583 c *=
Q->
Eval(Trans, ip);
2587 for (
int d = 0; d <
dimc; ++d)
2590 for (
int jj = 0; jj < trial_dof; ++jj)
2592 for (
int ii = 0; ii < test_dof; ++ii)
2594 elmat(d * test_dof + ii, jj) += shape(ii) * curldata[jj];
2613#ifdef MFEM_THREAD_SAFE
2618 trial_vshape.
SetSize(dof, vdim);
2648 Mult(trial_vshape,K,tmp);
2661 w *=
Q -> Eval (Trans, ip);
2679 int vdim = std::max(spaceDim, trial_fe.
GetRangeDim());
2680 int trial_dof = trial_fe.
GetDof();
2681 int test_dof = test_fe.
GetDof();
2684#ifdef MFEM_THREAD_SAFE
2690 trial_vshape.
SetSize(trial_dof, spaceDim);
2696 elmat.
SetSize(vdim*test_dof, trial_dof);
2718 for (
int d = 0; d < vdim; d++)
2720 for (
int j = 0; j < test_dof; j++)
2722 for (
int k = 0; k < trial_dof; k++)
2724 elmat(d * test_dof + j, k) +=
2725 shape(j) * D(d) * trial_vshape(k, d);
2734 for (
int d = 0; d < vdim; d++)
2736 for (
int j = 0; j < test_dof; j++)
2738 for (
int k = 0; k < trial_dof; k++)
2741 for (
int vd = 0; vd < spaceDim; vd++)
2743 Kv += K(d, vd) * trial_vshape(k, vd);
2745 elmat(d * test_dof + j, k) += shape(j) * Kv;
2754 w *=
Q->
Eval(Trans, ip);
2756 for (
int d = 0; d < vdim; d++)
2758 for (
int j = 0; j < test_dof; j++)
2760 for (
int k = 0; k < trial_dof; k++)
2762 elmat(d * test_dof + j, k) +=
2763 w * shape(j) * trial_vshape(k, d);
2775 int trial_vdim = std::max(spaceDim, trial_fe.
GetRangeDim());
2776 int test_vdim = std::max(spaceDim, test_fe.
GetRangeDim());
2777 int trial_dof = trial_fe.
GetDof();
2778 int test_dof = test_fe.
GetDof();
2781#ifdef MFEM_THREAD_SAFE
2787 trial_vshape.
SetSize(trial_dof,trial_vdim);
2788 test_vshape.
SetSize(test_dof,test_vdim);
2794 elmat.
SetSize (test_dof, trial_dof);
2817 Mult(test_vshape,K,tmp);
2830 w *=
Q -> Eval (Trans, ip);
2838 MFEM_ABORT(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
2839 " is not implemented for given trial and test bases.");
2851 int trial_dof = trial_fe.
GetDof();
2852 int test_dof = test_fe.
GetDof();
2855 dshape.
SetSize (trial_dof, dim);
2856 gshape.
SetSize (trial_dof, sdim);
2858 divshape.
SetSize (sdim*trial_dof);
2861 elmat.
SetSize (test_dof, sdim*trial_dof);
2867 for (
int i = 0; i < ir -> GetNPoints(); i++)
2878 Mult (dshape, Jadj, gshape);
2883 if (dim != sdim) { c /= Trans.
Weight(); }
2886 c *=
Q -> Eval (Trans, ip);
2913#ifdef MFEM_THREAD_SAFE
2934 for (
int i = 0; i < ir -> GetNPoints(); i++)
2945 c *=
Q -> Eval (Trans, ip);
2959 int tr_nd = trial_fe.
GetDof();
2960 int te_nd = test_fe.
GetDof();
2963#ifdef MFEM_THREAD_SAFE
2965 Vector te_divshape(te_nd);
2975 int order = 2 * max(test_fe.
GetOrder(),
2982 for (
int i = 0; i < ir -> GetNPoints(); i++)
2994 c *=
Q -> Eval (Trans, ip);
3007 const int dof = el.
GetDof();
3012 vdim = (vdim <= 0) ?
sdim : vdim;
3013 const bool square = (
dim ==
sdim);
3038 for (
int i = 0; i < ir -> GetNPoints(); i++)
3046 w = ip.
weight / (square ? w : w*w*w);
3053 VQ->
Eval(vcoeff, Trans, ip);
3054 for (
int k = 0; k < vdim; ++k)
3062 MQ->
Eval(mcoeff, Trans, ip);
3063 for (
int ii = 0; ii < vdim; ++ii)
3065 for (
int jj = 0; jj < vdim; ++jj)
3067 Mult_a_AAt(w*mcoeff(ii,jj), dshapedxt, pelmat);
3068 elmat.
AddMatrix(pelmat, dof*ii, dof*jj);
3074 if (
Q) { w *=
Q->
Eval(Trans, ip); }
3076 for (
int k = 0; k < vdim; ++k)
3088 const int dof = el.
GetDof();
3093 vdim = (vdim <= 0) ?
sdim : vdim;
3094 const bool square = (
dim ==
sdim);
3132 w = ip.
weight / (square ? w : w*w*w);
3138 VQ->
Eval(vcoeff, Tr, ip);
3139 for (
int k = 0; k < vdim; ++k)
3143 pelmat.
AddMult_a(w*vcoeff(k), vec_in, vec_out);
3148 MQ->
Eval(mcoeff, Tr, ip);
3149 for (
int ii = 0; ii < vdim; ++ii)
3152 for (
int jj = 0; jj < vdim; ++jj)
3155 pelmat.
AddMult_a(w*mcoeff(ii,jj), vec_in, vec_out);
3161 if (
Q) { w *=
Q->
Eval(Tr, ip); }
3163 for (
int k = 0; k < vdim; ++k)
3167 pelmat.
AddMult(vec_in, vec_out);
3189#ifdef MFEM_THREAD_SAFE
3240 for (
int d = 0; d <
dim; d++)
3242 for (
int k = 0; k < dof; k++)
3243 for (
int l = 0; l < dof; l++)
3245 elmat (dof*d+k, dof*d+l) += (M * w) * pelmat(k, l);
3248 for (
int ii = 0; ii <
dim; ii++)
3249 for (
int jj = 0; jj <
dim; jj++)
3251 for (
int kk = 0; kk < dof; kk++)
3252 for (
int ll = 0; ll < dof; ll++)
3254 elmat(dof*ii+kk, dof*jj+ll) +=
3255 (M * w) * gshape(kk, jj) * gshape(ll, ii);
3267 const int dof = el.
GetDof();
3269 const int tdim =
dim*(
dim+1)/2;
3272 MFEM_ASSERT(
dim == 2 ||
dim == 3,
3273 "dimension is not supported: dim = " <<
dim);
3278#ifdef MFEM_THREAD_SAFE
3284 real_t gh_data[9], grad_data[9];
3296 for (
int i = 0; i < fnd; i++)
3300 MultAtB(loc_data_mat, dshape, gh);
3321 L *= (grad(0,0) + grad(1,1));
3323 flux(i+fnd*0) = M2*grad(0,0) + L;
3324 flux(i+fnd*1) = M2*grad(1,1) + L;
3325 flux(i+fnd*2) = M*(grad(0,1) + grad(1,0));
3329 L *= (grad(0,0) + grad(1,1) + grad(2,2));
3331 flux(i+fnd*0) = M2*grad(0,0) + L;
3332 flux(i+fnd*1) = M2*grad(1,1) + L;
3333 flux(i+fnd*2) = M2*grad(2,2) + L;
3334 flux(i+fnd*3) = M*(grad(0,1) + grad(1,0));
3335 flux(i+fnd*4) = M*(grad(0,2) + grad(2,0));
3336 flux(i+fnd*5) = M*(grad(1,2) + grad(2,1));
3345 const int dof = fluxelem.
GetDof();
3347 const int tdim =
dim*(
dim+1)/2;
3352 MFEM_ASSERT(d_energy == NULL,
"anisotropic estimates are not supported");
3353 MFEM_ASSERT(flux.
Size() == dof*tdim,
"invalid 'flux' vector");
3355#ifndef MFEM_THREAD_SAFE
3360 real_t pointstress_data[6];
3361 Vector pointstress(pointstress_data, tdim);
3373 int order = 2 * Trans.
OrderGrad(&fluxelem);
3412 const real_t *s = pointstress_data;
3416 const real_t tr_e = (s[0] + s[1])/(2*(M + L));
3418 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + 2*s[2]*s[2]);
3423 const real_t tr_e = (s[0] + s[1] + s[2])/(2*M + 3*L);
3425 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + s[2]*(s[2] - L) +
3426 2*(s[3]*s[3] + s[4]*s[4] + s[5]*s[5]));
3498 nor(0) = 2*eip1.
x - 1.0;
3507 b =
beta * fabs(un);
3515 if (un >= 0.0 && ndof2)
3530 for (
int i = 0; i < ndof1; i++)
3531 for (
int j = 0; j < ndof1; j++)
3533 elmat(i, j) += w * shape1(i) * shape1(j);
3542 for (
int i = 0; i < ndof2; i++)
3543 for (
int j = 0; j < ndof1; j++)
3545 elmat(ndof1+i, j) -= w * shape2(i) * shape1(j);
3551 for (
int i = 0; i < ndof2; i++)
3552 for (
int j = 0; j < ndof2; j++)
3554 elmat(ndof1+i, ndof1+j) += w * shape2(i) * shape2(j);
3557 for (
int i = 0; i < ndof1; i++)
3558 for (
int j = 0; j < ndof2; j++)
3560 elmat(i, ndof1+j) -= w * shape1(i) * shape2(j);
3574 int tr_ndof1, te_ndof1, tr_ndof2, te_ndof2;
3579 tr_ndof1 = trial_fe1.
GetDof();
3580 te_ndof1 = test_fe1.
GetDof();
3585 tr_ndof2 = trial_fe2.
GetDof();
3586 te_ndof2 = test_fe2.
GetDof();
3598 elmat.
SetSize(te_ndof1 + te_ndof2, tr_ndof1 + tr_ndof2);
3627 if (tr_ndof2 && te_ndof2)
3641 nor(0) = 2*eip1.
x - 1.0;
3650 b =
beta * fabs(un);
3658 if (un >= 0.0 && tr_ndof2 && te_ndof2)
3674 for (
int i = 0; i < te_ndof1; i++)
3675 for (
int j = 0; j < tr_ndof1; j++)
3677 elmat(i, j) += w * te_shape1(i) * tr_shape1(j);
3681 if (tr_ndof2 && te_ndof2)
3687 for (
int i = 0; i < te_ndof2; i++)
3688 for (
int j = 0; j < tr_ndof1; j++)
3690 elmat(te_ndof1+i, j) -= w * te_shape2(i) * tr_shape1(j);
3696 for (
int i = 0; i < te_ndof2; i++)
3697 for (
int j = 0; j < tr_ndof2; j++)
3699 elmat(te_ndof1+i, tr_ndof1+j) += w * te_shape2(i) * tr_shape2(j);
3702 for (
int i = 0; i < te_ndof1; i++)
3703 for (
int j = 0; j < tr_ndof2; j++)
3705 elmat(i, tr_ndof1+j) -= w * te_shape1(i) * tr_shape2(j);
3728 int ndof1, ndof2, ndofs;
3729 bool kappa_is_nonzero = (
kappa != 0.);
3759 ndofs = ndof1 + ndof2;
3762 if (kappa_is_nonzero)
3771 const int order = (ndof2) ? max(el1.
GetOrder(),
3792 nor(0) = 2*eip1.
x - 1.0;
3822 if (kappa_is_nonzero)
3838 for (
int i = 0; i < ndof1; i++)
3839 for (
int j = 0; j < ndof1; j++)
3865 if (kappa_is_nonzero)
3872 for (
int i = 0; i < ndof1; i++)
3873 for (
int j = 0; j < ndof2; j++)
3878 for (
int i = 0; i < ndof2; i++)
3879 for (
int j = 0; j < ndof1; j++)
3884 for (
int i = 0; i < ndof2; i++)
3885 for (
int j = 0; j < ndof2; j++)
3891 if (kappa_is_nonzero)
3895 for (
int i = 0; i < ndof1; i++)
3898 for (
int j = 0; j <= i; j++)
3905 for (
int i = 0; i < ndof2; i++)
3907 const int i2 = ndof1 + i;
3909 for (
int j = 0; j < ndof1; j++)
3913 for (
int j = 0; j <= i; j++)
3923 if (kappa_is_nonzero)
3925 for (
int i = 0; i < ndofs; i++)
3927 for (
int j = 0; j < i; j++)
3929 real_t aij = elmat(i,j), aji = elmat(j,i), mij =
jmat(i,j);
3930 elmat(i,j) =
sigma*aji - aij + mij;
3931 elmat(j,i) =
sigma*aij - aji + mij;
3933 elmat(i,i) = (
sigma - 1.)*elmat(i,i) +
jmat(i,i);
3938 for (
int i = 0; i < ndofs; i++)
3940 for (
int j = 0; j < i; j++)
3942 real_t aij = elmat(i,j), aji = elmat(j,i);
3943 elmat(i,j) =
sigma*aji - aij;
3944 elmat(j,i) =
sigma*aij - aji;
3946 elmat(i,i) *= (
sigma - 1.);
3967 const int dim,
const int row_ndofs,
const int col_ndofs,
3968 const int row_offset,
const int col_offset,
3974 for (
int jm = 0, j = col_offset; jm <
dim; ++jm)
3976 for (
int jdof = 0; jdof < col_ndofs; ++jdof, ++j)
3978 const real_t t2 = col_dshape_dnM(jdof);
3979 for (
int im = 0, i = row_offset; im <
dim; ++im)
3981 const real_t t1 = col_dshape(jdof, jm) * col_nL(im);
3982 const real_t t3 = col_dshape(jdof, im) * col_nM(jm);
3983 const real_t tt = t1 + ((im == jm) ? t2 : 0.0) + t3;
3984 for (
int idof = 0; idof < row_ndofs; ++idof, ++i)
3986 elmat(i, j) += row_shape(idof) * tt;
3992 if (jmatcoef == 0.0) {
return; }
3994 for (
int d = 0; d <
dim; ++d)
3996 const int jo = col_offset + d*col_ndofs;
3997 const int io = row_offset + d*row_ndofs;
3998 for (
int jdof = 0, j = jo; jdof < col_ndofs; ++jdof, ++j)
4000 const real_t sj = jmatcoef * col_shape(jdof);
4001 for (
int i = max(io,j), idof = i - io; idof < row_ndofs; ++idof, ++i)
4003 jmat(i, j) += row_shape(idof) * sj;
4013#ifdef MFEM_THREAD_SAFE
4027 const int ndofs1 = el1.
GetDof();
4029 const int nvdofs =
dim*(ndofs1 + ndofs2);
4039 const bool kappa_is_nonzero = (
kappa != 0.0);
4040 if (kappa_is_nonzero)
4073 for (
int pind = 0; pind < ir->
GetNPoints(); ++pind)
4093 nor(0) = 2*eip1.
x - 1.0;
4114 wLM = (wL2 + 2.0*wM2);
4129 wLM += (wL1 + 2.0*wM1);
4137 dim, ndofs1, ndofs1, 0, 0, jmatcoef,
nL1,
nM1,
4140 if (ndofs2 == 0) {
continue; }
4147 dim, ndofs1, ndofs2, 0,
dim*ndofs1, jmatcoef,
nL2,
nM2,
4151 dim, ndofs2, ndofs1,
dim*ndofs1, 0, jmatcoef,
nL1,
nM1,
4160 if (kappa_is_nonzero)
4162 for (
int i = 0; i < nvdofs; ++i)
4164 for (
int j = 0; j < i; ++j)
4166 real_t aij = elmat(i,j), aji = elmat(j,i), mij =
jmat(i,j);
4167 elmat(i,j) =
alpha*aji - aij + mij;
4168 elmat(j,i) =
alpha*aij - aji + mij;
4170 elmat(i,i) = (
alpha - 1.)*elmat(i,i) +
jmat(i,i);
4175 for (
int i = 0; i < nvdofs; ++i)
4177 for (
int j = 0; j < i; ++j)
4179 real_t aij = elmat(i,j), aji = elmat(j,i);
4180 elmat(i,j) =
alpha*aji - aij;
4181 elmat(j,i) =
alpha*aij - aji;
4183 elmat(i,i) *= (
alpha - 1.);
4194 int i, j, face_ndof, ndof1, ndof2;
4199 face_ndof = trial_face_fe.
GetDof();
4200 ndof1 = test_fe1.
GetDof();
4202 face_shape.
SetSize(face_ndof);
4207 ndof2 = test_fe2.
GetDof();
4215 elmat.
SetSize(ndof1 + ndof2, face_ndof);
4245 trial_face_fe.
CalcShape(ip, face_shape);
4259 for (i = 0; i < ndof1; i++)
4260 for (j = 0; j < face_ndof; j++)
4262 elmat(i, j) += shape1(i) * face_shape(j);
4267 for (i = 0; i < ndof2; i++)
4268 for (j = 0; j < face_ndof; j++)
4270 elmat(ndof1+i, j) -= shape2(i) * face_shape(j);
4281 int i, j, face_ndof, ndof1, ndof2,
dim;
4286 face_ndof = trial_face_fe.
GetDof();
4287 ndof1 = test_fe1.
GetDof();
4290 face_shape.
SetSize(face_ndof);
4297 ndof2 = test_fe2.
GetDof();
4306 elmat.
SetSize(ndof1 + ndof2, face_ndof);
4329 trial_face_fe.
CalcShape(ip, face_shape);
4335 shape1.
Mult(normal, shape1_n);
4343 shape2.
Mult(normal, shape2_n);
4346 for (i = 0; i < ndof1; i++)
4347 for (j = 0; j < face_ndof; j++)
4349 elmat(i, j) += shape1_n(i) * face_shape(j);
4354 for (i = 0; i < ndof2; i++)
4355 for (j = 0; j < face_ndof; j++)
4357 elmat(ndof1+i, j) -= shape2_n(i) * face_shape(j);
4370 "TraceIntegrator::AssembleTraceFaceMatrix: Test space should be H1");
4372 "TraceIntegrator::AssembleTraceFaceMatrix: Trial space should be RT trace");
4374 int i, j, face_ndof, ndof;
4377 face_ndof = trial_face_fe.
GetDof();
4380 face_shape.
SetSize(face_ndof);
4383 elmat.
SetSize(ndof, face_ndof);
4397 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4401 if (iel != elem) { scale = -1.; }
4416 for (i = 0; i < ndof; i++)
4418 for (j = 0; j < face_ndof; j++)
4420 elmat(i, j) += shape(i) * face_shape(j);
4432 int i, j, face_ndof, ndof,
dim;
4436 "NormalTraceIntegrator::AssembleTraceFaceMatrix: Test space should be RT");
4438 "NormalTraceIntegrator::AssembleTraceFaceMatrix: Trial space should be H1 (trace)");
4440 face_ndof = trial_face_fe.
GetDof();
4444 face_shape.
SetSize(face_ndof);
4449 elmat.
SetSize(ndof, face_ndof);
4463 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4467 if (iel != elem) { scale = -1.; }
4477 shape.
Mult(normal, shape_n);
4478 face_shape *= ip.
weight*scale;
4480 for (i = 0; i < ndof; i++)
4482 for (j = 0; j < face_ndof; j++)
4484 elmat(i, j) += shape_n(i) * face_shape(j);
4498 "TangentTraceIntegrator::AssembleTraceFaceMatrix: Test space should be ND");
4500 int face_ndof, ndof,
dim;
4506 "Trial space should be ND face trace and test space should be a ND vector field in 3D ";
4508 trial_face_fe.
GetDim() == 2 && test_fe.
GetDim() == 3, msg);
4513 "Trial space should be H1 edge trace and test space should be a ND vector field in 2D";
4515 trial_face_fe.
GetDim() == 1 && test_fe.
GetDim() == 2, msg);
4517 face_ndof = trial_face_fe.
GetDof();
4520 int dimc = (
dim == 3) ? 3 : 1;
4528 elmat.
SetSize(ndof, face_ndof);
4542 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4546 if (iel != elem) { scale = -1.; }
4567 cross_product(normal, shape, shape_n);
4583 for (
int i = 0; i < ran_nodes.
Size(); i++)
4589 for (
int j = 0; j < shape.
Size(); j++)
4591 for (
int d = 0; d < spaceDim; d++)
4593 elmat(i, j+d*shape.
Size()) = shape(j)*n(d);
4614 void Eval(Vector &V, ElementTransformation &T,
4615 const IntegrationPoint &ip)
override
4631 internal::ShapeCoefficient dom_shape_coeff(*
Q, dom_fe);
4637 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
4666 VShapeCoefficient dom_shape_coeff(*
Q, dom_fe, Trans.
GetSpaceDim());
4692 vc(width), shape(height) { }
4704 VecShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4733 using VectorCoefficient::Eval;
4740 for (
int k = 0; k < vdim; k++)
4742 V(k) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
4747 VCrossVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4753 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
4773 vshape(height, width), vc(width)
4775 MFEM_ASSERT(width == 3,
"");
4784 for (
int k = 0; k < height; k++)
4786 M(k,0) = vc(1) * vshape(k,2) - vc(2) * vshape(k,1);
4787 M(k,1) = vc(2) * vshape(k,0) - vc(0) * vshape(k,2);
4788 M(k,2) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
4793 VCrossVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4827 void Eval(Vector &V, ElementTransformation &T,
4828 const IntegrationPoint &ip)
override
4846 internal::VDotVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4852 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.
real_t * GetData() const
Returns the matrix data array.
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 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 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)