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:
00087   Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00088               const Teuchos::ParameterList& paramlist);
00089 
00116   Operator (Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00117               Teuchos::RCP<CostDescriber> costs,
00118               const Teuchos::ParameterList& paramlist);
00119 
00144   Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00145      const Teuchos::ParameterList& paramlist);
00146 
00174   Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00175      Teuchos::RCP<CostDescriber> costs,
00176      const Teuchos::ParameterList& paramlist);
00177 
00179   virtual ~Operator();
00180 
00197   void setParameters(const Teuchos::ParameterList& paramlist);
00198 
00199   virtual void compute(bool force_compute) = 0 ; /* Make the class virtual, must be implemented in child class */
00200 
00203   bool alreadyComputed() const {
00204     return operation_already_computed_;
00205   }
00206 
00207   int numProperties() const {
00208     return (numberOfProperties_);
00209   }
00210 
00214   virtual const int& operator[](int myElem) const;
00215 
00218   virtual int numElemsWithProperty(int property) const;
00219 
00223   virtual void elemsWithProperty(int property,
00224        int* elementList,
00225        int len) const;
00226 
00227 private:
00228 
00229   void paramsToUpper(Teuchos::ParameterList &, int &changed);
00230   void stringToUpper(std::string &s, int &changed);
00231   int numberOfProperties_;
00232   std::vector<int> numberElemsByProperties_;
00233 
00234 protected:
00235   Teuchos::RCP<const Epetra_BlockMap> input_map_;
00236   Teuchos::RCP<const Epetra_CrsGraph> input_graph_;
00237   Teuchos::RCP<const Epetra_RowMatrix> input_matrix_;
00238   Teuchos::RCP<Isorropia::Epetra::CostDescriber> costs_;
00239   Teuchos::RCP<Epetra_Vector> weights_;
00240 
00241   Teuchos::ParameterList paramlist_;
00242 
00243 //   std::map<int,int> exports_, imports_;
00244   int exportsSize_;
00245   std::vector<int> imports_;
00246   std::vector<int> properties_;
00247 
00248   bool operation_already_computed_;
00249 
00250   int global_num_vertex_weights_;
00251   int global_num_graph_edge_weights_;
00252   int global_num_hg_edge_weights_;
00253 
00254   Teuchos::RCP<Library> lib_;
00255 
00256   void computeNumberOfProperties();
00257 };//class Operator
00258 
00259 }//namespace Epetra
00260 }//namespace Isorropia
00261 
00262 #endif //HAVE_EPETRA
00263 
00264 #endif
00265