44 #include <Epetra_CrsGraph.h>
45 #include <Epetra_MapColoring.h>
46 #include <Epetra_IntVector.h>
47 #include <Epetra_Map.h>
63 const Epetra_BlockMap & RowMap = orig.RowMap();
64 int nRows = RowMap.NumMyElements();
66 int NumColors = ColorMap_.NumColors();
67 int * ListOfColors = ColorMap_.ListOfColors();
69 map<int,int> MapOfColors;
70 for(
int i = 0; i < NumColors; ++i ) MapOfColors[ ListOfColors[i] ] = i;
73 vector<int> dummy( nRows, -1 );
74 NewTypePtr IndexVec =
new NewType( NumColors, Epetra_IntVector( Copy, RowMap, &dummy[0] ) );
76 int MaxNumIndices = orig.MaxNumIndices();
78 vector<int> Indices( MaxNumIndices );
80 for(
int i = 0; i < nRows; ++i )
82 orig.ExtractGlobalRowCopy( orig.GRID(i), MaxNumIndices, NumIndices, &Indices[0] );
84 for(
int j = 0; j < NumIndices; ++j )
85 (*IndexVec)[ MapOfColors[ColorMap_(Indices[j])] ][i] = Indices[j];
NewTypeRef operator()(OriginalTypeRef orig)
Generates a std::vector<Epetra_IntVector> from the input Epetra_CrsGraph.