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];
1397#ifdef MFEM_THREAD_SAFE
1416 w *=
Q -> Eval(Trans, ip);
1427 int tr_nd = trial_fe.
GetDof();
1428 int te_nd = test_fe.
GetDof();
1431#ifdef MFEM_THREAD_SAFE
1451 w *=
Q -> Eval(Trans, ip);
1487 MFEM_ASSERT(Trans.
Elem2No < 0,
1488 "support for interior faces is not implemented");
1493#ifdef MFEM_THREAD_SAFE
1520 w *=
Q -> Eval(Trans, ip);
1533#ifdef MFEM_THREAD_SAFE
1535 Vector shape, vec2, BdFidxT;
1554 Q->
Eval(Q_ir, Trans, *ir);
1568 adjJ.
Mult(vec1, vec2);
1569 dshape.
Mult(vec2, BdFidxT);
1607 Mult(dshape, adjJ, grad);
1612 for (
int k = 0; k < nd; k++)
1615 for (
int l = 0; l < nd; l++)
1618 for (
int s = 0; s <
dim; s++)
1620 a += Q_nodal(s,k)*grad(l,s);
1622 elmat(k,l) += wsk*
a;
1653 vdim = (vdim == -1) ? spaceDim : vdim;
1696 VQ->
Eval(vec, Trans, ip);
1697 for (
int k = 0; k < vdim; k++)
1704 MQ->
Eval(mcoeff, Trans, ip);
1705 for (
int i = 0; i < vdim; i++)
1706 for (
int j = 0; j < vdim; j++)
1718 for (
int k = 0; k < vdim; k++)
1730 int tr_nd = trial_fe.
GetDof();
1731 int te_nd = test_fe.
GetDof();
1738 elmat.
SetSize(te_nd*vdim, tr_nd*vdim);
1741 partelmat.
SetSize(te_nd, tr_nd);
1756 Trans.
OrderW() + Q_order);
1778 MultVWt(te_shape, shape, partelmat);
1782 VQ->
Eval(vec, Trans, ip);
1783 for (
int k = 0; k < vdim; k++)
1790 MQ->
Eval(mcoeff, Trans, ip);
1791 for (
int i = 0; i < vdim; i++)
1792 for (
int j = 0; j < vdim; j++)
1794 elmat.
AddMatrix(
norm*mcoeff(i,j), partelmat, te_nd*i, tr_nd*j);
1804 for (
int k = 0; k < vdim; k++)
1806 elmat.
AddMatrix(partelmat, te_nd*k, tr_nd*k);
1816 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1818#ifdef MFEM_THREAD_SAFE
1819 Vector divshape(trial_nd), shape(test_nd);
1825 elmat.
SetSize(test_nd, trial_nd);
1845 w *=
Q->
Eval(Trans, ip);
1856 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1862 "Trial space must be H(Curl) and test space must be H_1");
1864#ifdef MFEM_THREAD_SAFE
1876 elmat.
SetSize(test_nd, trial_nd);
1918 Mult(dshape, invdfdx, dshapedxt);
1926 w *=
Q->
Eval(Trans, ip);
1938 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1940 int dimc = (
dim == 3) ? 3 : 1;
1944 "At least one of the finite elements must be in H(Curl)");
1946 int curl_nd, vec_nd;
1958#ifdef MFEM_THREAD_SAFE
1969 elmat.
SetSize(test_nd, trial_nd);
2016 w *=
Q->
Eval(Trans, ip);
2022 AddMultABt(vshapeTest, curlshapeTrial_dFT, elmat);
2026 AddMultABt(curlshapeTrial_dFT, vshapeTest, elmat);
2038#ifdef MFEM_THREAD_SAFE
2062 w *= Q->
Eval(Tr, ip);
2075 int tr_nd = trial_fe.
GetDof();
2076 int te_nd = test_fe.
GetDof();
2079#ifdef MFEM_THREAD_SAFE
2106 w *= Q->
Eval(Tr, ip);
2121 int trial_nd = trial_fe.
GetDof();
2122 int test_nd = test_fe.
GetDof();
2128 elmat.
SetSize (test_nd,trial_nd);
2130 dshapedxt.
SetSize(trial_nd, spaceDim);
2168 Mult (dshape, invdfdx, dshapedxt);
2172 for (l = 0; l < trial_nd; l++)
2174 dshapedxi(l) = dshapedxt(l,xi);
2191#ifdef MFEM_THREAD_SAFE
2232 Mult(curlshape_dFt, M, curlshape);
2243 w *=
Q->
Eval(Trans, ip);
2258 int tr_nd = trial_fe.
GetDof();
2259 int te_nd = test_fe.
GetDof();
2264#ifdef MFEM_THREAD_SAFE
2310 Mult(te_curlshape_dFt, M, te_curlshape);
2311 AddMultABt(te_curlshape, curlshape_dFt, elmat);
2317 AddMultADBt(te_curlshape_dFt,D,curlshape_dFt,elmat);
2323 w *=
Q->
Eval(Trans, ip);
2326 AddMultABt(te_curlshape_dFt, curlshape_dFt, elmat);
2331void CurlCurlIntegrator
2336#ifdef MFEM_THREAD_SAFE
2340 MFEM_VERIFY(ir == NULL,
"Integration rule (ir) must be NULL")
2345 projcurl.
Mult(
u, flux);
2354 int nd = fluxelem.
GetDof();
2357#ifdef MFEM_THREAD_SAFE
2364 int order = 2 * fluxelem.
GetOrder();
2368 if (d_energy) { *d_energy = 0.0; }
2387 real_t e = w * (pointflux * pointflux);
2396#if ANISO_EXPERIMENTAL
2416#if ANISO_EXPERIMENTAL
2420 int n = (int) round(pow(ir.
GetNPoints(), 1.0/3.0));
2424 for (
int k = 0; k < n; k++)
2425 for (
int l = 0; l < n; l++)
2426 for (
int m = 0; m < n; m++)
2428 Vector &vec = pfluxes[(k*n + l)*n + m];
2431 tmp = vec; tmp -= pfluxes[(k*n + l)*n + (m-1)];
2432 (*d_energy)[0] += (tmp * tmp);
2436 tmp = vec; tmp -= pfluxes[(k*n + (l-1))*n + m];
2437 (*d_energy)[1] += (tmp * tmp);
2441 tmp = vec; tmp -= pfluxes[((k-1)*n + l)*n + m];
2442 (*d_energy)[2] += (tmp * tmp);
2460 int cld = (
dim*(
dim-1))/2;
2462#ifdef MFEM_THREAD_SAFE
2492 Mult(dshape_hat, Jadj, dshape);
2497 w *=
Q->
Eval(Trans, ip);
2510#ifdef MFEM_THREAD_SAFE
2536 MultAtB(elfun_mat, dshape_hat, grad_hat);
2542 Mult(grad_hat, Jadj, grad);
2546 real_t curl = grad(0,1) - grad(1,0);
2551 real_t curl_x = grad(2,1) - grad(1,2);
2552 real_t curl_y = grad(0,2) - grad(2,0);
2553 real_t curl_z = grad(1,0) - grad(0,1);
2554 w *= curl_x * curl_x + curl_y * curl_y + curl_z * curl_z;
2559 w *=
Q->
Eval(Tr, ip);
2567 return 0.5 * energy;
2575 int trial_dof = trial_fe.
GetDof();
2576 int test_dof = test_fe.
GetDof();
2577 int dimc = (
dim == 3) ? 3 : 1;
2581 "Trial finite element must be either 2D/3D H(Curl) or 2D H1");
2584 "Test finite element must be in H1/L2");
2597 elmat_comp.
SetSize(test_dof, trial_dof);
2630 c *=
Q->
Eval(Trans, ip);
2634 for (
int d = 0; d <
dimc; ++d)
2637 for (
int jj = 0; jj < trial_dof; ++jj)
2639 for (
int ii = 0; ii < test_dof; ++ii)
2641 elmat(d * test_dof + ii, jj) += shape(ii) * curldata[jj];
2660#ifdef MFEM_THREAD_SAFE
2665 trial_vshape.
SetSize(dof, vdim);
2695 Mult(trial_vshape,K,tmp);
2708 w *=
Q -> Eval (Trans, ip);
2726 int vdim = std::max(spaceDim, trial_fe.
GetRangeDim());
2727 int trial_dof = trial_fe.
GetDof();
2728 int test_dof = test_fe.
GetDof();
2731#ifdef MFEM_THREAD_SAFE
2737 trial_vshape.
SetSize(trial_dof, spaceDim);
2743 elmat.
SetSize(vdim*test_dof, trial_dof);
2765 for (
int d = 0; d < vdim; d++)
2767 for (
int j = 0; j < test_dof; j++)
2769 for (
int k = 0; k < trial_dof; k++)
2771 elmat(d * test_dof + j, k) +=
2772 shape(j) * D(d) * trial_vshape(k, d);
2781 for (
int d = 0; d < vdim; d++)
2783 for (
int j = 0; j < test_dof; j++)
2785 for (
int k = 0; k < trial_dof; k++)
2788 for (
int vd = 0; vd < spaceDim; vd++)
2790 Kv += K(d, vd) * trial_vshape(k, vd);
2792 elmat(d * test_dof + j, k) += shape(j) * Kv;
2801 w *=
Q->
Eval(Trans, ip);
2803 for (
int d = 0; d < vdim; d++)
2805 for (
int j = 0; j < test_dof; j++)
2807 for (
int k = 0; k < trial_dof; k++)
2809 elmat(d * test_dof + j, k) +=
2810 w * shape(j) * trial_vshape(k, d);
2822 int trial_vdim = std::max(spaceDim, trial_fe.
GetRangeDim());
2823 int test_vdim = std::max(spaceDim, test_fe.
GetRangeDim());
2824 int trial_dof = trial_fe.
GetDof();
2825 int test_dof = test_fe.
GetDof();
2828#ifdef MFEM_THREAD_SAFE
2834 trial_vshape.
SetSize(trial_dof,trial_vdim);
2835 test_vshape.
SetSize(test_dof,test_vdim);
2841 elmat.
SetSize (test_dof, trial_dof);
2864 Mult(test_vshape,K,tmp);
2877 w *=
Q -> Eval (Trans, ip);
2885 MFEM_ABORT(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
2886 " is not implemented for given trial and test bases.");
2898 int trial_dof = trial_fe.
GetDof();
2899 int test_dof = test_fe.
GetDof();
2902 dshape.
SetSize (trial_dof, dim);
2903 gshape.
SetSize (trial_dof, sdim);
2905 divshape.
SetSize (sdim*trial_dof);
2908 elmat.
SetSize (test_dof, sdim*trial_dof);
2914 for (
int i = 0; i < ir -> GetNPoints(); i++)
2925 Mult (dshape, Jadj, gshape);
2930 if (dim != sdim) { c /= Trans.
Weight(); }
2933 c *=
Q -> Eval (Trans, ip);
2960#ifdef MFEM_THREAD_SAFE
2981 for (
int i = 0; i < ir -> GetNPoints(); i++)
2992 c *=
Q -> Eval (Trans, ip);
3006 int tr_nd = trial_fe.
GetDof();
3007 int te_nd = test_fe.
GetDof();
3010#ifdef MFEM_THREAD_SAFE
3012 Vector te_divshape(te_nd);
3022 int order = 2 * max(test_fe.
GetOrder(),
3029 for (
int i = 0; i < ir -> GetNPoints(); i++)
3041 c *=
Q -> Eval (Trans, ip);
3054 const int dof = el.
GetDof();
3059 vdim = (vdim <= 0) ?
sdim : vdim;
3060 const bool square = (
dim ==
sdim);
3085 for (
int i = 0; i < ir -> GetNPoints(); i++)
3092 w = ip.
weight / (square ? w : w*w*w);
3099 VQ->
Eval(vcoeff, Trans, ip);
3100 for (
int k = 0; k < vdim; ++k)
3108 MQ->
Eval(mcoeff, Trans, ip);
3109 for (
int ii = 0; ii < vdim; ++ii)
3111 for (
int jj = 0; jj < vdim; ++jj)
3113 Mult_a_AAt(w*mcoeff(ii,jj), dshapedxt, pelmat);
3114 elmat.
AddMatrix(pelmat, dof*ii, dof*jj);
3120 if (
Q) { w *=
Q->
Eval(Trans, ip); }
3122 for (
int k = 0; k < vdim; ++k)
3134 const int dof = el.
GetDof();
3139 vdim = (vdim <= 0) ?
sdim : vdim;
3140 const bool square = (
dim ==
sdim);
3178 w = ip.
weight / (square ? w : w*w*w);
3184 VQ->
Eval(vcoeff, Tr, ip);
3185 for (
int k = 0; k < vdim; ++k)
3189 pelmat.
AddMult_a(w*vcoeff(k), vec_in, vec_out);
3194 MQ->
Eval(mcoeff, Tr, ip);
3195 for (
int ii = 0; ii < vdim; ++ii)
3198 for (
int jj = 0; jj < vdim; ++jj)
3201 pelmat.
AddMult_a(w*mcoeff(ii,jj), vec_in, vec_out);
3207 if (
Q) { w *=
Q->
Eval(Tr, ip); }
3209 for (
int k = 0; k < vdim; ++k)
3213 pelmat.
AddMult(vec_in, vec_out);
3235#ifdef MFEM_THREAD_SAFE
3286 for (
int d = 0; d <
dim; d++)
3288 for (
int k = 0; k < dof; k++)
3289 for (
int l = 0; l < dof; l++)
3291 elmat (dof*d+k, dof*d+l) += (M * w) * pelmat(k, l);
3294 for (
int ii = 0; ii <
dim; ii++)
3295 for (
int jj = 0; jj <
dim; jj++)
3297 for (
int kk = 0; kk < dof; kk++)
3298 for (
int ll = 0; ll < dof; ll++)
3300 elmat(dof*ii+kk, dof*jj+ll) +=
3301 (M * w) * gshape(kk, jj) * gshape(ll, ii);
3313 const int dof = el.
GetDof();
3315 const int tdim =
dim*(
dim+1)/2;
3318 MFEM_ASSERT(
dim == 2 ||
dim == 3,
3319 "dimension is not supported: dim = " <<
dim);
3324#ifdef MFEM_THREAD_SAFE
3330 real_t gh_data[9], grad_data[9];
3342 for (
int i = 0; i < fnd; i++)
3346 MultAtB(loc_data_mat, dshape, gh);
3367 L *= (grad(0,0) + grad(1,1));
3369 flux(i+fnd*0) = M2*grad(0,0) + L;
3370 flux(i+fnd*1) = M2*grad(1,1) + L;
3371 flux(i+fnd*2) = M*(grad(0,1) + grad(1,0));
3375 L *= (grad(0,0) + grad(1,1) + grad(2,2));
3377 flux(i+fnd*0) = M2*grad(0,0) + L;
3378 flux(i+fnd*1) = M2*grad(1,1) + L;
3379 flux(i+fnd*2) = M2*grad(2,2) + L;
3380 flux(i+fnd*3) = M*(grad(0,1) + grad(1,0));
3381 flux(i+fnd*4) = M*(grad(0,2) + grad(2,0));
3382 flux(i+fnd*5) = M*(grad(1,2) + grad(2,1));
3391 const int dof = fluxelem.
GetDof();
3393 const int tdim =
dim*(
dim+1)/2;
3398 MFEM_ASSERT(d_energy == NULL,
"anisotropic estimates are not supported");
3399 MFEM_ASSERT(flux.
Size() == dof*tdim,
"invalid 'flux' vector");
3401#ifndef MFEM_THREAD_SAFE
3406 real_t pointstress_data[6];
3407 Vector pointstress(pointstress_data, tdim);
3419 int order = 2 * Trans.
OrderGrad(&fluxelem);
3458 const real_t *s = pointstress_data;
3462 const real_t tr_e = (s[0] + s[1])/(2*(M + L));
3464 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + 2*s[2]*s[2]);
3469 const real_t tr_e = (s[0] + s[1] + s[2])/(2*M + 3*L);
3471 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + s[2]*(s[2] - L) +
3472 2*(s[3]*s[3] + s[4]*s[4] + s[5]*s[5]));
3544 nor(0) = 2*eip1.
x - 1.0;
3553 b =
beta * fabs(un);
3561 if (un >= 0.0 && ndof2)
3576 for (
int i = 0; i < ndof1; i++)
3577 for (
int j = 0; j < ndof1; j++)
3579 elmat(i, j) += w * shape1(i) * shape1(j);
3588 for (
int i = 0; i < ndof2; i++)
3589 for (
int j = 0; j < ndof1; j++)
3591 elmat(ndof1+i, j) -= w * shape2(i) * shape1(j);
3597 for (
int i = 0; i < ndof2; i++)
3598 for (
int j = 0; j < ndof2; j++)
3600 elmat(ndof1+i, ndof1+j) += w * shape2(i) * shape2(j);
3603 for (
int i = 0; i < ndof1; i++)
3604 for (
int j = 0; j < ndof2; j++)
3606 elmat(i, ndof1+j) -= w * shape1(i) * shape2(j);
3620 int tr_ndof1, te_ndof1, tr_ndof2, te_ndof2;
3625 tr_ndof1 = trial_fe1.
GetDof();
3626 te_ndof1 = test_fe1.
GetDof();
3631 tr_ndof2 = trial_fe2.
GetDof();
3632 te_ndof2 = test_fe2.
GetDof();
3644 elmat.
SetSize(te_ndof1 + te_ndof2, tr_ndof1 + tr_ndof2);
3673 if (tr_ndof2 && te_ndof2)
3687 nor(0) = 2*eip1.
x - 1.0;
3696 b =
beta * fabs(un);
3704 if (un >= 0.0 && tr_ndof2 && te_ndof2)
3720 for (
int i = 0; i < te_ndof1; i++)
3721 for (
int j = 0; j < tr_ndof1; j++)
3723 elmat(i, j) += w * te_shape1(i) * tr_shape1(j);
3727 if (tr_ndof2 && te_ndof2)
3733 for (
int i = 0; i < te_ndof2; i++)
3734 for (
int j = 0; j < tr_ndof1; j++)
3736 elmat(te_ndof1+i, j) -= w * te_shape2(i) * tr_shape1(j);
3742 for (
int i = 0; i < te_ndof2; i++)
3743 for (
int j = 0; j < tr_ndof2; j++)
3745 elmat(te_ndof1+i, tr_ndof1+j) += w * te_shape2(i) * tr_shape2(j);
3748 for (
int i = 0; i < te_ndof1; i++)
3749 for (
int j = 0; j < tr_ndof2; j++)
3751 elmat(i, tr_ndof1+j) -= w * te_shape1(i) * tr_shape2(j);
3774 int ndof1, ndof2, ndofs;
3775 bool kappa_is_nonzero = (
kappa != 0.);
3805 ndofs = ndof1 + ndof2;
3808 if (kappa_is_nonzero)
3817 const int order = (ndof2) ? max(el1.
GetOrder(),
3838 nor(0) = 2*eip1.
x - 1.0;
3868 if (kappa_is_nonzero)
3884 for (
int i = 0; i < ndof1; i++)
3885 for (
int j = 0; j < ndof1; j++)
3911 if (kappa_is_nonzero)
3918 for (
int i = 0; i < ndof1; i++)
3919 for (
int j = 0; j < ndof2; j++)
3924 for (
int i = 0; i < ndof2; i++)
3925 for (
int j = 0; j < ndof1; j++)
3930 for (
int i = 0; i < ndof2; i++)
3931 for (
int j = 0; j < ndof2; j++)
3937 if (kappa_is_nonzero)
3941 for (
int i = 0; i < ndof1; i++)
3944 for (
int j = 0; j <= i; j++)
3951 for (
int i = 0; i < ndof2; i++)
3953 const int i2 = ndof1 + i;
3955 for (
int j = 0; j < ndof1; j++)
3959 for (
int j = 0; j <= i; j++)
3969 if (kappa_is_nonzero)
3971 for (
int i = 0; i < ndofs; i++)
3973 for (
int j = 0; j < i; j++)
3975 real_t aij = elmat(i,j), aji = elmat(j,i), mij =
jmat(i,j);
3976 elmat(i,j) =
sigma*aji - aij + mij;
3977 elmat(j,i) =
sigma*aij - aji + mij;
3979 elmat(i,i) = (
sigma - 1.)*elmat(i,i) +
jmat(i,i);
3984 for (
int i = 0; i < ndofs; i++)
3986 for (
int j = 0; j < i; j++)
3988 real_t aij = elmat(i,j), aji = elmat(j,i);
3989 elmat(i,j) =
sigma*aji - aij;
3990 elmat(j,i) =
sigma*aij - aji;
3992 elmat(i,i) *= (
sigma - 1.);
4013 const int dim,
const int row_ndofs,
const int col_ndofs,
4014 const int row_offset,
const int col_offset,
4020 for (
int jm = 0, j = col_offset; jm <
dim; ++jm)
4022 for (
int jdof = 0; jdof < col_ndofs; ++jdof, ++j)
4024 const real_t t2 = col_dshape_dnM(jdof);
4025 for (
int im = 0, i = row_offset; im <
dim; ++im)
4027 const real_t t1 = col_dshape(jdof, jm) * col_nL(im);
4028 const real_t t3 = col_dshape(jdof, im) * col_nM(jm);
4029 const real_t tt = t1 + ((im == jm) ? t2 : 0.0) + t3;
4030 for (
int idof = 0; idof < row_ndofs; ++idof, ++i)
4032 elmat(i, j) += row_shape(idof) * tt;
4038 if (jmatcoef == 0.0) {
return; }
4040 for (
int d = 0; d <
dim; ++d)
4042 const int jo = col_offset + d*col_ndofs;
4043 const int io = row_offset + d*row_ndofs;
4044 for (
int jdof = 0, j = jo; jdof < col_ndofs; ++jdof, ++j)
4046 const real_t sj = jmatcoef * col_shape(jdof);
4047 for (
int i = max(io,j), idof = i - io; idof < row_ndofs; ++idof, ++i)
4049 jmat(i, j) += row_shape(idof) * sj;
4059#ifdef MFEM_THREAD_SAFE
4073 const int ndofs1 = el1.
GetDof();
4075 const int nvdofs =
dim*(ndofs1 + ndofs2);
4085 const bool kappa_is_nonzero = (
kappa != 0.0);
4086 if (kappa_is_nonzero)
4119 for (
int pind = 0; pind < ir->
GetNPoints(); ++pind)
4139 nor(0) = 2*eip1.
x - 1.0;
4160 wLM = (wL2 + 2.0*wM2);
4175 wLM += (wL1 + 2.0*wM1);
4183 dim, ndofs1, ndofs1, 0, 0, jmatcoef,
nL1,
nM1,
4186 if (ndofs2 == 0) {
continue; }
4193 dim, ndofs1, ndofs2, 0,
dim*ndofs1, jmatcoef,
nL2,
nM2,
4197 dim, ndofs2, ndofs1,
dim*ndofs1, 0, jmatcoef,
nL1,
nM1,
4206 if (kappa_is_nonzero)
4208 for (
int i = 0; i < nvdofs; ++i)
4210 for (
int j = 0; j < i; ++j)
4212 real_t aij = elmat(i,j), aji = elmat(j,i), mij =
jmat(i,j);
4213 elmat(i,j) =
alpha*aji - aij + mij;
4214 elmat(j,i) =
alpha*aij - aji + mij;
4216 elmat(i,i) = (
alpha - 1.)*elmat(i,i) +
jmat(i,i);
4221 for (
int i = 0; i < nvdofs; ++i)
4223 for (
int j = 0; j < i; ++j)
4225 real_t aij = elmat(i,j), aji = elmat(j,i);
4226 elmat(i,j) =
alpha*aji - aij;
4227 elmat(j,i) =
alpha*aij - aji;
4229 elmat(i,i) *= (
alpha - 1.);
4240 int i, j, face_ndof, ndof1, ndof2;
4245 face_ndof = trial_face_fe.
GetDof();
4246 ndof1 = test_fe1.
GetDof();
4248 face_shape.
SetSize(face_ndof);
4253 ndof2 = test_fe2.
GetDof();
4261 elmat.
SetSize(ndof1 + ndof2, face_ndof);
4291 trial_face_fe.
CalcShape(ip, face_shape);
4305 for (i = 0; i < ndof1; i++)
4306 for (j = 0; j < face_ndof; j++)
4308 elmat(i, j) += shape1(i) * face_shape(j);
4313 for (i = 0; i < ndof2; i++)
4314 for (j = 0; j < face_ndof; j++)
4316 elmat(ndof1+i, j) -= shape2(i) * face_shape(j);
4327 int i, j, face_ndof, ndof1, ndof2,
dim;
4332 face_ndof = trial_face_fe.
GetDof();
4333 ndof1 = test_fe1.
GetDof();
4336 face_shape.
SetSize(face_ndof);
4343 ndof2 = test_fe2.
GetDof();
4352 elmat.
SetSize(ndof1 + ndof2, face_ndof);
4375 trial_face_fe.
CalcShape(ip, face_shape);
4381 shape1.
Mult(normal, shape1_n);
4389 shape2.
Mult(normal, shape2_n);
4392 for (i = 0; i < ndof1; i++)
4393 for (j = 0; j < face_ndof; j++)
4395 elmat(i, j) += shape1_n(i) * face_shape(j);
4400 for (i = 0; i < ndof2; i++)
4401 for (j = 0; j < face_ndof; j++)
4403 elmat(ndof1+i, j) -= shape2_n(i) * face_shape(j);
4416 "TraceIntegrator::AssembleTraceFaceMatrix: Test space should be H1");
4418 "TraceIntegrator::AssembleTraceFaceMatrix: Trial space should be RT trace");
4420 int i, j, face_ndof, ndof;
4423 face_ndof = trial_face_fe.
GetDof();
4426 face_shape.
SetSize(face_ndof);
4429 elmat.
SetSize(ndof, face_ndof);
4443 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4447 if (iel != elem) { scale = -1.; }
4462 for (i = 0; i < ndof; i++)
4464 for (j = 0; j < face_ndof; j++)
4466 elmat(i, j) += shape(i) * face_shape(j);
4478 int i, j, face_ndof, ndof,
dim;
4482 "NormalTraceIntegrator::AssembleTraceFaceMatrix: Test space should be RT");
4484 "NormalTraceIntegrator::AssembleTraceFaceMatrix: Trial space should be H1 (trace)");
4486 face_ndof = trial_face_fe.
GetDof();
4490 face_shape.
SetSize(face_ndof);
4495 elmat.
SetSize(ndof, face_ndof);
4509 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4513 if (iel != elem) { scale = -1.; }
4523 shape.
Mult(normal, shape_n);
4524 face_shape *= ip.
weight*scale;
4526 for (i = 0; i < ndof; i++)
4528 for (j = 0; j < face_ndof; j++)
4530 elmat(i, j) += shape_n(i) * face_shape(j);
4544 "TangentTraceIntegrator::AssembleTraceFaceMatrix: Test space should be ND");
4546 int face_ndof, ndof,
dim;
4552 "Trial space should be ND face trace and test space should be a ND vector field in 3D ";
4554 trial_face_fe.
GetDim() == 2 && test_fe.
GetDim() == 3, msg);
4559 "Trial space should be H1 edge trace and test space should be a ND vector field in 2D";
4561 trial_face_fe.
GetDim() == 1 && test_fe.
GetDim() == 2, msg);
4563 face_ndof = trial_face_fe.
GetDof();
4566 int dimc = (
dim == 3) ? 3 : 1;
4574 elmat.
SetSize(ndof, face_ndof);
4588 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4592 if (iel != elem) { scale = -1.; }
4613 cross_product(normal, shape, shape_n);
4629 for (
int i = 0; i < ran_nodes.
Size(); i++)
4635 for (
int j = 0; j < shape.
Size(); j++)
4637 for (
int d = 0; d < spaceDim; d++)
4639 elmat(i, j+d*shape.
Size()) = shape(j)*n(d);
4660 void Eval(Vector &V, ElementTransformation &T,
4661 const IntegrationPoint &ip)
override
4677 internal::ShapeCoefficient dom_shape_coeff(*
Q, dom_fe);
4683 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
4712 VShapeCoefficient dom_shape_coeff(*
Q, dom_fe, Trans.
GetSpaceDim());
4738 vc(width), shape(height) { }
4750 VecShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4779 using VectorCoefficient::Eval;
4786 for (
int k = 0; k < vdim; k++)
4788 V(k) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
4793 VCrossVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4799 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
4819 vshape(height, width), vc(width)
4821 MFEM_ASSERT(width == 3,
"");
4830 for (
int k = 0; k < height; k++)
4832 M(k,0) = vc(1) * vshape(k,2) - vc(2) * vshape(k,1);
4833 M(k,1) = vc(2) * vshape(k,0) - vc(0) * vshape(k,2);
4834 M(k,2) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
4839 VCrossVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4873 void Eval(Vector &V, ElementTransformation &T,
4874 const IntegrationPoint &ip)
override
4892 internal::VDotVShapeCoefficient dom_shape_coeff(*
VQ, dom_fe);
4898 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
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.
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const bool stroud=false)
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.
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.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &Trans, const bool stroud=false)
MassIntegrator(const IntegrationRule *ir=nullptr)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
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
const IntegrationRule & Get(int GeomType, int Order)
Returns a Stroud integration rule for given GeomType and Order.
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.
StroudIntegrationRules StroudIntRules
A global object with all Stroud integration rules (defined in intrules.cpp)
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)