25 mfem_error (
"BilinearFormIntegrator::AssemblePA(...)\n"
26 " is not implemented for this class.");
32 mfem_error (
"BilinearFormIntegrator::AssemblePA(...)\n"
33 " is not implemented for this class.");
38 mfem_error (
"BilinearFormIntegrator::AssemblePAInteriorFaces(...)\n"
39 " is not implemented for this class.");
44 mfem_error (
"BilinearFormIntegrator::AssemblePABoundaryFaces(...)\n"
45 " is not implemented for this class.");
48 void BilinearFormIntegrator::AssembleDiagonalPA(
Vector &)
50 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalPA(...)\n"
51 " is not implemented for this class.");
54 void BilinearFormIntegrator::AddMultPA(
const Vector &,
Vector &)
const
56 mfem_error (
"BilinearFormIntegrator::MultAssembled(...)\n"
57 " is not implemented for this class.");
60 void BilinearFormIntegrator::AddMultTransposePA(
const Vector &,
Vector &)
const
62 mfem_error (
"BilinearFormIntegrator::MultAssembledTranspose(...)\n"
63 " is not implemented for this class.");
66 void BilinearFormIntegrator::AssembleElementMatrix (
70 mfem_error (
"BilinearFormIntegrator::AssembleElementMatrix(...)\n"
71 " is not implemented for this class.");
74 void BilinearFormIntegrator::AssembleElementMatrix2 (
78 mfem_error (
"BilinearFormIntegrator::AssembleElementMatrix2(...)\n"
79 " is not implemented for this class.");
82 void BilinearFormIntegrator::AssembleFaceMatrix (
86 mfem_error (
"BilinearFormIntegrator::AssembleFaceMatrix(...)\n"
87 " is not implemented for this class.");
90 void BilinearFormIntegrator::AssembleFaceMatrix(
95 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this"
96 " Integrator class.");
99 void BilinearFormIntegrator::AssembleElementVector(
103 mfem_error(
"BilinearFormIntegrator::AssembleElementVector\n"
104 " is not implemented for this class.");
108 void TransposeIntegrator::AssembleElementMatrix (
111 bfi -> AssembleElementMatrix (el, Trans, bfi_elmat);
116 void TransposeIntegrator::AssembleElementMatrix2 (
120 bfi -> AssembleElementMatrix2 (test_fe, trial_fe, Trans, bfi_elmat);
125 void TransposeIntegrator::AssembleFaceMatrix (
129 bfi -> AssembleFaceMatrix (el1, el2, Trans, bfi_elmat);
134 void LumpedIntegrator::AssembleElementMatrix (
137 bfi -> AssembleElementMatrix (el, Trans, elmat);
141 void InverseIntegrator::AssembleElementMatrix(
144 integrator->AssembleElementMatrix(el, Trans, elmat);
148 void SumIntegrator::AssembleElementMatrix(
151 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
153 integrators[0]->AssembleElementMatrix(el, Trans, elmat);
154 for (
int i = 1; i < integrators.Size(); i++)
156 integrators[i]->AssembleElementMatrix(el, Trans, elem_mat);
161 SumIntegrator::~SumIntegrator()
165 for (
int i = 0; i < integrators.Size(); i++)
167 delete integrators[i];
172 void MixedScalarIntegrator::AssembleElementMatrix2(
176 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
177 this->FiniteElementTypeFailureMessage());
179 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
180 bool same_shapes = same_calc_shape && (&trial_fe == &test_fe);
182 #ifdef MFEM_THREAD_SAFE
183 Vector test_shape(test_nd);
197 elmat.
SetSize(test_nd, trial_nd);
202 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
212 this->CalcTestShape(test_fe, Trans, test_shape);
213 this->CalcTrialShape(trial_fe, Trans, trial_shape);
219 w *= Q->Eval(Trans, ip);
223 #ifndef MFEM_THREAD_SAFE
231 void MixedVectorIntegrator::AssembleElementMatrix2(
235 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
236 this->FiniteElementTypeFailureMessage());
238 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
240 bool same_shapes = same_calc_shape && (&trial_fe == &test_fe);
242 #ifdef MFEM_THREAD_SAFE
243 Vector V(VQ ? VQ->GetVDim() : 0);
244 Vector D(DQ ? DQ->GetVDim() : 0);
245 DenseMatrix M(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
250 V.SetSize(VQ ? VQ->GetVDim() : 0);
251 D.SetSize(DQ ? DQ->GetVDim() : 0);
252 M.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
253 test_shape.SetSize(test_nd, spaceDim);
254 test_shape_tmp.
SetSize(test_nd, spaceDim);
258 trial_shape.
Reset(test_shape.Data(), trial_nd, spaceDim);
262 trial_shape.
SetSize(trial_nd, spaceDim);
265 elmat.
SetSize(test_nd, trial_nd);
270 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
280 this->CalcTestShape(test_fe, Trans, test_shape);
283 this->CalcTrialShape(trial_fe, Trans, trial_shape);
290 MQ->Eval(M, Trans, ip);
292 Mult(test_shape, M, test_shape_tmp);
293 AddMultABt(test_shape_tmp, trial_shape, elmat);
297 DQ->Eval(D, Trans, ip);
303 VQ->Eval(V, Trans, ip);
305 for (
int j=0; j<test_nd; j++)
307 test_shape_tmp(j,0) = test_shape(j,1) * V(2) -
308 test_shape(j,2) * V(1);
309 test_shape_tmp(j,1) = test_shape(j,2) * V(0) -
310 test_shape(j,0) * V(2);
311 test_shape_tmp(j,2) = test_shape(j,0) * V(1) -
312 test_shape(j,1) * V(0);
314 AddMultABt(test_shape_tmp, trial_shape, elmat);
320 w *= Q -> Eval (Trans, ip);
332 #ifndef MFEM_THREAD_SAFE
340 void MixedScalarVectorIntegrator::AssembleElementMatrix2(
344 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
345 this->FiniteElementTypeFailureMessage());
350 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
351 int sca_nd = sca_fe->
GetDof();
352 int vec_nd = vec_fe->
GetDof();
356 #ifdef MFEM_THREAD_SAFE
357 Vector V(VQ ? VQ->GetVDim() : 0);
360 Vector vshape_tmp(vec_nd);
362 V.SetSize(VQ ? VQ->GetVDim() : 0);
363 vshape.SetSize(vec_nd, spaceDim);
371 elmat.
SetSize(test_nd, trial_nd);
376 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
386 this->CalcShape(*sca_fe, Trans, shape);
387 this->CalcVShape(*vec_fe, Trans, vshape);
391 VQ->Eval(V, Trans, ip);
394 if ( vec_fe->
GetDim() == 2 && cross_2d )
401 vshape.Mult(V,vshape_tmp);
408 void GradientIntegrator::AssembleElementMatrix2(
413 int trial_dof = trial_fe.
GetDof();
414 int test_dof = test_fe.
GetDof();
418 dshape.
SetSize(trial_dof, dim);
419 gshape.SetSize(trial_dof, dim);
421 shape.SetSize(test_dof);
422 elmat.
SetSize(dim * test_dof, trial_dof);
424 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(trial_fe, test_fe,
428 elmat_comp.
SetSize(test_dof, trial_dof);
440 Mult(dshape, Jadj, gshape);
445 c *= Q->Eval(Trans, ip);
449 for (
int d = 0; d <
dim; ++d)
451 gshape.GetColumnReference(d, d_col);
452 MultVWt(shape, d_col, elmat_comp);
453 for (
int jj = 0; jj < trial_dof; ++jj)
455 for (
int ii = 0; ii < test_dof; ++ii)
457 elmat(d * test_dof + ii, jj) += elmat_comp(ii, jj);
474 void DiffusionIntegrator::AssembleElementMatrix
481 bool square = (dim == spaceDim);
484 #ifdef MFEM_THREAD_SAFE
485 DenseMatrix dshape(nd,dim), dshapedxt(nd,spaceDim), invdfdx(dim,spaceDim);
487 dshape.SetSize(nd,dim);
488 dshapedxt.SetSize(nd,spaceDim);
503 w = ip.
weight / (square ? w : w*w*w);
511 w *= Q->Eval(Trans, ip);
517 MQ->Eval(invdfdx, Trans, ip);
519 Mult(dshapedxt, invdfdx, dshape);
525 void DiffusionIntegrator::AssembleElementMatrix2(
529 int tr_nd = trial_fe.
GetDof();
530 int te_nd = test_fe.
GetDof();
533 bool square = (dim == spaceDim);
536 #ifdef MFEM_THREAD_SAFE
537 DenseMatrix dshape(tr_nd, dim), dshapedxt(tr_nd, spaceDim);
538 DenseMatrix te_dshape(te_nd, dim), te_dshapedxt(te_nd, spaceDim);
541 dshape.SetSize(tr_nd, dim);
542 dshapedxt.
SetSize(tr_nd, spaceDim);
543 te_dshape.SetSize(te_nd, dim);
544 te_dshapedxt.
SetSize(te_nd, spaceDim);
545 invdfdx.
SetSize(dim, spaceDim);
549 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(trial_fe, test_fe);
561 w = ip.
weight / (square ? w : w*w*w);
562 Mult(dshape, invdfdx, dshapedxt);
563 Mult(te_dshape, invdfdx, te_dshapedxt);
569 w *= Q->Eval(Trans, ip);
576 MQ->Eval(invdfdx, Trans, ip);
578 Mult(te_dshapedxt, invdfdx, te_dshape);
584 void DiffusionIntegrator::AssembleElementVector(
592 #ifdef MFEM_THREAD_SAFE
595 dshape.SetSize(nd,dim);
596 invdfdx.SetSize(dim);
600 pointflux.SetSize(dim);
618 dshape.MultTranspose(elfun, vec);
619 invdfdx.MultTranspose(vec, pointflux);
622 w *= Q->Eval(Tr, ip);
628 dshape.MultTranspose(elfun, pointflux);
629 invdfdx.MultTranspose(pointflux, vec);
630 MQ->Eval(mq, Tr, ip);
631 mq.
Mult(vec, pointflux);
634 invdfdx.Mult(pointflux, vec);
635 dshape.AddMult(vec, elvect);
639 void DiffusionIntegrator::ComputeElementFlux
643 int i, j, nd,
dim, spaceDim, fnd;
649 #ifdef MFEM_THREAD_SAFE
650 DenseMatrix dshape(nd,dim), invdfdx(dim, spaceDim);
652 dshape.SetSize(nd,dim);
653 invdfdx.
SetSize(dim, spaceDim);
656 pointflux.SetSize(spaceDim);
660 flux.
SetSize( fnd * spaceDim );
662 for (i = 0; i < fnd; i++)
666 dshape.MultTranspose(u, vec);
676 pointflux *= Q->Eval(Trans,ip);
678 for (j = 0; j < spaceDim; j++)
680 flux(fnd*j+i) = pointflux(j);
686 MFEM_ASSERT(dim == spaceDim,
"TODO");
687 MQ->Eval(invdfdx, Trans, ip);
688 invdfdx.
Mult(pointflux, vec);
689 for (j = 0; j <
dim; j++)
691 flux(fnd*j+i) = vec(j);
697 double DiffusionIntegrator::ComputeFluxEnergy
701 int nd = fluxelem.
GetDof();
705 #ifdef MFEM_THREAD_SAFE
710 pointflux.SetSize(spaceDim);
711 if (d_energy) { vec.SetSize(dim); }
714 int order = 2 * fluxelem.
GetOrder();
718 if (d_energy) { *d_energy = 0.0; }
726 for (
int k = 0; k < spaceDim; k++)
728 for (
int j = 0; j < nd; j++)
730 pointflux(k) += flux(k*nd+j)*shape(j);
739 double e = (pointflux * pointflux);
740 if (Q) { e *= Q->Eval(Trans, ip); }
745 MQ->Eval(mq, Trans, ip);
753 for (
int k = 0; k <
dim; k++)
755 (*d_energy)[k] += w * vec[k] * vec[k];
768 if (trial_fe.
Space() == FunctionSpace::Pk)
778 if (trial_fe.
Space() == FunctionSpace::rQk)
786 void MassIntegrator::AssembleElementMatrix
794 #ifdef MFEM_THREAD_SAFE
800 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(el, el, Trans);
812 w *= Q -> Eval(Trans, ip);
819 void MassIntegrator::AssembleElementMatrix2(
823 int tr_nd = trial_fe.
GetDof();
824 int te_nd = test_fe.
GetDof();
827 #ifdef MFEM_THREAD_SAFE
835 &GetRule(trial_fe, test_fe, Trans);
848 w *= Q -> Eval(Trans, ip);
863 if (trial_fe.
Space() == FunctionSpace::rQk)
871 void BoundaryMassIntegrator::AssembleFaceMatrix(
876 "support for interior faces is not implemented");
881 #ifdef MFEM_THREAD_SAFE
907 w *= Q -> Eval(*Trans.
Face, ip);
914 void ConvectionIntegrator::AssembleElementMatrix(
920 #ifdef MFEM_THREAD_SAFE
922 Vector shape, vec2, BdFidxT;
940 Q->Eval(Q_ir, Trans, *ir);
954 adjJ.
Mult(vec1, vec2);
955 dshape.
Mult(vec2, BdFidxT);
962 void GroupConvectionIntegrator::AssembleElementMatrix(
969 dshape.SetSize(nd,dim);
972 grad.SetSize(nd,dim);
981 Q->Eval(Q_nodal, Trans, el.
GetNodes());
993 Mult(dshape, adjJ, grad);
998 for (
int k = 0; k < nd; k++)
1000 double wsk = w*shape(k);
1001 for (
int l = 0; l < nd; l++)
1004 for (
int s = 0; s <
dim; s++)
1006 a += Q_nodal(s,k)*grad(l,s);
1008 elmat(k,l) += wsk*
a;
1027 return GetRule(el,el,Trans);
1030 void VectorMassIntegrator::AssembleElementMatrix
1040 vdim = (vdim == -1) ? spaceDim : vdim;
1044 partelmat.SetSize(nd);
1051 mcoeff.SetSize(vdim);
1059 if (el.
Space() == FunctionSpace::rQk)
1082 VQ->Eval(vec, Trans, ip);
1083 for (
int k = 0; k < vdim; k++)
1085 elmat.
AddMatrix(norm*vec(k), partelmat, nd*k, nd*k);
1090 MQ->Eval(mcoeff, Trans, ip);
1091 for (
int i = 0; i < vdim; i++)
1092 for (
int j = 0; j < vdim; j++)
1094 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, nd*i, nd*j);
1101 norm *= Q->Eval(Trans, ip);
1104 for (
int k = 0; k < vdim; k++)
1112 void VectorMassIntegrator::AssembleElementMatrix2(
1116 int tr_nd = trial_fe.
GetDof();
1117 int te_nd = test_fe.
GetDof();
1124 elmat.
SetSize(te_nd*vdim, tr_nd*vdim);
1125 shape.SetSize(tr_nd);
1126 te_shape.SetSize(te_nd);
1127 partelmat.SetSize(te_nd, tr_nd);
1134 mcoeff.SetSize(vdim);
1141 Trans.
OrderW() + Q_order);
1143 if (trial_fe.
Space() == FunctionSpace::rQk)
1163 MultVWt(te_shape, shape, partelmat);
1167 VQ->Eval(vec, Trans, ip);
1168 for (
int k = 0; k < vdim; k++)
1170 elmat.
AddMatrix(norm*vec(k), partelmat, te_nd*k, tr_nd*k);
1175 MQ->Eval(mcoeff, Trans, ip);
1176 for (
int i = 0; i < vdim; i++)
1177 for (
int j = 0; j < vdim; j++)
1179 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, te_nd*i, tr_nd*j);
1186 norm *= Q->Eval(Trans, ip);
1189 for (
int k = 0; k < vdim; k++)
1191 elmat.
AddMatrix(partelmat, te_nd*k, tr_nd*k);
1197 void VectorFEDivergenceIntegrator::AssembleElementMatrix2(
1201 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1203 #ifdef MFEM_THREAD_SAFE
1204 Vector divshape(trial_nd), shape(test_nd);
1206 divshape.SetSize(trial_nd);
1210 elmat.
SetSize(test_nd, trial_nd);
1229 w *= Q->Eval(Trans, ip);
1236 void VectorFEWeakDivergenceIntegrator::AssembleElementMatrix2(
1240 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1246 "Trial space must be H(Curl) and test space must be H_1");
1248 #ifdef MFEM_THREAD_SAFE
1254 dshape.SetSize(test_nd, dim);
1255 dshapedxt.
SetSize(test_nd, dim);
1256 vshape.
SetSize(trial_nd, dim);
1260 elmat.
SetSize(test_nd, trial_nd);
1302 Mult(dshape, invdfdx, dshapedxt);
1310 w *= Q->Eval(Trans, ip);
1318 void VectorFECurlIntegrator::AssembleElementMatrix2(
1322 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1324 int dimc = (dim == 3) ? 3 : 1;
1328 "At least one of the finite elements must be in H(Curl)");
1330 int curl_nd, vec_nd;
1342 #ifdef MFEM_THREAD_SAFE
1347 curlshapeTrial.
SetSize(curl_nd, dimc);
1348 curlshapeTrial_dFT.
SetSize(curl_nd, dimc);
1349 vshapeTest.
SetSize(vec_nd, dimc);
1353 elmat.
SetSize(test_nd, trial_nd);
1400 w *= Q->Eval(Trans, ip);
1406 AddMultABt(vshapeTest, curlshapeTrial_dFT, elmat);
1410 AddMultABt(curlshapeTrial_dFT, vshapeTest, elmat);
1415 void DerivativeIntegrator::AssembleElementMatrix2 (
1422 int trial_nd = trial_fe.
GetDof();
1423 int test_nd = test_fe.
GetDof();
1428 elmat.
SetSize (test_nd,trial_nd);
1429 dshape.SetSize (trial_nd,dim);
1430 dshapedxt.SetSize(trial_nd,dim);
1431 dshapedxi.SetSize(trial_nd);
1432 invdfdx.SetSize(dim);
1433 shape.SetSize (test_nd);
1439 if (trial_fe.
Space() == FunctionSpace::Pk)
1448 if (trial_fe.
Space() == FunctionSpace::rQk)
1468 Mult (dshape, invdfdx, dshapedxt);
1472 for (l = 0; l < trial_nd; l++)
1474 dshapedxi(l) = dshapedxt(l,xi);
1477 shape *= Q->Eval(Trans,ip) * det * ip.
weight;
1482 void CurlCurlIntegrator::AssembleElementMatrix
1488 int dimc = (dim == 3) ? 3 : 1;
1491 #ifdef MFEM_THREAD_SAFE
1492 DenseMatrix curlshape(nd,dimc), curlshape_dFt(nd,dimc), M;
1495 curlshape_dFt.SetSize(nd,dimc);
1504 if (el.
Space() == FunctionSpace::Pk)
1537 MQ->Eval(M, Trans, ip);
1539 Mult(curlshape_dFt, M, curlshape);
1544 w *= Q->Eval(Trans, ip);
1554 void CurlCurlIntegrator
1559 #ifdef MFEM_THREAD_SAFE
1566 projcurl.
Mult(u, flux);
1575 int nd = fluxelem.
GetDof();
1578 #ifdef MFEM_THREAD_SAFE
1582 pointflux.SetSize(dim);
1583 if (d_energy) { vec.SetSize(dim); }
1585 int order = 2 * fluxelem.
GetOrder();
1588 double energy = 0.0;
1589 if (d_energy) { *d_energy = 0.0; }
1608 double e = w * (pointflux * pointflux);
1617 #if ANISO_EXPERIMENTAL
1637 #if ANISO_EXPERIMENTAL
1641 int n = (int) round(pow(ir.
GetNPoints(), 1.0/3.0));
1645 for (
int k = 0; k < n; k++)
1646 for (
int l = 0; l < n; l++)
1647 for (
int m = 0; m < n; m++)
1649 Vector &vec = pfluxes[(k*n + l)*n + m];
1652 tmp = vec; tmp -= pfluxes[(k*n + l)*n + (m-1)];
1653 (*d_energy)[0] += (tmp * tmp);
1657 tmp = vec; tmp -= pfluxes[(k*n + (l-1))*n + m];
1658 (*d_energy)[1] += (tmp * tmp);
1662 tmp = vec; tmp -= pfluxes[((k-1)*n + l)*n + m];
1663 (*d_energy)[2] += (tmp * tmp);
1676 void VectorCurlCurlIntegrator::AssembleElementMatrix(
1681 int cld = (dim*(dim-1))/2;
1683 #ifdef MFEM_THREAD_SAFE
1684 DenseMatrix dshape_hat(dof, dim), dshape(dof, dim);
1687 dshape_hat.SetSize(dof, dim);
1689 curlshape.SetSize(dim*dof, cld);
1712 Mult(dshape_hat, Jadj, dshape);
1717 w *= Q->Eval(Trans, ip);
1724 double VectorCurlCurlIntegrator::GetElementEnergy(
1730 #ifdef MFEM_THREAD_SAFE
1731 DenseMatrix dshape_hat(dof, dim), Jadj(dim), grad_hat(dim), grad(dim);
1733 dshape_hat.SetSize(dof, dim);
1736 grad_hat.SetSize(dim);
1750 for (
int i = 0; i < ir->GetNPoints(); i++)
1755 MultAtB(elfun_mat, dshape_hat, grad_hat);
1761 Mult(grad_hat, Jadj, grad);
1765 double curl = grad(0,1) - grad(1,0);
1770 double curl_x = grad(2,1) - grad(1,2);
1771 double curl_y = grad(0,2) - grad(2,0);
1772 double curl_z = grad(1,0) - grad(0,1);
1773 w *= curl_x * curl_x + curl_y * curl_y + curl_z * curl_z;
1778 w *= Q->Eval(Tr, ip);
1784 elfun_mat.ClearExternalData();
1786 return 0.5 * energy;
1790 void VectorFEMassIntegrator::AssembleElementMatrix(
1800 #ifdef MFEM_THREAD_SAFE
1801 Vector D(VQ ? VQ->GetVDim() : 0);
1803 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1805 trial_vshape.
SetSize(dof, spaceDim);
1806 D.SetSize(VQ ? VQ->GetVDim() : 0);
1807 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1809 DenseMatrix tmp(trial_vshape.Height(), K.Width());
1833 MQ->Eval(K, Trans, ip);
1835 Mult(trial_vshape,K,tmp);
1840 VQ->Eval(D, Trans, ip);
1848 w *= Q -> Eval (Trans, ip);
1855 void VectorFEMassIntegrator::AssembleElementMatrix2(
1864 int vdim = MQ ? MQ->GetHeight() : spaceDim;
1865 int trial_dof = trial_fe.
GetDof();
1866 int test_dof = test_fe.
GetDof();
1869 #ifdef MFEM_THREAD_SAFE
1872 Vector D(VQ ? VQ->GetVDim() : 0);
1873 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1875 trial_vshape.
SetSize(trial_dof, spaceDim);
1877 D.SetSize(VQ ? VQ->GetVDim() : 0);
1878 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1881 elmat.
SetSize(vdim*test_dof, trial_dof);
1903 VQ->Eval(D, Trans, ip);
1905 for (
int d = 0; d < vdim; d++)
1907 for (
int j = 0; j < test_dof; j++)
1909 for (
int k = 0; k < trial_dof; k++)
1911 elmat(d * test_dof + j, k) +=
1912 shape(j) * D(d) * trial_vshape(k, d);
1919 MQ->Eval(K, Trans, ip);
1921 for (
int d = 0; d < vdim; d++)
1923 for (
int j = 0; j < test_dof; j++)
1925 for (
int k = 0; k < trial_dof; k++)
1928 for (
int vd = 0; vd < spaceDim; vd++)
1930 Kv += K(d, vd) * trial_vshape(k, vd);
1932 elmat(d * test_dof + j, k) += shape(j) * Kv;
1941 w *= Q->Eval(Trans, ip);
1943 for (
int d = 0; d < vdim; d++)
1945 for (
int j = 0; j < test_dof; j++)
1947 for (
int k = 0; k < trial_dof; k++)
1949 elmat(d * test_dof + j, k) +=
1950 w * shape(j) * trial_vshape(k, d);
1957 else if (test_fe.
GetRangeType() == FiniteElement::VECTOR
1962 int trial_dof = trial_fe.
GetDof();
1963 int test_dof = test_fe.
GetDof();
1966 #ifdef MFEM_THREAD_SAFE
1969 Vector D(VQ ? VQ->GetVDim() : 0);
1970 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1972 trial_vshape.
SetSize(trial_dof,spaceDim);
1973 test_vshape.
SetSize(test_dof,spaceDim);
1974 D.SetSize(VQ ? VQ->GetVDim() : 0);
1975 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1979 elmat.
SetSize (test_dof, trial_dof);
2001 MQ->Eval(K, Trans, ip);
2003 Mult(test_vshape,K,tmp);
2008 VQ->Eval(D, Trans, ip);
2016 w *= Q -> Eval (Trans, ip);
2024 mfem_error(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
2025 " is not implemented for given trial and test bases.");
2029 void VectorDivergenceIntegrator::AssembleElementMatrix2(
2036 int trial_dof = trial_fe.
GetDof();
2037 int test_dof = test_fe.
GetDof();
2040 dshape.SetSize (trial_dof, dim);
2041 gshape.SetSize (trial_dof, dim);
2043 divshape.SetSize (dim*trial_dof);
2044 shape.SetSize (test_dof);
2046 elmat.
SetSize (test_dof, dim*trial_dof);
2048 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(trial_fe, test_fe,
2053 for (
int i = 0; i < ir -> GetNPoints(); i++)
2063 Mult (dshape, Jadj, gshape);
2065 gshape.GradToDiv (divshape);
2070 c *= Q -> Eval (Trans, ip);
2089 void DivDivIntegrator::AssembleElementMatrix(
2097 #ifdef MFEM_THREAD_SAFE
2113 for (
int i = 0; i < ir -> GetNPoints(); i++)
2124 c *= Q -> Eval (Trans, ip);
2133 void VectorDiffusionIntegrator::AssembleElementMatrix(
2145 Jinv. SetSize (dim);
2146 dshape.SetSize (dof, dim);
2147 gshape.SetSize (dof, dim);
2148 pelmat.SetSize (dof);
2155 if (el.
Space() == FunctionSpace::rQk)
2167 for (
int i = 0; i < ir -> GetNPoints(); i++)
2177 Mult (dshape, Jinv, gshape);
2183 norm *= Q -> Eval (Trans, ip);
2188 for (
int d = 0; d <
dim; d++)
2190 for (
int k = 0; k < dof; k++)
2191 for (
int l = 0; l < dof; l++)
2193 elmat (dof*d+k, dof*d+l) += pelmat (k, l);
2199 void VectorDiffusionIntegrator::AssembleElementVector(
2208 dshape.SetSize(dof, dim);
2209 pelmat.SetSize(dim);
2210 gshape.SetSize(dim);
2221 ir = (el.
Space() == FunctionSpace::rQk) ?
2227 for (
int i = 0; i < ir->GetNPoints(); i++)
2236 w *= Q->Eval(Tr, ip);
2243 MultAtB(mat_in, dshape, pelmat);
2244 MultABt(pelmat, gshape, Jinv);
2250 void ElasticityIntegrator::AssembleElementMatrix(
2259 #ifdef MFEM_THREAD_SAFE
2260 DenseMatrix dshape(dof, dim), gshape(dof, dim), pelmat(dof);
2261 Vector divshape(dim*dof);
2263 dshape.SetSize(dof, dim);
2264 gshape.SetSize(dof, dim);
2265 pelmat.SetSize(dof);
2280 for (
int i = 0; i < ir -> GetNPoints(); i++)
2290 gshape.GradToDiv (divshape);
2292 M = mu->Eval(Trans, ip);
2295 L = lambda->Eval(Trans, ip);
2310 for (
int d = 0; d <
dim; d++)
2312 for (
int k = 0; k < dof; k++)
2313 for (
int l = 0; l < dof; l++)
2315 elmat (dof*d+k, dof*d+l) += (M * w) * pelmat(k, l);
2318 for (
int i = 0; i <
dim; i++)
2319 for (
int j = 0; j <
dim; j++)
2321 for (
int k = 0; k < dof; k++)
2322 for (
int l = 0; l < dof; l++)
2324 elmat(dof*i+k, dof*j+l) +=
2325 (M * w) * gshape(k, j) * gshape(l, i);
2332 void ElasticityIntegrator::ComputeElementFlux(
2337 const int dof = el.
GetDof();
2339 const int tdim = dim*(dim+1)/2;
2342 MFEM_ASSERT(dim == 2 || dim == 3,
2343 "dimension is not supported: dim = " << dim);
2345 MFEM_ASSERT(fluxelem.
GetMapType() == FiniteElement::VALUE,
"");
2346 MFEM_ASSERT(dynamic_cast<const NodalFiniteElement*>(&fluxelem),
"");
2348 #ifdef MFEM_THREAD_SAFE
2354 double gh_data[9], grad_data[9];
2363 for (
int i = 0; i < fnd; i++)
2367 MultAtB(loc_data_mat, dshape, gh);
2372 M = mu->Eval(Trans, ip);
2375 L = lambda->Eval(Trans, ip);
2385 const double M2 = 2.0*M;
2388 L *= (grad(0,0) + grad(1,1));
2390 flux(i+fnd*0) = M2*grad(0,0) + L;
2391 flux(i+fnd*1) = M2*grad(1,1) + L;
2392 flux(i+fnd*2) = M*(grad(0,1) + grad(1,0));
2396 L *= (grad(0,0) + grad(1,1) + grad(2,2));
2398 flux(i+fnd*0) = M2*grad(0,0) + L;
2399 flux(i+fnd*1) = M2*grad(1,1) + L;
2400 flux(i+fnd*2) = M2*grad(2,2) + L;
2401 flux(i+fnd*3) = M*(grad(0,1) + grad(1,0));
2402 flux(i+fnd*4) = M*(grad(0,2) + grad(2,0));
2403 flux(i+fnd*5) = M*(grad(1,2) + grad(2,1));
2412 const int dof = fluxelem.
GetDof();
2414 const int tdim = dim*(dim+1)/2;
2419 MFEM_ASSERT(d_energy == NULL,
"anisotropic estimates are not supported");
2420 MFEM_ASSERT(flux.
Size() == dof*tdim,
"invalid 'flux' vector");
2422 #ifndef MFEM_THREAD_SAFE
2427 double pointstress_data[6];
2428 Vector pointstress(pointstress_data, tdim);
2439 int order = 2 * Trans.
OrderGrad(&fluxelem);
2443 double energy = 0.0;
2445 for (
int i = 0; i < ir->GetNPoints(); i++)
2450 flux_mat.MultTranspose(shape, pointstress);
2455 M = mu->Eval(Trans, ip);
2458 L = lambda->Eval(Trans, ip);
2478 const double *s = pointstress_data;
2482 const double tr_e = (s[0] + s[1])/(2*(M + L));
2484 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + 2*s[2]*s[2]);
2489 const double tr_e = (s[0] + s[1] + s[2])/(2*M + 3*L);
2491 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + s[2]*(s[2] - L) +
2492 2*(s[3]*s[3] + s[4]*s[4] + s[5]*s[5]));
2506 int dim, ndof1, ndof2;
2512 Vector vu(dim), nor(dim);
2523 shape1.SetSize(ndof1);
2524 shape2.SetSize(ndof2);
2540 if (el1.
Space() == FunctionSpace::Pk)
2561 u->Eval(vu, *Trans.
Elem1, eip1);
2565 nor(0) = 2*eip1.
x - 1.0;
2573 a = 0.5 *
alpha * un;
2574 b = beta * fabs(un);
2582 if (un >= 0.0 && ndof2)
2585 rho_p = rho->Eval(*Trans.
Elem2, eip2);
2589 rho_p = rho->Eval(*Trans.
Elem1, eip1);
2598 for (
int i = 0; i < ndof1; i++)
2599 for (
int j = 0; j < ndof1; j++)
2601 elmat(i, j) += w * shape1(i) * shape1(j);
2610 for (
int i = 0; i < ndof2; i++)
2611 for (
int j = 0; j < ndof1; j++)
2613 elmat(ndof1+i, j) -= w * shape2(i) * shape1(j);
2619 for (
int i = 0; i < ndof2; i++)
2620 for (
int j = 0; j < ndof2; j++)
2622 elmat(ndof1+i, ndof1+j) += w * shape2(i) * shape2(j);
2625 for (
int i = 0; i < ndof1; i++)
2626 for (
int j = 0; j < ndof2; j++)
2628 elmat(i, ndof1+j) -= w * shape1(i) * shape2(j);
2643 void DGDiffusionIntegrator::AssembleFaceMatrix(
2647 int dim, ndof1, ndof2, ndofs;
2648 bool kappa_is_nonzero = (
kappa != 0.);
2663 shape1.SetSize(ndof1);
2664 dshape1.SetSize(ndof1, dim);
2665 dshape1dn.SetSize(ndof1);
2669 shape2.SetSize(ndof2);
2670 dshape2.SetSize(ndof2, dim);
2671 dshape2dn.SetSize(ndof2);
2678 ndofs = ndof1 + ndof2;
2681 if (kappa_is_nonzero)
2714 nor(0) = 2*eip1.
x - 1.0;
2733 w *= Q->Eval(*Trans.
Elem1, eip1);
2740 MQ->Eval(mq, *Trans.
Elem1, eip1);
2741 mq.MultTranspose(nh, ni);
2745 if (kappa_is_nonzero)
2760 dshape1.Mult(nh, dshape1dn);
2761 for (
int i = 0; i < ndof1; i++)
2762 for (
int j = 0; j < ndof1; j++)
2764 elmat(i, j) += shape1(i) * dshape1dn(j);
2778 w *= Q->Eval(*Trans.
Elem2, eip2);
2785 MQ->Eval(mq, *Trans.
Elem2, eip2);
2786 mq.MultTranspose(nh, ni);
2790 if (kappa_is_nonzero)
2795 dshape2.Mult(nh, dshape2dn);
2797 for (
int i = 0; i < ndof1; i++)
2798 for (
int j = 0; j < ndof2; j++)
2800 elmat(i, ndof1 + j) += shape1(i) * dshape2dn(j);
2803 for (
int i = 0; i < ndof2; i++)
2804 for (
int j = 0; j < ndof1; j++)
2806 elmat(ndof1 + i, j) -= shape2(i) * dshape1dn(j);
2809 for (
int i = 0; i < ndof2; i++)
2810 for (
int j = 0; j < ndof2; j++)
2812 elmat(ndof1 + i, ndof1 + j) -= shape2(i) * dshape2dn(j);
2816 if (kappa_is_nonzero)
2820 for (
int i = 0; i < ndof1; i++)
2822 const double wsi = wq*shape1(i);
2823 for (
int j = 0; j <= i; j++)
2825 jmat(i, j) += wsi * shape1(j);
2830 for (
int i = 0; i < ndof2; i++)
2832 const int i2 = ndof1 + i;
2833 const double wsi = wq*shape2(i);
2834 for (
int j = 0; j < ndof1; j++)
2836 jmat(i2, j) -= wsi * shape1(j);
2838 for (
int j = 0; j <= i; j++)
2840 jmat(i2, ndof1 + j) += wsi * shape2(j);
2848 if (kappa_is_nonzero)
2850 for (
int i = 0; i < ndofs; i++)
2852 for (
int j = 0; j < i; j++)
2854 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
2855 elmat(i,j) =
sigma*aji - aij + mij;
2856 elmat(j,i) =
sigma*aij - aji + mij;
2858 elmat(i,i) = (
sigma - 1.)*elmat(i,i) + jmat(i,i);
2863 for (
int i = 0; i < ndofs; i++)
2865 for (
int j = 0; j < i; j++)
2867 double aij = elmat(i,j), aji = elmat(j,i);
2868 elmat(i,j) =
sigma*aji - aij;
2869 elmat(j,i) =
sigma*aij - aji;
2871 elmat(i,i) *= (
sigma - 1.);
2878 void DGElasticityIntegrator::AssembleBlock(
2879 const int dim,
const int row_ndofs,
const int col_ndofs,
2880 const int row_offset,
const int col_offset,
2881 const double jmatcoef,
const Vector &col_nL,
const Vector &col_nM,
2886 for (
int jm = 0, j = col_offset; jm <
dim; ++jm)
2888 for (
int jdof = 0; jdof < col_ndofs; ++jdof, ++j)
2890 const double t2 = col_dshape_dnM(jdof);
2891 for (
int im = 0, i = row_offset; im <
dim; ++im)
2893 const double t1 = col_dshape(jdof, jm) * col_nL(im);
2894 const double t3 = col_dshape(jdof, im) * col_nM(jm);
2895 const double tt = t1 + ((im == jm) ? t2 : 0.0) + t3;
2896 for (
int idof = 0; idof < row_ndofs; ++idof, ++i)
2898 elmat(i, j) += row_shape(idof) * tt;
2904 if (jmatcoef == 0.0) {
return; }
2906 for (
int d = 0; d <
dim; ++d)
2908 const int jo = col_offset + d*col_ndofs;
2909 const int io = row_offset + d*row_ndofs;
2910 for (
int jdof = 0, j = jo; jdof < col_ndofs; ++jdof, ++j)
2912 const double sj = jmatcoef * col_shape(jdof);
2913 for (
int i = max(io,j), idof = i - io; idof < row_ndofs; ++idof, ++i)
2915 jmat(i, j) += row_shape(idof) * sj;
2921 void DGElasticityIntegrator::AssembleFaceMatrix(
2925 #ifdef MFEM_THREAD_SAFE
2934 Vector dshape1_dnM, dshape2_dnM;
2939 const int ndofs1 = el1.
GetDof();
2941 const int nvdofs = dim*(ndofs1 + ndofs2);
2951 const bool kappa_is_nonzero = (
kappa != 0.0);
2952 if (kappa_is_nonzero)
2961 dshape1_ps.
SetSize(ndofs1, dim);
2971 dshape2_ps.
SetSize(ndofs2, dim);
2985 for (
int pind = 0; pind < ir->
GetNPoints(); ++pind)
2997 Mult(dshape1, adjJ, dshape1_ps);
3001 nor(0) = 2*eip1.
x - 1.0;
3016 Mult(dshape2, adjJ, dshape2_ps);
3020 const double wL2 = w2 * lambda->Eval(*Trans.
Elem2, eip2);
3021 const double wM2 = w2 * mu->Eval(*Trans.
Elem2, eip2);
3024 wLM = (wL2 + 2.0*wM2);
3025 dshape2_ps.
Mult(nM2, dshape2_dnM);
3035 const double wL1 = w1 * lambda->Eval(*Trans.
Elem1, eip1);
3036 const double wM1 = w1 * mu->Eval(*Trans.
Elem1, eip1);
3039 wLM += (wL1 + 2.0*wM1);
3040 dshape1_ps.
Mult(nM1, dshape1_dnM);
3043 const double jmatcoef =
kappa * (nor*nor) * wLM;
3047 dim, ndofs1, ndofs1, 0, 0, jmatcoef, nL1, nM1,
3048 shape1, shape1, dshape1_dnM, dshape1_ps, elmat, jmat);
3050 if (ndofs2 == 0) {
continue; }
3057 dim, ndofs1, ndofs2, 0, dim*ndofs1, jmatcoef, nL2, nM2,
3058 shape1, shape2, dshape2_dnM, dshape2_ps, elmat, jmat);
3061 dim, ndofs2, ndofs1, dim*ndofs1, 0, jmatcoef, nL1, nM1,
3062 shape2, shape1, dshape1_dnM, dshape1_ps, elmat, jmat);
3065 dim, ndofs2, ndofs2, dim*ndofs1, dim*ndofs1, jmatcoef, nL2, nM2,
3066 shape2, shape2, dshape2_dnM, dshape2_ps, elmat, jmat);
3070 if (kappa_is_nonzero)
3072 for (
int i = 0; i < nvdofs; ++i)
3074 for (
int j = 0; j < i; ++j)
3076 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
3077 elmat(i,j) =
alpha*aji - aij + mij;
3078 elmat(j,i) =
alpha*aij - aji + mij;
3080 elmat(i,i) = (
alpha - 1.)*elmat(i,i) + jmat(i,i);
3085 for (
int i = 0; i < nvdofs; ++i)
3087 for (
int j = 0; j < i; ++j)
3089 double aij = elmat(i,j), aji = elmat(j,i);
3090 elmat(i,j) =
alpha*aji - aij;
3091 elmat(j,i) =
alpha*aij - aji;
3093 elmat(i,i) *= (
alpha - 1.);
3099 void TraceJumpIntegrator::AssembleFaceMatrix(
3104 int i, j, face_ndof, ndof1, ndof2;
3109 face_ndof = trial_face_fe.
GetDof();
3110 ndof1 = test_fe1.
GetDof();
3112 face_shape.SetSize(face_ndof);
3113 shape1.SetSize(ndof1);
3117 ndof2 = test_fe2.
GetDof();
3118 shape2.SetSize(ndof2);
3125 elmat.
SetSize(ndof1 + ndof2, face_ndof);
3140 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
3153 trial_face_fe.
CalcShape(ip, face_shape);
3166 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
3171 for (i = 0; i < ndof1; i++)
3172 for (j = 0; j < face_ndof; j++)
3174 elmat(i, j) += shape1(i) * face_shape(j);
3179 for (i = 0; i < ndof2; i++)
3180 for (j = 0; j < face_ndof; j++)
3182 elmat(ndof1+i, j) -= shape2(i) * face_shape(j);
3188 void NormalTraceJumpIntegrator::AssembleFaceMatrix(
3193 int i, j, face_ndof, ndof1, ndof2,
dim;
3196 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::VALUE,
"");
3198 face_ndof = trial_face_fe.
GetDof();
3199 ndof1 = test_fe1.
GetDof();
3202 face_shape.SetSize(face_ndof);
3203 normal.SetSize(dim);
3204 shape1.SetSize(ndof1,dim);
3205 shape1_n.SetSize(ndof1);
3209 ndof2 = test_fe2.
GetDof();
3210 shape2.SetSize(ndof2,dim);
3211 shape2_n.SetSize(ndof2);
3218 elmat.
SetSize(ndof1 + ndof2, face_ndof);
3241 trial_face_fe.
CalcShape(ip, face_shape);
3247 shape1.Mult(normal, shape1_n);
3255 shape2.Mult(normal, shape2_n);
3258 for (i = 0; i < ndof1; i++)
3259 for (j = 0; j < face_ndof; j++)
3261 elmat(i, j) -= shape1_n(i) * face_shape(j);
3266 for (i = 0; i < ndof2; i++)
3267 for (j = 0; j < face_ndof; j++)
3269 elmat(ndof1+i, j) += shape2_n(i) * face_shape(j);
3276 void NormalInterpolator::AssembleElementMatrix2(
3285 for (
int i = 0; i < ran_nodes.Size(); i++)
3291 for (
int j = 0; j < shape.Size(); j++)
3293 for (
int d = 0; d < spaceDim; d++)
3295 elmat(i, j+d*shape.Size()) = shape(j)*n(d);
3315 using VectorCoefficient::Eval;
3316 virtual void Eval(Vector &V, ElementTransformation &T,
3317 const IntegrationPoint &ip)
3320 fe.CalcPhysShape(T, V);
3333 internal::ShapeCoefficient dom_shape_coeff(*Q, dom_fe);
3339 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
3344 ScalarVectorProductInterpolator::AssembleElementMatrix2(
3363 fe.CalcPhysVShape(T, M);
3368 VShapeCoefficient dom_shape_coeff(*Q, dom_fe, Trans.
GetSpaceDim());
3379 VectorScalarProductInterpolator::AssembleElementMatrix2(
3394 vc(width), shape(height) { }
3401 fe.CalcPhysShape(T, shape);
3406 VecShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3417 VectorCrossProductInterpolator::AssembleElementMatrix2(
3433 vshape(height, width), vc(width)
3435 MFEM_ASSERT(width == 3,
"");
3443 fe.CalcPhysVShape(T, vshape);
3444 for (
int k = 0; k < height; k++)
3446 M(k,0) = vc(1) * vshape(k,2) - vc(2) * vshape(k,1);
3447 M(k,1) = vc(2) * vshape(k,0) - vc(0) * vshape(k,2);
3448 M(k,2) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
3453 VCrossVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3484 vshape(vdim, vq.GetVDim()), vc(vq.GetVDim()) { }
3486 using VectorCoefficient::Eval;
3487 virtual void Eval(Vector &V, ElementTransformation &T,
3488 const IntegrationPoint &ip)
3492 fe.CalcPhysVShape(T, vshape);
3500 VectorInnerProductInterpolator::AssembleElementMatrix2(
3506 internal::VDotVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3512 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.
For scalar fields; preserves point values.
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.
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)