25 mfem_error (
"BilinearFormIntegrator::Assemble (...)\n"
26 " is not implemented for this class.");
29 void BilinearFormIntegrator::AddMultPA(
const Vector &,
Vector &)
const
31 mfem_error (
"BilinearFormIntegrator::MultAssembled (...)\n"
32 " is not implemented for this class.");
35 void BilinearFormIntegrator::AddMultTransposePA(
const Vector &,
Vector &)
const
37 mfem_error (
"BilinearFormIntegrator::MultAssembledTranspose (...)\n"
38 " is not implemented for this class.");
41 void BilinearFormIntegrator::AssembleElementMatrix (
45 mfem_error (
"BilinearFormIntegrator::AssembleElementMatrix (...)\n"
46 " is not implemented for this class.");
49 void BilinearFormIntegrator::AssembleElementMatrix2 (
53 mfem_error (
"BilinearFormIntegrator::AssembleElementMatrix2 (...)\n"
54 " is not implemented for this class.");
57 void BilinearFormIntegrator::AssembleFaceMatrix (
61 mfem_error (
"BilinearFormIntegrator::AssembleFaceMatrix (...)\n"
62 " is not implemented for this class.");
65 void BilinearFormIntegrator::AssembleFaceMatrix(
70 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this"
71 " Integrator class.");
74 void BilinearFormIntegrator::AssembleElementVector(
78 mfem_error(
"BilinearFormIntegrator::AssembleElementVector\n"
79 " is not implemented for this class.");
83 void TransposeIntegrator::AssembleElementMatrix (
86 bfi -> AssembleElementMatrix (el, Trans, bfi_elmat);
91 void TransposeIntegrator::AssembleElementMatrix2 (
95 bfi -> AssembleElementMatrix2 (test_fe, trial_fe, Trans, bfi_elmat);
100 void TransposeIntegrator::AssembleFaceMatrix (
104 bfi -> AssembleFaceMatrix (el1, el2, Trans, bfi_elmat);
109 void LumpedIntegrator::AssembleElementMatrix (
112 bfi -> AssembleElementMatrix (el, Trans, elmat);
116 void InverseIntegrator::AssembleElementMatrix(
119 integrator->AssembleElementMatrix(el, Trans, elmat);
123 void SumIntegrator::AssembleElementMatrix(
126 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
128 integrators[0]->AssembleElementMatrix(el, Trans, elmat);
129 for (
int i = 1; i < integrators.Size(); i++)
131 integrators[i]->AssembleElementMatrix(el, Trans, elem_mat);
136 SumIntegrator::~SumIntegrator()
140 for (
int i = 0; i < integrators.Size(); i++)
142 delete integrators[i];
147 void MixedScalarIntegrator::AssembleElementMatrix2(
151 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
152 this->FiniteElementTypeFailureMessage());
154 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
155 bool same_shapes = same_calc_shape && (&trial_fe == &test_fe);
157 #ifdef MFEM_THREAD_SAFE
158 Vector test_shape(test_nd);
172 elmat.
SetSize(test_nd, trial_nd);
177 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
187 this->CalcTestShape(test_fe, Trans, test_shape);
188 this->CalcTrialShape(trial_fe, Trans, trial_shape);
194 w *= Q->Eval(Trans, ip);
198 #ifndef MFEM_THREAD_SAFE
206 void MixedVectorIntegrator::AssembleElementMatrix2(
210 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
211 this->FiniteElementTypeFailureMessage());
213 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
215 bool same_shapes = same_calc_shape && (&trial_fe == &test_fe);
217 #ifdef MFEM_THREAD_SAFE
218 Vector V(VQ ? VQ->GetVDim() : 0);
219 Vector D(DQ ? DQ->GetVDim() : 0);
220 DenseMatrix M(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
225 V.SetSize(VQ ? VQ->GetVDim() : 0);
226 D.SetSize(DQ ? DQ->GetVDim() : 0);
227 M.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
228 test_shape.SetSize(test_nd, spaceDim);
229 test_shape_tmp.
SetSize(test_nd, spaceDim);
233 trial_shape.
Reset(test_shape.Data(), trial_nd, spaceDim);
237 trial_shape.
SetSize(trial_nd, spaceDim);
240 elmat.
SetSize(test_nd, trial_nd);
245 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
255 this->CalcTestShape(test_fe, Trans, test_shape);
258 this->CalcTrialShape(trial_fe, Trans, trial_shape);
265 MQ->Eval(M, Trans, ip);
267 Mult(test_shape, M, test_shape_tmp);
268 AddMultABt(test_shape_tmp, trial_shape, elmat);
272 DQ->Eval(D, Trans, ip);
278 VQ->Eval(V, Trans, ip);
280 for (
int j=0; j<test_nd; j++)
282 test_shape_tmp(j,0) = test_shape(j,1) * V(2) -
283 test_shape(j,2) * V(1);
284 test_shape_tmp(j,1) = test_shape(j,2) * V(0) -
285 test_shape(j,0) * V(2);
286 test_shape_tmp(j,2) = test_shape(j,0) * V(1) -
287 test_shape(j,1) * V(0);
289 AddMultABt(test_shape_tmp, trial_shape, elmat);
295 w *= Q -> Eval (Trans, ip);
307 #ifndef MFEM_THREAD_SAFE
315 void MixedScalarVectorIntegrator::AssembleElementMatrix2(
319 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
320 this->FiniteElementTypeFailureMessage());
325 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
326 int sca_nd = sca_fe->
GetDof();
327 int vec_nd = vec_fe->
GetDof();
331 #ifdef MFEM_THREAD_SAFE
332 Vector V(VQ ? VQ->GetVDim() : 0);
335 Vector vshape_tmp(vec_nd);
337 V.SetSize(VQ ? VQ->GetVDim() : 0);
338 vshape.SetSize(vec_nd, spaceDim);
346 elmat.
SetSize(test_nd, trial_nd);
351 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
361 this->CalcShape(*sca_fe, Trans, shape);
362 this->CalcVShape(*vec_fe, Trans, vshape);
366 VQ->Eval(V, Trans, ip);
369 if ( vec_fe->
GetDim() == 2 && cross_2d )
376 vshape.Mult(V,vshape_tmp);
383 void DiffusionIntegrator::AssembleElementMatrix
390 bool square = (dim == spaceDim);
393 #ifdef MFEM_THREAD_SAFE
394 DenseMatrix dshape(nd,dim), dshapedxt(nd,spaceDim), invdfdx(dim,spaceDim);
396 dshape.SetSize(nd,dim);
397 dshapedxt.SetSize(nd,spaceDim);
412 w = ip.
weight / (square ? w : w*w*w);
420 w *= Q->Eval(Trans, ip);
426 MQ->Eval(invdfdx, Trans, ip);
428 Mult(dshapedxt, invdfdx, dshape);
434 void DiffusionIntegrator::AssembleElementMatrix2(
438 int tr_nd = trial_fe.
GetDof();
439 int te_nd = test_fe.
GetDof();
442 bool square = (dim == spaceDim);
445 #ifdef MFEM_THREAD_SAFE
446 DenseMatrix dshape(tr_nd, dim), dshapedxt(tr_nd, spaceDim);
447 DenseMatrix te_dshape(te_nd, dim), te_dshapedxt(te_nd, spaceDim);
450 dshape.SetSize(tr_nd, dim);
451 dshapedxt.
SetSize(tr_nd, spaceDim);
452 te_dshape.SetSize(te_nd, dim);
453 te_dshapedxt.
SetSize(te_nd, spaceDim);
454 invdfdx.
SetSize(dim, spaceDim);
458 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(trial_fe, test_fe);
470 w = ip.
weight / (square ? w : w*w*w);
471 Mult(dshape, invdfdx, dshapedxt);
472 Mult(te_dshape, invdfdx, te_dshapedxt);
478 w *= Q->Eval(Trans, ip);
485 MQ->Eval(invdfdx, Trans, ip);
487 Mult(te_dshapedxt, invdfdx, te_dshape);
493 void DiffusionIntegrator::AssembleElementVector(
501 #ifdef MFEM_THREAD_SAFE
504 dshape.SetSize(nd,dim);
505 invdfdx.SetSize(dim);
509 pointflux.SetSize(dim);
527 dshape.MultTranspose(elfun, vec);
528 invdfdx.MultTranspose(vec, pointflux);
531 w *= Q->Eval(Tr, ip);
537 dshape.MultTranspose(elfun, pointflux);
538 invdfdx.MultTranspose(pointflux, vec);
539 MQ->Eval(mq, Tr, ip);
540 mq.
Mult(vec, pointflux);
543 invdfdx.Mult(pointflux, vec);
544 dshape.AddMult(vec, elvect);
548 void DiffusionIntegrator::ComputeElementFlux
552 int i, j, nd,
dim, spaceDim, fnd;
558 #ifdef MFEM_THREAD_SAFE
559 DenseMatrix dshape(nd,dim), invdfdx(dim, spaceDim);
561 dshape.SetSize(nd,dim);
562 invdfdx.
SetSize(dim, spaceDim);
565 pointflux.SetSize(spaceDim);
569 flux.
SetSize( fnd * spaceDim );
571 for (i = 0; i < fnd; i++)
575 dshape.MultTranspose(u, vec);
585 pointflux *= Q->Eval(Trans,ip);
587 for (j = 0; j < spaceDim; j++)
589 flux(fnd*j+i) = pointflux(j);
595 MFEM_ASSERT(dim == spaceDim,
"TODO");
596 MQ->Eval(invdfdx, Trans, ip);
597 invdfdx.
Mult(pointflux, vec);
598 for (j = 0; j <
dim; j++)
600 flux(fnd*j+i) = vec(j);
606 double DiffusionIntegrator::ComputeFluxEnergy
610 int nd = fluxelem.
GetDof();
614 #ifdef MFEM_THREAD_SAFE
619 pointflux.SetSize(spaceDim);
620 if (d_energy) { vec.SetSize(dim); }
623 int order = 2 * fluxelem.
GetOrder();
627 if (d_energy) { *d_energy = 0.0; }
635 for (
int k = 0; k < spaceDim; k++)
637 for (
int j = 0; j < nd; j++)
639 pointflux(k) += flux(k*nd+j)*shape(j);
648 double e = (pointflux * pointflux);
649 if (Q) { e *= Q->Eval(Trans, ip); }
654 MQ->Eval(mq, Trans, ip);
662 for (
int k = 0; k <
dim; k++)
664 (*d_energy)[k] += w * vec[k] * vec[k];
677 if (trial_fe.
Space() == FunctionSpace::Pk)
687 if (trial_fe.
Space() == FunctionSpace::rQk)
695 void MassIntegrator::AssembleElementMatrix
703 #ifdef MFEM_THREAD_SAFE
709 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(el, el, Trans);
721 w *= Q -> Eval(Trans, ip);
728 void MassIntegrator::AssembleElementMatrix2(
732 int tr_nd = trial_fe.
GetDof();
733 int te_nd = test_fe.
GetDof();
737 #ifdef MFEM_THREAD_SAFE
745 &GetRule(trial_fe, test_fe, Trans);
758 w *= Q -> Eval(Trans, ip);
773 if (trial_fe.
Space() == FunctionSpace::rQk)
781 void BoundaryMassIntegrator::AssembleFaceMatrix(
786 "support for interior faces is not implemented");
791 #ifdef MFEM_THREAD_SAFE
817 w *= Q -> Eval(*Trans.
Face, ip);
825 void ConvectionIntegrator::AssembleElementMatrix(
831 #ifdef MFEM_THREAD_SAFE
833 Vector shape, vec2, BdFidxT;
851 Q->Eval(Q_ir, Trans, *ir);
865 adjJ.
Mult(vec1, vec2);
866 dshape.
Mult(vec2, BdFidxT);
873 void GroupConvectionIntegrator::AssembleElementMatrix(
880 dshape.SetSize(nd,dim);
883 grad.SetSize(nd,dim);
892 Q->Eval(Q_nodal, Trans, el.
GetNodes());
904 Mult(dshape, adjJ, grad);
909 for (
int k = 0; k < nd; k++)
911 double wsk = w*shape(k);
912 for (
int l = 0; l < nd; l++)
915 for (
int s = 0; s <
dim; s++)
917 a += Q_nodal(s,k)*grad(l,s);
926 void VectorMassIntegrator::AssembleElementMatrix
936 vdim = (vdim == -1) ? spaceDim : vdim;
940 partelmat.SetSize(nd);
947 mcoeff.SetSize(vdim);
955 if (el.
Space() == FunctionSpace::rQk)
978 VQ->Eval(vec, Trans, ip);
979 for (
int k = 0; k < vdim; k++)
981 elmat.
AddMatrix(norm*vec(k), partelmat, nd*k, nd*k);
986 MQ->Eval(mcoeff, Trans, ip);
987 for (
int i = 0; i < vdim; i++)
988 for (
int j = 0; j < vdim; j++)
990 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, nd*i, nd*j);
997 norm *= Q->Eval(Trans, ip);
1000 for (
int k = 0; k < vdim; k++)
1008 void VectorMassIntegrator::AssembleElementMatrix2(
1012 int tr_nd = trial_fe.
GetDof();
1013 int te_nd = test_fe.
GetDof();
1020 elmat.
SetSize(te_nd*vdim, tr_nd*vdim);
1021 shape.SetSize(tr_nd);
1022 te_shape.SetSize(te_nd);
1023 partelmat.SetSize(te_nd, tr_nd);
1030 mcoeff.SetSize(vdim);
1037 Trans.
OrderW() + Q_order);
1039 if (trial_fe.
Space() == FunctionSpace::rQk)
1059 MultVWt(te_shape, shape, partelmat);
1063 VQ->Eval(vec, Trans, ip);
1064 for (
int k = 0; k < vdim; k++)
1066 elmat.
AddMatrix(norm*vec(k), partelmat, te_nd*k, tr_nd*k);
1071 MQ->Eval(mcoeff, Trans, ip);
1072 for (
int i = 0; i < vdim; i++)
1073 for (
int j = 0; j < vdim; j++)
1075 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, te_nd*i, tr_nd*j);
1082 norm *= Q->Eval(Trans, ip);
1085 for (
int k = 0; k < vdim; k++)
1087 elmat.
AddMatrix(partelmat, te_nd*k, tr_nd*k);
1093 void VectorFEDivergenceIntegrator::AssembleElementMatrix2(
1097 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1099 #ifdef MFEM_THREAD_SAFE
1100 Vector divshape(trial_nd), shape(test_nd);
1102 divshape.SetSize(trial_nd);
1106 elmat.
SetSize(test_nd, trial_nd);
1125 w *= Q->Eval(Trans, ip);
1132 void VectorFEWeakDivergenceIntegrator::AssembleElementMatrix2(
1136 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1142 "Trial space must be H(Curl) and test space must be H_1");
1144 #ifdef MFEM_THREAD_SAFE
1150 dshape.SetSize(test_nd, dim);
1151 dshapedxt.
SetSize(test_nd, dim);
1152 vshape.
SetSize(trial_nd, dim);
1156 elmat.
SetSize(test_nd, trial_nd);
1198 Mult(dshape, invdfdx, dshapedxt);
1206 w *= Q->Eval(Trans, ip);
1214 void VectorFECurlIntegrator::AssembleElementMatrix2(
1218 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1220 int dimc = (dim == 3) ? 3 : 1;
1224 "At least one of the finite elements must be in H(Curl)");
1226 int curl_nd, vec_nd;
1238 #ifdef MFEM_THREAD_SAFE
1243 curlshapeTrial.
SetSize(curl_nd, dimc);
1244 curlshapeTrial_dFT.
SetSize(curl_nd, dimc);
1245 vshapeTest.
SetSize(vec_nd, dimc);
1249 elmat.
SetSize(test_nd, trial_nd);
1296 w *= Q->Eval(Trans, ip);
1302 AddMultABt(vshapeTest, curlshapeTrial_dFT, elmat);
1306 AddMultABt(curlshapeTrial_dFT, vshapeTest, elmat);
1311 void DerivativeIntegrator::AssembleElementMatrix2 (
1318 int trial_nd = trial_fe.
GetDof();
1319 int test_nd = test_fe.
GetDof();
1324 elmat.
SetSize (test_nd,trial_nd);
1325 dshape.SetSize (trial_nd,dim);
1326 dshapedxt.SetSize(trial_nd,dim);
1327 dshapedxi.SetSize(trial_nd);
1328 invdfdx.SetSize(dim);
1329 shape.SetSize (test_nd);
1335 if (trial_fe.
Space() == FunctionSpace::Pk)
1344 if (trial_fe.
Space() == FunctionSpace::rQk)
1364 Mult (dshape, invdfdx, dshapedxt);
1368 for (l = 0; l < trial_nd; l++)
1370 dshapedxi(l) = dshapedxt(l,xi);
1373 shape *= Q->Eval(Trans,ip) * det * ip.
weight;
1378 void CurlCurlIntegrator::AssembleElementMatrix
1384 int dimc = (dim == 3) ? 3 : 1;
1387 #ifdef MFEM_THREAD_SAFE
1388 DenseMatrix curlshape(nd,dimc), curlshape_dFt(nd,dimc), M;
1391 curlshape_dFt.SetSize(nd,dimc);
1400 if (el.
Space() == FunctionSpace::Pk)
1433 MQ->Eval(M, Trans, ip);
1435 Mult(curlshape_dFt, M, curlshape);
1440 w *= Q->Eval(Trans, ip);
1450 void CurlCurlIntegrator
1455 #ifdef MFEM_THREAD_SAFE
1462 projcurl.
Mult(u, flux);
1471 int nd = fluxelem.
GetDof();
1474 #ifdef MFEM_THREAD_SAFE
1478 pointflux.SetSize(dim);
1479 if (d_energy) { vec.SetSize(dim); }
1481 int order = 2 * fluxelem.
GetOrder();
1484 double energy = 0.0;
1485 if (d_energy) { *d_energy = 0.0; }
1504 double e = w * (pointflux * pointflux);
1513 #if ANISO_EXPERIMENTAL
1533 #if ANISO_EXPERIMENTAL
1537 int n = (int) round(pow(ir.
GetNPoints(), 1.0/3.0));
1541 for (
int k = 0; k < n; k++)
1542 for (
int l = 0; l < n; l++)
1543 for (
int m = 0; m < n; m++)
1545 Vector &vec = pfluxes[(k*n + l)*n + m];
1548 tmp = vec; tmp -= pfluxes[(k*n + l)*n + (m-1)];
1549 (*d_energy)[0] += (tmp * tmp);
1553 tmp = vec; tmp -= pfluxes[(k*n + (l-1))*n + m];
1554 (*d_energy)[1] += (tmp * tmp);
1558 tmp = vec; tmp -= pfluxes[((k-1)*n + l)*n + m];
1559 (*d_energy)[2] += (tmp * tmp);
1572 void VectorCurlCurlIntegrator::AssembleElementMatrix(
1577 int cld = (dim*(dim-1))/2;
1579 #ifdef MFEM_THREAD_SAFE
1580 DenseMatrix dshape_hat(dof, dim), dshape(dof, dim);
1583 dshape_hat.SetSize(dof, dim);
1585 curlshape.SetSize(dim*dof, cld);
1608 Mult(dshape_hat, Jadj, dshape);
1613 w *= Q->Eval(Trans, ip);
1620 double VectorCurlCurlIntegrator::GetElementEnergy(
1626 #ifdef MFEM_THREAD_SAFE
1627 DenseMatrix dshape_hat(dof, dim), Jadj(dim), grad_hat(dim), grad(dim);
1629 dshape_hat.SetSize(dof, dim);
1632 grad_hat.SetSize(dim);
1646 for (
int i = 0; i < ir->GetNPoints(); i++)
1651 MultAtB(elfun_mat, dshape_hat, grad_hat);
1657 Mult(grad_hat, Jadj, grad);
1661 double curl = grad(0,1) - grad(1,0);
1666 double curl_x = grad(2,1) - grad(1,2);
1667 double curl_y = grad(0,2) - grad(2,0);
1668 double curl_z = grad(1,0) - grad(0,1);
1669 w *= curl_x * curl_x + curl_y * curl_y + curl_z * curl_z;
1674 w *= Q->Eval(Tr, ip);
1680 elfun_mat.ClearExternalData();
1682 return 0.5 * energy;
1686 void VectorFEMassIntegrator::AssembleElementMatrix(
1696 #ifdef MFEM_THREAD_SAFE
1697 Vector D(VQ ? VQ->GetVDim() : 0);
1699 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1701 trial_vshape.
SetSize(dof, spaceDim);
1702 D.SetSize(VQ ? VQ->GetVDim() : 0);
1703 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1705 DenseMatrix tmp(trial_vshape.Height(), K.Width());
1729 MQ->Eval(K, Trans, ip);
1731 Mult(trial_vshape,K,tmp);
1736 VQ->Eval(D, Trans, ip);
1744 w *= Q -> Eval (Trans, ip);
1751 void VectorFEMassIntegrator::AssembleElementMatrix2(
1755 if ( test_fe.
GetRangeType() == FiniteElement::SCALAR && VQ )
1759 int trial_dof = trial_fe.
GetDof();
1760 int test_dof = test_fe.
GetDof();
1764 mfem_error(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
1765 " is not implemented for tensor materials");
1767 #ifdef MFEM_THREAD_SAFE
1772 trial_vshape.
SetSize(trial_dof, dim);
1777 elmat.
SetSize (test_dof, trial_dof);
1797 VQ->Eval(D, Trans, ip);
1800 for (
int d = 0; d <
dim; d++)
1802 for (
int j = 0; j < test_dof; j++)
1804 for (
int k = 0; k < trial_dof; k++)
1806 elmat(j, k) += D[d] * shape(j) * trial_vshape(k, d);
1812 else if ( test_fe.
GetRangeType() == FiniteElement::SCALAR )
1816 int trial_dof = trial_fe.
GetDof();
1817 int test_dof = test_fe.
GetDof();
1821 mfem_error(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
1822 " is not implemented for vector/tensor permeability");
1824 #ifdef MFEM_THREAD_SAFE
1828 trial_vshape.
SetSize(trial_dof, dim);
1832 elmat.
SetSize (dim*test_dof, trial_dof);
1854 w *= Q -> Eval (Trans, ip);
1857 for (
int d = 0; d <
dim; d++)
1859 for (
int j = 0; j < test_dof; j++)
1861 for (
int k = 0; k < trial_dof; k++)
1863 elmat(d * test_dof + j, k) += w * shape(j) * trial_vshape(k, d);
1873 int trial_dof = trial_fe.
GetDof();
1874 int test_dof = test_fe.
GetDof();
1878 mfem_error(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
1879 " is not implemented for vector/tensor permeability");
1881 #ifdef MFEM_THREAD_SAFE
1885 trial_vshape.
SetSize(trial_dof, dim);
1886 test_vshape.
SetSize(test_dof,dim);
1889 elmat.
SetSize (test_dof, trial_dof);
1911 w *= Q -> Eval (Trans, ip);
1914 for (
int d = 0; d <
dim; d++)
1916 for (
int j = 0; j < test_dof; j++)
1918 for (
int k = 0; k < trial_dof; k++)
1920 elmat(j, k) += w * test_vshape(j, d) * trial_vshape(k, d);
1928 void VectorDivergenceIntegrator::AssembleElementMatrix2(
1935 int trial_dof = trial_fe.
GetDof();
1936 int test_dof = test_fe.
GetDof();
1939 dshape.SetSize (trial_dof, dim);
1940 gshape.SetSize (trial_dof, dim);
1942 divshape.SetSize (dim*trial_dof);
1943 shape.SetSize (test_dof);
1945 elmat.
SetSize (test_dof, dim*trial_dof);
1956 for (
int i = 0; i < ir -> GetNPoints(); i++)
1966 Mult (dshape, Jadj, gshape);
1968 gshape.GradToDiv (divshape);
1973 c *= Q -> Eval (Trans, ip);
1983 void DivDivIntegrator::AssembleElementMatrix(
1991 #ifdef MFEM_THREAD_SAFE
2007 for (
int i = 0; i < ir -> GetNPoints(); i++)
2018 c *= Q -> Eval (Trans, ip);
2027 void VectorDiffusionIntegrator::AssembleElementMatrix(
2039 Jinv. SetSize (dim);
2040 dshape.SetSize (dof, dim);
2041 gshape.SetSize (dof, dim);
2042 pelmat.SetSize (dof);
2049 if (el.
Space() == FunctionSpace::rQk)
2061 for (
int i = 0; i < ir -> GetNPoints(); i++)
2071 Mult (dshape, Jinv, gshape);
2077 norm *= Q -> Eval (Trans, ip);
2082 for (
int d = 0; d <
dim; d++)
2084 for (
int k = 0; k < dof; k++)
2085 for (
int l = 0; l < dof; l++)
2087 elmat (dof*d+k, dof*d+l) += pelmat (k, l);
2093 void VectorDiffusionIntegrator::AssembleElementVector(
2102 dshape.SetSize(dof, dim);
2103 pelmat.SetSize(dim);
2104 gshape.SetSize(dim);
2115 ir = (el.
Space() == FunctionSpace::rQk) ?
2121 for (
int i = 0; i < ir->GetNPoints(); i++)
2130 w *= Q->Eval(Tr, ip);
2137 MultAtB(mat_in, dshape, pelmat);
2138 MultABt(pelmat, gshape, Jinv);
2144 void ElasticityIntegrator::AssembleElementMatrix(
2153 #ifdef MFEM_THREAD_SAFE
2154 DenseMatrix dshape(dof, dim), gshape(dof, dim), pelmat(dof);
2155 Vector divshape(dim*dof);
2157 dshape.SetSize(dof, dim);
2158 gshape.SetSize(dof, dim);
2159 pelmat.SetSize(dof);
2174 for (
int i = 0; i < ir -> GetNPoints(); i++)
2184 gshape.GradToDiv (divshape);
2186 M = mu->Eval(Trans, ip);
2189 L = lambda->Eval(Trans, ip);
2204 for (
int d = 0; d <
dim; d++)
2206 for (
int k = 0; k < dof; k++)
2207 for (
int l = 0; l < dof; l++)
2209 elmat (dof*d+k, dof*d+l) += (M * w) * pelmat(k, l);
2212 for (
int i = 0; i <
dim; i++)
2213 for (
int j = 0; j <
dim; j++)
2215 for (
int k = 0; k < dof; k++)
2216 for (
int l = 0; l < dof; l++)
2218 elmat(dof*i+k, dof*j+l) +=
2219 (M * w) * gshape(k, j) * gshape(l, i);
2226 void ElasticityIntegrator::ComputeElementFlux(
2231 const int dof = el.
GetDof();
2233 const int tdim = dim*(dim+1)/2;
2236 MFEM_ASSERT(dim == 2 || dim == 3,
2237 "dimension is not supported: dim = " << dim);
2239 MFEM_ASSERT(fluxelem.
GetMapType() == FiniteElement::VALUE,
"");
2240 MFEM_ASSERT(dynamic_cast<const NodalFiniteElement*>(&fluxelem),
"");
2242 #ifdef MFEM_THREAD_SAFE
2248 double gh_data[9], grad_data[9];
2257 for (
int i = 0; i < fnd; i++)
2261 MultAtB(loc_data_mat, dshape, gh);
2266 M = mu->Eval(Trans, ip);
2269 L = lambda->Eval(Trans, ip);
2279 const double M2 = 2.0*M;
2282 L *= (grad(0,0) + grad(1,1));
2284 flux(i+fnd*0) = M2*grad(0,0) + L;
2285 flux(i+fnd*1) = M2*grad(1,1) + L;
2286 flux(i+fnd*2) = M*(grad(0,1) + grad(1,0));
2290 L *= (grad(0,0) + grad(1,1) + grad(2,2));
2292 flux(i+fnd*0) = M2*grad(0,0) + L;
2293 flux(i+fnd*1) = M2*grad(1,1) + L;
2294 flux(i+fnd*2) = M2*grad(2,2) + L;
2295 flux(i+fnd*3) = M*(grad(0,1) + grad(1,0));
2296 flux(i+fnd*4) = M*(grad(0,2) + grad(2,0));
2297 flux(i+fnd*5) = M*(grad(1,2) + grad(2,1));
2306 const int dof = fluxelem.
GetDof();
2308 const int tdim = dim*(dim+1)/2;
2313 MFEM_ASSERT(d_energy == NULL,
"anisotropic estimates are not supported");
2314 MFEM_ASSERT(flux.
Size() == dof*tdim,
"invalid 'flux' vector");
2316 #ifndef MFEM_THREAD_SAFE
2321 double pointstress_data[6];
2322 Vector pointstress(pointstress_data, tdim);
2333 int order = 2 * Trans.
OrderGrad(&fluxelem);
2337 double energy = 0.0;
2339 for (
int i = 0; i < ir->GetNPoints(); i++)
2344 flux_mat.MultTranspose(shape, pointstress);
2349 M = mu->Eval(Trans, ip);
2352 L = lambda->Eval(Trans, ip);
2372 const double *s = pointstress_data;
2376 const double tr_e = (s[0] + s[1])/(2*(M + L));
2378 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + 2*s[2]*s[2]);
2383 const double tr_e = (s[0] + s[1] + s[2])/(2*M + 3*L);
2385 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + s[2]*(s[2] - L) +
2386 2*(s[3]*s[3] + s[4]*s[4] + s[5]*s[5]));
2400 int dim, ndof1, ndof2;
2406 Vector vu(dim), nor(dim);
2417 shape1.SetSize(ndof1);
2418 shape2.SetSize(ndof2);
2434 if (el1.
Space() == FunctionSpace::Pk)
2455 u->Eval(vu, *Trans.
Elem1, eip1);
2459 nor(0) = 2*eip1.
x - 1.0;
2467 a = 0.5 *
alpha * un;
2468 b = beta * fabs(un);
2476 if (un >= 0.0 && ndof2)
2479 rho_p = rho->Eval(*Trans.
Elem2, eip2);
2483 rho_p = rho->Eval(*Trans.
Elem1, eip1);
2492 for (
int i = 0; i < ndof1; i++)
2493 for (
int j = 0; j < ndof1; j++)
2495 elmat(i, j) += w * shape1(i) * shape1(j);
2504 for (
int i = 0; i < ndof2; i++)
2505 for (
int j = 0; j < ndof1; j++)
2507 elmat(ndof1+i, j) -= w * shape2(i) * shape1(j);
2513 for (
int i = 0; i < ndof2; i++)
2514 for (
int j = 0; j < ndof2; j++)
2516 elmat(ndof1+i, ndof1+j) += w * shape2(i) * shape2(j);
2519 for (
int i = 0; i < ndof1; i++)
2520 for (
int j = 0; j < ndof2; j++)
2522 elmat(i, ndof1+j) -= w * shape1(i) * shape2(j);
2529 void DGDiffusionIntegrator::AssembleFaceMatrix(
2533 int dim, ndof1, ndof2, ndofs;
2534 bool kappa_is_nonzero = (
kappa != 0.);
2549 shape1.SetSize(ndof1);
2550 dshape1.SetSize(ndof1, dim);
2551 dshape1dn.SetSize(ndof1);
2555 shape2.SetSize(ndof2);
2556 dshape2.SetSize(ndof2, dim);
2557 dshape2dn.SetSize(ndof2);
2564 ndofs = ndof1 + ndof2;
2567 if (kappa_is_nonzero)
2600 nor(0) = 2*eip1.
x - 1.0;
2619 w *= Q->Eval(*Trans.
Elem1, eip1);
2626 MQ->Eval(mq, *Trans.
Elem1, eip1);
2627 mq.MultTranspose(nh, ni);
2631 if (kappa_is_nonzero)
2646 dshape1.Mult(nh, dshape1dn);
2647 for (
int i = 0; i < ndof1; i++)
2648 for (
int j = 0; j < ndof1; j++)
2650 elmat(i, j) += shape1(i) * dshape1dn(j);
2664 w *= Q->Eval(*Trans.
Elem2, eip2);
2671 MQ->Eval(mq, *Trans.
Elem2, eip2);
2672 mq.MultTranspose(nh, ni);
2676 if (kappa_is_nonzero)
2681 dshape2.Mult(nh, dshape2dn);
2683 for (
int i = 0; i < ndof1; i++)
2684 for (
int j = 0; j < ndof2; j++)
2686 elmat(i, ndof1 + j) += shape1(i) * dshape2dn(j);
2689 for (
int i = 0; i < ndof2; i++)
2690 for (
int j = 0; j < ndof1; j++)
2692 elmat(ndof1 + i, j) -= shape2(i) * dshape1dn(j);
2695 for (
int i = 0; i < ndof2; i++)
2696 for (
int j = 0; j < ndof2; j++)
2698 elmat(ndof1 + i, ndof1 + j) -= shape2(i) * dshape2dn(j);
2702 if (kappa_is_nonzero)
2706 for (
int i = 0; i < ndof1; i++)
2708 const double wsi = wq*shape1(i);
2709 for (
int j = 0; j <= i; j++)
2711 jmat(i, j) += wsi * shape1(j);
2716 for (
int i = 0; i < ndof2; i++)
2718 const int i2 = ndof1 + i;
2719 const double wsi = wq*shape2(i);
2720 for (
int j = 0; j < ndof1; j++)
2722 jmat(i2, j) -= wsi * shape1(j);
2724 for (
int j = 0; j <= i; j++)
2726 jmat(i2, ndof1 + j) += wsi * shape2(j);
2734 if (kappa_is_nonzero)
2736 for (
int i = 0; i < ndofs; i++)
2738 for (
int j = 0; j < i; j++)
2740 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
2741 elmat(i,j) =
sigma*aji - aij + mij;
2742 elmat(j,i) =
sigma*aij - aji + mij;
2744 elmat(i,i) = (
sigma - 1.)*elmat(i,i) + jmat(i,i);
2749 for (
int i = 0; i < ndofs; i++)
2751 for (
int j = 0; j < i; j++)
2753 double aij = elmat(i,j), aji = elmat(j,i);
2754 elmat(i,j) =
sigma*aji - aij;
2755 elmat(j,i) =
sigma*aij - aji;
2757 elmat(i,i) *= (
sigma - 1.);
2764 void DGElasticityIntegrator::AssembleBlock(
2765 const int dim,
const int row_ndofs,
const int col_ndofs,
2766 const int row_offset,
const int col_offset,
2767 const double jmatcoef,
const Vector &col_nL,
const Vector &col_nM,
2772 for (
int jm = 0, j = col_offset; jm <
dim; ++jm)
2774 for (
int jdof = 0; jdof < col_ndofs; ++jdof, ++j)
2776 const double t2 = col_dshape_dnM(jdof);
2777 for (
int im = 0, i = row_offset; im <
dim; ++im)
2779 const double t1 = col_dshape(jdof, jm) * col_nL(im);
2780 const double t3 = col_dshape(jdof, im) * col_nM(jm);
2781 const double tt = t1 + ((im == jm) ? t2 : 0.0) + t3;
2782 for (
int idof = 0; idof < row_ndofs; ++idof, ++i)
2784 elmat(i, j) += row_shape(idof) * tt;
2790 if (jmatcoef == 0.0) {
return; }
2792 for (
int d = 0; d <
dim; ++d)
2794 const int jo = col_offset + d*col_ndofs;
2795 const int io = row_offset + d*row_ndofs;
2796 for (
int jdof = 0, j = jo; jdof < col_ndofs; ++jdof, ++j)
2798 const double sj = jmatcoef * col_shape(jdof);
2799 for (
int i = max(io,j), idof = i - io; idof < row_ndofs; ++idof, ++i)
2801 jmat(i, j) += row_shape(idof) * sj;
2807 void DGElasticityIntegrator::AssembleFaceMatrix(
2811 #ifdef MFEM_THREAD_SAFE
2820 Vector dshape1_dnM, dshape2_dnM;
2825 const int ndofs1 = el1.
GetDof();
2827 const int nvdofs = dim*(ndofs1 + ndofs2);
2837 const bool kappa_is_nonzero = (
kappa != 0.0);
2838 if (kappa_is_nonzero)
2847 dshape1_ps.
SetSize(ndofs1, dim);
2857 dshape2_ps.
SetSize(ndofs2, dim);
2871 for (
int pind = 0; pind < ir->
GetNPoints(); ++pind)
2883 Mult(dshape1, adjJ, dshape1_ps);
2887 nor(0) = 2*eip1.
x - 1.0;
2902 Mult(dshape2, adjJ, dshape2_ps);
2906 const double wL2 = w2 * lambda->Eval(*Trans.
Elem2, eip2);
2907 const double wM2 = w2 * mu->Eval(*Trans.
Elem2, eip2);
2910 wLM = (wL2 + 2.0*wM2);
2911 dshape2_ps.
Mult(nM2, dshape2_dnM);
2921 const double wL1 = w1 * lambda->Eval(*Trans.
Elem1, eip1);
2922 const double wM1 = w1 * mu->Eval(*Trans.
Elem1, eip1);
2925 wLM += (wL1 + 2.0*wM1);
2926 dshape1_ps.
Mult(nM1, dshape1_dnM);
2929 const double jmatcoef =
kappa * (nor*nor) * wLM;
2933 dim, ndofs1, ndofs1, 0, 0, jmatcoef, nL1, nM1,
2934 shape1, shape1, dshape1_dnM, dshape1_ps, elmat, jmat);
2936 if (ndofs2 == 0) {
continue; }
2943 dim, ndofs1, ndofs2, 0, dim*ndofs1, jmatcoef, nL2, nM2,
2944 shape1, shape2, dshape2_dnM, dshape2_ps, elmat, jmat);
2947 dim, ndofs2, ndofs1, dim*ndofs1, 0, jmatcoef, nL1, nM1,
2948 shape2, shape1, dshape1_dnM, dshape1_ps, elmat, jmat);
2951 dim, ndofs2, ndofs2, dim*ndofs1, dim*ndofs1, jmatcoef, nL2, nM2,
2952 shape2, shape2, dshape2_dnM, dshape2_ps, elmat, jmat);
2956 if (kappa_is_nonzero)
2958 for (
int i = 0; i < nvdofs; ++i)
2960 for (
int j = 0; j < i; ++j)
2962 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
2963 elmat(i,j) =
alpha*aji - aij + mij;
2964 elmat(j,i) =
alpha*aij - aji + mij;
2966 elmat(i,i) = (
alpha - 1.)*elmat(i,i) + jmat(i,i);
2971 for (
int i = 0; i < nvdofs; ++i)
2973 for (
int j = 0; j < i; ++j)
2975 double aij = elmat(i,j), aji = elmat(j,i);
2976 elmat(i,j) =
alpha*aji - aij;
2977 elmat(j,i) =
alpha*aij - aji;
2979 elmat(i,i) *= (
alpha - 1.);
2985 void TraceJumpIntegrator::AssembleFaceMatrix(
2990 int i, j, face_ndof, ndof1, ndof2;
2995 face_ndof = trial_face_fe.
GetDof();
2996 ndof1 = test_fe1.
GetDof();
2998 face_shape.SetSize(face_ndof);
2999 shape1.SetSize(ndof1);
3003 ndof2 = test_fe2.
GetDof();
3004 shape2.SetSize(ndof2);
3011 elmat.
SetSize(ndof1 + ndof2, face_ndof);
3026 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
3039 trial_face_fe.
CalcShape(ip, face_shape);
3052 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
3057 for (i = 0; i < ndof1; i++)
3058 for (j = 0; j < face_ndof; j++)
3060 elmat(i, j) += shape1(i) * face_shape(j);
3065 for (i = 0; i < ndof2; i++)
3066 for (j = 0; j < face_ndof; j++)
3068 elmat(ndof1+i, j) -= shape2(i) * face_shape(j);
3074 void NormalTraceJumpIntegrator::AssembleFaceMatrix(
3079 int i, j, face_ndof, ndof1, ndof2,
dim;
3082 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::VALUE,
"");
3084 face_ndof = trial_face_fe.
GetDof();
3085 ndof1 = test_fe1.
GetDof();
3088 face_shape.SetSize(face_ndof);
3089 normal.SetSize(dim);
3090 shape1.SetSize(ndof1,dim);
3091 shape1_n.SetSize(ndof1);
3095 ndof2 = test_fe2.
GetDof();
3096 shape2.SetSize(ndof2,dim);
3097 shape2_n.SetSize(ndof2);
3104 elmat.
SetSize(ndof1 + ndof2, face_ndof);
3127 trial_face_fe.
CalcShape(ip, face_shape);
3133 shape1.Mult(normal, shape1_n);
3141 shape2.Mult(normal, shape2_n);
3144 for (i = 0; i < ndof1; i++)
3145 for (j = 0; j < face_ndof; j++)
3147 elmat(i, j) -= shape1_n(i) * face_shape(j);
3152 for (i = 0; i < ndof2; i++)
3153 for (j = 0; j < face_ndof; j++)
3155 elmat(ndof1+i, j) += shape2_n(i) * face_shape(j);
3162 void NormalInterpolator::AssembleElementMatrix2(
3171 for (
int i = 0; i < ran_nodes.Size(); i++)
3177 for (
int j = 0; j < shape.Size(); j++)
3179 for (
int d = 0; d < spaceDim; d++)
3181 elmat(i, j+d*shape.Size()) = shape(j)*n(d);
3201 using VectorCoefficient::Eval;
3202 virtual void Eval(Vector &V, ElementTransformation &T,
3203 const IntegrationPoint &ip)
3206 fe.CalcPhysShape(T, V);
3219 internal::ShapeCoefficient dom_shape_coeff(*Q, dom_fe);
3225 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
3230 ScalarVectorProductInterpolator::AssembleElementMatrix2(
3249 fe.CalcPhysVShape(T, M);
3254 VShapeCoefficient dom_shape_coeff(*Q, dom_fe, Trans.
GetSpaceDim());
3265 VectorScalarProductInterpolator::AssembleElementMatrix2(
3280 vc(width), shape(height) { }
3287 fe.CalcPhysShape(T, shape);
3292 VecShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3303 VectorCrossProductInterpolator::AssembleElementMatrix2(
3319 vshape(height, width), vc(width)
3321 MFEM_ASSERT(width == 3,
"");
3329 fe.CalcPhysVShape(T, vshape);
3330 for (
int k = 0; k < height; k++)
3332 M(k,0) = vc(1) * vshape(k,2) - vc(2) * vshape(k,1);
3333 M(k,1) = vc(2) * vshape(k,0) - vc(0) * vshape(k,2);
3334 M(k,2) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
3339 VCrossVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3370 vshape(vdim, vq.GetVDim()), vc(vq.GetVDim()) { }
3372 using VectorCoefficient::Eval;
3373 virtual void Eval(Vector &V, ElementTransformation &T,
3374 const IntegrationPoint &ip)
3378 fe.CalcPhysVShape(T, vshape);
3386 VectorInnerProductInterpolator::AssembleElementMatrix2(
3392 internal::VDotVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3398 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
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 reference space dimension for the finite element.
void AddMultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += v w^t.
Class for an integration rule - an Array of IntegrationPoint.
void NewDataAndSize(double *d, int s)
Set the Vector data and size, deleting the old data, if owned.
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...
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.
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
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 SetSize(int s)
Resize the vector to size s.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
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. In the case of anisotropic orders, returns the maximum order...
Data type dense matrix using column-major storage.
int Size() const
Returns the size of the vector.
int Space() const
Returns the type of space on each element.
void AddMult_a_ABt(double a, const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += a * A * B^t.
double * GetData() const
Returns the matrix data array.
double * GetData() const
Return a pointer to the beginning of the Vector data.
void CalcOrtho(const DenseMatrix &J, Vector &n)
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
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.
void Reset(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
void AddMult_a_VWt(const double a, const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += a * v w^t.
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...
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.
int GetVDim()
Returns dimension of the vector.
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
double * Data() const
Returns the matrix data array.
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.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Base class Coefficient that may optionally depend on time.
void MultAAt(const DenseMatrix &a, DenseMatrix &aat)
Calculate the matrix A.At.
void GetColumnReference(int c, Vector &col)
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...
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.
void SetDataAndSize(double *d, int s)
Set the Vector data and size.
Vector & Set(const double a, const Vector &x)
(*this) = a * x
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...
void AddMultADBt(const DenseMatrix &A, const Vector &D, const DenseMatrix &B, DenseMatrix &ADBt)
ADBt = A D B^t, where D is diagonal.
Class for integration point with weight.
virtual void ProjectMatrixCoefficient(MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
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.
void Mult(const double *x, double *y) const
Matrix vector multiplication.
IntegrationRules RefinedIntRules(1, Quadrature1D::GaussLegendre)
A global object with all refined integration rules.
For scalar fields; preserves point values.
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
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
void AddMult_a_AAt(double a, const DenseMatrix &A, DenseMatrix &AAt)
AAt += a * A * A^t.
void Neg()
(*this) = -(*this)
double sigma(const Vector &x)