PlayaEpetraMatrixFactory.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 //   
00003 /* @HEADER@ */
00004 
00005 #ifndef PLAYA_EPETRAMATRIXFACTORY_HPP
00006 #define PLAYA_EPETRAMATRIXFACTORY_HPP
00007 
00008 #include "PlayaEpetraVectorSpace.hpp"
00009 #include "PlayaIncrementallyConfigurableMatrixFactory.hpp"
00010 #include "PlayaCollectivelyConfigurableMatrixFactory.hpp"
00011 #include "PlayaMatrixFactory.hpp"
00012 #include "PlayaHandleable.hpp"
00013 #include "PlayaPrintable.hpp"
00014 #include "Epetra_CrsGraph.h"
00015 
00016 namespace Playa
00017 {
00018 using namespace Teuchos;
00019   
00020 
00021 /** */
00022 class EpetraMatrixFactory : public MatrixFactory<double>,
00023                             public IncrementallyConfigurableMatrixFactory,
00024                             public CollectivelyConfigurableMatrixFactory
00025 {
00026 public:
00027 
00028   /** Construct an uninitialized EpetraMatrixFactory */
00029   EpetraMatrixFactory(const RCP<const EpetraVectorSpace>& domain,
00030     const RCP<const EpetraVectorSpace>& range);
00031 
00032   /** */
00033   const RCP<const EpetraVectorSpace>& epRange() const {return range_;}
00034 
00035   /** */
00036   const RCP<const EpetraVectorSpace>& epDomain() const {return domain_;}
00037 
00038 
00039   /** Initialize a set of nonzero elements in the matrix's graph.
00040    * @param globalRowIndex the global index of the row to which these
00041    * elements belong.
00042    * @param nElemsToInsert the number of elements being inserted in this
00043    * step
00044    * @param globalColumnIndices array of column indices. Must 
00045    * be nElemsToInsert in length. 
00046    */
00047   virtual void initializeNonzerosInRow(int globalRowIndex,
00048     int nElemsToInsert,
00049     const int* globalColumnIndices) ;
00050 
00051   /** 
00052    * Initialize nonzeros in a batch of rows. 
00053    */
00054   virtual void initializeNonzeroBatch(int numRows, 
00055     int rowBlockSize,
00056     const int* globalRowIndices,
00057     int numColumnsPerRow,
00058     const int* globalColumnIndices,
00059     const int* skipRow);
00060 
00061   /** Configure all rows at once */
00062   virtual void configure(int lowestRow,
00063     const std::vector<int>& rowPtrs,
00064     const std::vector<int>& nnzPerRow,
00065     const std::vector<int>& data);
00066 
00067   /** */
00068   void finalize();
00069 
00070   /** */
00071   const Epetra_CrsGraph& graph() const ;
00072 
00073   /** */
00074   virtual LinearOperator<double> createMatrix() const ;
00075 
00076 protected:
00077 
00078 private:
00079 
00080   /** */
00081   RCP<Epetra_CrsGraph> graph_;
00082 
00083   /** */
00084   RCP<const EpetraVectorSpace> range_;
00085 
00086   /** */
00087   RCP<const EpetraVectorSpace> domain_;
00088 };
00089 }
00090 
00091 #endif

Site Contact