00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <EpetraExt_Dirichlet_CrsMatrix.h>
00030
00031 #include <Epetra_CrsMatrix.h>
00032 #include <Epetra_IntVector.h>
00033 #include <Epetra_Import.h>
00034 #include <Epetra_Map.h>
00035
00036 namespace EpetraExt {
00037
00038 bool
00039 CrsMatrix_Dirichlet::
00040 fwd()
00041 {
00042 Epetra_CrsMatrix & Matrix = *origObj_;
00043
00044 const Epetra_Map & RowMap = Matrix.RowMap();
00045 const Epetra_Map & ColMap = Matrix.ColMap();
00046
00047 int NumMyElements = RowMap.NumMyElements();
00048 int NumMyColElements = ColMap.NumMyElements();
00049
00050 if( symmetric_ && colSet_.empty() )
00051 {
00052 if( Matrix.IndicesAreGlobal() )
00053 {
00054 Epetra_Import Importer( ColMap, RowMap );
00055 Epetra_IntVector colLocations( ColMap );
00056 colLocations.Import( locations_, Importer, Insert );
00057 for( int i = 0; i < NumMyColElements; ++ i )
00058 if( colLocations[i] ) colSet_.insert(i);
00059 }
00060 else
00061 {
00062 for( int i = 0; i < NumMyElements; ++i )
00063 if( locations_[i] ) colSet_.insert(i);
00064 }
00065 }
00066
00067 for( int i = 0; i < NumMyElements; ++i )
00068 {
00069 int * Indices;
00070 double * Vals;
00071 int NumIndices;
00072 if( locations_[i] )
00073 {
00074 Matrix.ExtractMyRowView( i, NumIndices, Vals, Indices );
00075 for( int j = 0; j < NumIndices; ++j )
00076 {
00077 if( Indices[j] == i ) Vals[i] = 1.0;
00078 else Vals[i] = 0.0;
00079 }
00080 }
00081 else if( symmetric_ )
00082 {
00083 Matrix.ExtractMyRowView( i, NumIndices, Vals, Indices );
00084 for( int j = 0; j < NumIndices; ++j )
00085 if( colSet_.count( Indices[j] ) ) Vals[j] = 0.0;
00086 }
00087 }
00088
00089 return true;
00090 }
00091
00092 bool
00093 CrsMatrix_Dirichlet::
00094 rvs()
00095 {
00096 return true;
00097 }
00098
00099 }
00100