IFPACK Development
Ifpack_IlukGraph.h
00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ***********************************************************************
00040 //@HEADER
00041 */
00042 
00043 #ifndef _IFPACK_ILUK_GRAPH_H_
00044 #define _IFPACK_ILUK_GRAPH_H_
00045 
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Epetra_Object.h" 
00048 #include "Epetra_CrsGraph.h"
00049 #include "Epetra_Import.h"
00050 
00051 #include "Teuchos_RefCountPtr.hpp"
00052 
00053 namespace Teuchos {
00054   class ParameterList;
00055 }
00056 
00058 
00077 class Ifpack_IlukGraph {
00078       
00079   // Give ostream << function some access to private and protected data/functions.
00080 
00081   friend ostream& operator << (ostream& os, const Ifpack_IlukGraph& A);
00082 
00083  public:
00084 
00086 
00099   Ifpack_IlukGraph(const Epetra_CrsGraph & Graph_in, int LevelFill_in, int LevelOverlap_in);
00100   
00102   Ifpack_IlukGraph(const Ifpack_IlukGraph & Graph_in);
00103 
00105   virtual ~Ifpack_IlukGraph();
00106   
00108   /* This method is only available if the Teuchos package is enabled.
00109      This method recogizes two parameter names: Level_fill and Level_overlap.
00110      Both are case insensitive, and in both cases the ParameterEntry must
00111      have type int.
00112   */
00113   int SetParameters(const Teuchos::ParameterList& parameterlist,
00114                     bool cerr_warning_if_unused=false);
00115 
00117   /* 
00118     \return Integer error code, set to 0 if successful.
00119     
00120   */
00121   virtual int ConstructFilledGraph();
00122 
00124   /* 
00125     \return Integer error code, set to 0 if successful.
00126     
00127   */
00128   virtual int ConstructOverlapGraph();
00129   
00131   virtual int LevelFill() const {return(LevelFill_);};
00132   
00134   virtual int LevelOverlap() const {return(LevelOverlap_);};
00135 
00136 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00137 
00138   int NumGlobalBlockRows() const {
00139     if(Graph_.RowMap().GlobalIndicesInt())
00140       return (int)(NumGlobalBlockRows_);
00141     else
00142       throw "Ifpack_IlukGraph::NumGlobalBlockRows: GlobalIndices not int.";
00143   }
00144   
00146   int NumGlobalBlockCols() const {
00147     if(Graph_.RowMap().GlobalIndicesInt())
00148       return (int)(NumGlobalBlockCols_);
00149     else
00150       throw "Ifpack_IlukGraph::NumGlobalBlockCols: GlobalIndices not int.";
00151   }
00152     
00154   int NumGlobalRows() const {
00155     if(Graph_.RowMap().GlobalIndicesInt())
00156       return (int)(NumGlobalRows_);
00157     else
00158       throw "Ifpack_IlukGraph::NumGlobalRows: GlobalIndices not int.";
00159   }
00160   
00162   int NumGlobalCols() const {
00163     if(Graph_.RowMap().GlobalIndicesInt())
00164       return (int)(NumGlobalCols_);
00165     else
00166       throw "Ifpack_IlukGraph::NumGlobalCols: GlobalIndices not int.";
00167   }
00169   int NumGlobalNonzeros() const {
00170     if(Graph_.RowMap().GlobalIndicesInt())
00171       return (int)(NumGlobalNonzeros_);
00172     else
00173       throw "Ifpack_IlukGraph::NumGlobalNonzeros: GlobalIndices not int.";
00174   }
00175   
00177   virtual int NumGlobalBlockDiagonals() const {
00178     if(Graph_.RowMap().GlobalIndicesInt())
00179       return (int)(NumGlobalBlockDiagonals_);
00180     else
00181       throw "Ifpack_IlukGraph::NumGlobalBlockDiagonals: GlobalIndices not int.";
00182   }
00183 #endif
00184 
00186   long long NumGlobalBlockRows64() const {return(NumGlobalBlockRows_);};
00187   
00189   long long NumGlobalBlockCols64() const {return(NumGlobalBlockCols_);};
00190     
00192   long long NumGlobalRows64() const {return(NumGlobalRows_);};
00193   
00195   long long NumGlobalCols64() const {return(NumGlobalCols_);};
00197   long long NumGlobalNonzeros64() const {return(NumGlobalNonzeros_);};
00198   
00200   virtual long long NumGlobalBlockDiagonals64() const {return(NumGlobalBlockDiagonals_);};
00201 
00203   int NumMyBlockRows() const {return(NumMyBlockRows_);};
00204   
00206   int NumMyBlockCols() const {return(NumMyBlockCols_);};
00207   
00208   
00210   int NumMyRows() const {return(NumMyRows_);};
00211   
00213   int NumMyCols() const {return(NumMyCols_);};
00214   
00216   int NumMyNonzeros() const {return(NumMyNonzeros_);};
00217   
00219   virtual int NumMyBlockDiagonals() const {return(NumMyBlockDiagonals_);};
00220   
00222 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00223   int IndexBase() const {
00224     if(Graph_.RowMap().GlobalIndicesInt())
00225       return (int) IndexBase64();
00226     throw "Ifpack_IlukGraph::IndexBase: GlobalIndices not int.";
00227   }
00228 #endif
00229   long long IndexBase64() const {return(IndexBase_);};
00230   
00232   virtual Epetra_CrsGraph & L_Graph() {return(*L_Graph_);};
00233   
00235   virtual Epetra_CrsGraph & U_Graph() {return(*U_Graph_);};
00236   
00238   virtual Epetra_CrsGraph & L_Graph() const {return(*L_Graph_);};
00239   
00241   virtual Epetra_CrsGraph & U_Graph() const {return(*U_Graph_);};
00242   
00244   virtual Epetra_Import * OverlapImporter() const  {return(&*OverlapImporter_);};
00245   
00247   virtual Epetra_CrsGraph * OverlapGraph() const  {return(&*OverlapGraph_);};
00248 
00250     virtual const Epetra_BlockMap & DomainMap() const {return(DomainMap_);};
00251 
00253     virtual const Epetra_BlockMap & RangeMap() const{return(RangeMap_);};
00254 
00256     virtual const Epetra_Comm & Comm() const{return(Comm_);};
00257   
00258  private:
00259     
00260 
00261   const Epetra_CrsGraph & Graph_;
00262   const Epetra_BlockMap & DomainMap_;
00263   const Epetra_BlockMap & RangeMap_;
00264   const Epetra_Comm & Comm_;
00265   Teuchos::RefCountPtr<Epetra_CrsGraph> OverlapGraph_;
00266   Teuchos::RefCountPtr<Epetra_BlockMap> OverlapRowMap_;
00267   Teuchos::RefCountPtr<Epetra_Import> OverlapImporter_;
00268   int LevelFill_;
00269   int LevelOverlap_;
00270   Teuchos::RefCountPtr<Epetra_CrsGraph> L_Graph_;
00271   Teuchos::RefCountPtr<Epetra_CrsGraph> U_Graph_;
00272   long long IndexBase_;
00273   long long NumGlobalRows_;
00274   long long NumGlobalCols_;
00275   long long NumGlobalBlockRows_;
00276   long long NumGlobalBlockCols_;
00277   long long NumGlobalBlockDiagonals_;
00278   long long NumGlobalNonzeros_;
00279   long long NumGlobalEntries_;
00280   int NumMyBlockRows_;
00281   int NumMyBlockCols_;
00282   int NumMyRows_;
00283   int NumMyCols_;
00284   int NumMyBlockDiagonals_;
00285   int NumMyNonzeros_;
00286   int NumMyEntries_;
00287   
00288 
00289  };
00290 
00292 ostream& operator << (ostream& os, const Ifpack_IlukGraph& A);
00293 
00294 #endif /* _IFPACK_ILUK_GRAPH_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends