70 "Number of columns mismatch in Operator::Mult!");
71 for (
int i = 0; i < X.
Size(); i++)
73 MFEM_ASSERT(X[i] && Y[i],
"Missing Vector in Operator::Mult!");
82 "Number of columns mismatch in Operator::MultTranspose!");
83 for (
int i = 0; i < X.
Size(); i++)
85 MFEM_ASSERT(X[i] && Y[i],
"Missing Vector in Operator::MultTranspose!");
94 "Number of columns mismatch in Operator::AddMult!");
95 for (
int i = 0; i < X.
Size(); i++)
97 MFEM_ASSERT(X[i] && Y[i],
"Missing Vector in Operator::AddMult!");
106 "Number of columns mismatch in Operator::AddMultTranspose!");
107 for (
int i = 0; i < X.
Size(); i++)
109 MFEM_ASSERT(X[i] && Y[i],
"Missing Vector in Operator::AddMultTranspose!");
222 trial_tdof_list, test_tdof_list,
254 if (n == 0) { n =
width; }
255 if (m == 0) { m =
height; }
260 os << setiosflags(ios::scientific | ios::showpos);
261 for (
int i = 0; i < n; i++)
265 for (
int j = 0; j < m; j++)
269 os << j+1 <<
" " << i+1 <<
" " << y(j) <<
'\n';
284 mfem_error(
"TimeDependentOperator::ExplicitMult() is not overridden!");
290 mfem_error(
"TimeDependentOperator::ImplicitMult() is not overridden!");
295 mfem_error(
"TimeDependentOperator::Mult() is not overridden!");
301 mfem_error(
"TimeDependentOperator::ImplicitSolve() is not overridden!");
307 mfem_error(
"TimeDependentOperator::GetImplicitGradient() is "
314 mfem_error(
"TimeDependentOperator::GetExplicitGradient() is "
323 mfem_error(
"TimeDependentOperator::SUNImplicitSetup() is not overridden!");
329 mfem_error(
"TimeDependentOperator::SUNImplicitSolve() is not overridden!");
335 mfem_error(
"TimeDependentOperator::SUNMassSetup() is not overridden!");
341 mfem_error(
"TimeDependentOperator::SUNMassSolve() is not overridden!");
347 mfem_error(
"TimeDependentOperator::SUNMassMult() is not overridden!");
356 mfem_error(
"SecondOrderTimeDependentOperator::Mult() is not overridden!");
365 mfem_error(
"SecondOrderTimeDependentOperator::ImplicitSolve() is not overridden!");
370 bool ownA,
bool ownB)
371 :
Operator(A->Height(), A->Width()),
372 A(A), B(B),
alpha(
alpha), beta(beta), ownA(ownA), ownB(ownB),
376 "incompatible Operators: different widths\n"
377 <<
"A->Width() = " << A->
Width()
378 <<
", B->Width() = " << B->
Width() );
380 "incompatible Operators: different heights\n"
381 <<
"A->Height() = " << A->
Height()
382 <<
", B->Height() = " << B->
Height() );
390 "Operator A of a SumOperator should not be in iterative mode");
395 "Operator B of a SumOperator should not be in iterative mode");
403 if (ownA) {
delete A; }
404 if (ownB) {
delete B; }
408 bool ownA,
bool ownB)
409 :
Operator(A->Height(), B->Width()),
410 A(A), B(B), ownA(ownA), ownB(ownB), z(A->Width())
413 "incompatible Operators: A->Width() = " << A->
Width()
414 <<
", B->Height() = " << B->
Height());
421 "Operator B of a ProductOperator should not be in iterative mode");
428 if (ownA) {
delete A; }
429 if (ownB) {
delete B; }
435 :
Operator(Rt_.Width(), P_.Width()), Rt(Rt_), A(A_), P(P_)
438 "incompatible Operators: Rt.Height() = " << Rt.
Height()
439 <<
", A.Height() = " << A.
Height());
441 "incompatible Operators: A.Width() = " << A.
Width()
442 <<
", P.Height() = " << P.
Height());
445 const Solver* SolverA =
dynamic_cast<const Solver*
>(&A);
449 "Operator A of an RAPOperator should not be in iterative mode");
452 const Solver* SolverP =
dynamic_cast<const Solver*
>(&P);
456 "Operator P of an RAPOperator should not be in iterative mode");
469 bool ownA,
bool ownB,
bool ownC)
472 , ownA(ownA), ownB(ownB), ownC(ownC)
475 "incompatible Operators: A->Width() = " << A->
Width()
476 <<
", B->Height() = " << B->
Height());
478 "incompatible Operators: B->Width() = " << B->
Width()
479 <<
", C->Height() = " << C->
Height());
486 "Operator B of a TripleProductOperator should not be in iterative mode");
493 "Operator C of a TripleProductOperator should not be in iterative mode");
505 if (ownA) {
delete A; }
506 if (ownB) {
delete B; }
507 if (ownC) {
delete C; }
514 :
Operator(A->Height(), A->Width()), A(A), own_A(own_A_),
515 diag_policy(diag_policy_)
542 const int id = idx[i];
549 const int id = idx[i];
554 MFEM_ABORT(
"unknown diagonal policy");
569 const int id = idx[i];
581 const int id = idx[i];
587 const bool transpose)
const
608 mfem::forall(csz, [=] MFEM_HOST_DEVICE (
int i) { d_z[idx[i]] = 0.0; });
627 const int id = idx[i];
634 const int id = idx[i];
649 const bool transpose)
const
670 mfem::forall(csz, [=] MFEM_HOST_DEVICE (
int i) { d_z[idx[i]] = 0.0; });
689 const int id = idx[i];
696 const int id = idx[i];
702 mfem_error(
"ConstrainedOperator::AbsMult #1");
705 mfem_error(
"ConstrainedOperator::AbsMult #2");
712 constexpr bool transpose =
false;
718 constexpr bool transpose =
false;
724 constexpr bool transpose =
true;
730 constexpr bool transpose =
true;
746 :
Operator(A->Height(), A->Width()), A(A), own_A(own_A_)
771 const int id = trial_idx[i];
779 auto d_b =
b.ReadWrite();
782 d_b[test_idx[i]] = 0.0;
860 if (dot_prod_type == 0)
872 int numSteps,
real_t tolerance,
883 for (
int iter = 0; iter < numSteps; ++iter)
888 if (comm != MPI_COMM_NULL)
905 if (comm != MPI_COMM_NULL)
916 real_t diff = std::abs((eigenvalueNew - eigenvalue) / eigenvalue);
918 eigenvalue = eigenvalueNew;
921 if (diff < tolerance)
int Size() const
Return the logical size of the array.
void MakeRef(T *data_, int size_, bool own_data=false)
Make this Array a reference to a pointer.
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
Square Operator for imposing essential boundary conditions using only the action, Mult(),...
Array< int > constraint_list
List of constrained indices/dofs.
void Mult(const Vector &x, Vector &y) const override
Constrained operator action.
Operator * A
The unconstrained Operator.
void EliminateRHS(const Vector &x, Vector &b) const
Eliminate "essential boundary condition" values specified in x from the given right-hand side b.
void ConstrainedAbsMult(const Vector &x, Vector &y, const bool transpose) const
Implementation of AbsMult or AbsMultTranspose. TODO - Generalize to allow constraining rows and colum...
ConstrainedOperator(Operator *A, const Array< int > &list, bool own_A=false, DiagonalPolicy diag_policy=DIAG_ONE)
Constructor from a general Operator and a list of essential indices/dofs.
void AbsMultTranspose(const Vector &x, Vector &y) const override
Action of the transpose absolute-value operator: y=|A|^t(x). The default behavior in class Operator i...
void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const override
Operator application: y+=A(x) (default) or y+=a*A(x).
void AssembleDiagonal(Vector &diag) const override
Diagonal of A, modified according to the used DiagonalPolicy.
DiagonalPolicy diag_policy
Diagonal policy for constrained dofs.
void ConstrainedMult(const Vector &x, Vector &y, const bool transpose) const
Implementation of Mult or MultTranspose. TODO - Generalize to allow constraining rows and columns dif...
Vector w
Auxiliary vectors.
void AbsMult(const Vector &x, Vector &y) const override
Action of the absolute-value operator: y=|A|(x). The default behavior in class Operator is to generat...
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
static MemoryClass GetMemoryClass()
(DEPRECATED) Equivalent to GetDeviceMemoryClass().
static MemoryClass GetDeviceMemoryClass()
Get the current Device MemoryClass. This is the MemoryClass used by most MFEM device kernels to acces...
virtual real_t Dot(const Vector &x, const Vector &y) const
Standard global/local inner product.
void FormRectangularLinearSystem(const Array< int > &trial_tdof_list, const Array< int > &test_tdof_list, Vector &x, Vector &b, Operator *&A, Vector &X, Vector &B)
Form a column-constrained linear system using a matrix-free approach.
virtual MemoryClass GetMemoryClass() const
Return the MemoryClass preferred by the Operator.
void FormConstrainedSystemOperator(const Array< int > &ess_tdof_list, ConstrainedOperator *&Aout)
see FormSystemOperator()
void FormLinearSystem(const Array< int > &ess_tdof_list, Vector &x, Vector &b, Operator *&A, Vector &X, Vector &B, int copy_interior=0)
Form a constrained linear system using a matrix-free approach.
int width
Dimension of the input / number of columns in the matrix.
void FormSystemOperator(const Array< int > &ess_tdof_list, Operator *&A)
Return in A a parallel (on truedofs) version of this square operator.
void FormDiscreteOperator(Operator *&A)
Return in A a parallel (on truedofs) version of this rectangular operator.
virtual void ArrayMultTranspose(const Array< const Vector * > &X, Array< Vector * > &Y) const
Action of the transpose operator on a matrix: Y=A^t(X).
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 ArrayAddMult(const Array< const Vector * > &X, Array< Vector * > &Y, const real_t a=1.0) const
Operator application on a matrix: Y+=A(X) (default) or Y+=a*A(X).