Epetra Package Browser (Single Doxygen Collection) Development
Epetra_FECrsGraph.h
Go to the documentation of this file.
00001 /*
00002 //@HEADER
00003 // ************************************************************************
00004 //
00005 //               Epetra: Linear Algebra Services Package
00006 //                 Copyright 2011 Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00039 //
00040 // ************************************************************************
00041 //@HEADER
00042 */
00043 
00044 #ifndef EPETRA_FECRSGRAPH_H
00045 #define EPETRA_FECRSGRAPH_H
00046 
00047 #include "Epetra_ConfigDefs.h"
00048 #include "Epetra_Map.h"
00049 #include "Epetra_CrsGraph.h"
00050 
00051 #include <map>
00052 
00065 class EPETRA_LIB_DLL_EXPORT Epetra_FECrsGraph : public Epetra_CrsGraph {
00066   friend class Epetra_FECrsMatrix;
00067 
00068   public:
00069 
00071   Epetra_FECrsGraph(Epetra_DataAccess CV,
00072         const Epetra_BlockMap& RowMap,
00073         int* NumIndicesPerRow,
00074         bool ignoreNonLocalEntries=false,
00075         bool buildNonlocalGraph=false);
00076 
00078   Epetra_FECrsGraph(Epetra_DataAccess CV,
00079         const Epetra_BlockMap& RowMap,
00080         int NumIndicesPerRow,
00081         bool ignoreNonLocalEntries=false,
00082         bool buildNonlocalGraph=false);
00083 
00085   Epetra_FECrsGraph(Epetra_DataAccess CV,
00086         const Epetra_BlockMap& RowMap,
00087         const Epetra_BlockMap& ColMap,
00088         int* NumIndicesPerRow,
00089         bool ignoreNonLocalEntries=false,
00090         bool buildNonlocalGraph=false);
00091 
00093   Epetra_FECrsGraph(Epetra_DataAccess CV,
00094         const Epetra_BlockMap& RowMap,
00095         const Epetra_BlockMap& ColMap,
00096         int NumIndicesPerRow,
00097         bool ignoreNonLocalEntries=false,
00098         bool buildNonlocalGraph=false);
00099 
00101   //  Using default copy constructor because there is no def in cpp file
00102   //  Epetra_FECrsGraph(const Epetra_FECrsGraph& Graph);
00103 
00105   virtual ~Epetra_FECrsGraph();
00106 
00107   //Let the compiler know we intend to overload the base-class function
00108   //InsertGlobalIndices rather than hide it.
00109   using Epetra_CrsGraph::InsertGlobalIndices;
00110 
00120 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00121   int InsertGlobalIndices(int numRows, const int* rows,
00122         int numCols, const int* cols);
00123 #endif
00124 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00125   int InsertGlobalIndices(int numRows, const long long* rows,
00126         int numCols, const long long* cols);
00127 #endif
00128 
00150   int GlobalAssemble(bool callFillComplete=true);
00151 
00177   int GlobalAssemble(const Epetra_Map& domain_map,
00178                      const Epetra_Map& range_map,
00179                      bool callFillComplete=true);
00180 
00181   bool UseNonlocalGraph () const {return buildNonlocalGraph_; };
00182 
00183  private:
00184   void DeleteMemory();
00185   int InsertNonlocalRow(int row, int offset);
00186   int InputNonlocalIndices(int row,
00187          int numCols,
00188          const int* cols);
00189   int InputNonlocalIndex(int rowoffset,
00190        int col);
00191 
00192   long long myFirstRow_;
00193   int myNumRows_;
00194   bool ignoreNonLocalEntries_;
00195 
00200 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00201   std::map<int,Epetra_CrsGraphData::EntriesInOneRow<int> > nonlocalRowData_int_;
00202 #endif
00203 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00204   std::map<long long,Epetra_CrsGraphData::EntriesInOneRow<long long> > nonlocalRowData_LL_;
00205 #endif
00206 
00207   template<typename int_type>
00208   std::map<int_type,Epetra_CrsGraphData::EntriesInOneRow<int_type> >& nonlocalRowData();
00209 
00214   Epetra_CrsGraph* nonlocalGraph_;
00215   bool buildNonlocalGraph_;
00216 
00217   Epetra_FECrsGraph & operator=(const Epetra_FECrsGraph& Graph);
00218 
00219   template<typename int_type>
00220   int InsertGlobalIndices(int numRows, const int_type* rows, int numCols, const int_type* cols);
00221 
00222   template<typename int_type>
00223   int GlobalAssemble(const Epetra_Map& domain_map, const Epetra_Map& range_map, bool callFillComplete);
00224 
00225 };//class Epetra_FECrsGraph
00226 
00227 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00228 template<> inline std::map<int,Epetra_CrsGraphData::EntriesInOneRow<int> >& Epetra_FECrsGraph::nonlocalRowData()
00229 {
00230   return nonlocalRowData_int_;
00231 }
00232 #endif
00233 
00234 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00235 template<> inline std::map<long long,Epetra_CrsGraphData::EntriesInOneRow<long long> >& Epetra_FECrsGraph::nonlocalRowData()
00236 {
00237   return nonlocalRowData_LL_;
00238 }
00239 #endif
00240 
00241 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines