25 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePA(fes)\n" 26 " is not implemented for this class.");
31 mfem_error (
"BilinearFormIntegrator::AssembleNURBSPA(fes)\n" 32 " is not implemented for this class.");
38 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePA(fes, fes)\n" 39 " is not implemented for this class.");
44 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePABoundary(fes)\n" 45 " is not implemented for this class.");
50 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePAInteriorFaces(...)\n" 51 " is not implemented for this class.");
56 MFEM_ABORT(
"BilinearFormIntegrator::AssemblePABoundaryFaces(...)\n" 57 " is not implemented for this class.");
60 void BilinearFormIntegrator::AssembleDiagonalPA(
Vector &)
62 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalPA(...)\n" 63 " is not implemented for this class.");
70 MFEM_ABORT(
"BilinearFormIntegrator::AssembleEA(...)\n" 71 " is not implemented for this class.");
80 MFEM_ABORT(
"BilinearFormIntegrator::AssembleEAInteriorFaces(...)\n" 81 " is not implemented for this class.");
89 MFEM_ABORT(
"BilinearFormIntegrator::AssembleEABoundaryFaces(...)\n" 90 " is not implemented for this class.");
93 void BilinearFormIntegrator::AssembleDiagonalPA_ADAt(
const Vector &,
Vector &)
95 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalPA_ADAt(...)\n" 96 " is not implemented for this class.");
99 void BilinearFormIntegrator::AddMultPA(
const Vector &,
Vector &)
const 101 MFEM_ABORT(
"BilinearFormIntegrator:AddMultPA:(...)\n" 102 " is not implemented for this class.");
105 void BilinearFormIntegrator::AddMultNURBSPA(
const Vector &,
Vector &)
const 107 MFEM_ABORT(
"BilinearFormIntegrator::AddMultNURBSPA(...)\n" 108 " is not implemented for this class.");
111 void BilinearFormIntegrator::AddMultTransposePA(
const Vector &,
Vector &)
const 113 MFEM_ABORT(
"BilinearFormIntegrator::AddMultTransposePA(...)\n" 114 " is not implemented for this class.");
119 MFEM_ABORT(
"BilinearFormIntegrator::AssembleMF(...)\n" 120 " is not implemented for this class.");
125 MFEM_ABORT(
"BilinearFormIntegrator::AddMultMF(...)\n" 126 " is not implemented for this class.");
129 void BilinearFormIntegrator::AddMultTransposeMF(
const Vector &,
Vector &)
const 131 MFEM_ABORT(
"BilinearFormIntegrator::AddMultTransposeMF(...)\n" 132 " is not implemented for this class.");
135 void BilinearFormIntegrator::AssembleDiagonalMF(
Vector &)
137 MFEM_ABORT(
"BilinearFormIntegrator::AssembleDiagonalMF(...)\n" 138 " is not implemented for this class.");
141 void BilinearFormIntegrator::AssembleElementMatrix(
145 MFEM_ABORT(
"BilinearFormIntegrator::AssembleElementMatrix(...)\n" 146 " is not implemented for this class.");
149 void BilinearFormIntegrator::AssembleElementMatrix2(
153 MFEM_ABORT(
"BilinearFormIntegrator::AssembleElementMatrix2(...)\n" 154 " is not implemented for this class.");
157 void BilinearFormIntegrator::AssemblePatchMatrix(
160 mfem_error (
"BilinearFormIntegrator::AssemblePatchMatrix(...)\n" 161 " is not implemented for this class.");
164 void BilinearFormIntegrator::AssembleFaceMatrix(
168 MFEM_ABORT(
"BilinearFormIntegrator::AssembleFaceMatrix(...)\n" 169 " is not implemented for this class.");
172 void BilinearFormIntegrator::AssembleFaceMatrix(
177 MFEM_ABORT(
"AssembleFaceMatrix (mixed form) is not implemented for this" 178 " Integrator class.");
181 void BilinearFormIntegrator::AssembleTraceFaceMatrix (
int elem,
187 MFEM_ABORT(
"AssembleTraceFaceMatrix (DPG form) is not implemented for this" 188 " Integrator class.");
191 void BilinearFormIntegrator::AssembleElementVector(
197 AssembleElementMatrix(el, Tr, elmat);
199 elmat.
Mult(elfun, elvect);
202 void BilinearFormIntegrator::AssembleFaceVector(
208 AssembleFaceMatrix(el1, el2, Tr, elmat);
210 elmat.
Mult(elfun, elvect);
219 void TransposeIntegrator::AssembleElementMatrix (
222 bfi -> AssembleElementMatrix (el, Trans, bfi_elmat);
227 void TransposeIntegrator::AssembleElementMatrix2 (
231 bfi -> AssembleElementMatrix2 (test_fe, trial_fe, Trans, bfi_elmat);
236 void TransposeIntegrator::AssembleFaceMatrix (
240 bfi -> AssembleFaceMatrix (el1, el2, Trans, bfi_elmat);
251 void LumpedIntegrator::AssembleElementMatrix (
254 bfi -> AssembleElementMatrix (el, Trans, elmat);
261 integrator->SetIntRule(ir);
264 void InverseIntegrator::AssembleElementMatrix(
267 integrator->AssembleElementMatrix(el, Trans, elmat);
274 for (
int i = 0; i < integrators.Size(); i++)
276 integrators[i]->SetIntRule(ir);
280 void SumIntegrator::AssembleElementMatrix(
283 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
285 integrators[0]->AssembleElementMatrix(el, Trans, elmat);
286 for (
int i = 1; i < integrators.Size(); i++)
288 integrators[i]->AssembleElementMatrix(el, Trans, elem_mat);
293 void SumIntegrator::AssembleElementMatrix2(
297 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
299 integrators[0]->AssembleElementMatrix2(el1, el2, Trans, elmat);
300 for (
int i = 1; i < integrators.Size(); i++)
302 integrators[i]->AssembleElementMatrix2(el1, el2, Trans, elem_mat);
307 void SumIntegrator::AssembleFaceMatrix(
311 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
313 integrators[0]->AssembleFaceMatrix(el1, el2, Trans, elmat);
314 for (
int i = 1; i < integrators.Size(); i++)
316 integrators[i]->AssembleFaceMatrix(el1, el2, Trans, elem_mat);
321 void SumIntegrator::AssembleFaceMatrix(
326 MFEM_ASSERT(integrators.Size() > 0,
"empty SumIntegrator.");
328 integrators[0]->AssembleFaceMatrix(tr_fe, te_fe1, te_fe2, Trans, elmat);
329 for (
int i = 1; i < integrators.Size(); i++)
331 integrators[i]->AssembleFaceMatrix(tr_fe, te_fe1, te_fe2, Trans, elem_mat);
338 for (
int i = 0; i < integrators.Size(); i++)
340 integrators[i]->AssemblePA(fes);
344 void SumIntegrator::AssembleDiagonalPA(
Vector &diag)
346 for (
int i = 0; i < integrators.Size(); i++)
348 integrators[i]->AssembleDiagonalPA(diag);
354 for (
int i = 0; i < integrators.Size(); i++)
356 integrators[i]->AssemblePAInteriorFaces(fes);
362 for (
int i = 0; i < integrators.Size(); i++)
364 integrators[i]->AssemblePABoundaryFaces(fes);
370 for (
int i = 0; i < integrators.Size(); i++)
372 integrators[i]->AddMultPA(x, y);
376 void SumIntegrator::AddMultTransposePA(
const Vector &x,
Vector &y)
const 378 for (
int i = 0; i < integrators.Size(); i++)
380 integrators[i]->AddMultTransposePA(x, y);
386 for (
int i = 0; i < integrators.Size(); i++)
388 integrators[i]->AssembleMF(fes);
394 for (
int i = 0; i < integrators.Size(); i++)
396 integrators[i]->AddMultTransposeMF(x, y);
400 void SumIntegrator::AddMultTransposeMF(
const Vector &x,
Vector &y)
const 402 for (
int i = 0; i < integrators.Size(); i++)
404 integrators[i]->AddMultMF(x, y);
408 void SumIntegrator::AssembleDiagonalMF(
Vector &diag)
410 for (
int i = 0; i < integrators.Size(); i++)
412 integrators[i]->AssembleDiagonalMF(diag);
419 for (
int i = 0; i < integrators.Size(); i++)
421 integrators[i]->AssembleEA(fes, emat,
add);
430 for (
int i = 0; i < integrators.Size(); i++)
432 integrators[i]->AssembleEAInteriorFaces(fes,ea_data_int,ea_data_ext,
add);
440 for (
int i = 0; i < integrators.Size(); i++)
442 integrators[i]->AssembleEABoundaryFaces(fes, ea_data_bdr,
add);
446 SumIntegrator::~SumIntegrator()
450 for (
int i = 0; i < integrators.Size(); i++)
452 delete integrators[i];
457 void MixedScalarIntegrator::AssembleElementMatrix2(
461 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
462 this->FiniteElementTypeFailureMessage());
464 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
465 bool same_shapes = same_calc_shape && (&trial_fe == &test_fe);
467 #ifdef MFEM_THREAD_SAFE 468 Vector test_shape(test_nd);
482 elmat.
SetSize(test_nd, trial_nd);
487 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
488 ir = &
IntRules.
Get(trial_fe.GetGeomType(), ir_order);
497 this->CalcTestShape(test_fe, Trans, test_shape);
498 this->CalcTrialShape(trial_fe, Trans, trial_shape);
504 w *= Q->Eval(Trans, ip);
508 #ifndef MFEM_THREAD_SAFE 516 void MixedVectorIntegrator::AssembleElementMatrix2(
520 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
521 this->FiniteElementTypeFailureMessage());
524 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
525 int test_vdim = GetTestVDim(test_fe);
526 int trial_vdim = GetTrialVDim(trial_fe);
527 bool same_shapes = same_calc_shape && (&trial_fe == &test_fe);
531 MFEM_VERIFY(MQ->GetHeight() == test_vdim,
532 "Dimension mismatch in height of matrix coefficient.");
533 MFEM_VERIFY(MQ->GetWidth() == trial_vdim,
534 "Dimension mismatch in width of matrix coefficient.");
538 MFEM_VERIFY(trial_vdim == test_vdim,
539 "Diagonal matrix coefficient requires matching " 540 "test and trial vector dimensions.");
541 MFEM_VERIFY(DQ->GetVDim() == trial_vdim,
542 "Dimension mismatch in diagonal matrix coefficient.");
546 MFEM_VERIFY(VQ->GetVDim() == 3,
"Vector coefficient must have " 547 "dimension equal to three.");
550 #ifdef MFEM_THREAD_SAFE 551 Vector V(VQ ? VQ->GetVDim() : 0);
552 Vector D(DQ ? DQ->GetVDim() : 0);
553 DenseMatrix M(MQ ? MQ->GetHeight() : 0, MQ ? MQ->GetWidth() : 0);
558 V.SetSize(VQ ? VQ->GetVDim() : 0);
559 D.SetSize(DQ ? DQ->GetVDim() : 0);
560 M.SetSize(MQ ? MQ->GetHeight() : 0, MQ ? MQ->GetWidth() : 0);
561 test_shape.SetSize(test_nd, test_vdim);
562 shape_tmp.
SetSize(test_nd, trial_vdim);
566 trial_shape.
Reset(test_shape.Data(), trial_nd, trial_vdim);
570 trial_shape.
SetSize(trial_nd, trial_vdim);
573 elmat.
SetSize(test_nd, trial_nd);
578 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
579 ir = &
IntRules.
Get(trial_fe.GetGeomType(), ir_order);
588 this->CalcTestShape(test_fe, Trans, test_shape);
591 this->CalcTrialShape(trial_fe, Trans, trial_shape);
598 MQ->Eval(M, Trans, ip);
600 Mult(test_shape, M, shape_tmp);
605 DQ->Eval(D, Trans, ip);
611 VQ->Eval(V, Trans, ip);
614 for (
int j=0; j<test_nd; j++)
620 if (test_vdim == 3 && trial_vdim == 3)
622 shape_tmp(j,0) = test_shape(j,1) * V(2) -
623 test_shape(j,2) * V(1);
624 shape_tmp(j,1) = test_shape(j,2) * V(0) -
625 test_shape(j,0) * V(2);
626 shape_tmp(j,2) = test_shape(j,0) * V(1) -
627 test_shape(j,1) * V(0);
629 else if (test_vdim == 3 && trial_vdim == 2)
631 shape_tmp(j,0) = test_shape(j,1) * V(2) -
632 test_shape(j,2) * V(1);
633 shape_tmp(j,1) = test_shape(j,2) * V(0) -
634 test_shape(j,0) * V(2);
636 else if (test_vdim == 3 && trial_vdim == 1)
638 shape_tmp(j,0) = test_shape(j,1) * V(2) -
639 test_shape(j,2) * V(1);
641 else if (test_vdim == 2 && trial_vdim == 3)
643 shape_tmp(j,0) = test_shape(j,1) * V(2);
644 shape_tmp(j,1) = -test_shape(j,0) * V(2);
645 shape_tmp(j,2) = test_shape(j,0) * V(1) -
646 test_shape(j,1) * V(0);
648 else if (test_vdim == 2 && trial_vdim == 2)
650 shape_tmp(j,0) = test_shape(j,1) * V(2);
651 shape_tmp(j,1) = -test_shape(j,0) * V(2);
653 else if (test_vdim == 1 && trial_vdim == 3)
655 shape_tmp(j,0) = 0.0;
656 shape_tmp(j,1) = -test_shape(j,0) * V(2);
657 shape_tmp(j,2) = test_shape(j,0) * V(1);
659 else if (test_vdim == 1 && trial_vdim == 1)
661 shape_tmp(j,0) = 0.0;
670 w *= Q -> Eval (Trans, ip);
682 #ifndef MFEM_THREAD_SAFE 690 void MixedScalarVectorIntegrator::AssembleElementMatrix2(
694 MFEM_ASSERT(this->VerifyFiniteElementTypes(trial_fe, test_fe),
695 this->FiniteElementTypeFailureMessage());
697 MFEM_VERIFY(VQ,
"MixedScalarVectorIntegrator: " 698 "VectorCoefficient must be set");
704 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
705 int sca_nd = sca_fe->
GetDof();
706 int vec_nd = vec_fe->
GetDof();
707 int vdim = GetVDim(*vec_fe);
710 MFEM_VERIFY(VQ->GetVDim() == vdim,
"MixedScalarVectorIntegrator: " 711 "Dimensions of VectorCoefficient and Vector-valued basis " 712 "functions must match");
714 #ifdef MFEM_THREAD_SAFE 718 Vector vshape_tmp(vec_nd);
729 elmat.
SetSize(test_nd, trial_nd);
734 int ir_order = this->GetIntegrationOrder(trial_fe, test_fe, Trans);
744 this->CalcShape(*sca_fe, Trans, shape);
745 this->CalcVShape(*vec_fe, Trans, vshape);
749 VQ->Eval(V, Trans, ip);
752 if ( vdim == 2 && cross_2d )
759 vshape.
Mult(V,vshape_tmp);
765 void GradientIntegrator::AssembleElementMatrix2(
770 int trial_dof = trial_fe.
GetDof();
771 int test_dof = test_fe.
GetDof();
776 gshape.SetSize(trial_dof,
dim);
778 shape.SetSize(test_dof);
785 elmat_comp.
SetSize(test_dof, trial_dof);
797 Mult(dshape, Jadj, gshape);
802 c *= Q->Eval(Trans, ip);
806 for (
int d = 0; d <
dim; ++d)
808 gshape.GetColumnReference(d, d_col);
809 MultVWt(shape, d_col, elmat_comp);
810 for (
int jj = 0; jj < trial_dof; ++jj)
812 for (
int ii = 0; ii < test_dof; ++ii)
814 elmat(d * test_dof + ii, jj) += elmat_comp(ii, jj);
831 void DiffusionIntegrator::AssembleElementMatrix
838 bool square = (
dim == spaceDim);
843 MFEM_VERIFY(VQ->GetVDim() == spaceDim,
844 "Unexpected dimension for VectorCoefficient");
848 MFEM_VERIFY(MQ->GetWidth() == spaceDim,
849 "Unexpected width for MatrixCoefficient");
850 MFEM_VERIFY(MQ->GetHeight() == spaceDim,
851 "Unexpected height for MatrixCoefficient");
854 #ifdef MFEM_THREAD_SAFE 858 Vector D(VQ ? VQ->GetVDim() : 0);
861 dshapedxt.
SetSize(nd, spaceDim);
862 dshapedxt_m.
SetSize(nd, MQ ? spaceDim : 0);
864 D.SetSize(VQ ? VQ->GetVDim() : 0);
873 bool deleteRule =
false;
874 if (NURBSFE && patchRules)
876 const int patch = NURBSFE->
GetPatch();
877 const int* ijk = NURBSFE->
GetIJK();
879 ir = &patchRules->GetElementRule(NURBSFE->
GetElement(), patch, ijk, kv,
891 w = ip.
weight / (square ? w : w*w*w);
897 MQ->Eval(M, Trans, ip);
899 Mult(dshapedxt, M, dshapedxt_m);
904 VQ->Eval(D, Trans, ip);
912 w *= Q->Eval(Trans, ip);
924 void DiffusionIntegrator::AssembleElementMatrix2(
928 int tr_nd = trial_fe.
GetDof();
929 int te_nd = test_fe.
GetDof();
932 bool square = (
dim == spaceDim);
937 MFEM_VERIFY(VQ->GetVDim() == spaceDim,
938 "Unexpected dimension for VectorCoefficient");
942 MFEM_VERIFY(MQ->GetWidth() == spaceDim,
943 "Unexpected width for MatrixCoefficient");
944 MFEM_VERIFY(MQ->GetHeight() == spaceDim,
945 "Unexpected height for MatrixCoefficient");
948 #ifdef MFEM_THREAD_SAFE 954 Vector D(VQ ? VQ->GetVDim() : 0);
957 dshapedxt.
SetSize(tr_nd, spaceDim);
958 te_dshape.SetSize(te_nd,
dim);
959 te_dshapedxt.
SetSize(te_nd, spaceDim);
961 dshapedxt_m.
SetSize(te_nd, MQ ? spaceDim : 0);
963 D.SetSize(VQ ? VQ->GetVDim() : 0);
979 w = ip.
weight / (square ? w : w*w*w);
980 Mult(dshape, invdfdx, dshapedxt);
981 Mult(te_dshape, invdfdx, te_dshapedxt);
985 MQ->Eval(M, Trans, ip);
987 Mult(te_dshapedxt, M, dshapedxt_m);
992 VQ->Eval(D, Trans, ip);
1000 w *= Q->Eval(Trans, ip);
1008 void DiffusionIntegrator::AssembleElementVector(
1019 MFEM_VERIFY(VQ->GetVDim() == spaceDim,
1020 "Unexpected dimension for VectorCoefficient");
1024 MFEM_VERIFY(MQ->GetWidth() == spaceDim,
1025 "Unexpected width for MatrixCoefficient");
1026 MFEM_VERIFY(MQ->GetHeight() == spaceDim,
1027 "Unexpected height for MatrixCoefficient");
1030 #ifdef MFEM_THREAD_SAFE 1032 Vector D(VQ ? VQ->GetVDim() : 0);
1035 invdfdx.SetSize(
dim, spaceDim);
1037 D.SetSize(VQ ? VQ->GetVDim() : 0);
1040 vecdxt.SetSize((VQ || MQ) ? spaceDim : 0);
1041 pointflux.SetSize(spaceDim);
1059 dshape.MultTranspose(elfun, vec);
1060 invdfdx.MultTranspose(vec, pointflux);
1063 w *= Q->Eval(Tr, ip);
1068 dshape.MultTranspose(elfun, vec);
1069 invdfdx.MultTranspose(vec, vecdxt);
1072 MQ->Eval(M, Tr, ip);
1073 M.
Mult(vecdxt, pointflux);
1077 VQ->Eval(D, Tr, ip);
1078 for (
int j=0; j<spaceDim; ++j)
1080 pointflux[j] = D[j] * vecdxt[j];
1085 invdfdx.Mult(pointflux, vec);
1086 dshape.AddMult(vec, elvect);
1090 void DiffusionIntegrator::ComputeElementFlux
1095 int nd, spaceDim, fnd;
1103 MFEM_VERIFY(VQ->GetVDim() == spaceDim,
1104 "Unexpected dimension for VectorCoefficient");
1108 MFEM_VERIFY(MQ->GetWidth() == spaceDim,
1109 "Unexpected width for MatrixCoefficient");
1110 MFEM_VERIFY(MQ->GetHeight() == spaceDim,
1111 "Unexpected height for MatrixCoefficient");
1114 #ifdef MFEM_THREAD_SAFE 1117 Vector D(VQ ? VQ->GetVDim() : 0);
1122 D.SetSize(VQ ? VQ->GetVDim() : 0);
1125 vecdxt.SetSize(spaceDim);
1126 pointflux.SetSize(MQ || VQ ? spaceDim : 0);
1133 flux.
SetSize( fnd * spaceDim );
1135 for (
int i = 0; i < fnd; i++)
1139 dshape.MultTranspose(
u, vec);
1151 vecdxt *= Q->Eval(Trans,ip);
1153 for (
int j = 0; j < spaceDim; j++)
1155 flux(fnd*j+i) = vecdxt(j);
1162 MQ->Eval(M, Trans, ip);
1163 M.
Mult(vecdxt, pointflux);
1167 VQ->Eval(D, Trans, ip);
1168 for (
int j=0; j<spaceDim; ++j)
1170 pointflux[j] = D[j] * vecdxt[j];
1173 for (
int j = 0; j < spaceDim; j++)
1175 flux(fnd*j+i) = pointflux(j);
1181 for (
int j = 0; j < spaceDim; j++)
1183 flux(fnd*j+i) = vecdxt(j);
1189 double DiffusionIntegrator::ComputeFluxEnergy
1193 int nd = fluxelem.
GetDof();
1197 #ifdef MFEM_THREAD_SAFE 1199 Vector D(VQ ? VQ->GetVDim() : 0);
1201 D.
SetSize(VQ ? VQ->GetVDim() : 0);
1205 pointflux.SetSize(spaceDim);
1206 if (d_energy) { vec.SetSize(spaceDim); }
1207 if (MQ) { M.
SetSize(spaceDim); }
1209 int order = 2 * fluxelem.
GetOrder();
1212 double energy = 0.0;
1213 if (d_energy) { *d_energy = 0.0; }
1221 for (
int k = 0; k < spaceDim; k++)
1223 for (
int j = 0; j < nd; j++)
1225 pointflux(k) += flux(k*nd+j)*shape(j);
1234 MQ->Eval(M, Trans, ip);
1239 VQ->Eval(D, Trans, ip);
1241 energy += w * (D * pointflux);
1245 double e = (pointflux * pointflux);
1246 if (Q) { e *= Q->Eval(Trans, ip); }
1254 for (
int k = 0; k <
dim; k++)
1256 (*d_energy)[k] += w * vec[k] * vec[k];
1269 if (trial_fe.
Space() == FunctionSpace::Pk)
1279 if (trial_fe.
Space() == FunctionSpace::rQk)
1287 void MassIntegrator::AssembleElementMatrix
1295 #ifdef MFEM_THREAD_SAFE 1314 w *= Q -> Eval(Trans, ip);
1321 void MassIntegrator::AssembleElementMatrix2(
1325 int tr_nd = trial_fe.
GetDof();
1326 int te_nd = test_fe.
GetDof();
1329 #ifdef MFEM_THREAD_SAFE 1337 &
GetRule(trial_fe, test_fe, Trans);
1350 w *= Q -> Eval(Trans, ip);
1365 if (trial_fe.
Space() == FunctionSpace::rQk)
1373 void BoundaryMassIntegrator::AssembleFaceMatrix(
1377 MFEM_ASSERT(Trans.
Elem2No < 0,
1378 "support for interior faces is not implemented");
1383 #ifdef MFEM_THREAD_SAFE 1412 w *= Q -> Eval(Trans, ip);
1419 void ConvectionIntegrator::AssembleElementMatrix(
1425 #ifdef MFEM_THREAD_SAFE 1427 Vector shape, vec2, BdFidxT;
1445 Q->Eval(Q_ir, Trans, *ir);
1459 adjJ.
Mult(vec1, vec2);
1460 dshape.
Mult(vec2, BdFidxT);
1467 void GroupConvectionIntegrator::AssembleElementMatrix(
1474 dshape.SetSize(nd,
dim);
1477 grad.SetSize(nd,
dim);
1486 Q->Eval(Q_nodal, Trans, el.
GetNodes());
1498 Mult(dshape, adjJ, grad);
1503 for (
int k = 0; k < nd; k++)
1505 double wsk = w*shape(k);
1506 for (
int l = 0; l < nd; l++)
1509 for (
int s = 0;
s <
dim;
s++)
1511 a += Q_nodal(
s,k)*grad(l,
s);
1513 elmat(k,l) += wsk*
a;
1534 void VectorMassIntegrator::AssembleElementMatrix
1544 vdim = (vdim == -1) ? spaceDim : vdim;
1548 partelmat.SetSize(nd);
1555 mcoeff.SetSize(vdim);
1563 if (el.
Space() == FunctionSpace::rQk)
1586 VQ->Eval(vec, Trans, ip);
1587 for (
int k = 0; k < vdim; k++)
1589 elmat.
AddMatrix(norm*vec(k), partelmat, nd*k, nd*k);
1594 MQ->Eval(mcoeff, Trans, ip);
1595 for (
int i = 0; i < vdim; i++)
1596 for (
int j = 0; j < vdim; j++)
1598 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, nd*i, nd*j);
1605 norm *= Q->Eval(Trans, ip);
1608 for (
int k = 0; k < vdim; k++)
1616 void VectorMassIntegrator::AssembleElementMatrix2(
1620 int tr_nd = trial_fe.
GetDof();
1621 int te_nd = test_fe.
GetDof();
1628 elmat.
SetSize(te_nd*vdim, tr_nd*vdim);
1629 shape.SetSize(tr_nd);
1630 te_shape.SetSize(te_nd);
1631 partelmat.SetSize(te_nd, tr_nd);
1638 mcoeff.SetSize(vdim);
1645 Trans.
OrderW() + Q_order);
1647 if (trial_fe.
Space() == FunctionSpace::rQk)
1667 MultVWt(te_shape, shape, partelmat);
1671 VQ->Eval(vec, Trans, ip);
1672 for (
int k = 0; k < vdim; k++)
1674 elmat.
AddMatrix(norm*vec(k), partelmat, te_nd*k, tr_nd*k);
1679 MQ->Eval(mcoeff, Trans, ip);
1680 for (
int i = 0; i < vdim; i++)
1681 for (
int j = 0; j < vdim; j++)
1683 elmat.
AddMatrix(norm*mcoeff(i,j), partelmat, te_nd*i, tr_nd*j);
1690 norm *= Q->Eval(Trans, ip);
1693 for (
int k = 0; k < vdim; k++)
1695 elmat.
AddMatrix(partelmat, te_nd*k, tr_nd*k);
1701 void VectorFEDivergenceIntegrator::AssembleElementMatrix2(
1705 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1707 #ifdef MFEM_THREAD_SAFE 1708 Vector divshape(trial_nd), shape(test_nd);
1710 divshape.SetSize(trial_nd);
1714 elmat.
SetSize(test_nd, trial_nd);
1734 w *= Q->Eval(Trans, ip);
1741 void VectorFEWeakDivergenceIntegrator::AssembleElementMatrix2(
1745 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1751 "Trial space must be H(Curl) and test space must be H_1");
1753 #ifdef MFEM_THREAD_SAFE 1759 dshape.SetSize(test_nd,
dim);
1765 elmat.
SetSize(test_nd, trial_nd);
1793 int ir_order = (trial_fe.
Space() == FunctionSpace::Pk) ?
1807 Mult(dshape, invdfdx, dshapedxt);
1815 w *= Q->Eval(Trans, ip);
1823 void VectorFECurlIntegrator::AssembleElementMatrix2(
1827 int trial_nd = trial_fe.
GetDof(), test_nd = test_fe.
GetDof(), i;
1829 int dimc = (
dim == 3) ? 3 : 1;
1833 "At least one of the finite elements must be in H(Curl)");
1835 int curl_nd, vec_nd;
1847 #ifdef MFEM_THREAD_SAFE 1858 elmat.
SetSize(test_nd, trial_nd);
1905 w *= Q->Eval(Trans, ip);
1911 AddMultABt(vshapeTest, curlshapeTrial_dFT, elmat);
1915 AddMultABt(curlshapeTrial_dFT, vshapeTest, elmat);
1920 void DerivativeIntegrator::AssembleElementMatrix2 (
1927 int trial_nd = trial_fe.
GetDof();
1928 int test_nd = test_fe.
GetDof();
1934 elmat.
SetSize (test_nd,trial_nd);
1935 dshape.SetSize (trial_nd,
dim);
1936 dshapedxt.SetSize(trial_nd, spaceDim);
1937 dshapedxi.SetSize(trial_nd);
1938 invdfdx.SetSize(
dim, spaceDim);
1939 shape.SetSize (test_nd);
1945 if (trial_fe.
Space() == FunctionSpace::Pk)
1954 if (trial_fe.
Space() == FunctionSpace::rQk)
1974 Mult (dshape, invdfdx, dshapedxt);
1978 for (l = 0; l < trial_nd; l++)
1980 dshapedxi(l) = dshapedxt(l,xi);
1983 shape *= Q->Eval(Trans,ip) * det * ip.
weight;
1988 void CurlCurlIntegrator::AssembleElementMatrix
1997 #ifdef MFEM_THREAD_SAFE 2002 curlshape_dFt.SetSize(nd,
dimc);
2012 if (el.
Space() == FunctionSpace::Pk)
2036 MQ->Eval(M, Trans, ip);
2038 Mult(curlshape_dFt, M, curlshape);
2043 DQ->Eval(D, Trans, ip);
2049 w *= Q->Eval(Trans, ip);
2064 int tr_nd = trial_fe.
GetDof();
2065 int te_nd = test_fe.
GetDof();
2070 #ifdef MFEM_THREAD_SAFE 2075 curlshape.SetSize(tr_nd,
dimc);
2076 curlshape_dFt.SetSize(tr_nd,
dimc);
2077 te_curlshape.SetSize(te_nd,
dimc);
2089 if (trial_fe.
Space() == FunctionSpace::Pk)
2113 MQ->Eval(M, Trans, ip);
2115 Mult(te_curlshape_dFt, M, te_curlshape);
2116 AddMultABt(te_curlshape, curlshape_dFt, elmat);
2120 DQ->Eval(D, Trans, ip);
2122 AddMultADBt(te_curlshape_dFt,D,curlshape_dFt,elmat);
2128 w *= Q->Eval(Trans, ip);
2131 AddMultABt(te_curlshape_dFt, curlshape_dFt, elmat);
2136 void CurlCurlIntegrator
2141 #ifdef MFEM_THREAD_SAFE 2145 MFEM_VERIFY(ir == NULL,
"Integration rule (ir) must be NULL")
2150 projcurl.
Mult(
u, flux);
2159 int nd = fluxelem.
GetDof();
2162 #ifdef MFEM_THREAD_SAFE 2166 pointflux.SetSize(
dim);
2167 if (d_energy) { vec.SetSize(
dim); }
2169 int order = 2 * fluxelem.
GetOrder();
2172 double energy = 0.0;
2173 if (d_energy) { *d_energy = 0.0; }
2192 double e = w * (pointflux * pointflux);
2201 #if ANISO_EXPERIMENTAL 2221 #if ANISO_EXPERIMENTAL 2225 int n = (int) round(pow(ir.
GetNPoints(), 1.0/3.0));
2229 for (
int k = 0; k < n; k++)
2230 for (
int l = 0; l < n; l++)
2231 for (
int m = 0; m < n; m++)
2233 Vector &vec = pfluxes[(k*n + l)*n + m];
2236 tmp = vec; tmp -= pfluxes[(k*n + l)*n + (m-1)];
2237 (*d_energy)[0] += (tmp * tmp);
2241 tmp = vec; tmp -= pfluxes[(k*n + (l-1))*n + m];
2242 (*d_energy)[1] += (tmp * tmp);
2246 tmp = vec; tmp -= pfluxes[((k-1)*n + l)*n + m];
2247 (*d_energy)[2] += (tmp * tmp);
2260 void VectorCurlCurlIntegrator::AssembleElementMatrix(
2265 int cld = (
dim*(
dim-1))/2;
2267 #ifdef MFEM_THREAD_SAFE 2271 dshape_hat.SetSize(dof,
dim);
2273 curlshape.SetSize(
dim*dof, cld);
2296 Mult(dshape_hat, Jadj, dshape);
2301 w *= Q->Eval(Trans, ip);
2308 double VectorCurlCurlIntegrator::GetElementEnergy(
2314 #ifdef MFEM_THREAD_SAFE 2317 dshape_hat.SetSize(dof,
dim);
2320 grad_hat.SetSize(
dim);
2334 for (
int i = 0; i < ir->GetNPoints(); i++)
2339 MultAtB(elfun_mat, dshape_hat, grad_hat);
2345 Mult(grad_hat, Jadj, grad);
2349 double curl = grad(0,1) - grad(1,0);
2354 double curl_x = grad(2,1) - grad(1,2);
2355 double curl_y = grad(0,2) - grad(2,0);
2356 double curl_z = grad(1,0) - grad(0,1);
2357 w *= curl_x * curl_x + curl_y * curl_y + curl_z * curl_z;
2362 w *= Q->Eval(Tr, ip);
2368 elfun_mat.ClearExternalData();
2370 return 0.5 * energy;
2373 void MixedCurlIntegrator::AssembleElementMatrix2(
2378 int trial_dof = trial_fe.
GetDof();
2379 int test_dof = test_fe.
GetDof();
2380 int dimc = (
dim == 3) ? 3 : 1;
2384 "Trial finite element must be either 2D/3D H(Curl) or 2D H1");
2387 "Test finite element must be in H1/L2");
2393 dshape.SetSize(trial_dof,
dim);
2394 curlshape.SetSize(trial_dof,
dim);
2399 curlshape.SetSize(trial_dof,
dimc);
2400 elmat_comp.SetSize(test_dof, trial_dof);
2403 shape.SetSize(test_dof);
2423 dshape.GradToVectorCurl2D(curlshape);
2433 c *= Q->Eval(Trans, ip);
2437 for (
int d = 0; d <
dimc; ++d)
2439 double * curldata = &(curlshape.GetData())[d*trial_dof];
2440 for (
int jj = 0; jj < trial_dof; ++jj)
2442 for (
int ii = 0; ii < test_dof; ++ii)
2444 elmat(d * test_dof + ii, jj) += shape(ii) * curldata[jj];
2452 void VectorFEMassIntegrator::AssembleElementMatrix(
2459 int vdim = std::max(spaceDim, el.
GetVDim());
2463 #ifdef MFEM_THREAD_SAFE 2464 Vector D(DQ ? DQ->GetVDim() : 0);
2466 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
2468 trial_vshape.
SetSize(dof, vdim);
2469 D.SetSize(DQ ? DQ->GetVDim() : 0);
2470 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
2472 DenseMatrix tmp(trial_vshape.Height(), K.Width());
2496 MQ->Eval(K, Trans, ip);
2498 Mult(trial_vshape,K,tmp);
2503 DQ->Eval(D, Trans, ip);
2511 w *= Q -> Eval (Trans, ip);
2518 void VectorFEMassIntegrator::AssembleElementMatrix2(
2527 int vdim = std::max(spaceDim, trial_fe.
GetVDim());
2528 int trial_dof = trial_fe.
GetDof();
2529 int test_dof = test_fe.
GetDof();
2532 #ifdef MFEM_THREAD_SAFE 2535 Vector D(DQ ? DQ->GetVDim() : 0);
2536 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
2538 trial_vshape.
SetSize(trial_dof, spaceDim);
2540 D.SetSize(DQ ? DQ->GetVDim() : 0);
2541 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
2544 elmat.
SetSize(vdim*test_dof, trial_dof);
2566 DQ->Eval(D, Trans, ip);
2568 for (
int d = 0; d < vdim; d++)
2570 for (
int j = 0; j < test_dof; j++)
2572 for (
int k = 0; k < trial_dof; k++)
2574 elmat(d * test_dof + j, k) +=
2575 shape(j) * D(d) * trial_vshape(k, d);
2582 MQ->Eval(K, Trans, ip);
2584 for (
int d = 0; d < vdim; d++)
2586 for (
int j = 0; j < test_dof; j++)
2588 for (
int k = 0; k < trial_dof; k++)
2591 for (
int vd = 0; vd < spaceDim; vd++)
2593 Kv += K(d, vd) * trial_vshape(k, vd);
2595 elmat(d * test_dof + j, k) += shape(j) * Kv;
2604 w *= Q->Eval(Trans, ip);
2606 for (
int d = 0; d < vdim; d++)
2608 for (
int j = 0; j < test_dof; j++)
2610 for (
int k = 0; k < trial_dof; k++)
2612 elmat(d * test_dof + j, k) +=
2613 w * shape(j) * trial_vshape(k, d);
2620 else if (test_fe.
GetRangeType() == FiniteElement::VECTOR
2625 int trial_vdim = std::max(spaceDim, trial_fe.
GetVDim());
2626 int test_vdim = std::max(spaceDim, test_fe.
GetVDim());
2627 int trial_dof = trial_fe.
GetDof();
2628 int test_dof = test_fe.
GetDof();
2631 #ifdef MFEM_THREAD_SAFE 2634 Vector D(DQ ? DQ->GetVDim() : 0);
2635 DenseMatrix K(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
2637 trial_vshape.
SetSize(trial_dof,trial_vdim);
2638 test_vshape.
SetSize(test_dof,test_vdim);
2639 D.SetSize(DQ ? DQ->GetVDim() : 0);
2640 K.SetSize(MQ ? MQ->GetVDim() : 0, MQ ? MQ->GetVDim() : 0);
2644 elmat.
SetSize (test_dof, trial_dof);
2666 MQ->Eval(K, Trans, ip);
2668 Mult(test_vshape,K,tmp);
2673 DQ->Eval(D, Trans, ip);
2681 w *= Q -> Eval (Trans, ip);
2689 MFEM_ABORT(
"VectorFEMassIntegrator::AssembleElementMatrix2(...)\n" 2690 " is not implemented for given trial and test bases.");
2694 void VectorDivergenceIntegrator::AssembleElementMatrix2(
2701 int trial_dof = trial_fe.
GetDof();
2702 int test_dof = test_fe.
GetDof();
2705 dshape.SetSize (trial_dof,
dim);
2706 gshape.SetSize (trial_dof,
dim);
2708 divshape.SetSize (
dim*trial_dof);
2709 shape.SetSize (test_dof);
2718 for (
int i = 0; i < ir -> GetNPoints(); i++)
2728 Mult (dshape, Jadj, gshape);
2730 gshape.GradToDiv (divshape);
2735 c *= Q -> Eval (Trans, ip);
2754 void DivDivIntegrator::AssembleElementMatrix(
2762 #ifdef MFEM_THREAD_SAFE 2778 for (
int i = 0; i < ir -> GetNPoints(); i++)
2789 c *= Q -> Eval (Trans, ip);
2797 void DivDivIntegrator::AssembleElementMatrix2(
2803 int tr_nd = trial_fe.
GetDof();
2804 int te_nd = test_fe.
GetDof();
2807 #ifdef MFEM_THREAD_SAFE 2809 Vector te_divshape(te_nd);
2819 int order = 2 * max(test_fe.
GetOrder(),
2826 for (
int i = 0; i < ir -> GetNPoints(); i++)
2838 c *= Q -> Eval (Trans, ip);
2846 void VectorDiffusionIntegrator::AssembleElementMatrix(
2851 const int dof = el.
GetDof();
2856 vdim = (vdim <= 0) ? sdim : vdim;
2857 const bool square = (
dim == sdim);
2861 vcoeff.SetSize(vdim);
2865 mcoeff.SetSize(vdim);
2868 dshape.SetSize(dof,
dim);
2869 dshapedxt.SetSize(dof, sdim);
2872 pelmat.SetSize(dof);
2882 for (
int i = 0; i < ir -> GetNPoints(); i++)
2889 double w = Trans.
Weight();
2890 w = ip.
weight / (square ? w : w*w*w);
2897 VQ->Eval(vcoeff, Trans, ip);
2898 for (
int k = 0; k < vdim; ++k)
2906 MQ->Eval(mcoeff, Trans, ip);
2907 for (
int ii = 0; ii < vdim; ++ii)
2909 for (
int jj = 0; jj < vdim; ++jj)
2911 Mult_a_AAt(w*mcoeff(ii,jj), dshapedxt, pelmat);
2912 elmat.
AddMatrix(pelmat, dof*ii, dof*jj);
2918 if (Q) { w *= Q->Eval(Trans, ip); }
2920 for (
int k = 0; k < vdim; ++k)
2928 void VectorDiffusionIntegrator::AssembleElementVector(
2932 const int dof = el.
GetDof();
2937 vdim = (vdim <= 0) ? sdim : vdim;
2938 const bool square = (
dim == sdim);
2942 vcoeff.SetSize(vdim);
2946 mcoeff.SetSize(vdim);
2949 dshape.SetSize(dof,
dim);
2950 dshapedxt.SetSize(dof,
dim);
2968 for (
int i = 0; i < ir->GetNPoints(); i++)
2975 w = ip.
weight / (square ? w : w*w*w);
2981 VQ->Eval(vcoeff, Tr, ip);
2982 for (
int k = 0; k < vdim; ++k)
2984 pelmat *= w*vcoeff(k);
2985 const Vector vec_in(mat_in.GetColumn(k), dof);
2986 Vector vec_out(mat_out.GetColumn(k), dof);
2987 pelmat.AddMult(vec_in, vec_out);
2992 MQ->Eval(mcoeff, Tr, ip);
2993 for (
int ii = 0; ii < vdim; ++ii)
2995 Vector vec_out(mat_out.GetColumn(ii), dof);
2996 for (
int jj = 0; jj < vdim; ++jj)
2998 pelmat *= w*mcoeff(ii,jj);
2999 const Vector vec_in(mat_in.GetColumn(jj), dof);
3000 pelmat.Mult(vec_in, vec_out);
3006 if (Q) { w *= Q->Eval(Tr, ip); }
3008 for (
int k = 0; k < vdim; ++k)
3010 const Vector vec_in(mat_in.GetColumn(k), dof);
3011 Vector vec_out(mat_out.GetColumn(k), dof);
3012 pelmat.AddMult(vec_in, vec_out);
3019 void ElasticityIntegrator::AssembleElementMatrix(
3028 #ifdef MFEM_THREAD_SAFE 3032 dshape.SetSize(dof,
dim);
3033 gshape.SetSize(dof,
dim);
3034 pelmat.SetSize(dof);
3049 for (
int i = 0; i < ir -> GetNPoints(); i++)
3059 gshape.GradToDiv (divshape);
3061 M =
mu->Eval(Trans, ip);
3064 L = lambda->Eval(Trans, ip);
3079 for (
int d = 0; d <
dim; d++)
3081 for (
int k = 0; k < dof; k++)
3082 for (
int l = 0; l < dof; l++)
3084 elmat (dof*d+k, dof*d+l) += (M * w) * pelmat(k, l);
3087 for (
int ii = 0; ii <
dim; ii++)
3088 for (
int jj = 0; jj <
dim; jj++)
3090 for (
int kk = 0; kk < dof; kk++)
3091 for (
int ll = 0; ll < dof; ll++)
3093 elmat(dof*ii+kk, dof*jj+ll) +=
3094 (M * w) * gshape(kk, jj) * gshape(ll, ii);
3101 void ElasticityIntegrator::ComputeElementFlux(
3106 const int dof = el.
GetDof();
3108 const int tdim =
dim*(
dim+1)/2;
3111 MFEM_ASSERT(
dim == 2 ||
dim == 3,
3112 "dimension is not supported: dim = " <<
dim);
3114 MFEM_ASSERT(fluxelem.
GetMapType() == FiniteElement::VALUE,
"");
3115 MFEM_ASSERT(dynamic_cast<const NodalFiniteElement*>(&fluxelem),
"");
3117 #ifdef MFEM_THREAD_SAFE 3123 double gh_data[9], grad_data[9];
3135 for (
int i = 0; i < fnd; i++)
3139 MultAtB(loc_data_mat, dshape, gh);
3144 M =
mu->Eval(Trans, ip);
3147 L = lambda->Eval(Trans, ip);
3157 const double M2 = 2.0*M;
3160 L *= (grad(0,0) + grad(1,1));
3162 flux(i+fnd*0) = M2*grad(0,0) + L;
3163 flux(i+fnd*1) = M2*grad(1,1) + L;
3164 flux(i+fnd*2) = M*(grad(0,1) + grad(1,0));
3168 L *= (grad(0,0) + grad(1,1) + grad(2,2));
3170 flux(i+fnd*0) = M2*grad(0,0) + L;
3171 flux(i+fnd*1) = M2*grad(1,1) + L;
3172 flux(i+fnd*2) = M2*grad(2,2) + L;
3173 flux(i+fnd*3) = M*(grad(0,1) + grad(1,0));
3174 flux(i+fnd*4) = M*(grad(0,2) + grad(2,0));
3175 flux(i+fnd*5) = M*(grad(1,2) + grad(2,1));
3184 const int dof = fluxelem.
GetDof();
3186 const int tdim =
dim*(
dim+1)/2;
3191 MFEM_ASSERT(d_energy == NULL,
"anisotropic estimates are not supported");
3192 MFEM_ASSERT(flux.
Size() == dof*tdim,
"invalid 'flux' vector");
3194 #ifndef MFEM_THREAD_SAFE 3199 double pointstress_data[6];
3200 Vector pointstress(pointstress_data, tdim);
3211 int order = 2 * Trans.
OrderGrad(&fluxelem);
3215 double energy = 0.0;
3217 for (
int i = 0; i < ir->GetNPoints(); i++)
3222 flux_mat.MultTranspose(shape, pointstress);
3227 M =
mu->Eval(Trans, ip);
3230 L = lambda->Eval(Trans, ip);
3250 const double *
s = pointstress_data;
3254 const double tr_e = (
s[0] +
s[1])/(2*(M + L));
3256 pt_e = (0.25/M)*(
s[0]*(
s[0] - L) +
s[1]*(
s[1] - L) + 2*
s[2]*
s[2]);
3261 const double tr_e = (
s[0] +
s[1] +
s[2])/(2*M + 3*L);
3263 pt_e = (0.25/M)*(
s[0]*(
s[0] - L) +
s[1]*(
s[1] - L) +
s[2]*(
s[2] - L) +
3264 2*(
s[3]*
s[3] +
s[4]*
s[4] +
s[5]*
s[5]));
3295 shape1.SetSize(ndof1);
3296 shape2.SetSize(ndof2);
3312 if (el1.
Space() == FunctionSpace::Pk)
3333 u->Eval(vu, *Trans.
Elem1, eip1);
3337 nor(0) = 2*eip1.
x - 1.0;
3346 b =
beta * fabs(un);
3354 if (un >= 0.0 && ndof2)
3356 rho_p = rho->Eval(*Trans.
Elem2, eip2);
3360 rho_p = rho->Eval(*Trans.
Elem1, eip1);
3369 for (
int i = 0; i < ndof1; i++)
3370 for (
int j = 0; j < ndof1; j++)
3372 elmat(i, j) += w * shape1(i) * shape1(j);
3381 for (
int i = 0; i < ndof2; i++)
3382 for (
int j = 0; j < ndof1; j++)
3384 elmat(ndof1+i, j) -= w * shape2(i) * shape1(j);
3390 for (
int i = 0; i < ndof2; i++)
3391 for (
int j = 0; j < ndof2; j++)
3393 elmat(ndof1+i, ndof1+j) += w * shape2(i) * shape2(j);
3396 for (
int i = 0; i < ndof1; i++)
3397 for (
int j = 0; j < ndof2; j++)
3399 elmat(i, ndof1+j) -= w * shape1(i) * shape2(j);
3410 int int_order = T.Elem1->OrderW() + 2*order;
3414 void DGDiffusionIntegrator::AssembleFaceMatrix(
3418 int dim, ndof1, ndof2, ndofs;
3419 bool kappa_is_nonzero = (
kappa != 0.);
3434 shape1.SetSize(ndof1);
3435 dshape1.SetSize(ndof1,
dim);
3436 dshape1dn.SetSize(ndof1);
3440 shape2.SetSize(ndof2);
3441 dshape2.SetSize(ndof2,
dim);
3442 dshape2dn.SetSize(ndof2);
3449 ndofs = ndof1 + ndof2;
3452 if (kappa_is_nonzero)
3490 nor(0) = 2*eip1.
x - 1.0;
3508 w *= Q->Eval(*Trans.
Elem1, eip1);
3515 MQ->Eval(mq, *Trans.
Elem1, eip1);
3516 mq.MultTranspose(nh, ni);
3520 if (kappa_is_nonzero)
3535 dshape1.Mult(nh, dshape1dn);
3536 for (
int i = 0; i < ndof1; i++)
3537 for (
int j = 0; j < ndof1; j++)
3539 elmat(i, j) += shape1(i) * dshape1dn(j);
3551 w *= Q->Eval(*Trans.
Elem2, eip2);
3558 MQ->Eval(mq, *Trans.
Elem2, eip2);
3559 mq.MultTranspose(nh, ni);
3563 if (kappa_is_nonzero)
3568 dshape2.Mult(nh, dshape2dn);
3570 for (
int i = 0; i < ndof1; i++)
3571 for (
int j = 0; j < ndof2; j++)
3573 elmat(i, ndof1 + j) += shape1(i) * dshape2dn(j);
3576 for (
int i = 0; i < ndof2; i++)
3577 for (
int j = 0; j < ndof1; j++)
3579 elmat(ndof1 + i, j) -= shape2(i) * dshape1dn(j);
3582 for (
int i = 0; i < ndof2; i++)
3583 for (
int j = 0; j < ndof2; j++)
3585 elmat(ndof1 + i, ndof1 + j) -= shape2(i) * dshape2dn(j);
3589 if (kappa_is_nonzero)
3593 for (
int i = 0; i < ndof1; i++)
3595 const double wsi = wq*shape1(i);
3596 for (
int j = 0; j <= i; j++)
3598 jmat(i, j) += wsi * shape1(j);
3603 for (
int i = 0; i < ndof2; i++)
3605 const int i2 = ndof1 + i;
3606 const double wsi = wq*shape2(i);
3607 for (
int j = 0; j < ndof1; j++)
3609 jmat(i2, j) -= wsi * shape1(j);
3611 for (
int j = 0; j <= i; j++)
3613 jmat(i2, ndof1 + j) += wsi * shape2(j);
3621 if (kappa_is_nonzero)
3623 for (
int i = 0; i < ndofs; i++)
3625 for (
int j = 0; j < i; j++)
3627 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
3628 elmat(i,j) =
sigma*aji - aij + mij;
3629 elmat(j,i) =
sigma*aij - aji + mij;
3631 elmat(i,i) = (
sigma - 1.)*elmat(i,i) + jmat(i,i);
3636 for (
int i = 0; i < ndofs; i++)
3638 for (
int j = 0; j < i; j++)
3640 double aij = elmat(i,j), aji = elmat(j,i);
3641 elmat(i,j) =
sigma*aji - aij;
3642 elmat(j,i) =
sigma*aij - aji;
3644 elmat(i,i) *= (
sigma - 1.);
3651 void DGElasticityIntegrator::AssembleBlock(
3652 const int dim,
const int row_ndofs,
const int col_ndofs,
3653 const int row_offset,
const int col_offset,
3654 const double jmatcoef,
const Vector &col_nL,
const Vector &col_nM,
3659 for (
int jm = 0, j = col_offset; jm <
dim; ++jm)
3661 for (
int jdof = 0; jdof < col_ndofs; ++jdof, ++j)
3663 const double t2 = col_dshape_dnM(jdof);
3664 for (
int im = 0, i = row_offset; im <
dim; ++im)
3666 const double t1 = col_dshape(jdof, jm) * col_nL(im);
3667 const double t3 = col_dshape(jdof, im) * col_nM(jm);
3668 const double tt = t1 + ((im == jm) ? t2 : 0.0) + t3;
3669 for (
int idof = 0; idof < row_ndofs; ++idof, ++i)
3671 elmat(i, j) += row_shape(idof) * tt;
3677 if (jmatcoef == 0.0) {
return; }
3679 for (
int d = 0; d <
dim; ++d)
3681 const int jo = col_offset + d*col_ndofs;
3682 const int io = row_offset + d*row_ndofs;
3683 for (
int jdof = 0, j = jo; jdof < col_ndofs; ++jdof, ++j)
3685 const double sj = jmatcoef * col_shape(jdof);
3686 for (
int i = max(io,j), idof = i - io; idof < row_ndofs; ++idof, ++i)
3688 jmat(i, j) += row_shape(idof) * sj;
3694 void DGElasticityIntegrator::AssembleFaceMatrix(
3698 #ifdef MFEM_THREAD_SAFE 3707 Vector dshape1_dnM, dshape2_dnM;
3712 const int ndofs1 = el1.
GetDof();
3714 const int nvdofs =
dim*(ndofs1 + ndofs2);
3724 const bool kappa_is_nonzero = (
kappa != 0.0);
3725 if (kappa_is_nonzero)
3758 for (
int pind = 0; pind < ir->
GetNPoints(); ++pind)
3774 Mult(dshape1, adjJ, dshape1_ps);
3778 nor(0) = 2*eip1.
x - 1.0;
3791 Mult(dshape2, adjJ, dshape2_ps);
3795 const double wL2 = w2 * lambda->Eval(*Trans.
Elem2, eip2);
3796 const double wM2 = w2 *
mu->Eval(*Trans.
Elem2, eip2);
3799 wLM = (wL2 + 2.0*wM2);
3800 dshape2_ps.
Mult(nM2, dshape2_dnM);
3810 const double wL1 = w1 * lambda->Eval(*Trans.
Elem1, eip1);
3811 const double wM1 = w1 *
mu->Eval(*Trans.
Elem1, eip1);
3814 wLM += (wL1 + 2.0*wM1);
3815 dshape1_ps.
Mult(nM1, dshape1_dnM);
3818 const double jmatcoef =
kappa * (nor*nor) * wLM;
3822 dim, ndofs1, ndofs1, 0, 0, jmatcoef, nL1, nM1,
3823 shape1, shape1, dshape1_dnM, dshape1_ps, elmat, jmat);
3825 if (ndofs2 == 0) {
continue; }
3832 dim, ndofs1, ndofs2, 0,
dim*ndofs1, jmatcoef, nL2, nM2,
3833 shape1, shape2, dshape2_dnM, dshape2_ps, elmat, jmat);
3836 dim, ndofs2, ndofs1,
dim*ndofs1, 0, jmatcoef, nL1, nM1,
3837 shape2, shape1, dshape1_dnM, dshape1_ps, elmat, jmat);
3840 dim, ndofs2, ndofs2,
dim*ndofs1,
dim*ndofs1, jmatcoef, nL2, nM2,
3841 shape2, shape2, dshape2_dnM, dshape2_ps, elmat, jmat);
3845 if (kappa_is_nonzero)
3847 for (
int i = 0; i < nvdofs; ++i)
3849 for (
int j = 0; j < i; ++j)
3851 double aij = elmat(i,j), aji = elmat(j,i), mij = jmat(i,j);
3852 elmat(i,j) =
alpha*aji - aij + mij;
3853 elmat(j,i) =
alpha*aij - aji + mij;
3855 elmat(i,i) = (
alpha - 1.)*elmat(i,i) + jmat(i,i);
3860 for (
int i = 0; i < nvdofs; ++i)
3862 for (
int j = 0; j < i; ++j)
3864 double aij = elmat(i,j), aji = elmat(j,i);
3865 elmat(i,j) =
alpha*aji - aij;
3866 elmat(j,i) =
alpha*aij - aji;
3868 elmat(i,i) *= (
alpha - 1.);
3874 void TraceJumpIntegrator::AssembleFaceMatrix(
3879 int i, j, face_ndof, ndof1, ndof2;
3884 face_ndof = trial_face_fe.
GetDof();
3885 ndof1 = test_fe1.
GetDof();
3887 face_shape.SetSize(face_ndof);
3888 shape1.SetSize(ndof1);
3892 ndof2 = test_fe2.
GetDof();
3893 shape2.SetSize(ndof2);
3900 elmat.
SetSize(ndof1 + ndof2, face_ndof);
3915 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
3935 trial_face_fe.
CalcShape(ip, face_shape);
3944 if (trial_face_fe.
GetMapType() == FiniteElement::VALUE)
3949 for (i = 0; i < ndof1; i++)
3950 for (j = 0; j < face_ndof; j++)
3952 elmat(i, j) += shape1(i) * face_shape(j);
3957 for (i = 0; i < ndof2; i++)
3958 for (j = 0; j < face_ndof; j++)
3960 elmat(ndof1+i, j) -= shape2(i) * face_shape(j);
3966 void NormalTraceJumpIntegrator::AssembleFaceMatrix(
3971 int i, j, face_ndof, ndof1, ndof2,
dim;
3974 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::VALUE,
"");
3976 face_ndof = trial_face_fe.
GetDof();
3977 ndof1 = test_fe1.
GetDof();
3980 face_shape.SetSize(face_ndof);
3981 normal.SetSize(
dim);
3982 shape1.SetSize(ndof1,
dim);
3983 shape1_n.SetSize(ndof1);
3987 ndof2 = test_fe2.
GetDof();
3988 shape2.SetSize(ndof2,
dim);
3989 shape2_n.SetSize(ndof2);
3996 elmat.
SetSize(ndof1 + ndof2, face_ndof);
4019 trial_face_fe.
CalcShape(ip, face_shape);
4025 shape1.Mult(normal, shape1_n);
4033 shape2.Mult(normal, shape2_n);
4036 for (i = 0; i < ndof1; i++)
4037 for (j = 0; j < face_ndof; j++)
4039 elmat(i, j) += shape1_n(i) * face_shape(j);
4044 for (i = 0; i < ndof2; i++)
4045 for (j = 0; j < face_ndof; j++)
4047 elmat(ndof1+i, j) -= shape2_n(i) * face_shape(j);
4053 void TraceIntegrator::AssembleTraceFaceMatrix(
int elem,
4059 MFEM_VERIFY(test_fe.
GetMapType() == FiniteElement::VALUE,
4060 "TraceIntegrator::AssembleTraceFaceMatrix: Test space should be H1");
4061 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::INTEGRAL,
4062 "TraceIntegrator::AssembleTraceFaceMatrix: Trial space should be RT trace");
4064 int i, j, face_ndof, ndof;
4067 face_ndof = trial_face_fe.
GetDof();
4070 face_shape.SetSize(face_ndof);
4071 shape.SetSize(ndof);
4073 elmat.
SetSize(ndof, face_ndof);
4087 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4091 if (iel != elem) { scale = -1.; }
4106 for (i = 0; i < ndof; i++)
4108 for (j = 0; j < face_ndof; j++)
4110 elmat(i, j) += shape(i) * face_shape(j);
4116 void NormalTraceIntegrator::AssembleTraceFaceMatrix(
int elem,
4122 int i, j, face_ndof, ndof,
dim;
4125 MFEM_VERIFY(test_fe.
GetMapType() == FiniteElement::H_DIV,
4126 "NormalTraceIntegrator::AssembleTraceFaceMatrix: Test space should be RT");
4127 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::VALUE,
4128 "NormalTraceIntegrator::AssembleTraceFaceMatrix: Trial space should be H1 (trace)");
4130 face_ndof = trial_face_fe.
GetDof();
4134 face_shape.SetSize(face_ndof);
4135 normal.SetSize(
dim);
4136 shape.SetSize(ndof,
dim);
4137 shape_n.SetSize(ndof);
4139 elmat.
SetSize(ndof, face_ndof);
4153 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4157 if (iel != elem) { scale = -1.; }
4167 shape.Mult(normal, shape_n);
4168 face_shape *= ip.
weight*scale;
4170 for (i = 0; i < ndof; i++)
4172 for (j = 0; j < face_ndof; j++)
4174 elmat(i, j) += shape_n(i) * face_shape(j);
4180 void TangentTraceIntegrator::AssembleTraceFaceMatrix(
int elem,
4187 MFEM_VERIFY(test_fe.
GetMapType() == FiniteElement::H_CURL,
4188 "TangentTraceIntegrator::AssembleTraceFaceMatrix: Test space should be ND");
4190 int face_ndof, ndof,
dim;
4196 "Trial space should be ND face trace and test space should be a ND vector field in 3D ";
4197 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::H_CURL &&
4198 trial_face_fe.
GetDim() == 2 && test_fe.
GetDim() == 3, msg);
4203 "Trial space should be H1 edge trace and test space should be a ND vector field in 2D";
4204 MFEM_VERIFY(trial_face_fe.
GetMapType() == FiniteElement::VALUE &&
4205 trial_face_fe.
GetDim() == 1 && test_fe.
GetDim() == 2, msg);
4207 face_ndof = trial_face_fe.
GetDof();
4210 int dimc = (
dim == 3) ? 3 : 1;
4212 face_shape.SetSize(face_ndof,
dimc);
4213 shape_n.SetSize(ndof,
dimc);
4214 shape.SetSize(ndof,
dim);
4215 normal.SetSize(
dim);
4218 elmat.
SetSize(ndof, face_ndof);
4232 MFEM_VERIFY(elem == Trans.
Elem2->
ElementNo,
"Elem != Trans.Elem2->ElementNo");
4236 if (iel != elem) { scale = -1.; }
4249 face_shape.GetColumnReference(0,temp);
4257 cross_product(normal, shape, shape_n);
4259 const double w = scale*ip.
weight;
4264 void NormalInterpolator::AssembleElementMatrix2(
4273 for (
int i = 0; i < ran_nodes.Size(); i++)
4279 for (
int j = 0; j < shape.Size(); j++)
4281 for (
int d = 0; d < spaceDim; d++)
4283 elmat(i, j+d*shape.Size()) = shape(j)*n(d);
4303 using VectorCoefficient::Eval;
4304 virtual void Eval(Vector &V, ElementTransformation &T,
4305 const IntegrationPoint &ip)
4321 internal::ShapeCoefficient dom_shape_coeff(*Q, dom_fe);
4327 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
4332 ScalarVectorProductInterpolator::AssembleElementMatrix2(
4356 VShapeCoefficient dom_shape_coeff(*Q, dom_fe, Trans.
GetSpaceDim());
4367 VectorScalarProductInterpolator::AssembleElementMatrix2(
4382 vc(width), shape(height) { }
4394 VecShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
4405 ScalarCrossProductInterpolator::AssembleElementMatrix2(
4423 using VectorCoefficient::Eval;
4430 for (
int k = 0; k < vdim; k++)
4432 V(k) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
4437 VCrossVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
4443 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
4447 VectorCrossProductInterpolator::AssembleElementMatrix2(
4463 vshape(height, width), vc(width)
4465 MFEM_ASSERT(width == 3,
"");
4474 for (
int k = 0; k < height; k++)
4476 M(k,0) = vc(1) * vshape(k,2) - vc(2) * vshape(k,1);
4477 M(k,1) = vc(2) * vshape(k,0) - vc(0) * vshape(k,2);
4478 M(k,2) = vc(0) * vshape(k,1) - vc(1) * vshape(k,0);
4483 VCrossVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
4514 vshape(vdim, vq.GetVDim()), vc(vq.GetVDim()) { }
4516 using VectorCoefficient::Eval;
4517 virtual void Eval(Vector &V, ElementTransformation &T,
4518 const IntegrationPoint &ip)
4530 VectorInnerProductInterpolator::AssembleElementMatrix2(
4536 internal::VDotVShapeCoefficient dom_shape_coeff(*VQ, dom_fe);
4542 ran_fe.
Project(dom_shape_coeff, Trans, elmat_as_vec);
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 GetNPoints() const
Returns the number of the points in the integration rule.
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.
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 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...
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.
int Space() const
Returns the type of FunctionSpace on the element.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
int GetCurlDim() const
Returns the dimension of the curl for vector-valued finite elements.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void CalcAdjugate(const DenseMatrix &a, DenseMatrix &adja)
int Size() const
Returns the size of the vector.
Data type dense matrix using column-major storage.
An arbitrary order and dimension NURBS element.
double * Data() const
Returns the matrix data array.
IntegrationRules RefinedIntRules(1, Quadrature1D::GaussLegendre)
A global object with all refined integration rules.
void CalcPhysVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Equivalent to the CalcVShape() method with the same arguments.
void AddMult_a_ABt(double a, const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += a * A * B^t.
void CalcOrtho(const DenseMatrix &J, Vector &n)
void Mult_a_AAt(double a, const DenseMatrix &A, DenseMatrix &AAt)
AAt = a * A * A^t.
void add(const Vector &v1, const Vector &v2, Vector &v)
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
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.
double * GetData() const
Returns the matrix data array.
void Reset(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
void MultTranspose(const double *x, double *y) const
Multiply a vector with the transpose matrix.
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.
double InnerProduct(const double *x, const double *y) const
Compute y^t A x.
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.
virtual void CalcPhysCurlShape(ElementTransformation &Trans, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in physical space at the point de...
void AddMult_a_VVt(const double a, const Vector &v, DenseMatrix &VVt)
VVt += a * v v^t.
Array< const KnotVector * > & KnotVectors() const
int GetVDim()
Returns dimension of the vector.
void Mult(const double *x, double *y) const
Matrix vector multiplication.
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.
void CalcPhysDShape(ElementTransformation &Trans, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in physical space at the poi...
double * GetData() const
Return a pointer to the beginning of the Vector data.
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
virtual void ProjectMatrixCoefficient(MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
Given a matrix coefficient and a transformation, compute an approximation ("projection") in the local...
double p(const Vector &x, double t)
void Transpose()
(*this) = (*this)^t
int GetDim() const
Returns the reference space dimension for the finite element.
void MultVVt(const Vector &v, DenseMatrix &vvt)
Make a matrix from a vector V.Vt.
ComplexDenseMatrix * MultAtB(const ComplexDenseMatrix &A, const ComplexDenseMatrix &B)
Multiply the complex conjugate transpose of a matrix A with a matrix B. A^H*B.
void 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...
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)
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.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void SetDataAndSize(double *d, int s)
Set the Vector data and size.
Vector & Set(const double a, const Vector &x)
(*this) = a * x
const IntegrationRule & GetRule(const Integrator &integ, const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
void CalcPhysShape(ElementTransformation &Trans, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in physical space at the point ...
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.
int GetVDim() const
Returns the vector dimension for vector-valued finite elements.
const int * GetIJK() const
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 GradToCurl(DenseMatrix &curl)
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
void AddMultADAt(const DenseMatrix &A, const Vector &D, DenseMatrix &ADAt)
ADAt += A D A^t, where D is diagonal.
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
double sigma(const Vector &x)
double u(const Vector &xvec)
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
void AddMult_a_AAt(double a, const DenseMatrix &A, DenseMatrix &AAt)
AAt += a * A * A^t.
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 Neg()
(*this) = -(*this)