23 void BilinearFormIntegrator::AssembleElementMatrix (
27 mfem_error (
"BilinearFormIntegrator::AssembleElementMatrix (...)\n"
28 " is not implemented fot this class.");
31 void BilinearFormIntegrator::AssembleElementMatrix2 (
35 mfem_error (
"BilinearFormIntegrator::AssembleElementMatrix2 (...)\n"
36 " is not implemented fot this class.");
39 void BilinearFormIntegrator::AssembleFaceMatrix (
43 mfem_error (
"BilinearFormIntegrator::AssembleFaceMatrix (...)\n"
44 " is not implemented fot this class.");
47 void BilinearFormIntegrator::AssembleFaceMatrix(
52 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this"
53 " Integrator class.");
56 void BilinearFormIntegrator::AssembleElementVector(
60 mfem_error(
"BilinearFormIntegrator::AssembleElementVector\n"
61 " is not implemented fot this class.");
65 void TransposeIntegrator::AssembleElementMatrix (
68 bfi -> AssembleElementMatrix (el, Trans, bfi_elmat);
73 void TransposeIntegrator::AssembleElementMatrix2 (
77 bfi -> AssembleElementMatrix2 (test_fe, trial_fe, Trans, bfi_elmat);
82 void TransposeIntegrator::AssembleFaceMatrix (
86 bfi -> AssembleFaceMatrix (el1, el2, Trans, bfi_elmat);
91 void LumpedIntegrator::AssembleElementMatrix (
94 bfi -> AssembleElementMatrix (el, Trans, elmat);
98 void InverseIntegrator::AssembleElementMatrix(
101 integrator->AssembleElementMatrix(el, Trans, elmat);
105 void SumIntegrator::AssembleElementMatrix(
108 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
110 integrators[0]->AssembleElementMatrix(el, Trans, elmat);
111 for (
int i = 1; i < integrators.Size(); i++)
113 integrators[i]->AssembleElementMatrix(el, Trans, elem_mat);
118 SumIntegrator::~SumIntegrator()
122 for (
int i = 0; i < integrators.Size(); i++)
124 delete integrators[i];
130 void DiffusionIntegrator::AssembleElementMatrix
137 bool square = (dim == spaceDim);
140 #ifdef MFEM_THREAD_SAFE
141 DenseMatrix dshape(nd,dim), dshapedxt(nd,spaceDim), invdfdx(dim,spaceDim);
143 dshape.SetSize(nd,dim);
144 dshapedxt.SetSize(nd,spaceDim);
153 if (el.
Space() == FunctionSpace::Pk)
163 if (el.
Space() == FunctionSpace::rQk)
184 w = ip.
weight / (square ? w : w*w*w);
185 Mult(dshape, invdfdx, dshapedxt);
190 w *= Q->Eval(Trans, ip);
196 MQ->Eval(invdfdx, Trans, ip);
198 Mult(dshapedxt, invdfdx, dshape);
204 void DiffusionIntegrator::AssembleElementMatrix2(
208 int tr_nd = trial_fe.
GetDof();
209 int te_nd = test_fe.
GetDof();
212 bool square = (dim == spaceDim);
215 #ifdef MFEM_THREAD_SAFE
216 DenseMatrix dshape(tr_nd, dim), dshapedxt(tr_nd, spaceDim);
217 DenseMatrix te_dshape(te_nd, dim), te_dshapedxt(te_nd, spaceDim);
220 dshape.SetSize(tr_nd, dim);
221 dshapedxt.
SetSize(tr_nd, spaceDim);
222 te_dshape.SetSize(te_nd, dim);
223 te_dshapedxt.
SetSize(te_nd, spaceDim);
224 invdfdx.
SetSize(dim, spaceDim);
232 if (trial_fe.
Space() == FunctionSpace::Pk)
241 if (trial_fe.
Space() == FunctionSpace::rQk)
261 w = ip.
weight / (square ? w : w*w*w);
262 Mult(dshape, invdfdx, dshapedxt);
263 Mult(te_dshape, invdfdx, te_dshapedxt);
269 w *= Q->Eval(Trans, ip);
276 MQ->Eval(invdfdx, Trans, ip);
278 Mult(te_dshapedxt, invdfdx, te_dshape);
284 void DiffusionIntegrator::AssembleElementVector(
292 #ifdef MFEM_THREAD_SAFE
295 dshape.SetSize(nd,dim);
296 invdfdx.SetSize(dim);
300 pointflux.SetSize(dim);
308 if (el.
Space() == FunctionSpace::Pk)
318 if (el.
Space() == FunctionSpace::rQk)
340 dshape.MultTranspose(elfun, vec);
341 invdfdx.MultTranspose(vec, pointflux);
344 w *= Q->Eval(Tr, ip);
350 dshape.MultTranspose(elfun, pointflux);
351 invdfdx.MultTranspose(pointflux, vec);
352 MQ->Eval(mq, Tr, ip);
353 mq.
Mult(vec, pointflux);
356 invdfdx.Mult(pointflux, vec);
357 dshape.AddMult(vec, elvect);
361 void DiffusionIntegrator::ComputeElementFlux
365 int i, j, nd,
dim, spaceDim, fnd;
371 #ifdef MFEM_THREAD_SAFE
372 DenseMatrix dshape(nd,dim), invdfdx(dim, spaceDim);
374 dshape.SetSize(nd,dim);
375 invdfdx.
SetSize(dim, spaceDim);
378 pointflux.SetSize(spaceDim);
382 flux.
SetSize( fnd * spaceDim );
384 for (i = 0; i < fnd; i++)
388 dshape.MultTranspose(u, vec);
398 pointflux *= Q->Eval(Trans,ip);
400 for (j = 0; j < spaceDim; j++)
402 flux(fnd*j+i) = pointflux(j);
408 MFEM_ASSERT(dim == spaceDim,
"TODO");
409 MQ->Eval(invdfdx, Trans, ip);
410 invdfdx.
Mult(pointflux, vec);
411 for (j = 0; j <
dim; j++)
413 flux(fnd*j+i) = vec(j);
419 double DiffusionIntegrator::ComputeFluxEnergy
423 int nd = fluxelem.
GetDof();
427 #ifdef MFEM_THREAD_SAFE
432 pointflux.SetSize(spaceDim);
433 if (d_energy) { vec.SetSize(dim); }
436 int order = 2 * fluxelem.
GetOrder();
440 if (d_energy) { *d_energy = 0.0; }
448 for (
int k = 0; k < spaceDim; k++)
450 for (
int j = 0; j < nd; j++)
452 pointflux(k) += flux(k*nd+j)*shape(j);
461 double e = (pointflux * pointflux);
462 if (Q) { e *= Q->Eval(Trans, ip); }
467 MQ->Eval(mq, Trans, ip);
475 for (
int k = 0; k <
dim; k++)
477 (*d_energy)[k] += w * vec[k] * vec[k];
487 void MassIntegrator::AssembleElementMatrix
504 if (el.
Space() == FunctionSpace::rQk)
524 w *= Q -> Eval(Trans, ip);
531 void MassIntegrator::AssembleElementMatrix2(
535 int tr_nd = trial_fe.
GetDof();
536 int te_nd = test_fe.
GetDof();
541 shape.SetSize (tr_nd);
542 te_shape.SetSize (te_nd);
563 w *= Q -> Eval(Trans, ip);
572 void ConvectionIntegrator::AssembleElementMatrix(
579 dshape.SetSize(nd,dim);
594 Q.Eval(Q_ir, Trans, *ir);
605 Q_ir.GetColumnReference(i, vec1);
606 vec1 *= alpha * ip.
weight;
608 adjJ.Mult(vec1, vec2);
609 dshape.Mult(vec2, BdFidxT);
616 void GroupConvectionIntegrator::AssembleElementMatrix(
623 dshape.SetSize(nd,dim);
626 grad.SetSize(nd,dim);
635 Q.Eval(Q_nodal, Trans, el.
GetNodes());
647 Mult(dshape, adjJ, grad);
649 double w = alpha * ip.
weight;
652 for (
int k = 0; k < nd; k++)
654 double wsk = w*shape(k);
655 for (
int l = 0; l < nd; l++)
658 for (
int s = 0; s <
dim; s++)
660 a += Q_nodal(s,k)*grad(l,s);
669 void VectorMassIntegrator::AssembleElementMatrix
679 int vdim = (VQ) ? (VQ -> GetVDim()) : ((MQ) ? (MQ -> GetVDim()) : spaceDim);
683 partelmat.SetSize(nd);
690 mcoeff.SetSize(vdim);
698 if (el.
Space() == FunctionSpace::rQk)
721 VQ->Eval(vec, Trans, ip);
722 for (
int k = 0; k < vdim; k++)
724 elmat.
AddMatrix(norm*vec(k), partelmat, nd*k, nd*k);
729 MQ->Eval(mcoeff, Trans, ip);
730 for (
int i = 0; i < vdim; i++)
731 for (
int j = 0; j < vdim; j++)
733 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, nd*i, nd*j);
740 norm *= Q->Eval(Trans, ip);
743 for (
int k = 0; k < vdim; k++)
751 void VectorMassIntegrator::AssembleElementMatrix2(
755 int tr_nd = trial_fe.
GetDof();
756 int te_nd = test_fe.
GetDof();
763 vdim = (VQ) ? (VQ -> GetVDim()) : ((MQ) ? (MQ -> GetVDim()) : (dim));
765 elmat.
SetSize(te_nd*vdim, tr_nd*vdim);
766 shape.SetSize(tr_nd);
767 te_shape.SetSize(te_nd);
768 partelmat.SetSize(te_nd, tr_nd);
775 mcoeff.SetSize(vdim);
782 Trans.
OrderW() + Q_order);
784 if (trial_fe.
Space() == FunctionSpace::rQk)
804 MultVWt(te_shape, shape, partelmat);
808 VQ->Eval(vec, Trans, ip);
809 for (
int k = 0; k < vdim; k++)
811 elmat.
AddMatrix(norm*vec(k), partelmat, te_nd*k, tr_nd*k);
816 MQ->Eval(mcoeff, Trans, ip);
817 for (
int i = 0; i < vdim; i++)
818 for (
int j = 0; j < vdim; j++)
820 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, te_nd*i, tr_nd*j);
827 norm *= Q->Eval(Trans, ip);
830 for (
int k = 0; k < vdim; k++)
832 elmat.
AddMatrix(partelmat, te_nd*k, tr_nd*k);
838 void VectorFEDivergenceIntegrator::AssembleElementMatrix2(
842 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
844 #ifdef MFEM_THREAD_SAFE
845 Vector divshape(trial_nd), shape(test_nd);
847 divshape.SetSize(trial_nd);
851 elmat.
SetSize(test_nd, trial_nd);
870 w *= Q->Eval(Trans, ip);
877 void VectorFECurlIntegrator::AssembleElementMatrix2(
881 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
884 #ifdef MFEM_THREAD_SAFE
889 curlshapeTrial.
SetSize(trial_nd, dim);
890 curlshapeTrial_dFT.
SetSize(trial_nd, dim);
891 vshapeTest.
SetSize(test_nd, dim);
894 elmat.
SetSize(test_nd, trial_nd);
916 w *= Q->Eval(Trans, ip);
919 AddMultABt(vshapeTest, curlshapeTrial_dFT, elmat);
923 void DerivativeIntegrator::AssembleElementMatrix2 (
930 int trial_nd = trial_fe.
GetDof();
931 int test_nd = test_fe.
GetDof();
936 elmat.
SetSize (test_nd,trial_nd);
937 dshape.SetSize (trial_nd,dim);
938 dshapedxt.SetSize(trial_nd,dim);
939 dshapedxi.SetSize(trial_nd);
940 invdfdx.SetSize(dim);
941 shape.SetSize (test_nd);
947 if (trial_fe.
Space() == FunctionSpace::Pk)
956 if (trial_fe.
Space() == FunctionSpace::rQk)
976 Mult (dshape, invdfdx, dshapedxt);
980 for (l = 0; l < trial_nd; l++)
982 dshapedxi(l) = dshapedxt(l,xi);
985 shape *= Q.Eval(Trans,ip) * det * ip.
weight;
990 void CurlCurlIntegrator::AssembleElementMatrix
996 int dimc = (dim == 3) ? 3 : 1;
999 #ifdef MFEM_THREAD_SAFE
1000 DenseMatrix curlshape(nd,dimc), curlshape_dFt(nd,dimc);
1002 curlshape.SetSize(nd,dimc);
1003 curlshape_dFt.
SetSize(nd,dimc);
1011 if (el.
Space() == FunctionSpace::Pk)
1044 w *= Q->Eval(Trans, ip);
1051 void CurlCurlIntegrator
1056 #ifdef MFEM_THREAD_SAFE
1063 projcurl.
Mult(u, flux);
1072 int nd = fluxelem.
GetDof();
1075 #ifdef MFEM_THREAD_SAFE
1079 pointflux.SetSize(dim);
1080 if (d_energy) { vec.SetSize(dim); }
1082 int order = 2 * fluxelem.
GetOrder();
1085 double energy = 0.0;
1086 if (d_energy) { *d_energy = 0.0; }
1105 double e = w * (pointflux * pointflux);
1114 #if ANISO_EXPERIMENTAL
1134 #if ANISO_EXPERIMENTAL
1138 int n = (int) round(pow(ir.
GetNPoints(), 1.0/3.0));
1142 for (
int k = 0; k < n; k++)
1143 for (
int l = 0; l < n; l++)
1144 for (
int m = 0; m < n; m++)
1146 Vector &vec = pfluxes[(k*n + l)*n + m];
1149 tmp = vec; tmp -= pfluxes[(k*n + l)*n + (m-1)];
1150 (*d_energy)[0] += (tmp * tmp);
1154 tmp = vec; tmp -= pfluxes[(k*n + (l-1))*n + m];
1155 (*d_energy)[1] += (tmp * tmp);
1159 tmp = vec; tmp -= pfluxes[((k-1)*n + l)*n + m];
1160 (*d_energy)[2] += (tmp * tmp);
1173 void VectorCurlCurlIntegrator::AssembleElementMatrix(
1178 int cld = (dim*(dim-1))/2;
1180 #ifdef MFEM_THREAD_SAFE
1181 DenseMatrix dshape_hat(dof, dim), dshape(dof, dim);
1184 dshape_hat.SetSize(dof, dim);
1186 curlshape.SetSize(dim*dof, cld);
1208 Mult(dshape_hat, Jadj, dshape);
1213 w *= Q->Eval(Trans, ip);
1220 double VectorCurlCurlIntegrator::GetElementEnergy(
1226 #ifdef MFEM_THREAD_SAFE
1227 DenseMatrix dshape_hat(dof, dim), Jadj(dim), grad_hat(dim), grad(dim);
1229 dshape_hat.SetSize(dof, dim);
1232 grad_hat.SetSize(dim);
1246 for (
int i = 0; i < ir->GetNPoints(); i++)
1251 MultAtB(elfun_mat, dshape_hat, grad_hat);
1257 Mult(grad_hat, Jadj, grad);
1261 double curl = grad(0,1) - grad(1,0);
1266 double curl_x = grad(2,1) - grad(1,2);
1267 double curl_y = grad(0,2) - grad(2,0);
1268 double curl_z = grad(1,0) - grad(0,1);
1269 w *= curl_x * curl_x + curl_y * curl_y + curl_z * curl_z;
1274 w *= Q->Eval(Tr, ip);
1280 elfun_mat.ClearExternalData();
1282 return 0.5 * energy;
1286 void VectorFEMassIntegrator::AssembleElementMatrix(
1296 #ifdef MFEM_THREAD_SAFE
1297 Vector D(VQ ? VQ->GetVDim() : 0);
1299 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1301 trial_vshape.
SetSize(dof, spaceDim);
1302 D.SetSize(VQ ? VQ->GetVDim() : 0);
1303 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1305 DenseMatrix tmp(trial_vshape.Height(), K.Width());
1329 MQ->Eval(K, Trans, ip);
1331 Mult(trial_vshape,K,tmp);
1336 VQ->Eval(D, Trans, ip);
1344 w *= Q -> Eval (Trans, ip);
1351 void VectorFEMassIntegrator::AssembleElementMatrix2(
1355 if ( test_fe.
GetRangeType() == FiniteElement::SCALAR && VQ )
1359 int trial_dof = trial_fe.
GetDof();
1360 int test_dof = test_fe.
GetDof();
1364 mfem_error(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
1365 " is not implemented for tensor materials");
1367 #ifdef MFEM_THREAD_SAFE
1372 trial_vshape.
SetSize(trial_dof, dim);
1377 elmat.
SetSize (test_dof, trial_dof);
1397 VQ->Eval(D, Trans, ip);
1400 for (
int d = 0; d <
dim; d++)
1402 for (
int j = 0; j < test_dof; j++)
1404 for (
int k = 0; k < trial_dof; k++)
1406 elmat(j, k) += D[d] * shape(j) * trial_vshape(k, d);
1412 else if ( test_fe.
GetRangeType() == FiniteElement::SCALAR )
1416 int trial_dof = trial_fe.
GetDof();
1417 int test_dof = test_fe.
GetDof();
1421 mfem_error(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
1422 " is not implemented for vector/tensor permeability");
1424 #ifdef MFEM_THREAD_SAFE
1428 trial_vshape.
SetSize(trial_dof, dim);
1432 elmat.
SetSize (dim*test_dof, trial_dof);
1454 w *= Q -> Eval (Trans, ip);
1457 for (
int d = 0; d <
dim; d++)
1459 for (
int j = 0; j < test_dof; j++)
1461 for (
int k = 0; k < trial_dof; k++)
1463 elmat(d * test_dof + j, k) += w * shape(j) * trial_vshape(k, d);
1473 int trial_dof = trial_fe.
GetDof();
1474 int test_dof = test_fe.
GetDof();
1478 mfem_error(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
1479 " is not implemented for vector/tensor permeability");
1481 #ifdef MFEM_THREAD_SAFE
1485 trial_vshape.
SetSize(trial_dof, dim);
1486 test_vshape.
SetSize(test_dof,dim);
1489 elmat.
SetSize (test_dof, trial_dof);
1511 w *= Q -> Eval (Trans, ip);
1514 for (
int d = 0; d <
dim; d++)
1516 for (
int j = 0; j < test_dof; j++)
1518 for (
int k = 0; k < trial_dof; k++)
1520 elmat(j, k) += w * test_vshape(j, d) * trial_vshape(k, d);
1528 void VectorDivergenceIntegrator::AssembleElementMatrix2(
1535 int trial_dof = trial_fe.
GetDof();
1536 int test_dof = test_fe.
GetDof();
1539 dshape.SetSize (trial_dof, dim);
1540 gshape.SetSize (trial_dof, dim);
1542 divshape.SetSize (dim*trial_dof);
1543 shape.SetSize (test_dof);
1545 elmat.
SetSize (test_dof, dim*trial_dof);
1556 for (
int i = 0; i < ir -> GetNPoints(); i++)
1566 Mult (dshape, Jadj, gshape);
1568 gshape.GradToDiv (divshape);
1573 c *= Q -> Eval (Trans, ip);
1583 void DivDivIntegrator::AssembleElementMatrix(
1591 #ifdef MFEM_THREAD_SAFE
1607 for (
int i = 0; i < ir -> GetNPoints(); i++)
1618 c *= Q -> Eval (Trans, ip);
1627 void VectorDiffusionIntegrator::AssembleElementMatrix(
1639 Jinv. SetSize (dim);
1640 dshape.SetSize (dof, dim);
1641 gshape.SetSize (dof, dim);
1642 pelmat.SetSize (dof);
1649 if (el.
Space() == FunctionSpace::rQk)
1661 for (
int i = 0; i < ir -> GetNPoints(); i++)
1671 Mult (dshape, Jinv, gshape);
1677 norm *= Q -> Eval (Trans, ip);
1682 for (
int d = 0; d <
dim; d++)
1684 for (
int k = 0; k < dof; k++)
1685 for (
int l = 0; l < dof; l++)
1687 elmat (dof*d+k, dof*d+l) += pelmat (k, l);
1694 void ElasticityIntegrator::AssembleElementMatrix(
1701 #ifdef MFEM_THREAD_SAFE
1702 DenseMatrix dshape(dof, dim), Jinv(dim), gshape(dof, dim), pelmat(dof);
1703 Vector divshape(dim*dof);
1706 dshape.SetSize(dof, dim);
1707 gshape.SetSize(dof, dim);
1723 for (
int i = 0; i < ir -> GetNPoints(); i++)
1732 Mult(dshape, Jinv, gshape);
1734 gshape.GradToDiv (divshape);
1736 M = mu->Eval(Trans, ip);
1739 L = lambda->Eval(Trans, ip);
1754 for (
int d = 0; d <
dim; d++)
1756 for (
int k = 0; k < dof; k++)
1757 for (
int l = 0; l < dof; l++)
1759 elmat (dof*d+k, dof*d+l) += (M * w) * pelmat(k, l);
1762 for (
int i = 0; i <
dim; i++)
1763 for (
int j = 0; j <
dim; j++)
1765 for (
int k = 0; k < dof; k++)
1766 for (
int l = 0; l < dof; l++)
1767 elmat(dof*i+k, dof*j+l) +=
1768 (M * w) * gshape(k, j) * gshape(l, i);
1780 int dim, ndof1, ndof2;
1786 Vector vu(dim), nor(dim);
1797 shape1.SetSize(ndof1);
1798 shape2.SetSize(ndof2);
1814 if (el1.
Space() == FunctionSpace::Pk)
1835 u->Eval(vu, *Trans.
Elem1, eip1);
1839 nor(0) = 2*eip1.
x - 1.0;
1847 a = 0.5 * alpha * un;
1848 b = beta * fabs(un);
1856 if (un >= 0.0 && ndof2)
1859 rho_p = rho->Eval(*Trans.
Elem2, eip2);
1863 rho_p = rho->Eval(*Trans.
Elem1, eip1);
1872 for (
int i = 0; i < ndof1; i++)
1873 for (
int j = 0; j < ndof1; j++)
1875 elmat(i, j) += w * shape1(i) * shape1(j);
1884 for (
int i = 0; i < ndof2; i++)
1885 for (
int j = 0; j < ndof1; j++)
1887 elmat(ndof1+i, j) -= w * shape2(i) * shape1(j);
1893 for (
int i = 0; i < ndof2; i++)
1894 for (
int j = 0; j < ndof2; j++)
1896 elmat(ndof1+i, ndof1+j) += w * shape2(i) * shape2(j);
1899 for (
int i = 0; i < ndof1; i++)
1900 for (
int j = 0; j < ndof2; j++)
1902 elmat(i, ndof1+j) -= w * shape1(i) * shape2(j);
1909 void DGDiffusionIntegrator::AssembleFaceMatrix(
1913 int dim, ndof1, ndof2, ndofs;
1914 bool kappa_is_nonzero = (
kappa != 0.);
1929 shape1.SetSize(ndof1);
1930 dshape1.SetSize(ndof1, dim);
1931 dshape1dn.SetSize(ndof1);
1935 shape2.SetSize(ndof2);
1936 dshape2.SetSize(ndof2, dim);
1937 dshape2dn.SetSize(ndof2);
1944 ndofs = ndof1 + ndof2;
1947 if (kappa_is_nonzero)
1980 nor(0) = 2*eip1.
x - 1.0;
1999 w *= Q->Eval(*Trans.
Elem1, eip1);
2006 MQ->Eval(mq, *Trans.
Elem1, eip1);
2007 mq.MultTranspose(nh, ni);
2011 if (kappa_is_nonzero)
2026 dshape1.Mult(nh, dshape1dn);
2027 for (
int i = 0; i < ndof1; i++)
2028 for (
int j = 0; j < ndof1; j++)
2030 elmat(i, j) += shape1(i) * dshape1dn(j);
2044 w *= Q->Eval(*Trans.
Elem2, eip2);
2051 MQ->Eval(mq, *Trans.
Elem2, eip2);
2052 mq.MultTranspose(nh, ni);
2056 if (kappa_is_nonzero)
2061 dshape2.Mult(nh, dshape2dn);
2063 for (
int i = 0; i < ndof1; i++)
2064 for (
int j = 0; j < ndof2; j++)
2066 elmat(i, ndof1 + j) += shape1(i) * dshape2dn(j);
2069 for (
int i = 0; i < ndof2; i++)
2070 for (
int j = 0; j < ndof1; j++)
2072 elmat(ndof1 + i, j) -= shape2(i) * dshape1dn(j);
2075 for (
int i = 0; i < ndof2; i++)
2076 for (
int j = 0; j < ndof2; j++)
2078 elmat(ndof1 + i, ndof1 + j) -= shape2(i) * dshape2dn(j);
2082 if (kappa_is_nonzero)
2086 for (
int i = 0; i < ndof1; i++)
2088 const double wsi = wq*shape1(i);
2089 for (
int j = 0; j <= i; j++)
2091 jmat(i, j) += wsi * shape1(j);
2096 for (
int i = 0; i < ndof2; i++)
2098 const int i2 = ndof1 + i;
2099 const double wsi = wq*shape2(i);
2100 for (
int j = 0; j < ndof1; j++)
2102 jmat(i2, j) -= wsi * shape1(j);
2104 for (
int j = 0; j <= i; j++)
2106 jmat(i2, ndof1 + j) += wsi * shape2(j);
2114 if (kappa_is_nonzero)
2116 for (
int i = 0; i < ndofs; i++)
2118 for (
int j = 0; j < i; j++)
2120 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
2121 elmat(i,j) = sigma*aji - aij + mij;
2122 elmat(j,i) = sigma*aij - aji + mij;
2124 elmat(i,i) = (sigma - 1.)*elmat(i,i) + jmat(i,i);
2129 for (
int i = 0; i < ndofs; i++)
2131 for (
int j = 0; j < i; j++)
2133 double aij = elmat(i,j), aji = elmat(j,i);
2134 elmat(i,j) = sigma*aji - aij;
2135 elmat(j,i) = sigma*aij - aji;
2137 elmat(i,i) *= (sigma - 1.);
2142 void TraceJumpIntegrator::AssembleFaceMatrix(
2147 int i, j, face_ndof, ndof1, ndof2;
2152 face_ndof = trial_face_fe.
GetDof();
2153 ndof1 = test_fe1.
GetDof();
2155 face_shape.SetSize(face_ndof);
2156 shape1.SetSize(ndof1);
2160 ndof2 = test_fe2.
GetDof();
2161 shape2.SetSize(ndof2);
2168 elmat.
SetSize(ndof1 + ndof2, face_ndof);
2183 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
2196 trial_face_fe.
CalcShape(ip, face_shape);
2209 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
2214 for (i = 0; i < ndof1; i++)
2215 for (j = 0; j < face_ndof; j++)
2217 elmat(i, j) += shape1(i) * face_shape(j);
2222 for (i = 0; i < ndof2; i++)
2223 for (j = 0; j < face_ndof; j++)
2225 elmat(ndof1+i, j) -= shape2(i) * face_shape(j);
2231 void NormalTraceJumpIntegrator::AssembleFaceMatrix(
2236 int i, j, face_ndof, ndof1, ndof2,
dim;
2239 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::VALUE,
"");
2241 face_ndof = trial_face_fe.
GetDof();
2242 ndof1 = test_fe1.
GetDof();
2245 face_shape.SetSize(face_ndof);
2246 normal.SetSize(dim);
2247 shape1.SetSize(ndof1,dim);
2248 shape1_n.SetSize(ndof1);
2252 ndof2 = test_fe2.
GetDof();
2253 shape2.SetSize(ndof2,dim);
2254 shape2_n.SetSize(ndof2);
2261 elmat.
SetSize(ndof1 + ndof2, face_ndof);
2284 trial_face_fe.
CalcShape(ip, face_shape);
2290 shape1.Mult(normal, shape1_n);
2298 shape2.Mult(normal, shape2_n);
2301 for (i = 0; i < ndof1; i++)
2302 for (j = 0; j < face_ndof; j++)
2304 elmat(i, j) -= shape1_n(i) * face_shape(j);
2309 for (i = 0; i < ndof2; i++)
2310 for (j = 0; j < face_ndof; j++)
2312 elmat(ndof1+i, j) += shape2_n(i) * face_shape(j);
2319 void NormalInterpolator::AssembleElementMatrix2(
2328 for (
int i = 0; i < ran_nodes.Size(); i++)
2334 for (
int j = 0; j < shape.Size(); j++)
2336 for (
int d = 0; d < spaceDim; d++)
2338 elmat(i, j+d*shape.Size()) = shape(j)*n(d);
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for Finite Elements.
void MultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
Multiply a matrix A with the transpose of a matrix B: A*Bt.
int GetDim() const
Returns the space dimension for the finite element.
void AddMultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += v w^t.
Class for integration rule.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
void MultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void SetSize(int s)
Resizes the vector if the new size is different.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
double InnerProduct(const double *x, const double *y) const
Compute y^t A x.
void CalcAdjugate(const DenseMatrix &a, DenseMatrix &adja)
int GetOrder() const
Returns the order of the finite element.
Data type dense matrix using column-major storage.
int Space() const
Returns the type of space on each element.
void CalcOrtho(const DenseMatrix &J, Vector &n)
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
void MultTranspose(const double *x, double *y) const
Multiply a vector with the transpose matrix.
IntegrationRules IntRules(0)
A global object with all integration rules (defined in intrules.cpp)
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
void Invert()
Replaces the current matrix with its inverse.
const IntegrationRule & GetNodes() const
void AddMult_a_VVt(const double a, const Vector &v, DenseMatrix &VVt)
VVt += a * v v^t.
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
int GetGeomType() const
Returns the geometry type:
void Transpose()
(*this) = (*this)^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.
int GetDof() const
Returns the degrees of freedom in the FE space.
void mfem_error(const char *msg)
void MultAAt(const DenseMatrix &a, DenseMatrix &aat)
Calculate the matrix A.At.
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
void AddMatrix(DenseMatrix &A, int ro, int co)
Perform (ro+i,co+j)+=A(i,j) for 0<=i<A.Height, 0<=j<A.Width.
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Class for integration point with weight.
void GradToCurl(DenseMatrix &curl)
void MultAtB(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &AtB)
Multiply the transpose of a matrix A with a matrix B: At*B.
IntegrationRules RefinedIntRules(1)
A global object with all refined integration rules.
void Mult(const double *x, double *y) const
Matrix vector multiplication.
void AddMultADAt(const DenseMatrix &A, const Vector &D, DenseMatrix &ADAt)
ADAt += A D A^t, where D is diagonal.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
void AddMult_a_AAt(double a, const DenseMatrix &A, DenseMatrix &AAt)
AAt += a * A * A^t.