12 #include "transfer.hpp"
14 #include "../general/forall.hpp"
21 : dom_fes(dom_fes_), ran_fes(ran_fes_),
23 fw_t_oper(), bw_t_oper()
28 MFEM_VERIFY(par_dom == par_ran,
"the domain and range FE spaces must both"
29 " be either serial or parallel");
50 MFEM_VERIFY(mat != NULL,
"Operator is not a SparseMatrix");
53 t_oper.
Reset(const_cast<SparseMatrix*>(mat),
false);
66 const int RP_case = bool(out_cR) + 2*bool(in_cP);
70 t_oper.
Reset(const_cast<Operator*>(&oper),
false);
83 out_cR, &oper, in_cP,
false,
false,
false));
89 MFEM_ABORT(
"Operator::Type is not supported: " <<
oper_type);
111 else if ((hy_mat = dynamic_cast<const HypreParMatrix *>(&oper)))
120 MFEM_ABORT(
"unknown Operator type");
128 false,
false,
false));
132 MFEM_ABORT(
"Operator::Type is not supported: " <<
oper_type);
137 return *t_oper.
Ptr();
172 for (
int i = 0; i < elem_geoms.Size(); i++)
175 localP[elem_geoms[i]]);
183 MFEM_ABORT(
"Operator::Type is not supported: " <<
oper_type);
213 MFEM_ABORT(
"unknown type of FE space");
224 MFEM_ABORT(
"Operator::Type is not supported: " <<
oper_type);
233 :
Operator(fes_lor_.GetVSize(), fes_ho_.GetVSize()),
243 ho2lor.MakeI(nel_ho);
244 for (
int ilor = 0; ilor < nel_lor; ++ilor)
247 ho2lor.AddAColumnInRow(iho);
250 for (
int ilor = 0; ilor < nel_lor; ++ilor)
253 ho2lor.AddConnection(iho, ilor);
291 int nel_ho = mesh_ho->
GetNE();
292 int nel_lor = mesh_lor->
GetNE();
295 if (nel_ho == 0) {
return; }
302 for (
int ig = 0; ig < geoms.
Size(); ++ig)
312 for (
int iho = 0; iho < nel_ho; ++iho)
317 offsets[iho+1] = offsets[iho] + fe_ho.
GetDof()*fe_lor.
GetDof()*nref;
328 for (
int iho = 0; iho < nel_ho; ++iho)
337 int ndof_ho = fe_ho.
GetDof();
338 int ndof_lor = fe_lor.
GetDof();
343 DenseMatrix R_iho(&R[offsets[iho]], ndof_lor*nref, ndof_ho);
344 DenseMatrix P_iho(&P[offsets[iho]], ndof_ho, ndof_lor*nref);
346 DenseMatrix Minv_lor(ndof_lor*nref, ndof_lor*nref);
362 for (
int iref = 0; iref < nref; ++iref)
365 int ilor = lor_els[iref];
368 M_lor.
CopyMN(M_lor_el, iref*ndof_lor, iref*ndof_lor);
372 Minv_lor.
CopyMN(M_lor_el, iref*ndof_lor, iref*ndof_lor);
382 ElemMixedMass(geom, fe_ho, fe_lor, el_tr, ip_tr, M_mixed_el);
384 M_mixed.
CopyMN(M_mixed_el, iref*ndof_lor, 0);
391 RtMlorR_inv.
Mult(RtMlor, P_iho);
398 int vdim = fes_ho.GetVDim();
401 for (
int iho = 0; iho < fes_ho.GetNE(); ++iho)
403 int nref = ho2lor.RowSize(iho);
404 int ndof_ho = fes_ho.GetFE(iho)->GetDof();
405 int ndof_lor = fes_lor.GetFE(ho2lor.GetRow(iho)[0])->GetDof();
406 xel_mat.
SetSize(ndof_ho, vdim);
407 yel_mat.
SetSize(ndof_lor*nref, vdim);
408 DenseMatrix R_iho(&R[offsets[iho]], ndof_lor*nref, ndof_ho);
410 fes_ho.GetElementVDofs(iho, vdofs);
414 for (
int iref = 0; iref < nref; ++iref)
416 int ilor = ho2lor.GetRow(iho)[iref];
417 for (
int vd=0; vd<vdim; ++vd)
419 fes_lor.GetElementDofs(ilor, vdofs);
420 fes_lor.DofsToVDofs(vd, vdofs);
430 int vdim = fes_ho.GetVDim();
434 for (
int iho = 0; iho < fes_ho.GetNE(); ++iho)
436 int nref = ho2lor.RowSize(iho);
437 int ndof_ho = fes_ho.GetFE(iho)->GetDof();
438 int ndof_lor = fes_lor.GetFE(ho2lor.GetRow(iho)[0])->GetDof();
439 xel_mat.
SetSize(ndof_lor*nref, vdim);
440 yel_mat.
SetSize(ndof_ho, vdim);
441 DenseMatrix R_iho(&R[offsets[iho]], ndof_lor*nref, ndof_ho);
444 for (
int iref=0; iref<nref; ++iref)
446 int ilor = ho2lor.GetRow(iho)[iref];
447 for (
int vd=0; vd<vdim; ++vd)
449 fes_lor.GetElementDofs(ilor, vdofs);
450 fes_lor.DofsToVDofs(vd, vdofs);
457 fes_ho.GetElementVDofs(iho, vdofs);
465 int vdim = fes_ho.GetVDim();
469 for (
int iho = 0; iho < fes_ho.GetNE(); ++iho)
471 int nref = ho2lor.RowSize(iho);
472 int ndof_ho = fes_ho.GetFE(iho)->GetDof();
473 int ndof_lor = fes_lor.GetFE(ho2lor.GetRow(iho)[0])->GetDof();
474 xel_mat.
SetSize(ndof_lor*nref, vdim);
475 yel_mat.
SetSize(ndof_ho, vdim);
476 DenseMatrix P_iho(&P[offsets[iho]], ndof_ho, ndof_lor*nref);
479 for (
int iref = 0; iref < nref; ++iref)
481 int ilor = ho2lor.GetRow(iho)[iref];
482 for (
int vd = 0; vd < vdim; ++vd)
484 fes_lor.GetElementDofs(ilor, vdofs);
485 fes_lor.DofsToVDofs(vd, vdofs);
492 fes_ho.GetElementVDofs(iho, vdofs);
500 int vdim = fes_ho.GetVDim();
503 for (
int iho = 0; iho < fes_ho.GetNE(); ++iho)
505 int nref = ho2lor.RowSize(iho);
506 int ndof_ho = fes_ho.GetFE(iho)->GetDof();
507 int ndof_lor = fes_lor.GetFE(ho2lor.GetRow(iho)[0])->GetDof();
508 xel_mat.
SetSize(ndof_ho, vdim);
509 yel_mat.
SetSize(ndof_lor*nref, vdim);
510 DenseMatrix P_iho(&P[offsets[iho]], ndof_ho, ndof_lor*nref);
512 fes_ho.GetElementVDofs(iho, vdofs);
517 for (
int iref = 0; iref < nref; ++iref)
519 int ilor = ho2lor.GetRow(iho)[iref];
520 for (
int vd=0; vd<vdim; ++vd)
522 fes_lor.GetElementDofs(ilor, vdofs);
523 fes_lor.DofsToVDofs(vd, vdofs);
536 int nel_ho = mesh_ho->
GetNE();
537 int nel_lor = mesh_lor->
GetNE();
541 if (nel_ho == 0) {
return; }
548 for (
int ig = 0; ig < geoms.
Size(); ++ig)
563 for (
int iho = 0; iho < nel_ho; ++iho)
571 int nedof_lor = fe_lor.
GetDof();
576 Vector shape_lor(nedof_lor);
579 for (
int iref = 0; iref < nref; ++iref)
581 int ilor = lor_els[iref];
592 ML_el += (shape_lor *= (el_tr->
Weight() * ip_lor.
weight));
599 for (
int i = 0; i < ndof_lor; ++i)
601 ML_inv[i] = 1.0 / ML_inv[i];
616 for (
int iho = 0; iho < nel_ho; ++iho)
629 int nedof_ho = fe_ho.
GetDof();
630 int nedof_lor = fe_lor.
GetDof();
634 for (
int iref = 0; iref < nref; ++iref)
636 int ilor = lor_els[iref];
648 for (
int i = 0; i < nedof_lor; ++i)
651 R_el.
SetRow(i, R_row.
Set(ML_inv[dofs_lor[i]], R_row));
680 int vdim = fes_ho.GetVDim();
681 const int ndof_ho = fes_ho.GetNDofs();
682 const int ndof_lor = fes_lor.GetNDofs();
688 for (
int d = 0; d < vdim; ++d)
690 fes_ho.GetVDofs(d, dofs_ho);
691 fes_lor.GetVDofs(d, dofs_lor);
693 R.Mult(x_dim, y_dim);
701 int vdim = fes_ho.GetVDim();
702 const int ndof_ho = fes_ho.GetNDofs();
703 const int ndof_lor = fes_lor.GetNDofs();
709 for (
int d = 0; d < vdim; ++d)
711 fes_ho.GetVDofs(d, dofs_ho);
712 fes_lor.GetVDofs(d, dofs_lor);
714 R.MultTranspose(x_dim, y_dim);
722 int vdim = fes_ho.GetVDim();
723 const int ndof_ho = fes_ho.GetNDofs();
724 const int ndof_lor = fes_lor.GetNDofs();
731 for (
int d = 0; d < vdim; ++d)
733 fes_lor.GetVDofs(d, dofs_lor);
736 M_LH.MultTranspose(x_dim, xbar);
738 pcg.Mult(xbar, y_dim);
739 fes_ho.GetVDofs(d, dofs_ho);
747 int vdim = fes_ho.GetVDim();
748 const int ndof_ho = fes_ho.GetNDofs();
749 const int ndof_lor = fes_lor.GetNDofs();
756 for (
int d = 0; d < vdim; ++d)
758 fes_ho.GetVDofs(d, dofs_ho);
762 pcg.Mult(x_dim, xbar);
763 M_LH.Mult(xbar, y_dim);
764 fes_lor.GetVDofs(d, dofs_lor);
771 pcg.SetRelTol(p_rtol_);
776 pcg.SetAbsTol(p_atol_);
779 void L2ProjectionGridTransfer::L2ProjectionH1Space::AllocR()
781 const Table& elem_dof_ho = fes_ho.GetElementToDofTable();
782 const Table& elem_dof_lor = fes_lor.GetElementToDofTable();
783 const int ndof_ho = fes_ho.GetNDofs();
784 const int ndof_lor = fes_lor.GetNDofs();
787 Transpose(elem_dof_lor, dof_elem_lor, ndof_lor);
789 Mesh* mesh_lor = fes_lor.GetMesh();
793 const int* elem_dof_hoI = elem_dof_ho.
GetI();
794 const int* elem_dof_hoJ = elem_dof_ho.
GetJ();
795 const int* dof_elem_lorI = dof_elem_lor.
GetI();
796 const int* dof_elem_lorJ = dof_elem_lor.
GetJ();
802 dof_used_ho.
SetSize(ndof_ho, -1);
805 for (
int ilor = 0; ilor < ndof_lor; ++ilor)
807 for (
int jlor = dof_elem_lorI[ilor]; jlor < dof_elem_lorI[ilor + 1]; ++jlor)
809 int el_lor = dof_elem_lorJ[jlor];
811 for (
int jho = elem_dof_hoI[iho]; jho < elem_dof_hoI[iho + 1]; ++jho)
813 int dof_ho = elem_dof_hoJ[jho];
814 if (dof_used_ho[dof_ho] != ilor)
816 dof_used_ho[dof_ho] = ilor;
824 Table dof_lor_dof_ho;
825 dof_lor_dof_ho.SetDims(ndof_lor, sizeJ);
827 for (
int i = 0; i < ndof_ho; ++i)
833 int* dof_dofI = dof_lor_dof_ho.GetI();
834 int* dof_dofJ = dof_lor_dof_ho.GetJ();
836 for (
int ilor = 0; ilor < ndof_lor; ++ilor)
838 dof_dofI[ilor] = sizeJ;
839 for (
int jlor = dof_elem_lorI[ilor]; jlor < dof_elem_lorI[ilor + 1]; ++jlor)
841 int el_lor = dof_elem_lorJ[jlor];
843 for (
int jho = elem_dof_hoI[iho]; jho < elem_dof_hoI[iho + 1]; ++jho)
845 int dof_ho = elem_dof_hoJ[jho];
846 if (dof_used_ho[dof_ho] != ilor)
848 dof_used_ho[dof_ho] = ilor;
849 dof_dofJ[sizeJ] = dof_ho;
856 dof_lor_dof_ho.SortRows();
857 double* data = Memory<double>(dof_dofI[ndof_lor]);
859 R = SparseMatrix(dof_dofI, dof_dofJ, data, ndof_lor, ndof_ho,
863 dof_lor_dof_ho.LoseData();
874 if (!
F) { BuildF(); }
882 if (!
F) { BuildF(); }
888 void L2ProjectionGridTransfer::BuildF()
904 :
Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize())
907 if (lFESpace_.
FEColl() == hFESpace_.
FEColl() && !isvar_order)
919 && dynamic_cast<const TensorBasisElement*>(hFESpace_.
GetFE(0))
949 :
Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize()), lFESpace(lFESpace_),
971 for (
int i = 0; i < mesh->
GetNE(); i++)
977 if (geom != cached_geom || isvar_order)
979 h_fe = hFESpace.
GetFE(i);
980 l_fe = lFESpace.
GetFE(i);
987 for (
int vd = 0; vd < vdim; vd++)
989 l_dofs.
Copy(l_vdofs);
991 h_dofs.
Copy(h_vdofs);
998 loc_prol.
Mult(subX, subY);
1026 int vdim = lFESpace.
GetVDim();
1028 for (
int i = 0; i < mesh->
GetNE(); i++)
1034 if (geom != cached_geom || isvar_order)
1036 h_fe = hFESpace.
GetFE(i);
1037 l_fe = lFESpace.
GetFE(i);
1045 for (
int vd = 0; vd < vdim; vd++)
1047 l_dofs.
Copy(l_vdofs);
1049 h_dofs.
Copy(h_vdofs);
1057 for (
int p = 0;
p < h_dofs.
Size(); ++
p)
1059 if (processed[lFESpace.
DecodeDof(h_dofs[
p])])
1065 loc_prol.
Mult(subX, subY);
1073 for (
int p = 0;
p < h_dofs.
Size(); ++
p)
1075 processed[lFESpace.
DecodeDof(h_dofs[
p])] = 1;
1085 :
Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize()), lFESpace(lFESpace_),
1091 if (mesh->
GetNE() == 0)
1099 MFEM_VERIFY(ltel,
"Low order FE space must be tensor product space");
1103 MFEM_VERIFY(htel,
"High order FE space must be tensor product space");
1113 int j = hdofmap[i] >=0 ? hdofmap[i] : -1 - hdofmap[i];
1117 NE = lFESpace.
GetNE();
1125 elem_restrict_lex_l =
1128 MFEM_VERIFY(elem_restrict_lex_l,
1129 "Low order ElementRestriction not available");
1131 elem_restrict_lex_h =
1134 MFEM_VERIFY(elem_restrict_lex_h,
1135 "High order ElementRestriction not available");
1142 MFEM_VERIFY(dynamic_cast<const ElementRestriction*>(elem_restrict_lex_h),
1143 "High order element restriction is of unsupported type");
1147 ->BooleanMask(mask);
1151 namespace TransferKernels
1166 for (
int dy = 0; dy < D1D; ++dy)
1169 for (
int qy = 0; qy < Q1D; ++qy)
1173 for (
int dx = 0; dx < D1D; ++dx)
1175 const double s = x_(dx, dy, e);
1176 for (
int qx = 0; qx < Q1D; ++qx)
1178 sol_x[qx] += B_(qx, dx) *
s;
1181 for (
int qy = 0; qy < Q1D; ++qy)
1183 const double d2q = B_(qy, dy);
1184 for (
int qx = 0; qx < Q1D; ++qx)
1186 y_(qx, qy, e) += d2q * sol_x[qx];
1190 for (
int qy = 0; qy < Q1D; ++qy)
1192 for (
int qx = 0; qx < Q1D; ++qx)
1194 y_(qx, qy, e) *= m_(qx, qy, e);
1204 auto x_ =
Reshape(localL.
Read(), D1D, D1D, D1D, NE);
1207 auto m_ =
Reshape(mask.
Read(), Q1D, Q1D, Q1D, NE);
1213 for (
int dz = 0; dz < D1D; ++dz)
1216 for (
int qy = 0; qy < Q1D; ++qy)
1218 for (
int qx = 0; qx < Q1D; ++qx)
1220 sol_xy[qy][qx] = 0.0;
1223 for (
int dy = 0; dy < D1D; ++dy)
1226 for (
int qx = 0; qx < Q1D; ++qx)
1230 for (
int dx = 0; dx < D1D; ++dx)
1232 const double s = x_(dx, dy, dz, e);
1233 for (
int qx = 0; qx < Q1D; ++qx)
1235 sol_x[qx] += B_(qx, dx) *
s;
1238 for (
int qy = 0; qy < Q1D; ++qy)
1240 const double wy = B_(qy, dy);
1241 for (
int qx = 0; qx < Q1D; ++qx)
1243 sol_xy[qy][qx] += wy * sol_x[qx];
1247 for (
int qz = 0; qz < Q1D; ++qz)
1249 const double wz = B_(qz, dz);
1250 for (
int qy = 0; qy < Q1D; ++qy)
1252 for (
int qx = 0; qx < Q1D; ++qx)
1254 y_(qx, qy, qz, e) += wz * sol_xy[qy][qx];
1259 for (
int qz = 0; qz < Q1D; ++qz)
1261 for (
int qy = 0; qy < Q1D; ++qy)
1263 for (
int qx = 0; qx < Q1D; ++qx)
1265 y_(qx, qy, qz, e) *= m_(qx, qy, qz, e);
1285 for (
int qy = 0; qy < Q1D; ++qy)
1288 for (
int dx = 0; dx < D1D; ++dx)
1292 for (
int qx = 0; qx < Q1D; ++qx)
1294 const double s = m_(qx, qy, e) * x_(qx, qy, e);
1295 for (
int dx = 0; dx < D1D; ++dx)
1297 sol_x[dx] += Bt_(dx, qx) *
s;
1300 for (
int dy = 0; dy < D1D; ++dy)
1302 const double q2d = Bt_(dy, qy);
1303 for (
int dx = 0; dx < D1D; ++dx)
1305 y_(dx, dy, e) += q2d * sol_x[dx];
1315 auto x_ =
Reshape(localH.
Read(), Q1D, Q1D, Q1D, NE);
1318 auto m_ =
Reshape(mask.
Read(), Q1D, Q1D, Q1D, NE);
1324 for (
int qz = 0; qz < Q1D; ++qz)
1327 for (
int dy = 0; dy < D1D; ++dy)
1329 for (
int dx = 0; dx < D1D; ++dx)
1334 for (
int qy = 0; qy < Q1D; ++qy)
1337 for (
int dx = 0; dx < D1D; ++dx)
1341 for (
int qx = 0; qx < Q1D; ++qx)
1343 const double s = m_(qx, qy, qz, e) * x_(qx, qy, qz, e);
1344 for (
int dx = 0; dx < D1D; ++dx)
1346 sol_x[dx] += Bt_(dx, qx) *
s;
1349 for (
int dy = 0; dy < D1D; ++dy)
1351 const double wy = Bt_(dy, qy);
1352 for (
int dx = 0; dx < D1D; ++dx)
1354 sol_xy[dy][dx] += wy * sol_x[dx];
1358 for (
int dz = 0; dz < D1D; ++dz)
1360 const double wz = Bt_(dz, qz);
1361 for (
int dy = 0; dy < D1D; ++dy)
1363 for (
int dx = 0; dx < D1D; ++dx)
1365 y_(dx, dy, dz, e) += wz * sol_xy[dy][dx];
1388 elem_restrict_lex_l->
Mult(x, localL);
1399 MFEM_ABORT(
"TensorProductPRefinementTransferOperator::Mult not "
1400 "implemented for dim = "
1414 elem_restrict_lex_h->
Mult(x, localH);
1425 MFEM_ABORT(
"TensorProductPRefinementTransferOperator::MultTranspose not "
1426 "implemented for dim = "
1435 :
Operator(hFESpace_.GetTrueVSize(), lFESpace_.GetTrueVSize()),
1436 lFESpace(lFESpace_),
1448 if (P) { MFEM_VERIFY(R,
"Both P and R have to be not NULL") }
1464 delete localTransferOperator;
1472 localTransferOperator->
Mult(tmpL, tmpH);
1477 localTransferOperator->
Mult(x, tmpH);
1482 localTransferOperator->
Mult(x, y);
1490 R->MultTranspose(x, tmpH);
1496 R->MultTranspose(x, tmpH);
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for all finite elements.
virtual ~InterpolationGridTransfer()
const Operator & MakeTrueOperator(FiniteElementSpace &fes_in, FiniteElementSpace &fes_out, const Operator &oper, OperatorHandle &t_oper)
int Size() const
Return the logical size of the array.
void SetSubVector(const Array< int > &dofs, const double value)
Set the entries listed in dofs to the given value.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
void AddMultVWt(const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += v w^t.
SparseMatrix * RefinementMatrix_main(const int coarse_ndofs, const Table &coarse_elem_dof, const Table *coarse_elem_fos, const DenseTensor localP[]) const
int GetNDofs() const
Returns number of degrees of freedom.
Class for an integration rule - an Array of IntegrationPoint.
virtual void MultTranspose(const Vector &x, Vector &y) const override
Restriction by applying the transpose of the Mult method.
const SparseMatrix * GetConformingProlongation() const
The returned SparseMatrix is owned by the FiniteElementSpace.
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
Data type for scaled Jacobi-type smoother of sparse matrix.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
virtual void Prolongate(const Vector &x, Vector &y) const
virtual const SparseMatrix * GetHpRestrictionMatrix() const
The returned SparseMatrix is owned by the FiniteElementSpace.
BilinearFormIntegrator * mass_integ
Ownership depends on own_mass_integ.
Tensor product representation using 1D matrices/tensors with dimensions using 1D number of quadrature...
L2ProjectionH1Space(const FiniteElementSpace &fes_ho_, const FiniteElementSpace &fes_lor_)
void SetRow(int r, const double *row)
virtual ~TensorProductPRefinementTransferOperator()
Destructor.
Field is discontinuous across element interfaces.
FiniteElementSpace & dom_fes
Domain FE space.
virtual int GetContType() const =0
Matrix-free transfer operator between finite element spaces on the same mesh.
void SetSize(int s)
Resize the vector to size s.
static int DecodeDof(int dof)
Helpers to remove encoded sign from a DOF.
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().
virtual void Mult(const Vector &x, Vector &y) const
Pointer to an Operator of a specified type.
int * GetJ()
Return the array J.
virtual void MultTranspose(const Vector &x, Vector &y) const override
Restriction by applying the transpose of the Mult method.
void Copy(Array ©) const
Create a copy of the internal array to the provided copy.
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
void GetGeometries(int dim, Array< Geometry::Type > &el_geoms) const
Return all element geometries of the given dimension present in the mesh.
int nqpt
Number of quadrature points. When mode is TENSOR, this is the 1D number.
Data type dense matrix using column-major storage.
int Size() const
Returns the size of the vector.
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
virtual ~TransferOperator()
Destructor.
Operator::Type oper_type
Desired Operator::Type for the construction of all operators defined by the underlying transfer algor...
int ndof
Number of degrees of freedom = number of basis functions. When mode is TENSOR, this is the 1D number...
int * GetI()
Return the array I.
~TrueTransferOperator()
Destructor.
void ElemMixedMass(Geometry::Type geom, const FiniteElement &fe_ho, const FiniteElement &fe_lor, ElementTransformation *el_tr, IntegrationPointTransformation &ip_tr, DenseMatrix &M_mixed_el) const
int GetNE() const
Returns number of elements.
virtual void Mult(const Vector &x, Vector &y) const override
Interpolation or prolongation of a vector x corresponding to the coarse space to the vector y corresp...
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
Abstract parallel finite element space.
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
void GetInverseMatrix(DenseMatrix &Ainv) const
Compute and return the inverse matrix in Ainv.
virtual const Operator & ForwardOperator()
Return an Operator that transfers GridFunctions from the domain FE space to GridFunctions in the rang...
void Factor()
Factor the current DenseMatrix, *a.
double * GetData() const
Returns the matrix data array.
HypreParMatrix * ParMult(const HypreParMatrix *A, const HypreParMatrix *B, bool own_matrix)
Geometry::Type GetElementBaseGeometry(int i) const
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
void BuildHo2Lor(int nel_ho, int nel_lor, const CoarseFineTransformations &cf_tr)
virtual ~PRefinementTransferOperator()
Destructor.
virtual void Mult(const Vector &x, Vector &y) const
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
virtual void ProlongateTranspose(const Vector &x, Vector &y) const
Derefinement operator, used by the friend class InterpolationGridTransfer.
FiniteElementSpace & ran_fes
Range FE space.
const SparseMatrix * GetConformingRestriction() const
The returned SparseMatrix is owned by the FiniteElementSpace.
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
ID for class SparseMatrix.
int GetNE() const
Returns number of elements in the mesh.
const FiniteElementSpace & fes_ho
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
virtual const Operator & BackwardOperator()
Return an Operator that transfers GridFunctions from the range FE space back to GridFunctions in the ...
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
General product operator: x -> (A*B)(x) = A(B(x)).
ID for the base class Operator, i.e. any type.
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
virtual void MultTranspose(const Vector &x, Vector &y) const override
Restriction by applying the transpose of the Mult method.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Mesh * GetMesh() const
Returns the mesh.
OperatorHandle F
Forward, coarse-to-fine, operator.
virtual void MultTranspose(const Vector &x, Vector &y) const
GridTransfer(FiniteElementSpace &dom_fes_, FiniteElementSpace &ran_fes_)
void GetRow(int r, Vector &row) const
static MemoryType GetMemoryType()
(DEPRECATED) Equivalent to GetDeviceMemoryType().
void SetMaxIter(int max_it)
TensorProductPRefinementTransferOperator(const FiniteElementSpace &lFESpace_, const FiniteElementSpace &hFESpace_)
Constructs a transfer operator from lFESpace to hFESpace which have different FE collections.
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...
HypreParMatrix * Dof_TrueDof_Matrix() const
The true dof-to-dof interpolation matrix.
virtual const Operator * GetProlongationMatrix() const
The returned Operator is owned by the FiniteElementSpace.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
void Restriction2D(const int NE, const int D1D, const int Q1D, const Vector &localH, Vector &localL, const Array< double > &Bt, const Vector &mask)
virtual void SetAbsTol(double p_atol_)
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
L2Projection(const FiniteElementSpace &fes_ho_, const FiniteElementSpace &fes_lor_)
int GetVDim() const
Returns vector dimension.
void AddElementVector(const Array< int > &dofs, const Vector &elemvect)
Add elements of the elemvect Vector to the entries listed in dofs. Negative dof values cause the -dof...
void AddSubMatrix(const Array< int > &rows, const Array< int > &cols, const DenseMatrix &subm, int skip_zeros=1)
Operator * Ptr() const
Access the underlying Operator pointer.
virtual void Prolongate(const Vector &x, Vector &y) const
virtual DofTransformation * GetElementDofs(int elem, Array< int > &dofs) const
Returns indices of degrees of freedom of element 'elem'.
void GetTransferOperator(const FiniteElementSpace &coarse_fes, OperatorHandle &T) const
Construct and return an Operator that can be used to transfer GridFunction data from coarse_fes...
OperatorHandle B
Backward, fine-to-coarse, operator.
void GetLocalRefinementMatrices(Geometry::Type geom, DenseTensor &localP) const
List of mesh geometries stored as Array<Geometry::Type>.
virtual const Operator & BackwardOperator()
Return an Operator that transfers GridFunctions from the range FE space back to GridFunctions in the ...
void SetMassIntegrator(BilinearFormIntegrator *mass_integ_, bool own_mass_integ_=true)
Assign a mass integrator to be used in the construction of the backward, fine-to-coarse, transfer operator.
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i-th element.
Array< double > Bt
Transpose of B.
HYPRE_BigInt * GetTrueDofOffsets() const
double p(const Vector &x, double t)
virtual void MultTranspose(const Vector &x, Vector &y) const override
Restriction by applying the transpose of the Mult method.
void Transpose()
(*this) = (*this)^t
ComplexDenseMatrix * MultAtB(const ComplexDenseMatrix &A, const ComplexDenseMatrix &B)
Multiply the complex conjugate transpose of a matrix A with a matrix B. A^H*B.
Matrix-free transfer operator between finite element spaces.
Operator that converts FiniteElementSpace L-vectors to E-vectors.
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.
virtual void MultTranspose(const Vector &x, Vector &y) const
Matrix-free transfer operator between finite element spaces on the same mesh exploiting the tensor pr...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
virtual void Mult(const Vector &x, Vector &y) const override
Interpolation or prolongation of a vector x corresponding to the coarse space to the vector y corresp...
L2Prolongation * B
Backward, fine-to-coarse, operator.
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
void Restriction3D(const int NE, const int D1D, const int Q1D, const Vector &localH, Vector &localL, const Array< double > &Bt, const Vector &mask)
void Mult(const double *x, double *y) const
Matrix vector multiplication with the inverse of dense matrix.
Structure representing the matrices/tensors needed to evaluate (in reference space) the values...
bool own_mass_integ
Ownership flag for mass_integ.
const CoarseFineTransformations & GetRefinementTransforms()
Vector & Set(const double a, const Vector &x)
(*this) = a * x
L2Projection * F
Forward, coarse-to-fine, operator.
Array< double > B
Basis functions evaluated at quadrature points.
const Array< int > & GetDofMap() const
Get an Array<int> that maps lexicographically ordered indices to the indices of the respective nodes/...
virtual const DofToQuad & GetDofToQuad(const IntegrationRule &ir, DofToQuad::Mode mode) const
Return a DofToQuad structure corresponding to the given IntegrationRule using the given DofToQuad::Mo...
virtual const Operator & ForwardOperator()
Return an Operator that transfers GridFunctions from the domain FE space to GridFunctions in the rang...
virtual double * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
Class for integration point with weight.
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
GridFunction interpolation operator applicable after mesh refinement.
virtual void Mult(const Vector &x, Vector &y) const override
Interpolation or prolongation of a vector x corresponding to the coarse space to the vector y corresp...
SparseMatrix * TransposeMult(const SparseMatrix &A, const SparseMatrix &B)
C = A^T B.
virtual void ProlongateTranspose(const Vector &x, Vector &y) const
const Table * GetElementToFaceOrientationTable() const
const FiniteElementSpace & fes_lor
General triple product operator x -> A*B*C*x, with ownership of the factors.
PRefinementTransferOperator(const FiniteElementSpace &lFESpace_, const FiniteElementSpace &hFESpace_)
Constructs a transfer operator from lFESpace to hFESpace which have different FE collections.
TrueTransferOperator(const FiniteElementSpace &lFESpace_, const FiniteElementSpace &hFESpace_)
Constructs a transfer operator working on true degrees of freedom from lFESpace to hFESpace...
virtual ~L2ProjectionH1Space()
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
virtual void Mult(const Vector &x, Vector &y) const override
Interpolation or prolongation of a true dof vector x to a true dof vector y.
Lexicographic ordering for tensor-product FiniteElements.
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
const FiniteElementCollection * FEColl() const
void Mult(const double *x, double *y) const
Matrix vector multiplication.
virtual ~L2ProjectionGridTransfer()
ID for class HypreParMatrix.
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
void CopyMN(const DenseMatrix &A, int m, int n, int Aro, int Aco)
Copy the m x n submatrix of A at row/col offsets Aro/Aco to *this.
const Table & GetElementToDofTable() const
Return a reference to the internal Table that stores the lists of scalar dofs, for each mesh element...
virtual void GetTransferMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Return interpolation matrix, I, which maps dofs from a coarse element, fe, to the fine dofs on this f...
Field is continuous across element interfaces.
HypreParMatrix * LeftDiagMult(const SparseMatrix &D, HYPRE_BigInt *row_starts=NULL) const
Multiply the HypreParMatrix on the left by a block-diagonal parallel matrix D and return the result a...
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
Wrapper for hypre's ParCSR matrix class.
virtual const SparseMatrix * GetRestrictionMatrix() const
The returned SparseMatrix is owned by the FiniteElementSpace.
Rank 3 tensor (array of matrices)
L2ProjectionL2Space(const FiniteElementSpace &fes_ho_, const FiniteElementSpace &fes_lor_)
virtual const Operator * GetRestrictionOperator() const
An abstract operator that performs the same action as GetRestrictionMatrix.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
void Prolongation2D(const int NE, const int D1D, const int Q1D, const Vector &localL, Vector &localH, const Array< double > &B, const Vector &mask)
virtual void SetRelTol(double p_rtol_)
virtual const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
TransferOperator(const FiniteElementSpace &lFESpace, const FiniteElementSpace &hFESpace)
Constructs a transfer operator from lFESpace to hFESpace.
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims...dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
void Prolongation3D(const int NE, const int D1D, const int Q1D, const Vector &localL, Vector &localH, const Array< double > &B, const Vector &mask)
void DofsToVDofs(Array< int > &dofs, int ndofs=-1) const