44 #include <Epetra_Export.h> 45 #include <Epetra_Import.h> 46 #include <Epetra_LinearProblem.h> 47 #include <Epetra_CrsGraph.h> 48 #include <Epetra_CrsMatrix.h> 49 #include <Epetra_MultiVector.h> 50 #include <Epetra_Vector.h> 51 #include <Epetra_IntVector.h> 52 #include <Epetra_Map.h> 53 #include <Epetra_Comm.h> 60 if( MatExporter_ )
delete MatExporter_;
61 if( VecExporter_ )
delete VecExporter_;
62 if( Importer_ )
delete Importer_;
64 if( NewProblem_ )
delete NewProblem_;
65 if( NewRHS_ )
delete NewRHS_;
66 if( NewLHS_ )
delete NewLHS_;
67 if( NewMatrix_ )
delete NewMatrix_;
75 OldMatrix_ =
dynamic_cast<Epetra_CrsMatrix*
>( orig.GetMatrix() );
76 OldGraph_ =
const_cast<Epetra_CrsGraph*
>(&OldMatrix_->Graph());
77 OldRHS_ = orig.GetRHS();
78 OldLHS_ = orig.GetLHS();
79 OldRowMap_ =
const_cast<Epetra_Map*
>(&OldMatrix_->RowMap());
84 if( !OldMatrix_ ) ierr = -2;
85 if( !OldRHS_ ) ierr = -3;
86 if( !OldLHS_ ) ierr = -4;
88 Epetra_CrsGraph & NewGraph = graphTrans_( *OldGraph_ );
89 NewMatrix_ =
new Epetra_CrsMatrix( Copy, NewGraph );
91 Epetra_BlockMap & NewRowMap =
const_cast<Epetra_BlockMap&
>(NewGraph.RowMap());
93 NewRHS_ =
new Epetra_MultiVector( NewRowMap, 1 );
94 NewLHS_ =
new Epetra_MultiVector( NewRowMap, 1 );
96 MatExporter_ =
new Epetra_Export( *OldRowMap_, NewRowMap );
97 VecExporter_ =
new Epetra_Export( *OldRowMap_, NewRowMap );
98 Importer_ =
new Epetra_Import( *OldRowMap_, NewRowMap );
100 NewProblem_ =
new Epetra_LinearProblem( NewMatrix_, NewLHS_, NewRHS_ );
109 NewLHS_->Export( *OldLHS_, *VecExporter_, Insert );
110 NewRHS_->Export( *OldRHS_, *VecExporter_, Insert );
111 NewMatrix_->Export( *OldMatrix_, *MatExporter_, Insert );
120 OldLHS_->Import( *NewLHS_, *Importer_, Insert );
NewTypeRef operator()(OriginalTypeRef orig)
Constructs an Epetra_LinearProblem from the original using the same row transformation given by the E...
bool fwd()
Forward migration of data from original to transformed object.
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.
bool rvs()
Reverse migration of data from transformed to original object.
~LinearProblem_GraphTrans()
EpetraExt::LinearProblem_GraphTrans Destructor.