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]]);
182 MFEM_ABORT(
"Operator::Type is not supported: " <<
oper_type);
212 MFEM_ABORT(
"unknown type of FE space");
223 MFEM_ABORT(
"Operator::Type is not supported: " <<
oper_type);
232 :
Operator(fes_lor_.GetVSize(), fes_ho_.GetVSize()),
242 ho2lor.MakeI(nel_ho);
243 for (
int ilor = 0; ilor < nel_lor; ++ilor)
246 ho2lor.AddAColumnInRow(iho);
249 for (
int ilor = 0; ilor < nel_lor; ++ilor)
252 ho2lor.AddConnection(iho, ilor);
290 int nel_ho = mesh_ho->
GetNE();
291 int nel_lor = mesh_lor->
GetNE();
294 if (nel_ho == 0) {
return; }
301 for (
int ig = 0; ig < geoms.
Size(); ++ig)
311 for (
int iho = 0; iho < nel_ho; ++iho)
316 offsets[iho+1] = offsets[iho] + fe_ho.
GetDof()*fe_lor.
GetDof()*nref;
327 for (
int iho = 0; iho < nel_ho; ++iho)
336 int ndof_ho = fe_ho.
GetDof();
337 int ndof_lor = fe_lor.
GetDof();
342 DenseMatrix R_iho(&R[offsets[iho]], ndof_lor*nref, ndof_ho);
343 DenseMatrix P_iho(&P[offsets[iho]], ndof_ho, ndof_lor*nref);
345 DenseMatrix Minv_lor(ndof_lor*nref, ndof_lor*nref);
361 for (
int iref = 0; iref < nref; ++iref)
364 int ilor = lor_els[iref];
367 M_lor.
CopyMN(M_lor_el, iref*ndof_lor, iref*ndof_lor);
371 Minv_lor.
CopyMN(M_lor_el, iref*ndof_lor, iref*ndof_lor);
381 ElemMixedMass(geom, fe_ho, fe_lor, el_tr, ip_tr, M_mixed_el);
383 M_mixed.
CopyMN(M_mixed_el, iref*ndof_lor, 0);
390 RtMlorR_inv.
Mult(RtMlor, P_iho);
397 int vdim = fes_ho.GetVDim();
400 for (
int iho = 0; iho < fes_ho.GetNE(); ++iho)
402 int nref = ho2lor.RowSize(iho);
403 int ndof_ho = fes_ho.GetFE(iho)->GetDof();
404 int ndof_lor = fes_lor.GetFE(ho2lor.GetRow(iho)[0])->GetDof();
405 xel_mat.
SetSize(ndof_ho, vdim);
406 yel_mat.
SetSize(ndof_lor*nref, vdim);
407 DenseMatrix R_iho(&R[offsets[iho]], ndof_lor*nref, ndof_ho);
409 fes_ho.GetElementVDofs(iho, vdofs);
413 for (
int iref = 0; iref < nref; ++iref)
415 int ilor = ho2lor.GetRow(iho)[iref];
416 for (
int vd=0; vd<vdim; ++vd)
418 fes_lor.GetElementDofs(ilor, vdofs);
419 fes_lor.DofsToVDofs(vd, vdofs);
429 int vdim = fes_ho.GetVDim();
433 for (
int iho = 0; iho < fes_ho.GetNE(); ++iho)
435 int nref = ho2lor.RowSize(iho);
436 int ndof_ho = fes_ho.GetFE(iho)->GetDof();
437 int ndof_lor = fes_lor.GetFE(ho2lor.GetRow(iho)[0])->GetDof();
438 xel_mat.
SetSize(ndof_lor*nref, vdim);
439 yel_mat.
SetSize(ndof_ho, vdim);
440 DenseMatrix R_iho(&R[offsets[iho]], ndof_lor*nref, ndof_ho);
443 for (
int iref=0; iref<nref; ++iref)
445 int ilor = ho2lor.GetRow(iho)[iref];
446 for (
int vd=0; vd<vdim; ++vd)
448 fes_lor.GetElementDofs(ilor, vdofs);
449 fes_lor.DofsToVDofs(vd, vdofs);
456 fes_ho.GetElementVDofs(iho, vdofs);
464 int vdim = fes_ho.GetVDim();
468 for (
int iho = 0; iho < fes_ho.GetNE(); ++iho)
470 int nref = ho2lor.RowSize(iho);
471 int ndof_ho = fes_ho.GetFE(iho)->GetDof();
472 int ndof_lor = fes_lor.GetFE(ho2lor.GetRow(iho)[0])->GetDof();
473 xel_mat.
SetSize(ndof_lor*nref, vdim);
474 yel_mat.
SetSize(ndof_ho, vdim);
475 DenseMatrix P_iho(&P[offsets[iho]], ndof_ho, ndof_lor*nref);
478 for (
int iref = 0; iref < nref; ++iref)
480 int ilor = ho2lor.GetRow(iho)[iref];
481 for (
int vd = 0; vd < vdim; ++vd)
483 fes_lor.GetElementDofs(ilor, vdofs);
484 fes_lor.DofsToVDofs(vd, vdofs);
491 fes_ho.GetElementVDofs(iho, vdofs);
499 int vdim = fes_ho.GetVDim();
502 for (
int iho = 0; iho < fes_ho.GetNE(); ++iho)
504 int nref = ho2lor.RowSize(iho);
505 int ndof_ho = fes_ho.GetFE(iho)->GetDof();
506 int ndof_lor = fes_lor.GetFE(ho2lor.GetRow(iho)[0])->GetDof();
507 xel_mat.
SetSize(ndof_ho, vdim);
508 yel_mat.
SetSize(ndof_lor*nref, vdim);
509 DenseMatrix P_iho(&P[offsets[iho]], ndof_ho, ndof_lor*nref);
511 fes_ho.GetElementVDofs(iho, vdofs);
516 for (
int iref = 0; iref < nref; ++iref)
518 int ilor = ho2lor.GetRow(iho)[iref];
519 for (
int vd=0; vd<vdim; ++vd)
521 fes_lor.GetElementDofs(ilor, vdofs);
522 fes_lor.DofsToVDofs(vd, vdofs);
535 int nel_ho = mesh_ho->
GetNE();
536 int nel_lor = mesh_lor->
GetNE();
540 if (nel_ho == 0) {
return; }
547 for (
int ig = 0; ig < geoms.
Size(); ++ig)
562 for (
int iho = 0; iho < nel_ho; ++iho)
570 int nedof_lor = fe_lor.
GetDof();
575 Vector shape_lor(nedof_lor);
578 for (
int iref = 0; iref < nref; ++iref)
580 int ilor = lor_els[iref];
591 ML_el += (shape_lor *= (el_tr->
Weight() * ip_lor.
weight));
598 for (
int i = 0; i < ndof_lor; ++i)
600 ML_inv[i] = 1.0 / ML_inv[i];
615 for (
int iho = 0; iho < nel_ho; ++iho)
628 int nedof_ho = fe_ho.
GetDof();
629 int nedof_lor = fe_lor.
GetDof();
633 for (
int iref = 0; iref < nref; ++iref)
635 int ilor = lor_els[iref];
647 for (
int i = 0; i < nedof_lor; ++i)
650 R_el.
SetRow(i, R_row.
Set(ML_inv[dofs_lor[i]], R_row));
679 int vdim = fes_ho.GetVDim();
680 const int ndof_ho = fes_ho.GetNDofs();
681 const int ndof_lor = fes_lor.GetNDofs();
687 for (
int d = 0; d < vdim; ++d)
689 fes_ho.GetVDofs(d, dofs_ho);
690 fes_lor.GetVDofs(d, dofs_lor);
692 R.Mult(x_dim, y_dim);
700 int vdim = fes_ho.GetVDim();
701 const int ndof_ho = fes_ho.GetNDofs();
702 const int ndof_lor = fes_lor.GetNDofs();
708 for (
int d = 0; d < vdim; ++d)
710 fes_ho.GetVDofs(d, dofs_ho);
711 fes_lor.GetVDofs(d, dofs_lor);
713 R.MultTranspose(x_dim, y_dim);
721 int vdim = fes_ho.GetVDim();
722 const int ndof_ho = fes_ho.GetNDofs();
723 const int ndof_lor = fes_lor.GetNDofs();
730 for (
int d = 0; d < vdim; ++d)
732 fes_lor.GetVDofs(d, dofs_lor);
735 M_LH.MultTranspose(x_dim, xbar);
737 pcg.Mult(xbar, y_dim);
738 fes_ho.GetVDofs(d, dofs_ho);
746 int vdim = fes_ho.GetVDim();
747 const int ndof_ho = fes_ho.GetNDofs();
748 const int ndof_lor = fes_lor.GetNDofs();
755 for (
int d = 0; d < vdim; ++d)
757 fes_ho.GetVDofs(d, dofs_ho);
761 pcg.Mult(x_dim, xbar);
762 M_LH.Mult(xbar, y_dim);
763 fes_lor.GetVDofs(d, dofs_lor);
770 pcg.SetRelTol(p_rtol_);
775 pcg.SetAbsTol(p_atol_);
778 void L2ProjectionGridTransfer::L2ProjectionH1Space::AllocR()
780 const Table& elem_dof_ho = fes_ho.GetElementToDofTable();
781 const Table& elem_dof_lor = fes_lor.GetElementToDofTable();
782 const int ndof_ho = fes_ho.GetNDofs();
783 const int ndof_lor = fes_lor.GetNDofs();
786 Transpose(elem_dof_lor, dof_elem_lor, ndof_lor);
788 Mesh* mesh_lor = fes_lor.GetMesh();
792 const int* elem_dof_hoI = elem_dof_ho.
GetI();
793 const int* elem_dof_hoJ = elem_dof_ho.
GetJ();
794 const int* dof_elem_lorI = dof_elem_lor.
GetI();
795 const int* dof_elem_lorJ = dof_elem_lor.
GetJ();
801 dof_used_ho.
SetSize(ndof_ho, -1);
804 for (
int ilor = 0; ilor < ndof_lor; ++ilor)
806 for (
int jlor = dof_elem_lorI[ilor]; jlor < dof_elem_lorI[ilor + 1]; ++jlor)
808 int el_lor = dof_elem_lorJ[jlor];
810 for (
int jho = elem_dof_hoI[iho]; jho < elem_dof_hoI[iho + 1]; ++jho)
812 int dof_ho = elem_dof_hoJ[jho];
813 if (dof_used_ho[dof_ho] != ilor)
815 dof_used_ho[dof_ho] = ilor;
823 Table dof_lor_dof_ho;
824 dof_lor_dof_ho.SetDims(ndof_lor, sizeJ);
826 for (
int i = 0; i < ndof_ho; ++i)
832 int* dof_dofI = dof_lor_dof_ho.GetI();
833 int* dof_dofJ = dof_lor_dof_ho.GetJ();
835 for (
int ilor = 0; ilor < ndof_lor; ++ilor)
837 dof_dofI[ilor] = sizeJ;
838 for (
int jlor = dof_elem_lorI[ilor]; jlor < dof_elem_lorI[ilor + 1]; ++jlor)
840 int el_lor = dof_elem_lorJ[jlor];
842 for (
int jho = elem_dof_hoI[iho]; jho < elem_dof_hoI[iho + 1]; ++jho)
844 int dof_ho = elem_dof_hoJ[jho];
845 if (dof_used_ho[dof_ho] != ilor)
847 dof_used_ho[dof_ho] = ilor;
848 dof_dofJ[sizeJ] = dof_ho;
855 dof_lor_dof_ho.SortRows();
856 double* data = Memory<double>(dof_dofI[ndof_lor]);
858 R = SparseMatrix(dof_dofI, dof_dofJ, data, ndof_lor, ndof_ho,
862 dof_lor_dof_ho.LoseData();
873 if (!
F) { BuildF(); }
881 if (!
F) { BuildF(); }
887 void L2ProjectionGridTransfer::BuildF()
903 :
Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize())
915 && dynamic_cast<const TensorBasisElement*>(hFESpace_.
GetFE(0)))
940 :
Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize()), lFESpace(lFESpace_),
961 for (
int i = 0; i < mesh->
GetNE(); i++)
967 if (geom != cached_geom)
969 h_fe = hFESpace.
GetFE(i);
970 l_fe = lFESpace.
GetFE(i);
977 for (
int vd = 0; vd < vdim; vd++)
979 l_dofs.
Copy(l_vdofs);
981 h_dofs.
Copy(h_vdofs);
984 loc_prol.
Mult(subX, subY);
1008 int vdim = lFESpace.
GetVDim();
1010 for (
int i = 0; i < mesh->
GetNE(); i++)
1016 if (geom != cached_geom)
1018 h_fe = hFESpace.
GetFE(i);
1019 l_fe = lFESpace.
GetFE(i);
1027 for (
int vd = 0; vd < vdim; vd++)
1029 l_dofs.
Copy(l_vdofs);
1031 h_dofs.
Copy(h_vdofs);
1035 for (
int p = 0;
p < h_dofs.
Size(); ++
p)
1037 if (processed[lFESpace.
DecodeDof(h_dofs[
p])])
1043 loc_prol.
Mult(subX, subY);
1047 for (
int p = 0;
p < h_dofs.
Size(); ++
p)
1049 processed[lFESpace.
DecodeDof(h_dofs[
p])] = 1;
1059 :
Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize()), lFESpace(lFESpace_),
1065 if (mesh->
GetNE() == 0)
1073 MFEM_VERIFY(ltel,
"Low order FE space must be tensor product space");
1077 MFEM_VERIFY(htel,
"High order FE space must be tensor product space");
1090 NE = lFESpace.
GetNE();
1098 elem_restrict_lex_l =
1101 MFEM_VERIFY(elem_restrict_lex_l,
1102 "Low order ElementRestriction not available");
1104 elem_restrict_lex_h =
1107 MFEM_VERIFY(elem_restrict_lex_h,
1108 "High order ElementRestriction not available");
1115 MFEM_VERIFY(dynamic_cast<const ElementRestriction*>(elem_restrict_lex_h),
1116 "High order element restriction is of unsupported type");
1120 ->BooleanMask(mask);
1124 namespace TransferKernels
1139 for (
int dy = 0; dy < D1D; ++dy)
1142 for (
int qy = 0; qy < Q1D; ++qy)
1146 for (
int dx = 0; dx < D1D; ++dx)
1148 const double s = x_(dx, dy, e);
1149 for (
int qx = 0; qx < Q1D; ++qx)
1151 sol_x[qx] += B_(qx, dx) *
s;
1154 for (
int qy = 0; qy < Q1D; ++qy)
1156 const double d2q = B_(qy, dy);
1157 for (
int qx = 0; qx < Q1D; ++qx)
1159 y_(qx, qy, e) += d2q * sol_x[qx];
1163 for (
int qy = 0; qy < Q1D; ++qy)
1165 for (
int qx = 0; qx < Q1D; ++qx)
1167 y_(qx, qy, e) *= m_(qx, qy, e);
1177 auto x_ =
Reshape(localL.
Read(), D1D, D1D, D1D, NE);
1180 auto m_ =
Reshape(mask.
Read(), Q1D, Q1D, Q1D, NE);
1186 for (
int dz = 0; dz < D1D; ++dz)
1189 for (
int qy = 0; qy < Q1D; ++qy)
1191 for (
int qx = 0; qx < Q1D; ++qx)
1193 sol_xy[qy][qx] = 0.0;
1196 for (
int dy = 0; dy < D1D; ++dy)
1199 for (
int qx = 0; qx < Q1D; ++qx)
1203 for (
int dx = 0; dx < D1D; ++dx)
1205 const double s = x_(dx, dy, dz, e);
1206 for (
int qx = 0; qx < Q1D; ++qx)
1208 sol_x[qx] += B_(qx, dx) *
s;
1211 for (
int qy = 0; qy < Q1D; ++qy)
1213 const double wy = B_(qy, dy);
1214 for (
int qx = 0; qx < Q1D; ++qx)
1216 sol_xy[qy][qx] += wy * sol_x[qx];
1220 for (
int qz = 0; qz < Q1D; ++qz)
1222 const double wz = B_(qz, dz);
1223 for (
int qy = 0; qy < Q1D; ++qy)
1225 for (
int qx = 0; qx < Q1D; ++qx)
1227 y_(qx, qy, qz, e) += wz * sol_xy[qy][qx];
1232 for (
int qz = 0; qz < Q1D; ++qz)
1234 for (
int qy = 0; qy < Q1D; ++qy)
1236 for (
int qx = 0; qx < Q1D; ++qx)
1238 y_(qx, qy, qz, e) *= m_(qx, qy, qz, e);
1258 for (
int qy = 0; qy < Q1D; ++qy)
1261 for (
int dx = 0; dx < D1D; ++dx)
1265 for (
int qx = 0; qx < Q1D; ++qx)
1267 const double s = m_(qx, qy, e) * x_(qx, qy, e);
1268 for (
int dx = 0; dx < D1D; ++dx)
1270 sol_x[dx] += Bt_(dx, qx) *
s;
1273 for (
int dy = 0; dy < D1D; ++dy)
1275 const double q2d = Bt_(dy, qy);
1276 for (
int dx = 0; dx < D1D; ++dx)
1278 y_(dx, dy, e) += q2d * sol_x[dx];
1288 auto x_ =
Reshape(localH.
Read(), Q1D, Q1D, Q1D, NE);
1291 auto m_ =
Reshape(mask.
Read(), Q1D, Q1D, Q1D, NE);
1297 for (
int qz = 0; qz < Q1D; ++qz)
1300 for (
int dy = 0; dy < D1D; ++dy)
1302 for (
int dx = 0; dx < D1D; ++dx)
1307 for (
int qy = 0; qy < Q1D; ++qy)
1310 for (
int dx = 0; dx < D1D; ++dx)
1314 for (
int qx = 0; qx < Q1D; ++qx)
1316 const double s = m_(qx, qy, qz, e) * x_(qx, qy, qz, e);
1317 for (
int dx = 0; dx < D1D; ++dx)
1319 sol_x[dx] += Bt_(dx, qx) *
s;
1322 for (
int dy = 0; dy < D1D; ++dy)
1324 const double wy = Bt_(dy, qy);
1325 for (
int dx = 0; dx < D1D; ++dx)
1327 sol_xy[dy][dx] += wy * sol_x[dx];
1331 for (
int dz = 0; dz < D1D; ++dz)
1333 const double wz = Bt_(dz, qz);
1334 for (
int dy = 0; dy < D1D; ++dy)
1336 for (
int dx = 0; dx < D1D; ++dx)
1338 y_(dx, dy, dz, e) += wz * sol_xy[dy][dx];
1361 elem_restrict_lex_l->
Mult(x, localL);
1372 MFEM_ABORT(
"TensorProductPRefinementTransferOperator::Mult not "
1373 "implemented for dim = "
1387 elem_restrict_lex_h->
Mult(x, localH);
1398 MFEM_ABORT(
"TensorProductPRefinementTransferOperator::MultTranspose not "
1399 "implemented for dim = "
1409 :
Operator(hFESpace_.GetTrueVSize(), lFESpace_.GetTrueVSize()),
1410 lFESpace(lFESpace_),
1423 delete localTransferOperator;
1429 localTransferOperator->
Mult(tmpL, 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.
void BuildTranspose() const
Build and store internally the transpose of this matrix which will be used in the methods AddMultTran...
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.
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
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.
FiniteElementSpace & dom_fes
Domain FE space.
virtual int GetContType() const =0
virtual const Operator * GetProlongationMatrix() const
The returned Operator is owned by the FiniteElementSpace.
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.
SparseMatrix * RefinementMatrix_main(const int coarse_ndofs, const Table &coarse_elem_dof, const DenseTensor localP[]) const
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.
virtual void GetElementDofs(int elem, Array< int > &dofs) const
Returns indices of degrees of freedom of element 'elem'.
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 Operator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims...dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
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.
void SetPrintLevel(int print_lvl)
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().
TrueTransferOperator(const ParFiniteElementSpace &lFESpace_, const ParFiniteElementSpace &hFESpace_)
Constructs a transfer operator working on true degrees of freedom from lFESpace to hFESpace...
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
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
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...
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
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.
Field is continuous across element interfaces.
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
virtual const SparseMatrix * GetRestrictionMatrix() const
Get the R matrix which restricts a local dof vector to true dof vector.
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.
void MultTranspose(const Vector &x, Vector &y) const
Multiply a vector with the transposed matrix. y = At * x.
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.
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
void MultAtB(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &AtB)
Multiply the transpose of a matrix A with a matrix B: At*B.
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...
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.
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