43 #include "Ifpack_OverlapGraph.h"
44 #include "Epetra_CrsGraph.h"
45 #include "Epetra_RowMatrix.h"
46 #include "Epetra_BlockMap.h"
47 #include "Epetra_Map.h"
49 #include <Teuchos_ParameterList.hpp>
50 #include <ifp_parameters.h>
54 : UserMatrixGraph_(UserMatrixGraph_in),
55 OverlapLevel_(OverlapLevel_in)
58 IsOverlapped_ = (OverlapLevel_in>0 && UserMatrixGraph_in->DomainMap().DistributedGlobal());
60 ConstructOverlapGraph(UserMatrixGraph_in);
65 : UserMatrix_(UserMatrix_in),
66 OverlapLevel_(OverlapLevel_in)
69 IsOverlapped_ = (OverlapLevel_in>0 && UserMatrix_in->OperatorDomainMap().DistributedGlobal());
71 throw ReportError(
"This constructor is not implemented yet. Need to add Epetra_SrcObject support to Epetra_Import/Export", -1);
75 : OverlapGraph_(Source.OverlapGraph_),
76 UserMatrixGraph_(Source.UserMatrixGraph_),
77 UserMatrix_(Source.UserMatrix_),
78 OverlapRowMap_(Source.OverlapRowMap_),
79 OverlapLevel_(Source.OverlapLevel_),
80 IsOverlapped_(Source.IsOverlapped_)
83 if (OverlapGraph_!=Teuchos::null) OverlapGraph_ = Teuchos::rcp(
new Epetra_CrsGraph(*OverlapGraph_) );
84 if (OverlapRowMap_!=Teuchos::null) OverlapRowMap_ = Teuchos::rcp(
new Epetra_BlockMap(*OverlapRowMap_) );
91 bool cerr_warning_if_unused)
94 params.int_params[Ifpack::level_overlap-FIRST_INT_PARAM] = OverlapLevel_;
96 Ifpack::set_parameters(parameterlist, params, cerr_warning_if_unused);
98 OverlapLevel_ = params.int_params[Ifpack::level_overlap-FIRST_INT_PARAM];
103 int Ifpack_OverlapGraph::ConstructOverlapGraph(
const Teuchos::RefCountPtr<const Epetra_CrsGraph>& UserMatrixGraph) {
105 if (!IsOverlapped_) {
106 OverlapGraph_ = Teuchos::rcp_const_cast<
Epetra_CrsGraph>( UserMatrixGraph );
107 OverlapRowMap_ = Teuchos::rcp( (
Epetra_BlockMap *) &UserMatrixGraph->RowMap(), false );
111 Teuchos::RefCountPtr<Epetra_CrsGraph> OldGraph;
112 Teuchos::RefCountPtr<Epetra_BlockMap> OldRowMap;
116 for (
int level=1; level <= OverlapLevel_; level++) {
117 OldGraph = OverlapGraph_;
118 OldRowMap = OverlapRowMap_;
120 OverlapImporter_ = Teuchos::rcp( (
Epetra_Import *) OldGraph->Importer(), false );
121 OverlapRowMap_ = Teuchos::rcp(
new Epetra_BlockMap(OverlapImporter_->TargetMap()) );
123 if (level<OverlapLevel_)
124 OverlapGraph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, *OverlapRowMap_, 0) );
128 OverlapGraph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, *OverlapRowMap_, *OverlapRowMap_, 0) );
130 EPETRA_CHK_ERR(OverlapGraph_->Import( *UserMatrixGraph, *OverlapImporter_, Insert));
131 if (level<OverlapLevel_) {
132 EPETRA_CHK_ERR(OverlapGraph_->FillComplete(DomainMap, RangeMap));
136 OverlapImporter_ = Teuchos::rcp(
new Epetra_Import(*OverlapRowMap_, DomainMap) );
137 EPETRA_CHK_ERR(OverlapGraph_->FillComplete(DomainMap, RangeMap));
Ifpack_OverlapGraph: Constructs a graph for use with Ifpack preconditioners.
Ifpack_OverlapGraph(const Teuchos::RefCountPtr< const Epetra_CrsGraph > &UserMatrixGraph_in, int OverlapLevel_in)
Constructor using Epetra_CrsGraph.
int SetParameters(const Teuchos::ParameterList ¶meterlist, bool cerr_warning_if_unused=false)
Set parameters using a Teuchos::ParameterList object.