// ====================================================================== Operator GetJacobiIterationOperator(const Operator& Amat, double Damping) { struct ML_AGG_Matrix_Context* widget = new struct ML_AGG_Matrix_Context; widget->near_bdry = 0; widget->aggr_info = 0; widget->drop_tol = 0.0; widget->Amat = Amat.GetML_Operator(); widget->omega = Damping; ML_Operator* tmp_ML = ML_Operator_Create(GetML_Comm()); ML_Operator_Set_ApplyFuncData(tmp_ML, widget->Amat->invec_leng, widget->Amat->outvec_leng, widget, widget->Amat->matvec->Nrows, NULL, 0); tmp_ML->data_destroy = widget_destroy; ML_Operator_Set_Getrow(tmp_ML, widget->Amat->getrow->Nrows, ML_AGG_JacobiSmoother_Getrows); // Creates a new copy of pre_comm, so that the old pre_comm // can be destroyed without worry ML_CommInfoOP_Clone(&(tmp_ML->getrow->pre_comm), widget->Amat->getrow->pre_comm); Operator tmp(Amat.GetDomainSpace(), Amat.GetRangeSpace(), tmp_ML, true, Amat.GetRCPOperatorBox()); return(tmp); }
// ====================================================================== Operator GetScaledOperator(const Operator& A, const double alpha) { ML_Operator* ScaledA = 0; ScaledA = ML_Operator_ExplicitlyScale(A.GetML_Operator(), (double)alpha); if (ScaledA == 0) ML_THROW("ML_Operator_ExplicitlyScale returned 0", -1); Operator res; res.Reshape(A.GetDomainSpace(), A.GetRangeSpace(), ScaledA, true, A.GetRCPOperatorBox()); return(res); }