00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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
00084 Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00085 const Teuchos::ParameterList& paramlist, int base);
00086
00102 Operator (Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00103 Teuchos::RCP<CostDescriber> costs,
00104 const Teuchos::ParameterList& paramlist, int base);
00105
00119 Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00120 const Teuchos::ParameterList& paramlist, int base);
00121
00139 Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00140 Teuchos::RCP<CostDescriber> costs,
00141 const Teuchos::ParameterList& paramlist, int base);
00142
00157 Operator(Teuchos::RCP<const Epetra_MultiVector> coords,
00158 const Teuchos::ParameterList& paramlist, int base);
00159
00177 Operator(Teuchos::RCP<const Epetra_MultiVector> coords,
00178 Teuchos::RCP<const Epetra_MultiVector> weights,
00179 const Teuchos::ParameterList& paramlist, int base);
00180
00182 virtual ~Operator();
00183
00187 void setParameters(const Teuchos::ParameterList& paramlist);
00188
00189 virtual void compute(bool force_compute) = 0 ;
00190
00193 bool alreadyComputed() const {
00194 return operation_already_computed_;
00195 }
00196
00197 int numProperties() const {
00198 return (numberOfProperties_);
00199 }
00200
00201 int numLocalProperties() const {
00202 return (localNumberOfProperties_);
00203 }
00204
00208 virtual const int& operator[](int myElem) const;
00209
00212 virtual int numElemsWithProperty(int property) const;
00213
00217 virtual void elemsWithProperty(int property,
00218 int* elementList,
00219 int len) const;
00220
00221 virtual int extractPropertiesCopy(int len,
00222 int& size,
00223 int* array) const ;
00224
00225 virtual int extractPropertiesView(int& size,
00226 const int*& array) const;
00227
00228 private:
00229
00230 void paramsToUpper(Teuchos::ParameterList &, int &changed, bool rmUnderscore=true);
00231 void stringToUpper(std::string &s, int &changed, bool rmUnderscore=false);
00232 int numberOfProperties_;
00233 int localNumberOfProperties_;
00234 std::vector<int> numberElemsByProperties_;
00235
00236 protected:
00237 Teuchos::RCP<const Epetra_BlockMap> input_map_;
00238 Teuchos::RCP<const Epetra_CrsGraph> input_graph_;
00239 Teuchos::RCP<const Epetra_RowMatrix> input_matrix_;
00240 Teuchos::RCP<const Epetra_MultiVector> input_coords_;
00241 Teuchos::RCP<Isorropia::Epetra::CostDescriber> costs_;
00242 Teuchos::RCP<const Epetra_MultiVector> weights_;
00243
00244 Teuchos::ParameterList paramlist_;
00245
00246 int exportsSize_;
00247 std::vector<int> imports_;
00248 std::vector<int> properties_;
00249
00250 bool operation_already_computed_;
00251
00252 int global_num_vertex_weights_;
00253 int global_num_graph_edge_weights_;
00254 int global_num_hg_edge_weights_;
00255
00256 Teuchos::RCP<Library> lib_;
00257
00258 int base_;
00259
00260 void computeNumberOfProperties();
00261 };
00262
00263 }
00264 }
00265
00266 #endif //HAVE_EPETRA
00267
00268 #endif
00269