37 ConstrainedOperator(CeedOperator oper,
const Array<int> &ess_tdofs_,
40 ~ConstrainedOperator();
41 void Mult(
const Vector& x, Vector& y)
const;
42 CeedOperator GetCeedOperator()
const;
43 const Array<int> &GetEssentialTrueDofs()
const;
48 ceed::Operator *unconstrained_op;
52ConstrainedOperator::ConstrainedOperator(
54 const Array<int> &ess_tdofs_,
56 : ess_tdofs(ess_tdofs_), P(P_)
58 unconstrained_op =
new ceed::Operator(oper);
60 height = width = rap->
Height();
61 bool own_rap = (rap != unconstrained_op);
65ConstrainedOperator::ConstrainedOperator(CeedOperator oper,
67 : ConstrainedOperator(oper, Array<int>(), P_)
70ConstrainedOperator::~ConstrainedOperator()
72 delete constrained_op;
73 delete unconstrained_op;
76void ConstrainedOperator::Mult(
const Vector& x, Vector& y)
const
78 constrained_op->Mult(x, y);
81CeedOperator ConstrainedOperator::GetCeedOperator()
const
83 return unconstrained_op->GetCeedOperator();
86const Array<int> &ConstrainedOperator::GetEssentialTrueDofs()
const
100 CeedSize in_len, out_len;
101 int ierr = CeedOperatorGetActiveVectorLengths(oper, &in_len, &out_len);
103 *size = (CeedInt)in_len;
104 MFEM_VERIFY(in_len == out_len,
"not a square CeedOperator");
105 MFEM_VERIFY(in_len == *size,
"size overflow");
112 CeedOperator ceed_op = op.GetCeedOperator();
113 const Array<int> &ess_tdofs = op.GetEssentialTrueDofs();
119 ierr = CeedVectorCreate(internal::ceed, length, &diagceed); PCeedChk(ierr);
121 ierr = CeedGetPreferredMemType(internal::ceed, &mem); PCeedChk(ierr);
122 if (!Device::Allows(Backend::CUDA) || mem != CEED_MEM_DEVICE)
126 Vector local_diag(length);
127 CeedScalar *ptr = (mem == CEED_MEM_HOST) ? local_diag.
HostWrite() :
128 local_diag.
Write(
true);
129 ierr = CeedVectorSetArray(diagceed, mem, CEED_USE_POINTER, ptr);
131 ierr = CeedOperatorLinearAssembleDiagonal(ceed_op, diagceed,
132 CEED_REQUEST_IMMEDIATE);
134 ierr = CeedVectorTakeArray(diagceed, mem, NULL); PCeedChk(ierr);
149 const int cheb_order = 3;
154 const double jacobi_scale = 0.65;
157 ierr = CeedVectorDestroy(&diagceed); PCeedChk(ierr);
164class AssembledAMG :
public Solver
169 MFEM_ASSERT(P != NULL,
"Provided HypreParMatrix is invalid!");
170 height = width = oper.Height();
173 const Array<int> ess_tdofs = oper.GetEssentialTrueDofs();
175 ierr = CeedOperatorFullAssemble(oper.GetCeedOperator(), &mat_local);
181 op_assembled =
RAP(&hypre_local, P);
183 HypreParMatrix *mat_e = op_assembled->EliminateRowsCols(ess_tdofs);
185 amg =
new HypreBoomerAMG(*op_assembled);
186 amg->SetPrintLevel(0);
189 void Mult(
const Vector &x, Vector &y)
const override { amg->Mult(x, y); }
197 SparseMatrix *mat_local;
198 HypreParMatrix *op_assembled;
209 ho_boundary_ones = 0.0;
210 const int *ho_ess_tdofs_h = ho_ess_tdofs.
HostRead();
211 for (
int i=0; i<ho_ess_tdofs.
Size(); ++i)
213 ho_boundary_ones[ho_ess_tdofs_h[i]] = 1.0;
217 auto lobo = lo_boundary_ones.
HostRead();
218 for (
int i = 0; i < lo_boundary_ones.
Size(); ++i)
222 alg_lo_ess_tdofs.
Append(i);
235 MFEM_ABORT(
"This integrator does not support Ceed!");
243 ierr = CeedCompositeOperatorCreate(internal::ceed, &op); PCeedChk(ierr);
245 MFEM_VERIFY(form.
GetBBFI()->Size() == 0,
246 "Not implemented for this integrator!");
247 MFEM_VERIFY(form.
GetFBFI()->Size() == 0,
248 "Not implemented for this integrator!");
249 MFEM_VERIFY(form.
GetBFBFI()->Size() == 0,
250 "Not implemented for this integrator!");
254 for (
int i = 0; i < bffis->
Size(); ++i)
263 CeedElemRestriction er,
270 ierr = CeedOperatorIsComposite(op, &isComposite); PCeedChk(ierr);
271 MFEM_ASSERT(isComposite,
"");
273 CeedOperator op_coarse;
274 ierr = CeedCompositeOperatorCreate(internal::ceed,
275 &op_coarse); PCeedChk(ierr);
278 CeedOperator *subops;
279#if CEED_VERSION_GE(0, 10, 2)
280 ierr = CeedCompositeOperatorGetNumSub(op, &nsub); PCeedChk(ierr);
281 ierr = CeedCompositeOperatorGetSubList(op, &subops); PCeedChk(ierr);
283 ierr = CeedOperatorGetNumSub(op, &nsub); PCeedChk(ierr);
284 ierr = CeedOperatorGetSubList(op, &subops); PCeedChk(ierr);
286 for (
int isub=0; isub<nsub; ++isub)
288 CeedOperator subop = subops[isub];
289 CeedBasis basis_coarse, basis_c2f;
290 CeedOperator subop_coarse;
292 &basis_c2f, &subop_coarse); PCeedChk(ierr);
295 ierr = CeedBasisDestroy(&basis_coarse); PCeedChk(ierr);
296 ierr = CeedBasisDestroy(&basis_c2f); PCeedChk(ierr);
297 ierr = CeedCompositeOperatorAddSub(op_coarse, subop_coarse);
299 ierr = CeedOperatorDestroy(&subop_coarse); PCeedChk(ierr);
304AlgebraicMultigrid::AlgebraicMultigrid(
311 ceed_operators.
SetSize(nlevels);
320 for (
int ilevel=nlevels-2; ilevel>=0; --ilevel)
324 ceed_operators[ilevel+1],
space.GetCeedElemRestriction(),
325 space.GetCeedCoarseToFine(),
space.GetOrderReduction());
333 for (
int ilevel=0; ilevel<nlevels; ++ilevel)
337 ConstrainedOperator *op =
new ConstrainedOperator(
357 if (P_mat) { smoother =
new AssembledAMG(*op, P_mat); }
373int AlgebraicInterpolation::Initialize(
374 Ceed ceed, CeedBasis basisctof,
375 CeedElemRestriction erestrictu_coarse, CeedElemRestriction erestrictu_fine)
380 ierr = CeedElemRestrictionGetLVectorSize(erestrictu_coarse, &
width);
382 ierr = CeedElemRestrictionGetLVectorSize(erestrictu_fine, &
height);
386 const int bp3_ncompu = 1;
387 CeedQFunction l_qf_restrict, l_qf_prolong;
388 ierr = CeedQFunctionCreateIdentity(ceed, bp3_ncompu, CEED_EVAL_NONE,
389 CEED_EVAL_INTERP, &l_qf_restrict); PCeedChk(ierr);
390 ierr = CeedQFunctionCreateIdentity(ceed, bp3_ncompu, CEED_EVAL_INTERP,
391 CEED_EVAL_NONE, &l_qf_prolong); PCeedChk(ierr);
393 qf_restrict = l_qf_restrict;
394 qf_prolong = l_qf_prolong;
396 CeedVector c_fine_multiplicity;
397 ierr = CeedVectorCreate(ceed,
height, &c_fine_multiplicity); PCeedChk(ierr);
398 ierr = CeedVectorSetValue(c_fine_multiplicity, 0.0); PCeedChk(ierr);
402 ierr = CeedOperatorCreate(ceed, qf_restrict, CEED_QFUNCTION_NONE,
403 CEED_QFUNCTION_NONE, &op_restrict); PCeedChk(ierr);
404 ierr = CeedOperatorSetField(op_restrict,
"input", erestrictu_fine,
405 CEED_BASIS_NONE, CEED_VECTOR_ACTIVE); PCeedChk(ierr);
406 ierr = CeedOperatorSetField(op_restrict,
"output", erestrictu_coarse,
407 basisctof, CEED_VECTOR_ACTIVE); PCeedChk(ierr);
411 ierr = CeedOperatorCreate(ceed, qf_prolong, CEED_QFUNCTION_NONE,
412 CEED_QFUNCTION_NONE, &op_interp); PCeedChk(ierr);
413 ierr = CeedOperatorSetField(op_interp,
"input", erestrictu_coarse,
414 basisctof, CEED_VECTOR_ACTIVE); PCeedChk(ierr);
415 ierr = CeedOperatorSetField(op_interp,
"output", erestrictu_fine,
416 CEED_BASIS_NONE, CEED_VECTOR_ACTIVE); PCeedChk(ierr);
418 ierr = CeedElemRestrictionGetMultiplicity(erestrictu_fine,
419 c_fine_multiplicity); PCeedChk(ierr);
420 ierr = CeedVectorCreate(ceed,
height, &fine_multiplicity_r); PCeedChk(ierr);
422 CeedScalar* fine_r_data;
423 const CeedScalar* fine_data;
424 ierr = CeedVectorGetArrayWrite(fine_multiplicity_r, CEED_MEM_HOST,
425 &fine_r_data); PCeedChk(ierr);
426 ierr = CeedVectorGetArrayRead(c_fine_multiplicity, CEED_MEM_HOST,
427 &fine_data); PCeedChk(ierr);
428 for (CeedSize i = 0; i <
height; ++i)
430 fine_r_data[i] = 1.0 / fine_data[i];
433 ierr = CeedVectorRestoreArray(fine_multiplicity_r, &fine_r_data);
435 ierr = CeedVectorRestoreArrayRead(c_fine_multiplicity, &fine_data);
437 ierr = CeedVectorDestroy(&c_fine_multiplicity); PCeedChk(ierr);
439 ierr = CeedVectorCreate(ceed,
height, &fine_work); PCeedChk(ierr);
441 ierr = CeedVectorCreate(ceed,
height, &v_); PCeedChk(ierr);
442 ierr = CeedVectorCreate(ceed,
width, &u_); PCeedChk(ierr);
447int AlgebraicInterpolation::Finalize()
451 ierr = CeedQFunctionDestroy(&qf_restrict); PCeedChk(ierr);
452 ierr = CeedQFunctionDestroy(&qf_prolong); PCeedChk(ierr);
453 ierr = CeedOperatorDestroy(&op_interp); PCeedChk(ierr);
454 ierr = CeedOperatorDestroy(&op_restrict); PCeedChk(ierr);
455 ierr = CeedVectorDestroy(&fine_multiplicity_r); PCeedChk(ierr);
456 ierr = CeedVectorDestroy(&fine_work); PCeedChk(ierr);
462 Ceed ceed, CeedBasis basisctof,
463 CeedElemRestriction erestrictu_coarse,
464 CeedElemRestriction erestrictu_fine)
467 CeedSize lo_nldofs, ho_nldofs;
468 ierr = CeedElemRestrictionGetLVectorSize(erestrictu_coarse, &lo_nldofs);
470 ierr = CeedElemRestrictionGetLVectorSize(erestrictu_fine,
471 &ho_nldofs); PCeedChk(ierr);
473 width = (int)lo_nldofs;
474 MFEM_VERIFY(ho_nldofs ==
height,
"height overflow");
475 MFEM_VERIFY(lo_nldofs ==
width,
"width overflow");
477 ierr = Initialize(ceed, basisctof, erestrictu_coarse, erestrictu_fine);
484 ierr = CeedVectorDestroy(&v_); PCeedChk(ierr);
485 ierr = CeedVectorDestroy(&u_); PCeedChk(ierr);
488 ierr = CeedBasisDestroy(&basisctof_); PCeedChk(ierr);
499 CeedVectorGetCeed(
a, &ceed);
501 CeedSize length, length2;
502 ierr = CeedVectorGetLength(
a, &length); PCeedChk(ierr);
503 ierr = CeedVectorGetLength(
b, &length2); PCeedChk(ierr);
504 if (length != length2)
506 return CeedError(ceed, 1,
"Vector sizes don't match");
512 mem = CEED_MEM_DEVICE;
519 const CeedScalar *b_data;
520 ierr = CeedVectorGetArray(
a, mem, &a_data); PCeedChk(ierr);
521 ierr = CeedVectorGetArrayRead(
b, mem, &b_data); PCeedChk(ierr);
522 MFEM_VERIFY(
int(length) == length,
"length overflow");
524 {a_data[i] *= b_data[i];});
526 ierr = CeedVectorRestoreArray(
a, &a_data); PCeedChk(ierr);
527 ierr = CeedVectorRestoreArrayRead(
b, &b_data); PCeedChk(ierr);
535 const CeedScalar *in_ptr;
538 ierr = CeedGetPreferredMemType(internal::ceed, &mem); PCeedChk(ierr);
550 ierr = CeedVectorSetArray(u_, mem, CEED_USE_POINTER,
551 const_cast<CeedScalar*
>(in_ptr)); PCeedChk(ierr);
552 ierr = CeedVectorSetArray(v_, mem, CEED_USE_POINTER,
553 out_ptr); PCeedChk(ierr);
555 ierr = CeedOperatorApply(op_interp, u_, v_,
556 CEED_REQUEST_IMMEDIATE); PCeedChk(ierr);
559 ierr = CeedVectorTakeArray(u_, mem,
const_cast<CeedScalar**
>(&in_ptr));
561 ierr = CeedVectorTakeArray(v_, mem, &out_ptr); PCeedChk(ierr);
569 ierr = CeedGetPreferredMemType(internal::ceed, &mem); PCeedChk(ierr);
570 const CeedScalar *in_ptr;
583 ierr = CeedVectorSetArray(v_, mem, CEED_USE_POINTER,
584 const_cast<CeedScalar*
>(in_ptr)); PCeedChk(ierr);
585 ierr = CeedVectorSetArray(u_, mem, CEED_USE_POINTER,
586 out_ptr); PCeedChk(ierr);
589 ierr = CeedVectorGetLength(v_, &length); PCeedChk(ierr);
591 const CeedScalar *multiplicitydata;
592 CeedScalar *workdata;
593 ierr = CeedVectorGetArrayRead(fine_multiplicity_r, mem,
594 &multiplicitydata); PCeedChk(ierr);
595 ierr = CeedVectorGetArrayWrite(fine_work, mem, &workdata); PCeedChk(ierr);
596 MFEM_VERIFY((
int)length == length,
"length overflow");
598 {workdata[i] = in_ptr[i] * multiplicitydata[i];});
599 ierr = CeedVectorRestoreArrayRead(fine_multiplicity_r,
601 ierr = CeedVectorRestoreArray(fine_work, &workdata); PCeedChk(ierr);
603 ierr = CeedOperatorApply(op_restrict, fine_work, u_,
604 CEED_REQUEST_IMMEDIATE); PCeedChk(ierr);
606 ierr = CeedVectorTakeArray(v_, mem,
const_cast<CeedScalar**
>(&in_ptr));
608 ierr = CeedVectorTakeArray(u_, mem, &out_ptr); PCeedChk(ierr);
615 int current_order = order;
616 while (current_order > 0)
619 current_order = current_order/2;
634 ceed_interpolations.SetSize(nlevels-1);
635 R_tr.SetSize(nlevels-1);
639 current_order = order;
641 Ceed ceed = internal::ceed;
643 CeedElemRestriction er = fine_er;
655 for (
int ilevel=nlevels-2; ilevel>=0; --ilevel)
657 const int order_reduction = current_order - (current_order/2);
664 *
fespaces[ilevel+1], er, current_order,
dim, order_reduction, gc);
672 *
fespaces[ilevel+1], er, current_order,
dim, order_reduction);
674 current_order = current_order/2;
678 space->GetCeedCoarseToFine(),
679 space->GetCeedElemRestriction(),
691 prolongations[ilevel] = ceed_interpolations[ilevel]->SetupRAP(
692 space->GetProlongationMatrix(), R_tr[ilevel]);
696 er =
space->GetCeedElemRestriction();
702 CeedElemRestriction fine_er,
706) : order_reduction(order_reduction_)
721 MFEM_VERIFY(
ndofs == ndofs_,
"ndofs overflow");
738 CeedElemRestriction fine_er,
741 int order_reduction_,
749 MFEM_VERIFY((
int)lsize == lsize,
"size overflow");
756 group_ldof.
MakeI(group_ldof_fine.
Size());
757 for (
int g=1; g<group_ldof_fine.
Size(); ++g)
759 int nldof_fine_g = group_ldof_fine.
RowSize(g);
760 const int *ldof_fine_g = group_ldof_fine.
GetRow(g);
761 for (
int i=0; i<nldof_fine_g; ++i)
763 int icoarse =
dof_map[ldof_fine_g[i]];
767 ldof_group[icoarse] = g;
772 for (
int g=1; g<group_ldof_fine.
Size(); ++g)
774 int nldof_fine_g = group_ldof_fine.
RowSize(g);
775 const int *ldof_fine_g = group_ldof_fine.
GetRow(g);
776 for (
int i=0; i<nldof_fine_g; ++i)
778 int icoarse =
dof_map[ldof_fine_g[i]];
790 for (
int i=0; i<lsize; ++i)
792 int g = ldof_group[i];
795 ldof_ltdof[i] = ltsize;
800 gc->
Bcast(ldof_ltdof);
803 for (
int j=0; j<lsize; ++j)
807 int i = ldof_ltdof[j];
826 if (P_mat) {
return P_mat; }
829 MFEM_VERIFY(pmesh != NULL,
"");
833 int ltsize = P->
Width();
837 MPI_Comm comm = pmesh->
GetComm();
841 if (HYPRE_AssumedPartitionCheck())
845 MPI_Request *requests =
new MPI_Request[2*nsize];
846 MPI_Status *statuses =
new MPI_Status[2*nsize];
847 tdof_nb_offsets.
SetSize(nsize+1);
848 tdof_nb_offsets[0] = tdof_offsets[0];
851 int request_counter = 0;
852 for (
int i = 1; i <= nsize; i++)
854 MPI_Irecv(&tdof_nb_offsets[i], 1, HYPRE_MPI_INT,
856 &requests[request_counter++]);
858 for (
int i = 1; i <= nsize; i++)
860 MPI_Isend(&tdof_nb_offsets[0], 1, HYPRE_MPI_INT,
862 &requests[request_counter++]);
864 MPI_Waitall(request_counter, requests, statuses);
885 i_diag[0] = i_offd[0] = 0;
886 diag_counter = offd_counter = 0;
887 for (
int i_ldof = 0; i_ldof < lsize; i_ldof++)
889 int g = ldof_group[i_ldof];
890 int i_ltdof = ldof_ltdof[i_ldof];
893 j_diag[diag_counter++] = i_ltdof;
898 if (HYPRE_AssumedPartitionCheck())
909 cmap_j_offd[offd_counter].one = global_tdof_number;
910 cmap_j_offd[offd_counter].two = offd_counter;
913 i_diag[i_ldof+1] = diag_counter;
914 i_offd[i_ldof+1] = offd_counter;
919 for (
int i = 0; i < offd_counter; i++)
921 cmap[i] = cmap_j_offd[i].one;
922 j_offd[cmap_j_offd[i].two] = i;
927 row_starts, col_starts,
928 i_diag, j_diag, i_offd, j_offd,
954 "AlgebraicSolver requires a Ceed device");
957 "AlgebraicSolver requires partial assembly or fully matrix-free.");
959 "AlgebraicSolver requires tensor product basis functions.");
964 MFEM_ABORT(
"AlgebraicSolver requires Ceed support");
979 multigrid->
Mult(x, y);
const T * HostRead() const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), false).
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Square Operator for imposing essential boundary conditions using only the action, Mult(),...
static bool Allows(unsigned long b_mask)
Return true if any of the backends in the backend mask, b_mask, are allowed.
int GetNumLevels() const
Returns the number of levels in the hierarchy.
Operator * GetProlongationAtLevel(int level) const
Returns the prolongation operator from the finite element space at level to the finite element space ...
Array< bool > ownedProlongations
virtual const FiniteElementSpace & GetFESpaceAtLevel(int level) const
Returns the finite element space at the given level.
Array< bool > ownedMeshes
Array< Operator * > prolongations
Array< FiniteElementSpace * > fespaces
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetOrder(int i) const
Returns the polynomial degree of the i'th finite element.
int ndofs
Number of degrees of freedom. Number of unknowns is ndofs * vdim.
Mesh * mesh
The mesh that FE space lives on (not owned).
Mesh * GetMesh() const
Returns the mesh.
Geometric multigrid associated with a hierarchy of finite element spaces.
Array< Array< int > * > essentialTrueDofs
const FiniteElementSpaceHierarchy & fespaces
Communicator performing operations within groups defined by a GroupTopology with arbitrary-size data ...
Table & GroupLDofTable()
Fill-in the returned Table reference to initialize the GroupCommunicator then call Finalize().
const GroupTopology & GetGroupTopology()
Get a reference to the associated GroupTopology object.
void Bcast(T *ldata, int layout) const
Broadcast within each group where the master is the root.
void SetLTDofTable(const Array< int > &ldof_ltdof)
Initialize the internal group_ltdof Table.
void Finalize()
Allocate internal buffers after the GroupLDofTable is defined.
int GetNeighborRank(int i) const
Return the MPI rank of neighbor 'i'.
bool IAmMaster(int g) const
Return true if I am master for group 'g'.
int GetGroupMaster(int g) const
Return the neighbor index of the group master for a given group. Neighbor 0 is the local processor.
int GetGroupMasterRank(int g) const
Return the rank of the group master for group 'g'.
int GetNumNeighbors() const
Return the number of neighbors including the local processor.
Wrapper for hypre's ParCSR matrix class.
HYPRE_BigInt GetGlobalNumRows() const
Return the global number of rows.
MPI_Comm GetComm() const
MPI communicator.
HYPRE_BigInt * RowPart()
Returns the row partitioning.
Class used by MFEM to store pointers to host and/or device memory.
int Dimension() const
Dimension of the reference space used within the elements.
void AddLevel(Operator *op, Solver *smoother, bool ownOperator, bool ownSmoother)
Adds a level to the multigrid operator hierarchy.
virtual void Mult(const Vector &x, Vector &y) const override
Application of the multigrid as a preconditioner.
Chebyshev accelerated smoothing with given vector, no matrix necessary.
Jacobi smoothing for a given bilinear form (no matrix necessary).
int width
Dimension of the input / number of columns in the matrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Operator * SetupRAP(const Operator *Pi, const Operator *Po)
Returns RAP Operator of this, using input/output Prolongation matrices Pi corresponds to "P",...
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 ...
Abstract parallel finite element space.
GroupCommunicator & GroupComm()
Return a reference to the internal GroupCommunicator (on VDofs)
HypreParMatrix * Dof_TrueDof_Matrix() const
The true dof-to-dof interpolation matrix.
Class for parallel meshes.
void GenerateOffsets(int N, HYPRE_BigInt loc_sizes[], Array< HYPRE_BigInt > *offsets[]) const
virtual void SetOperator(const Operator &op)=0
Set/update the solver for the given operator.
virtual void Finalize(int skip_zeros=1)
Finalize the matrix initialization, switching the storage format from LIL to CSR.
void Set(const int i, const int j, const real_t val)
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
void AddConnection(int r, int c)
void MakeI(int nrows)
Next 7 methods are used together with the default constructor.
int Size() const
Returns the number of TYPE I elements.
void AddAColumnInRow(int r)
The transpose of a given operator. Switches the roles of the methods Mult() and MultTranspose().
virtual const real_t * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
virtual real_t * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
Memory< real_t > & GetMemory()
Return a reference to the Memory object used by the Vector.
void NewMemoryAndSize(const Memory< real_t > &mem, int s, bool own_mem)
Reset the Vector to use the given external Memory mem and size s.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
virtual real_t * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
virtual real_t * HostReadWrite()
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), false).
virtual real_t * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
A way to use algebraic levels in a Multigrid object.
AlgebraicCoarseSpace(FiniteElementSpace &fine_fes, CeedElemRestriction fine_er, int order, int dim, int order_reduction_)
CeedElemRestriction ceed_elem_restriction
Multigrid interpolation operator in Ceed framework.
~AlgebraicInterpolation()
virtual void Mult(const mfem::Vector &x, mfem::Vector &y) const
Operator application: y=A(x).
AlgebraicInterpolation(Ceed ceed, CeedBasis basisctof, CeedElemRestriction erestrictu_coarse, CeedElemRestriction erestrictu_fine)
virtual void MultTranspose(const mfem::Vector &x, mfem::Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Extension of Multigrid object to algebraically generated coarse spaces.
virtual void SetOperator(const mfem::Operator &op) override
Not supported for multigrid.
AlgebraicSolver(BilinearForm &form, const Array< int > &ess_tdofs)
Constructs algebraic multigrid hierarchy and solver.
void SetOperator(const mfem::Operator &op)
Set/update the solver for the given operator.
void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
Hierarchy of AlgebraicCoarseSpace objects for use in Multigrid object.
AlgebraicSpaceHierarchy(FiniteElementSpace &fespace)
Construct hierarchy based on finest FiniteElementSpace.
AlgebraicCoarseSpace & GetAlgebraicCoarseSpace(int level)
CeedOperator & GetCeedOperator()
Parallel version of AlgebraicCoarseSpace.
ParAlgebraicCoarseSpace(FiniteElementSpace &fine_fes, CeedElemRestriction fine_er, int order, int dim, int order_reduction_, GroupCommunicator *gc_fine)
GroupCommunicator * GetGroupCommunicator() const
~ParAlgebraicCoarseSpace()
HypreParMatrix * GetProlongationHypreParMatrix()
int CeedBasisATPMGCoarseToFine(Ceed ceed, int P1d, int dim, int order_reduction, CeedBasis *basisc2f)
Create coarse-to-fine basis, given number of input nodes and order reduction.
Solver * BuildSmootherFromCeed(ConstrainedOperator &op, bool chebyshev)
void CoarsenEssentialDofs(const mfem::Operator &interp, const Array< int > &ho_ess_tdofs, Array< int > &alg_lo_ess_tdofs)
void InitRestriction(const FiniteElementSpace &fes, Ceed ceed, CeedElemRestriction *restr)
Initialize a CeedElemRestriction for non-mixed meshes.
int CeedOperatorGetSize(CeedOperator oper, CeedInt *size)
CeedOperator CreateCeedCompositeOperatorFromBilinearForm(BilinearForm &form)
int CeedVectorPointwiseMult(CeedVector a, const CeedVector b)
int CeedATPMGOperator(CeedOperator oper, int order_reduction, CeedElemRestriction coarse_er, CeedBasis coarse_basis_in, CeedBasis basis_ctof_in, CeedOperator *out)
CeedOperator CoarsenCeedCompositeOperator(CeedOperator op, CeedElemRestriction er, CeedBasis c2f, int order_reduction)
void AddToCompositeOperator(BilinearFormIntegrator *integ, CeedOperator op)
int CeedATPMGElemRestriction(int order, int order_reduction, CeedElemRestriction er_in, CeedElemRestriction *er_out, CeedInt *&dof_map)
Take given (high-order) CeedElemRestriction and make a new CeedElemRestriction, which corresponds to ...
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void RAP(const DenseMatrix &A, const DenseMatrix &P, DenseMatrix &RAP)
bool DeviceCanUseCeed()
Function that determines if a CEED kernel should be used, based on the current mfem::Device configura...
bool UsesTensorBasis(const FiniteElementSpace &fes)
Return true if the mesh contains only one topology and the elements are tensor elements.
void SortPairs(Pair< A, B > *pairs, int size)
Sort an array of Pairs with respect to the first element.
void forall(int N, lambda &&body)
@ CUDA
[device] CUDA backend. Enabled when MFEM_USE_CUDA = YES.
@ DEVICE_MASK
Biwise-OR of all device backends.