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_error (
"BilinearFormIntegrator::AssembleDiagonalPA(...)\n"
51 " is not implemented for this class.");
58 mfem_error (
"BilinearFormIntegrator::AssembleEA(...)\n"
59 " is not implemented for this class.");
68 mfem_error (
"BilinearFormIntegrator::AssembleEAInteriorFaces(...)\n"
69 " is not implemented for this class.");
77 mfem_error (
"BilinearFormIntegrator::AssembleEABoundaryFaces(...)\n"
78 " is not implemented for this class.");
81 void BilinearFormIntegrator::AssembleDiagonalPA_ADAt(
const Vector &,
Vector &)
83 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalPA_ADAt(...)\n"
84 " is not implemented for this class.");
87 void BilinearFormIntegrator::AddMultPA(
const Vector &,
Vector &)
const
89 mfem_error (
"BilinearFormIntegrator::MultAssembled(...)\n"
90 " is not implemented for this class.");
93 void BilinearFormIntegrator::AddMultTransposePA(
const Vector &,
Vector &)
const
95 mfem_error (
"BilinearFormIntegrator::MultAssembledTranspose(...)\n"
96 " is not implemented for this class.");
101 mfem_error (
"BilinearFormIntegrator::AssembleMF(...)\n"
102 " is not implemented for this class.");
107 mfem_error (
"BilinearFormIntegrator::AddMultMF(...)\n"
108 " is not implemented for this class.");
111 void BilinearFormIntegrator::AddMultTransposeMF(
const Vector &,
Vector &)
const
113 mfem_error (
"BilinearFormIntegrator::AddMultTransposeMF(...)\n"
114 " is not implemented for this class.");
117 void BilinearFormIntegrator::AssembleDiagonalMF(
Vector &)
119 mfem_error (
"BilinearFormIntegrator::AssembleDiagonalMF(...)\n"
120 " is not implemented for this class.");
123 void BilinearFormIntegrator::AssembleElementMatrix (
127 mfem_error (
"BilinearFormIntegrator::AssembleElementMatrix(...)\n"
128 " is not implemented for this class.");
131 void BilinearFormIntegrator::AssembleElementMatrix2 (
135 mfem_error (
"BilinearFormIntegrator::AssembleElementMatrix2(...)\n"
136 " is not implemented for this class.");
139 void BilinearFormIntegrator::AssembleFaceMatrix (
143 mfem_error (
"BilinearFormIntegrator::AssembleFaceMatrix(...)\n"
144 " is not implemented for this class.");
147 void BilinearFormIntegrator::AssembleFaceMatrix(
152 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this"
153 " Integrator class.");
156 void BilinearFormIntegrator::AssembleElementVector(
162 AssembleElementMatrix(el, Tr, elmat);
164 elmat.
Mult(elfun, elvect);
167 void BilinearFormIntegrator::AssembleFaceVector(
173 AssembleFaceMatrix(el1, el2, Tr, elmat);
175 elmat.
Mult(elfun, elvect);
179 void TransposeIntegrator::AssembleElementMatrix (
182 bfi -> AssembleElementMatrix (el, Trans, bfi_elmat);
187 void TransposeIntegrator::AssembleElementMatrix2 (
191 bfi -> AssembleElementMatrix2 (test_fe, trial_fe, Trans, bfi_elmat);
196 void TransposeIntegrator::AssembleFaceMatrix (
200 bfi -> AssembleFaceMatrix (el1, el2, Trans, bfi_elmat);
205 void LumpedIntegrator::AssembleElementMatrix (
208 bfi -> AssembleElementMatrix (el, Trans, elmat);
212 void InverseIntegrator::AssembleElementMatrix(
215 integrator->AssembleElementMatrix(el, Trans, elmat);
219 void SumIntegrator::AssembleElementMatrix(
222 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
224 integrators[0]->AssembleElementMatrix(el, Trans, elmat);
225 for (
int i = 1; i < integrators.Size(); i++)
227 integrators[i]->AssembleElementMatrix(el, Trans, elem_mat);
232 SumIntegrator::~SumIntegrator()
236 for (
int i = 0; i < integrators.Size(); i++)
238 delete integrators[i];
243 void MixedScalarIntegrator::AssembleElementMatrix2(
247 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
248 this->FiniteElementTypeFailureMessage());
250 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
251 bool same_shapes = same_calc_shape && (&trial_fe == &test_fe);
253 #ifdef MFEM_THREAD_SAFE
254 Vector test_shape(test_nd);
268 elmat.
SetSize(test_nd, trial_nd);
273 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
283 this->CalcTestShape(test_fe, Trans, test_shape);
284 this->CalcTrialShape(trial_fe, Trans, trial_shape);
290 w *= Q->Eval(Trans, ip);
294 #ifndef MFEM_THREAD_SAFE
302 void MixedVectorIntegrator::AssembleElementMatrix2(
306 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
307 this->FiniteElementTypeFailureMessage());
309 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
311 bool same_shapes = same_calc_shape && (&trial_fe == &test_fe);
313 #ifdef MFEM_THREAD_SAFE
314 Vector V(VQ ? VQ->GetVDim() : 0);
315 Vector D(DQ ? DQ->GetVDim() : 0);
316 DenseMatrix M(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
321 V.SetSize(VQ ? VQ->GetVDim() : 0);
322 D.SetSize(DQ ? DQ->GetVDim() : 0);
323 M.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
324 test_shape.SetSize(test_nd, spaceDim);
325 test_shape_tmp.
SetSize(test_nd, spaceDim);
329 trial_shape.
Reset(test_shape.Data(), trial_nd, spaceDim);
333 trial_shape.
SetSize(trial_nd, spaceDim);
336 elmat.
SetSize(test_nd, trial_nd);
341 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
351 this->CalcTestShape(test_fe, Trans, test_shape);
354 this->CalcTrialShape(trial_fe, Trans, trial_shape);
361 MQ->Eval(M, Trans, ip);
363 Mult(test_shape, M, test_shape_tmp);
364 AddMultABt(test_shape_tmp, trial_shape, elmat);
368 DQ->Eval(D, Trans, ip);
374 VQ->Eval(V, Trans, ip);
376 for (
int j=0; j<test_nd; j++)
378 test_shape_tmp(j,0) = test_shape(j,1) * V(2) -
379 test_shape(j,2) * V(1);
380 test_shape_tmp(j,1) = test_shape(j,2) * V(0) -
381 test_shape(j,0) * V(2);
382 test_shape_tmp(j,2) = test_shape(j,0) * V(1) -
383 test_shape(j,1) * V(0);
385 AddMultABt(test_shape_tmp, trial_shape, elmat);
391 w *= Q -> Eval (Trans, ip);
403 #ifndef MFEM_THREAD_SAFE
411 void MixedScalarVectorIntegrator::AssembleElementMatrix2(
415 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
416 this->FiniteElementTypeFailureMessage());
421 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
422 int sca_nd = sca_fe->
GetDof();
423 int vec_nd = vec_fe->
GetDof();
427 #ifdef MFEM_THREAD_SAFE
428 Vector V(VQ ? VQ->GetVDim() : 0);
431 Vector vshape_tmp(vec_nd);
433 V.SetSize(VQ ? VQ->GetVDim() : 0);
434 vshape.SetSize(vec_nd, spaceDim);
442 elmat.
SetSize(test_nd, trial_nd);
447 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
457 this->CalcShape(*sca_fe, Trans, shape);
458 this->CalcVShape(*vec_fe, Trans, vshape);
462 VQ->Eval(V, Trans, ip);
465 if ( vec_fe->
GetDim() == 2 && cross_2d )
472 vshape.Mult(V,vshape_tmp);
479 void GradientIntegrator::AssembleElementMatrix2(
484 int trial_dof = trial_fe.
GetDof();
485 int test_dof = test_fe.
GetDof();
489 dshape.
SetSize(trial_dof, dim);
490 gshape.SetSize(trial_dof, dim);
492 shape.SetSize(test_dof);
493 elmat.
SetSize(dim * test_dof, trial_dof);
495 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(trial_fe, test_fe,
499 elmat_comp.
SetSize(test_dof, trial_dof);
511 Mult(dshape, Jadj, gshape);
516 c *= Q->Eval(Trans, ip);
520 for (
int d = 0; d <
dim; ++d)
522 gshape.GetColumnReference(d, d_col);
523 MultVWt(shape, d_col, elmat_comp);
524 for (
int jj = 0; jj < trial_dof; ++jj)
526 for (
int ii = 0; ii < test_dof; ++ii)
528 elmat(d * test_dof + ii, jj) += elmat_comp(ii, jj);
545 void DiffusionIntegrator::AssembleElementMatrix
552 bool square = (dim == spaceDim);
555 #ifdef MFEM_THREAD_SAFE
556 DenseMatrix dshape(nd,dim), dshapedxt(nd,spaceDim), invdfdx(dim,spaceDim);
557 Vector D(VQ ? VQ->GetVDim() : 0);
560 dshapedxt.SetSize(nd,spaceDim);
562 D.SetSize(VQ ? VQ->GetVDim() : 0);
576 w = ip.
weight / (square ? w : w*w*w);
582 MQ->Eval(invdfdx, Trans, ip);
584 Mult(dshapedxt, invdfdx, dshape);
589 VQ->Eval(D, Trans, ip);
597 w *= Q->Eval(Trans, ip);
604 void DiffusionIntegrator::AssembleElementMatrix2(
608 int tr_nd = trial_fe.
GetDof();
609 int te_nd = test_fe.
GetDof();
612 bool square = (dim == spaceDim);
615 #ifdef MFEM_THREAD_SAFE
616 DenseMatrix dshape(tr_nd, dim), dshapedxt(tr_nd, spaceDim);
617 DenseMatrix te_dshape(te_nd, dim), te_dshapedxt(te_nd, spaceDim);
619 Vector D(VQ ? VQ->GetVDim() : 0);
622 dshapedxt.
SetSize(tr_nd, spaceDim);
623 te_dshape.SetSize(te_nd, dim);
624 te_dshapedxt.
SetSize(te_nd, spaceDim);
625 invdfdx.
SetSize(dim, spaceDim);
626 D.SetSize(VQ ? VQ->GetVDim() : 0);
630 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(trial_fe, test_fe);
642 w = ip.
weight / (square ? w : w*w*w);
643 Mult(dshape, invdfdx, dshapedxt);
644 Mult(te_dshape, invdfdx, te_dshapedxt);
648 MQ->Eval(invdfdx, Trans, ip);
650 Mult(te_dshapedxt, invdfdx, te_dshape);
655 VQ->Eval(D, Trans, ip);
663 w *= Q->Eval(Trans, ip);
671 void DiffusionIntegrator::AssembleElementVector(
681 MFEM_VERIFY(VQ->GetVDim() ==
dim,
"Unexpected dimension for VectorCoefficient");
684 #ifdef MFEM_THREAD_SAFE
686 Vector D(VQ ? VQ->GetVDim() : 0);
689 invdfdx.SetSize(dim);
691 D.SetSize(VQ ? VQ->GetVDim() : 0);
694 pointflux.SetSize(dim);
712 dshape.MultTranspose(elfun, vec);
713 invdfdx.MultTranspose(vec, pointflux);
716 w *= Q->Eval(Tr, ip);
721 dshape.MultTranspose(elfun, pointflux);
722 invdfdx.MultTranspose(pointflux, vec);
725 MQ->Eval(mq, Tr, ip);
726 mq.
Mult(vec, pointflux);
731 for (
int j=0; j<
dim; ++j)
733 pointflux[j] *= D[j];
738 invdfdx.Mult(pointflux, vec);
739 dshape.AddMult(vec, elvect);
743 void DiffusionIntegrator::ComputeElementFlux
747 int i, j, nd,
dim, spaceDim, fnd;
753 #ifdef MFEM_THREAD_SAFE
754 DenseMatrix dshape(nd,dim), invdfdx(dim, spaceDim);
756 dshape.SetSize(nd,dim);
757 invdfdx.
SetSize(dim, spaceDim);
760 pointflux.SetSize(spaceDim);
764 flux.
SetSize( fnd * spaceDim );
766 for (i = 0; i < fnd; i++)
770 dshape.MultTranspose(u, vec);
780 pointflux *= Q->Eval(Trans,ip);
782 for (j = 0; j < spaceDim; j++)
784 flux(fnd*j+i) = pointflux(j);
790 MFEM_ASSERT(dim == spaceDim,
"TODO");
791 MQ->Eval(invdfdx, Trans, ip);
792 invdfdx.
Mult(pointflux, vec);
793 for (j = 0; j <
dim; j++)
795 flux(fnd*j+i) = vec(j);
801 double DiffusionIntegrator::ComputeFluxEnergy
805 int nd = fluxelem.
GetDof();
809 #ifdef MFEM_THREAD_SAFE
814 pointflux.SetSize(spaceDim);
815 if (d_energy) { vec.SetSize(dim); }
818 int order = 2 * fluxelem.
GetOrder();
822 if (d_energy) { *d_energy = 0.0; }
830 for (
int k = 0; k < spaceDim; k++)
832 for (
int j = 0; j < nd; j++)
834 pointflux(k) += flux(k*nd+j)*shape(j);
843 double e = (pointflux * pointflux);
844 if (Q) { e *= Q->Eval(Trans, ip); }
849 MQ->Eval(mq, Trans, ip);
857 for (
int k = 0; k <
dim; k++)
859 (*d_energy)[k] += w * vec[k] * vec[k];
872 if (trial_fe.
Space() == FunctionSpace::Pk)
882 if (trial_fe.
Space() == FunctionSpace::rQk)
890 void MassIntegrator::AssembleElementMatrix
898 #ifdef MFEM_THREAD_SAFE
904 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(el, el, Trans);
916 w *= Q -> Eval(Trans, ip);
923 void MassIntegrator::AssembleElementMatrix2(
927 int tr_nd = trial_fe.
GetDof();
928 int te_nd = test_fe.
GetDof();
931 #ifdef MFEM_THREAD_SAFE
939 &GetRule(trial_fe, test_fe, Trans);
952 w *= Q -> Eval(Trans, ip);
967 if (trial_fe.
Space() == FunctionSpace::rQk)
975 void BoundaryMassIntegrator::AssembleFaceMatrix(
980 "support for interior faces is not implemented");
985 #ifdef MFEM_THREAD_SAFE
1014 w *= Q -> Eval(Trans, ip);
1021 void ConvectionIntegrator::AssembleElementMatrix(
1027 #ifdef MFEM_THREAD_SAFE
1029 Vector shape, vec2, BdFidxT;
1047 Q->Eval(Q_ir, Trans, *ir);
1061 adjJ.
Mult(vec1, vec2);
1062 dshape.
Mult(vec2, BdFidxT);
1069 void GroupConvectionIntegrator::AssembleElementMatrix(
1076 dshape.SetSize(nd,dim);
1079 grad.SetSize(nd,dim);
1088 Q->Eval(Q_nodal, Trans, el.
GetNodes());
1100 Mult(dshape, adjJ, grad);
1105 for (
int k = 0; k < nd; k++)
1107 double wsk = w*shape(k);
1108 for (
int l = 0; l < nd; l++)
1111 for (
int s = 0; s <
dim; s++)
1113 a += Q_nodal(s,k)*grad(l,s);
1115 elmat(k,l) += wsk*
a;
1134 return GetRule(el,el,Trans);
1137 void VectorMassIntegrator::AssembleElementMatrix
1147 vdim = (vdim == -1) ? spaceDim : vdim;
1151 partelmat.SetSize(nd);
1158 mcoeff.SetSize(vdim);
1166 if (el.
Space() == FunctionSpace::rQk)
1189 VQ->Eval(vec, Trans, ip);
1190 for (
int k = 0; k < vdim; k++)
1192 elmat.
AddMatrix(norm*vec(k), partelmat, nd*k, nd*k);
1197 MQ->Eval(mcoeff, Trans, ip);
1198 for (
int i = 0; i < vdim; i++)
1199 for (
int j = 0; j < vdim; j++)
1201 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, nd*i, nd*j);
1208 norm *= Q->Eval(Trans, ip);
1211 for (
int k = 0; k < vdim; k++)
1219 void VectorMassIntegrator::AssembleElementMatrix2(
1223 int tr_nd = trial_fe.
GetDof();
1224 int te_nd = test_fe.
GetDof();
1231 elmat.
SetSize(te_nd*vdim, tr_nd*vdim);
1232 shape.SetSize(tr_nd);
1233 te_shape.SetSize(te_nd);
1234 partelmat.SetSize(te_nd, tr_nd);
1241 mcoeff.SetSize(vdim);
1248 Trans.
OrderW() + Q_order);
1250 if (trial_fe.
Space() == FunctionSpace::rQk)
1270 MultVWt(te_shape, shape, partelmat);
1274 VQ->Eval(vec, Trans, ip);
1275 for (
int k = 0; k < vdim; k++)
1277 elmat.
AddMatrix(norm*vec(k), partelmat, te_nd*k, tr_nd*k);
1282 MQ->Eval(mcoeff, Trans, ip);
1283 for (
int i = 0; i < vdim; i++)
1284 for (
int j = 0; j < vdim; j++)
1286 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, te_nd*i, tr_nd*j);
1293 norm *= Q->Eval(Trans, ip);
1296 for (
int k = 0; k < vdim; k++)
1298 elmat.
AddMatrix(partelmat, te_nd*k, tr_nd*k);
1304 void VectorFEDivergenceIntegrator::AssembleElementMatrix2(
1308 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1310 #ifdef MFEM_THREAD_SAFE
1311 Vector divshape(trial_nd), shape(test_nd);
1313 divshape.SetSize(trial_nd);
1317 elmat.
SetSize(test_nd, trial_nd);
1336 w *= Q->Eval(Trans, ip);
1343 void VectorFEWeakDivergenceIntegrator::AssembleElementMatrix2(
1347 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1353 "Trial space must be H(Curl) and test space must be H_1");
1355 #ifdef MFEM_THREAD_SAFE
1361 dshape.SetSize(test_nd, dim);
1362 dshapedxt.
SetSize(test_nd, dim);
1363 vshape.
SetSize(trial_nd, dim);
1367 elmat.
SetSize(test_nd, trial_nd);
1409 Mult(dshape, invdfdx, dshapedxt);
1417 w *= Q->Eval(Trans, ip);
1425 void VectorFECurlIntegrator::AssembleElementMatrix2(
1429 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1431 int dimc = (dim == 3) ? 3 : 1;
1435 "At least one of the finite elements must be in H(Curl)");
1437 int curl_nd, vec_nd;
1449 #ifdef MFEM_THREAD_SAFE
1454 curlshapeTrial.
SetSize(curl_nd, dimc);
1455 curlshapeTrial_dFT.
SetSize(curl_nd, dimc);
1456 vshapeTest.
SetSize(vec_nd, dimc);
1460 elmat.
SetSize(test_nd, trial_nd);
1507 w *= Q->Eval(Trans, ip);
1513 AddMultABt(vshapeTest, curlshapeTrial_dFT, elmat);
1517 AddMultABt(curlshapeTrial_dFT, vshapeTest, elmat);
1522 void DerivativeIntegrator::AssembleElementMatrix2 (
1529 int trial_nd = trial_fe.
GetDof();
1530 int test_nd = test_fe.
GetDof();
1535 elmat.
SetSize (test_nd,trial_nd);
1536 dshape.SetSize (trial_nd,dim);
1537 dshapedxt.SetSize(trial_nd,dim);
1538 dshapedxi.SetSize(trial_nd);
1539 invdfdx.SetSize(dim);
1540 shape.SetSize (test_nd);
1546 if (trial_fe.
Space() == FunctionSpace::Pk)
1555 if (trial_fe.
Space() == FunctionSpace::rQk)
1575 Mult (dshape, invdfdx, dshapedxt);
1579 for (l = 0; l < trial_nd; l++)
1581 dshapedxi(l) = dshapedxt(l,xi);
1584 shape *= Q->Eval(Trans,ip) * det * ip.
weight;
1589 void CurlCurlIntegrator::AssembleElementMatrix
1595 int dimc = (dim == 3) ? 3 : 1;
1598 #ifdef MFEM_THREAD_SAFE
1600 DenseMatrix curlshape(nd,dimc), curlshape_dFt(nd,dimc), M;
1603 curlshape_dFt.SetSize(nd,dimc);
1613 if (el.
Space() == FunctionSpace::Pk)
1646 MQ->Eval(M, Trans, ip);
1648 Mult(curlshape_dFt, M, curlshape);
1653 DQ->Eval(D, Trans, ip);
1659 w *= Q->Eval(Trans, ip);
1669 void CurlCurlIntegrator
1674 #ifdef MFEM_THREAD_SAFE
1681 projcurl.
Mult(u, flux);
1690 int nd = fluxelem.
GetDof();
1693 #ifdef MFEM_THREAD_SAFE
1697 pointflux.SetSize(dim);
1698 if (d_energy) { vec.SetSize(dim); }
1700 int order = 2 * fluxelem.
GetOrder();
1703 double energy = 0.0;
1704 if (d_energy) { *d_energy = 0.0; }
1723 double e = w * (pointflux * pointflux);
1732 #if ANISO_EXPERIMENTAL
1752 #if ANISO_EXPERIMENTAL
1756 int n = (int) round(pow(ir.
GetNPoints(), 1.0/3.0));
1760 for (
int k = 0; k < n; k++)
1761 for (
int l = 0; l < n; l++)
1762 for (
int m = 0; m < n; m++)
1764 Vector &vec = pfluxes[(k*n + l)*n + m];
1767 tmp = vec; tmp -= pfluxes[(k*n + l)*n + (m-1)];
1768 (*d_energy)[0] += (tmp * tmp);
1772 tmp = vec; tmp -= pfluxes[(k*n + (l-1))*n + m];
1773 (*d_energy)[1] += (tmp * tmp);
1777 tmp = vec; tmp -= pfluxes[((k-1)*n + l)*n + m];
1778 (*d_energy)[2] += (tmp * tmp);
1791 void VectorCurlCurlIntegrator::AssembleElementMatrix(
1796 int cld = (dim*(dim-1))/2;
1798 #ifdef MFEM_THREAD_SAFE
1799 DenseMatrix dshape_hat(dof, dim), dshape(dof, dim);
1802 dshape_hat.SetSize(dof, dim);
1804 curlshape.SetSize(dim*dof, cld);
1827 Mult(dshape_hat, Jadj, dshape);
1832 w *= Q->Eval(Trans, ip);
1839 double VectorCurlCurlIntegrator::GetElementEnergy(
1845 #ifdef MFEM_THREAD_SAFE
1846 DenseMatrix dshape_hat(dof, dim), Jadj(dim), grad_hat(dim), grad(dim);
1848 dshape_hat.SetSize(dof, dim);
1851 grad_hat.SetSize(dim);
1865 for (
int i = 0; i < ir->GetNPoints(); i++)
1870 MultAtB(elfun_mat, dshape_hat, grad_hat);
1876 Mult(grad_hat, Jadj, grad);
1880 double curl = grad(0,1) - grad(1,0);
1885 double curl_x = grad(2,1) - grad(1,2);
1886 double curl_y = grad(0,2) - grad(2,0);
1887 double curl_z = grad(1,0) - grad(0,1);
1888 w *= curl_x * curl_x + curl_y * curl_y + curl_z * curl_z;
1893 w *= Q->Eval(Tr, ip);
1899 elfun_mat.ClearExternalData();
1901 return 0.5 * energy;
1905 void VectorFEMassIntegrator::AssembleElementMatrix(
1915 #ifdef MFEM_THREAD_SAFE
1916 Vector D(VQ ? VQ->GetVDim() : 0);
1918 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1920 trial_vshape.
SetSize(dof, spaceDim);
1921 D.SetSize(VQ ? VQ->GetVDim() : 0);
1922 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1924 DenseMatrix tmp(trial_vshape.Height(), K.Width());
1948 MQ->Eval(K, Trans, ip);
1950 Mult(trial_vshape,K,tmp);
1955 VQ->Eval(D, Trans, ip);
1963 w *= Q -> Eval (Trans, ip);
1970 void VectorFEMassIntegrator::AssembleElementMatrix2(
1979 int vdim = MQ ? MQ->GetHeight() : spaceDim;
1980 int trial_dof = trial_fe.
GetDof();
1981 int test_dof = test_fe.
GetDof();
1984 #ifdef MFEM_THREAD_SAFE
1987 Vector D(VQ ? VQ->GetVDim() : 0);
1988 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1990 trial_vshape.
SetSize(trial_dof, spaceDim);
1992 D.SetSize(VQ ? VQ->GetVDim() : 0);
1993 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
1996 elmat.
SetSize(vdim*test_dof, trial_dof);
2018 VQ->Eval(D, Trans, ip);
2020 for (
int d = 0; d < vdim; d++)
2022 for (
int j = 0; j < test_dof; j++)
2024 for (
int k = 0; k < trial_dof; k++)
2026 elmat(d * test_dof + j, k) +=
2027 shape(j) * D(d) * trial_vshape(k, d);
2034 MQ->Eval(K, Trans, ip);
2036 for (
int d = 0; d < vdim; d++)
2038 for (
int j = 0; j < test_dof; j++)
2040 for (
int k = 0; k < trial_dof; k++)
2043 for (
int vd = 0; vd < spaceDim; vd++)
2045 Kv += K(d, vd) * trial_vshape(k, vd);
2047 elmat(d * test_dof + j, k) += shape(j) * Kv;
2056 w *= Q->Eval(Trans, ip);
2058 for (
int d = 0; d < vdim; d++)
2060 for (
int j = 0; j < test_dof; j++)
2062 for (
int k = 0; k < trial_dof; k++)
2064 elmat(d * test_dof + j, k) +=
2065 w * shape(j) * trial_vshape(k, d);
2072 else if (test_fe.
GetRangeType() == FiniteElement::VECTOR
2077 int trial_dof = trial_fe.
GetDof();
2078 int test_dof = test_fe.
GetDof();
2081 #ifdef MFEM_THREAD_SAFE
2084 Vector D(VQ ? VQ->GetVDim() : 0);
2085 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
2087 trial_vshape.
SetSize(trial_dof,spaceDim);
2088 test_vshape.
SetSize(test_dof,spaceDim);
2089 D.SetSize(VQ ? VQ->GetVDim() : 0);
2090 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
2094 elmat.
SetSize (test_dof, trial_dof);
2116 MQ->Eval(K, Trans, ip);
2118 Mult(test_vshape,K,tmp);
2123 VQ->Eval(D, Trans, ip);
2131 w *= Q -> Eval (Trans, ip);
2139 mfem_error(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n"
2140 " is not implemented for given trial and test bases.");
2144 void VectorDivergenceIntegrator::AssembleElementMatrix2(
2151 int trial_dof = trial_fe.
GetDof();
2152 int test_dof = test_fe.
GetDof();
2155 dshape.SetSize (trial_dof, dim);
2156 gshape.SetSize (trial_dof, dim);
2158 divshape.SetSize (dim*trial_dof);
2159 shape.SetSize (test_dof);
2161 elmat.
SetSize (test_dof, dim*trial_dof);
2163 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(trial_fe, test_fe,
2168 for (
int i = 0; i < ir -> GetNPoints(); i++)
2178 Mult (dshape, Jadj, gshape);
2180 gshape.GradToDiv (divshape);
2185 c *= Q -> Eval (Trans, ip);
2204 void DivDivIntegrator::AssembleElementMatrix(
2212 #ifdef MFEM_THREAD_SAFE
2228 for (
int i = 0; i < ir -> GetNPoints(); i++)
2239 c *= Q -> Eval (Trans, ip);
2248 void VectorDiffusionIntegrator::AssembleElementMatrix(
2254 const int dof = el.
GetDof();
2256 const bool square = (dim == sdim);
2261 dshape.SetSize(dof, dim);
2262 dshapedxt.SetSize(dof, sdim);
2263 pelmat.SetSize(dof);
2268 ir = &DiffusionIntegrator::GetRule(el,el);
2274 for (
int i = 0; i < ir -> GetNPoints(); i++)
2280 w = ip.
weight / (square ? w : w*w*w);
2284 if (Q) { w *= Q -> Eval (Trans, ip); }
2287 for (
int d = 0; d < sdim; d++)
2289 for (
int k = 0; k < dof; k++)
2291 for (
int l = 0; l < dof; l++)
2293 elmat(dof*d+k, dof*d+l) = pelmat(k, l);
2299 void VectorDiffusionIntegrator::AssembleElementVector(
2308 dshape.SetSize(dof, dim);
2309 pelmat.SetSize(dim);
2310 gshape.SetSize(dim);
2319 ir = &DiffusionIntegrator::GetRule(el,el);
2323 for (
int i = 0; i < ir->GetNPoints(); i++)
2332 w *= Q->Eval(Tr, ip);
2339 MultAtB(mat_in, dshape, pelmat);
2340 MultABt(pelmat, gshape, Jinv);
2346 void ElasticityIntegrator::AssembleElementMatrix(
2355 #ifdef MFEM_THREAD_SAFE
2356 DenseMatrix dshape(dof, dim), gshape(dof, dim), pelmat(dof);
2357 Vector divshape(dim*dof);
2359 dshape.SetSize(dof, dim);
2360 gshape.SetSize(dof, dim);
2361 pelmat.SetSize(dof);
2376 for (
int i = 0; i < ir -> GetNPoints(); i++)
2386 gshape.GradToDiv (divshape);
2388 M =
mu->Eval(Trans, ip);
2391 L = lambda->Eval(Trans, ip);
2406 for (
int d = 0; d <
dim; d++)
2408 for (
int k = 0; k < dof; k++)
2409 for (
int l = 0; l < dof; l++)
2411 elmat (dof*d+k, dof*d+l) += (M * w) * pelmat(k, l);
2414 for (
int i = 0; i <
dim; i++)
2415 for (
int j = 0; j <
dim; j++)
2417 for (
int k = 0; k < dof; k++)
2418 for (
int l = 0; l < dof; l++)
2420 elmat(dof*i+k, dof*j+l) +=
2421 (M * w) * gshape(k, j) * gshape(l, i);
2428 void ElasticityIntegrator::ComputeElementFlux(
2433 const int dof = el.
GetDof();
2435 const int tdim = dim*(dim+1)/2;
2438 MFEM_ASSERT(dim == 2 || dim == 3,
2439 "dimension is not supported: dim = " << dim);
2441 MFEM_ASSERT(fluxelem.
GetMapType() == FiniteElement::VALUE,
"");
2442 MFEM_ASSERT(dynamic_cast<const NodalFiniteElement*>(&fluxelem),
"");
2444 #ifdef MFEM_THREAD_SAFE
2450 double gh_data[9], grad_data[9];
2459 for (
int i = 0; i < fnd; i++)
2463 MultAtB(loc_data_mat, dshape, gh);
2468 M =
mu->Eval(Trans, ip);
2471 L = lambda->Eval(Trans, ip);
2481 const double M2 = 2.0*M;
2484 L *= (grad(0,0) + grad(1,1));
2486 flux(i+fnd*0) = M2*grad(0,0) + L;
2487 flux(i+fnd*1) = M2*grad(1,1) + L;
2488 flux(i+fnd*2) = M*(grad(0,1) + grad(1,0));
2492 L *= (grad(0,0) + grad(1,1) + grad(2,2));
2494 flux(i+fnd*0) = M2*grad(0,0) + L;
2495 flux(i+fnd*1) = M2*grad(1,1) + L;
2496 flux(i+fnd*2) = M2*grad(2,2) + L;
2497 flux(i+fnd*3) = M*(grad(0,1) + grad(1,0));
2498 flux(i+fnd*4) = M*(grad(0,2) + grad(2,0));
2499 flux(i+fnd*5) = M*(grad(1,2) + grad(2,1));
2508 const int dof = fluxelem.
GetDof();
2510 const int tdim = dim*(dim+1)/2;
2515 MFEM_ASSERT(d_energy == NULL,
"anisotropic estimates are not supported");
2516 MFEM_ASSERT(flux.
Size() == dof*tdim,
"invalid 'flux' vector");
2518 #ifndef MFEM_THREAD_SAFE
2523 double pointstress_data[6];
2524 Vector pointstress(pointstress_data, tdim);
2535 int order = 2 * Trans.
OrderGrad(&fluxelem);
2539 double energy = 0.0;
2541 for (
int i = 0; i < ir->GetNPoints(); i++)
2546 flux_mat.MultTranspose(shape, pointstress);
2551 M =
mu->Eval(Trans, ip);
2554 L = lambda->Eval(Trans, ip);
2574 const double *s = pointstress_data;
2578 const double tr_e = (s[0] + s[1])/(2*(M + L));
2580 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + 2*s[2]*s[2]);
2585 const double tr_e = (s[0] + s[1] + s[2])/(2*M + 3*L);
2587 pt_e = (0.25/M)*(s[0]*(s[0] - L) + s[1]*(s[1] - L) + s[2]*(s[2] - L) +
2588 2*(s[3]*s[3] + s[4]*s[4] + s[5]*s[5]));
2602 int dim, ndof1, ndof2;
2608 Vector vu(dim), nor(dim);
2619 shape1.SetSize(ndof1);
2620 shape2.SetSize(ndof2);
2636 if (el1.
Space() == FunctionSpace::Pk)
2657 u->Eval(vu, *Trans.
Elem1, eip1);
2661 nor(0) = 2*eip1.
x - 1.0;
2669 a = 0.5 *
alpha * un;
2670 b = beta * fabs(un);
2678 if (un >= 0.0 && ndof2)
2680 rho_p = rho->Eval(*Trans.
Elem2, eip2);
2684 rho_p = rho->Eval(*Trans.
Elem1, eip1);
2693 for (
int i = 0; i < ndof1; i++)
2694 for (
int j = 0; j < ndof1; j++)
2696 elmat(i, j) += w * shape1(i) * shape1(j);
2705 for (
int i = 0; i < ndof2; i++)
2706 for (
int j = 0; j < ndof1; j++)
2708 elmat(ndof1+i, j) -= w * shape2(i) * shape1(j);
2714 for (
int i = 0; i < ndof2; i++)
2715 for (
int j = 0; j < ndof2; j++)
2717 elmat(ndof1+i, ndof1+j) += w * shape2(i) * shape2(j);
2720 for (
int i = 0; i < ndof1; i++)
2721 for (
int j = 0; j < ndof2; j++)
2723 elmat(i, ndof1+j) -= w * shape1(i) * shape2(j);
2738 void DGDiffusionIntegrator::AssembleFaceMatrix(
2742 int dim, ndof1, ndof2, ndofs;
2743 bool kappa_is_nonzero = (
kappa != 0.);
2758 shape1.SetSize(ndof1);
2759 dshape1.SetSize(ndof1, dim);
2760 dshape1dn.SetSize(ndof1);
2764 shape2.SetSize(ndof2);
2765 dshape2.SetSize(ndof2, dim);
2766 dshape2dn.SetSize(ndof2);
2773 ndofs = ndof1 + ndof2;
2776 if (kappa_is_nonzero)
2814 nor(0) = 2*eip1.
x - 1.0;
2832 w *= Q->Eval(*Trans.
Elem1, eip1);
2839 MQ->Eval(mq, *Trans.
Elem1, eip1);
2840 mq.MultTranspose(nh, ni);
2844 if (kappa_is_nonzero)
2859 dshape1.Mult(nh, dshape1dn);
2860 for (
int i = 0; i < ndof1; i++)
2861 for (
int j = 0; j < ndof1; j++)
2863 elmat(i, j) += shape1(i) * dshape1dn(j);
2875 w *= Q->Eval(*Trans.
Elem2, eip2);
2882 MQ->Eval(mq, *Trans.
Elem2, eip2);
2883 mq.MultTranspose(nh, ni);
2887 if (kappa_is_nonzero)
2892 dshape2.Mult(nh, dshape2dn);
2894 for (
int i = 0; i < ndof1; i++)
2895 for (
int j = 0; j < ndof2; j++)
2897 elmat(i, ndof1 + j) += shape1(i) * dshape2dn(j);
2900 for (
int i = 0; i < ndof2; i++)
2901 for (
int j = 0; j < ndof1; j++)
2903 elmat(ndof1 + i, j) -= shape2(i) * dshape1dn(j);
2906 for (
int i = 0; i < ndof2; i++)
2907 for (
int j = 0; j < ndof2; j++)
2909 elmat(ndof1 + i, ndof1 + j) -= shape2(i) * dshape2dn(j);
2913 if (kappa_is_nonzero)
2917 for (
int i = 0; i < ndof1; i++)
2919 const double wsi = wq*shape1(i);
2920 for (
int j = 0; j <= i; j++)
2922 jmat(i, j) += wsi * shape1(j);
2927 for (
int i = 0; i < ndof2; i++)
2929 const int i2 = ndof1 + i;
2930 const double wsi = wq*shape2(i);
2931 for (
int j = 0; j < ndof1; j++)
2933 jmat(i2, j) -= wsi * shape1(j);
2935 for (
int j = 0; j <= i; j++)
2937 jmat(i2, ndof1 + j) += wsi * shape2(j);
2945 if (kappa_is_nonzero)
2947 for (
int i = 0; i < ndofs; i++)
2949 for (
int j = 0; j < i; j++)
2951 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
2952 elmat(i,j) =
sigma*aji - aij + mij;
2953 elmat(j,i) =
sigma*aij - aji + mij;
2955 elmat(i,i) = (
sigma - 1.)*elmat(i,i) + jmat(i,i);
2960 for (
int i = 0; i < ndofs; i++)
2962 for (
int j = 0; j < i; j++)
2964 double aij = elmat(i,j), aji = elmat(j,i);
2965 elmat(i,j) =
sigma*aji - aij;
2966 elmat(j,i) =
sigma*aij - aji;
2968 elmat(i,i) *= (
sigma - 1.);
2975 void DGElasticityIntegrator::AssembleBlock(
2976 const int dim,
const int row_ndofs,
const int col_ndofs,
2977 const int row_offset,
const int col_offset,
2978 const double jmatcoef,
const Vector &col_nL,
const Vector &col_nM,
2983 for (
int jm = 0, j = col_offset; jm <
dim; ++jm)
2985 for (
int jdof = 0; jdof < col_ndofs; ++jdof, ++j)
2987 const double t2 = col_dshape_dnM(jdof);
2988 for (
int im = 0, i = row_offset; im <
dim; ++im)
2990 const double t1 = col_dshape(jdof, jm) * col_nL(im);
2991 const double t3 = col_dshape(jdof, im) * col_nM(jm);
2992 const double tt = t1 + ((im == jm) ? t2 : 0.0) + t3;
2993 for (
int idof = 0; idof < row_ndofs; ++idof, ++i)
2995 elmat(i, j) += row_shape(idof) * tt;
3001 if (jmatcoef == 0.0) {
return; }
3003 for (
int d = 0; d <
dim; ++d)
3005 const int jo = col_offset + d*col_ndofs;
3006 const int io = row_offset + d*row_ndofs;
3007 for (
int jdof = 0, j = jo; jdof < col_ndofs; ++jdof, ++j)
3009 const double sj = jmatcoef * col_shape(jdof);
3010 for (
int i = max(io,j), idof = i - io; idof < row_ndofs; ++idof, ++i)
3012 jmat(i, j) += row_shape(idof) * sj;
3018 void DGElasticityIntegrator::AssembleFaceMatrix(
3022 #ifdef MFEM_THREAD_SAFE
3031 Vector dshape1_dnM, dshape2_dnM;
3036 const int ndofs1 = el1.
GetDof();
3038 const int nvdofs = dim*(ndofs1 + ndofs2);
3048 const bool kappa_is_nonzero = (
kappa != 0.0);
3049 if (kappa_is_nonzero)
3058 dshape1_ps.
SetSize(ndofs1, dim);
3068 dshape2_ps.
SetSize(ndofs2, dim);
3082 for (
int pind = 0; pind < ir->
GetNPoints(); ++pind)
3098 Mult(dshape1, adjJ, dshape1_ps);
3102 nor(0) = 2*eip1.
x - 1.0;
3115 Mult(dshape2, adjJ, dshape2_ps);
3119 const double wL2 = w2 * lambda->Eval(*Trans.
Elem2, eip2);
3120 const double wM2 = w2 *
mu->Eval(*Trans.
Elem2, eip2);
3123 wLM = (wL2 + 2.0*wM2);
3124 dshape2_ps.
Mult(nM2, dshape2_dnM);
3134 const double wL1 = w1 * lambda->Eval(*Trans.
Elem1, eip1);
3135 const double wM1 = w1 *
mu->Eval(*Trans.
Elem1, eip1);
3138 wLM += (wL1 + 2.0*wM1);
3139 dshape1_ps.
Mult(nM1, dshape1_dnM);
3142 const double jmatcoef =
kappa * (nor*nor) * wLM;
3146 dim, ndofs1, ndofs1, 0, 0, jmatcoef, nL1, nM1,
3147 shape1, shape1, dshape1_dnM, dshape1_ps, elmat, jmat);
3149 if (ndofs2 == 0) {
continue; }
3156 dim, ndofs1, ndofs2, 0, dim*ndofs1, jmatcoef, nL2, nM2,
3157 shape1, shape2, dshape2_dnM, dshape2_ps, elmat, jmat);
3160 dim, ndofs2, ndofs1, dim*ndofs1, 0, jmatcoef, nL1, nM1,
3161 shape2, shape1, dshape1_dnM, dshape1_ps, elmat, jmat);
3164 dim, ndofs2, ndofs2, dim*ndofs1, dim*ndofs1, jmatcoef, nL2, nM2,
3165 shape2, shape2, dshape2_dnM, dshape2_ps, elmat, jmat);
3169 if (kappa_is_nonzero)
3171 for (
int i = 0; i < nvdofs; ++i)
3173 for (
int j = 0; j < i; ++j)
3175 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
3176 elmat(i,j) =
alpha*aji - aij + mij;
3177 elmat(j,i) =
alpha*aij - aji + mij;
3179 elmat(i,i) = (
alpha - 1.)*elmat(i,i) + jmat(i,i);
3184 for (
int i = 0; i < nvdofs; ++i)
3186 for (
int j = 0; j < i; ++j)
3188 double aij = elmat(i,j), aji = elmat(j,i);
3189 elmat(i,j) =
alpha*aji - aij;
3190 elmat(j,i) =
alpha*aij - aji;
3192 elmat(i,i) *= (
alpha - 1.);
3198 void TraceJumpIntegrator::AssembleFaceMatrix(
3203 int i, j, face_ndof, ndof1, ndof2;
3208 face_ndof = trial_face_fe.
GetDof();
3209 ndof1 = test_fe1.
GetDof();
3211 face_shape.SetSize(face_ndof);
3212 shape1.SetSize(ndof1);
3216 ndof2 = test_fe2.
GetDof();
3217 shape2.SetSize(ndof2);
3224 elmat.
SetSize(ndof1 + ndof2, face_ndof);
3239 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
3259 trial_face_fe.
CalcShape(ip, face_shape);
3268 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
3273 for (i = 0; i < ndof1; i++)
3274 for (j = 0; j < face_ndof; j++)
3276 elmat(i, j) += shape1(i) * face_shape(j);
3281 for (i = 0; i < ndof2; i++)
3282 for (j = 0; j < face_ndof; j++)
3284 elmat(ndof1+i, j) -= shape2(i) * face_shape(j);
3290 void NormalTraceJumpIntegrator::AssembleFaceMatrix(
3295 int i, j, face_ndof, ndof1, ndof2,
dim;
3298 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::VALUE,
"");
3300 face_ndof = trial_face_fe.
GetDof();
3301 ndof1 = test_fe1.
GetDof();
3304 face_shape.SetSize(face_ndof);
3305 normal.SetSize(dim);
3306 shape1.SetSize(ndof1,dim);
3307 shape1_n.SetSize(ndof1);
3311 ndof2 = test_fe2.
GetDof();
3312 shape2.SetSize(ndof2,dim);
3313 shape2_n.SetSize(ndof2);
3320 elmat.
SetSize(ndof1 + ndof2, face_ndof);
3343 trial_face_fe.
CalcShape(ip, face_shape);
3349 shape1.Mult(normal, shape1_n);
3357 shape2.Mult(normal, shape2_n);
3360 for (i = 0; i < ndof1; i++)
3361 for (j = 0; j < face_ndof; j++)
3363 elmat(i, j) -= shape1_n(i) * face_shape(j);
3368 for (i = 0; i < ndof2; i++)
3369 for (j = 0; j < face_ndof; j++)
3371 elmat(ndof1+i, j) += shape2_n(i) * face_shape(j);
3378 void NormalInterpolator::AssembleElementMatrix2(
3387 for (
int i = 0; i < ran_nodes.Size(); i++)
3393 for (
int j = 0; j < shape.Size(); j++)
3395 for (
int d = 0; d < spaceDim; d++)
3397 elmat(i, j+d*shape.Size()) = shape(j)*n(d);
3417 using VectorCoefficient::Eval;
3418 virtual void Eval(Vector &V, ElementTransformation &T,
3419 const IntegrationPoint &ip)
3422 fe.CalcPhysShape(T, V);
3435 internal::ShapeCoefficient dom_shape_coeff(*Q, dom_fe);
3441 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
3446 ScalarVectorProductInterpolator::AssembleElementMatrix2(
3465 fe.CalcPhysVShape(T, M);
3470 VShapeCoefficient dom_shape_coeff(*Q, dom_fe, Trans.
GetSpaceDim());
3481 VectorScalarProductInterpolator::AssembleElementMatrix2(
3496 vc(width), shape(height) { }
3503 fe.CalcPhysShape(T, shape);
3508 VecShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3519 VectorCrossProductInterpolator::AssembleElementMatrix2(
3535 vshape(height, width), vc(width)
3537 MFEM_ASSERT(width == 3,
"");
3545 fe.CalcPhysVShape(T, vshape);
3546 for (
int k = 0; k < height; k++)
3548 M(k,0) = vc(1) * vshape(k,2) - vc(2) * vshape(k,1);
3549 M(k,1) = vc(2) * vshape(k,0) - vc(0) * vshape(k,2);
3550 M(k,2) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
3555 VCrossVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3586 vshape(vdim, vq.GetVDim()), vc(vq.GetVDim()) { }
3588 using VectorCoefficient::Eval;
3589 virtual void Eval(Vector &V, ElementTransformation &T,
3590 const IntegrationPoint &ip)
3594 fe.CalcPhysVShape(T, vshape);
3602 VectorInnerProductInterpolator::AssembleElementMatrix2(
3608 internal::VDotVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
3614 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 all 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.
Base class for vector Coefficients that optionally depend on time and space.
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
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 FunctionSpace on the element.
void AddMult_a_ABt(double a, const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += a * A * B^t.
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
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)
void add(const Vector &v1, const Vector &v2, Vector &v)
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto 'this' FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
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
Get a const reference to the nodes of the element.
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.
double p(const Vector &x, double t)
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 Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Base class for Matrix Coefficients that optionally depend on time and space.
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
Given a matrix coefficient and a transformation, compute an approximation ("projection") in the local...
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...
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
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)