Isorropia: Partitioning, Load Balancing and more Version 3.0
Isorropia_EpetraOperator.hpp
Go to the documentation of this file.
00001 //@HEADER
00002 /*
00003 ************************************************************************
00004 
00005               Isorropia: Partitioning and Load Balancing Package
00006                 Copyright (2006) Sandia Corporation
00007 
00008 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 license for use of this work by or on behalf of the U.S. Government.
00010 
00011 This library is free software; you can redistribute it and/or modify
00012 it under the terms of the GNU Lesser General Public License as
00013 published by the Free Software Foundation; either version 2.1 of the
00014 License, or (at your option) any later version.
00015 
00016 This library is distributed in the hope that it will be useful, but
00017 WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 Lesser General Public License for more details.
00020 
00021 You should have received a copy of the GNU Lesser General Public
00022 License along with this library; if not, write to the Free Software
00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 USA
00025 
00026 ************************************************************************
00027 */
00028 //@HEADER
00029 
00030 #ifndef _Isorropia_EpetraOperator_hpp_
00031 #define _Isorropia_EpetraOperator_hpp_
00032 
00033 #include <Isorropia_ConfigDefs.hpp>
00034 #include <Teuchos_RCP.hpp>
00035 #include <Teuchos_ParameterList.hpp>
00036 
00037 #include <Isorropia_EpetraCostDescriber.hpp>
00038 #include <Isorropia_Operator.hpp>
00039 #include <Isorropia_EpetraLibrary.hpp>
00040 
00041 #ifdef HAVE_EPETRA
00042 class Epetra_Map;
00043 class Epetra_BlockMap;
00044 class Epetra_Import;
00045 class Epetra_Vector;
00046 class Epetra_MultiVector;
00047 class Epetra_CrsGraph;
00048 class Epetra_CrsMatrix;
00049 class Epetra_RowMatrix;
00050 class Epetra_LinearProblem;
00051 
00052 namespace Isorropia {
00053 
00054 namespace Epetra {
00055   class CostDescriber;
00056 
00062 class Operator : virtual public Isorropia::Operator {
00063 public:
00064 
00065 //   Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph, int base);
00066 
00067 //   Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, int base);
00068 
00069 //   Operator(Teuchos::RCP<const Epetra_MultiVector> input_coords, int base);
00070 
00071 //   Operator(Teuchos::RCP<const Epetra_BlockMap> input_map, int base);
00072 
00073 //   Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph, 
00074 //     Teuchos::RCP<const Epetra_MultiVector> input_coords, int base);
00075 
00076 //   Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, 
00077 //     Teuchos::RCP<const Epetra_MultiVector> input_coords, int base);
00078 
00079 
00095   Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00096               const Teuchos::ParameterList& paramlist, int base);
00097 
00098 
00113   Operator(Teuchos::RCP<const Epetra_BlockMap> input_map,
00114               const Teuchos::ParameterList& paramlist, int base);
00115 
00116 
00117 
00137   Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00138      Teuchos::RCP<const Epetra_MultiVector> input_coords,
00139            const Teuchos::ParameterList& paramlist, int base);
00140 
00141 
00161   Operator (Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00162             Teuchos::RCP<CostDescriber> costs,
00163               const Teuchos::ParameterList& paramlist, int base);
00164 
00165 
00191   Operator (Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00192             Teuchos::RCP<CostDescriber> costs,
00193       Teuchos::RCP<const Epetra_MultiVector> coords,
00194       Teuchos::RCP<const Epetra_MultiVector> weights,
00195               const Teuchos::ParameterList& paramlist, int base);
00196 
00197 
00213   Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00214      const Teuchos::ParameterList& paramlist, int base);
00215 
00216 
00236   Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00237      Teuchos::RCP<const Epetra_MultiVector> coords,
00238      const Teuchos::ParameterList& paramlist, int base);
00239 
00240 
00260   Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00261      Teuchos::RCP<CostDescriber> costs,
00262      const Teuchos::ParameterList& paramlist, int base);
00263 
00264 
00291   Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00292      Teuchos::RCP<CostDescriber> costs,
00293      Teuchos::RCP<const Epetra_MultiVector> coords,
00294      Teuchos::RCP<const Epetra_MultiVector> weights,
00295      const Teuchos::ParameterList& paramlist, int base);
00296 
00297 
00314   Operator(Teuchos::RCP<const Epetra_MultiVector> coords,
00315      const Teuchos::ParameterList& paramlist, int base);
00316 
00336   Operator(Teuchos::RCP<const Epetra_MultiVector> coords,
00337            Teuchos::RCP<const Epetra_MultiVector> weights,
00338      const Teuchos::ParameterList& paramlist, int base);
00339 
00341   virtual ~Operator();
00342 
00346   void setParameters(const Teuchos::ParameterList& paramlist);
00347 
00348   virtual void compute(bool force_compute) = 0 ;
00349 
00352   bool alreadyComputed() const {
00353     return operation_already_computed_;
00354   }
00355 
00356   int numProperties() const {
00357     return (numberOfProperties_);
00358   }
00359 
00360   int numLocalProperties() const {
00361     return (localNumberOfProperties_);
00362   }
00363 
00367   virtual const int& operator[](int myElem) const;
00368 
00371   virtual int numElemsWithProperty(int property) const;
00372 
00376   virtual void elemsWithProperty(int property,
00377        int* elementList,
00378        int len) const;
00379 
00380   virtual int extractPropertiesCopy(int len,
00381             int& size,
00382             int* array) const ;
00383 
00384   virtual int extractPropertiesView(int& size,
00385             const int*& array) const;
00386 
00387 private:
00388 
00389   void paramsToUpper(Teuchos::ParameterList &, int &changed, bool rmUnderscore=true);
00390   void stringToUpper(std::string &s, int &changed, bool rmUnderscore=false);
00391   int numberOfProperties_;
00392   int localNumberOfProperties_;
00393   std::vector<int> numberElemsByProperties_;
00394 
00395 protected:
00396   Teuchos::RCP<const Epetra_BlockMap> input_map_;
00397   Teuchos::RCP<const Epetra_CrsGraph> input_graph_;
00398   Teuchos::RCP<const Epetra_RowMatrix> input_matrix_;
00399   Teuchos::RCP<const Epetra_MultiVector> input_coords_;
00400   Teuchos::RCP<Isorropia::Epetra::CostDescriber> costs_;
00401   Teuchos::RCP<const Epetra_MultiVector> weights_;
00402 
00403   Teuchos::ParameterList paramlist_;
00404 
00405   int exportsSize_;
00406   std::vector<int> imports_;
00407   std::vector<int> properties_;
00408 
00409   bool operation_already_computed_;
00410 
00411   int global_num_vertex_weights_;
00412   int global_num_graph_edge_weights_;
00413   int global_num_hg_edge_weights_;
00414 
00415   Teuchos::RCP<Library> lib_;
00416 
00417   int base_;
00418 
00419   void computeNumberOfProperties();
00420 };//class Operator
00421 
00422 }//namespace Epetra
00423 }//namespace Isorropia
00424 
00425 #endif //HAVE_EPETRA
00426 
00427 #endif
00428