42 #ifndef EpetraExt_TCRSGRAPH_MAPCOLORINGINDEX_H
43 #define EpetraExt_TCRSGRAPH_MAPCOLORINGINDEX_H
46 #include <Epetra_GIDTypeVector.h>
47 #include <Epetra_MapColoring.h>
62 template<
typename int_type>
64 :
public StructuralTransform< Epetra_CrsGraph,std::vector<typename Epetra_GIDTypeVector<int_type>::impl> > {
80 : ColorMap_( ColorMap )
94 template<
typename int_type>
99 if(!orig.RowMap().
template GlobalIndicesIsType<int_type>())
100 throw "EpetraExt::TCrsGraph_MapColoringIndex::operator(): Global indices mismatch.";
107 int NumColors = ColorMap_.NumColors();
108 int * ListOfColors = ColorMap_.ListOfColors();
110 std::map<int,int> MapOfColors;
111 for(
int i = 0; i < NumColors; ++i ) MapOfColors[ ListOfColors[i] ] = i;
114 std::vector<int_type> dummy( nRows, -1 );
117 int MaxNumIndices = orig.MaxNumIndices();
119 std::vector<int_type> Indices( MaxNumIndices );
121 for(
int i = 0; i < nRows; ++i )
123 orig.ExtractGlobalRowCopy( (int_type) orig.GRID64(i), MaxNumIndices, NumIndices, &Indices[0] );
125 for(
int j = 0; j < NumIndices; ++j )
126 (*IndexVec)[ MapOfColors[ColorMap_(Indices[j])] ][i] = Indices[j];
136 #endif // EpetraExt_TCRSGRAPH_MAPCOLORINGINDEX_H
138 #if defined(EpetraExt_SHOW_DEPRECATED_WARNINGS)
140 #warning "The EpetraExt package is deprecated"
StructuralTransform< Epetra_CrsGraph, std::vector< typename Epetra_GIDTypeVector< int_type >::impl > > Base
Transform< T, T >::NewTypeRef Transform_Composite< T >typename Transform< T, T >::OriginalTypeRef orig this origObj_
Base::NewTypeRef NewTypeRef
Generates a std::vector<Epetra_IntVector> from the input Epetra_CrsGraph.
int NumMyElements() const
~TCrsGraph_MapColoringIndex()
Destructor.
Generates a std::vector of Epetra_IntVector's to be used to map perturbation contributions to a CrsGr...
NewTypeRef operator()(OriginalTypeRef orig)
Analysis of transform operation on original object and construction of new object.
Base::OriginalTypeRef OriginalTypeRef
TCrsGraph_MapColoringIndex(const Epetra_MapColoring &ColorMap)
Constructor input param ColorMap defines the perturbation coloring.