Isorropia: Partitioning, Load Balancing and more
Isorropia_EpetraOperator.hpp
Go to the documentation of this file.
1//@HEADER
2//************************************************************************
3//
4// Isorropia: Partitioning and Load Balancing Package
5// Copyright (2006) Sandia Corporation
6//
7//Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8//license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37//************************************************************************
38//@HEADER
39
40#ifndef _Isorropia_EpetraOperator_hpp_
41#define _Isorropia_EpetraOperator_hpp_
42
44#include <Teuchos_RCP.hpp>
45#include <Teuchos_ParameterList.hpp>
46
50
51#ifdef HAVE_EPETRA
52class Epetra_Map;
53class Epetra_BlockMap;
54class Epetra_Import;
55class Epetra_Vector;
56class Epetra_MultiVector;
57class Epetra_CrsGraph;
58class Epetra_CrsMatrix;
59class Epetra_RowMatrix;
60class Epetra_LinearProblem;
61
62namespace Isorropia {
63
64namespace Epetra {
65 class CostDescriber;
66
72class Operator : virtual public Isorropia::Operator {
73public:
74
75// Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph, int base);
76
77// Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, int base);
78
79// Operator(Teuchos::RCP<const Epetra_MultiVector> input_coords, int base);
80
81// Operator(Teuchos::RCP<const Epetra_BlockMap> input_map, int base);
82
83// Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
84// Teuchos::RCP<const Epetra_MultiVector> input_coords, int base);
85
86// Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
87// Teuchos::RCP<const Epetra_MultiVector> input_coords, int base);
88
89
105 Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
106 const Teuchos::ParameterList& paramlist, int base);
107
108
123 Operator(Teuchos::RCP<const Epetra_BlockMap> input_map,
124 const Teuchos::ParameterList& paramlist, int base);
125
126
127
147 Operator(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
148 Teuchos::RCP<const Epetra_MultiVector> input_coords,
149 const Teuchos::ParameterList& paramlist, int base);
150
151
171 Operator (Teuchos::RCP<const Epetra_CrsGraph> input_graph,
172 Teuchos::RCP<CostDescriber> costs,
173 const Teuchos::ParameterList& paramlist, int base);
174
175
201 Operator (Teuchos::RCP<const Epetra_CrsGraph> input_graph,
202 Teuchos::RCP<CostDescriber> costs,
203 Teuchos::RCP<const Epetra_MultiVector> coords,
204 Teuchos::RCP<const Epetra_MultiVector> weights,
205 const Teuchos::ParameterList& paramlist, int base);
206
207
223 Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
224 const Teuchos::ParameterList& paramlist, int base);
225
226
246 Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
247 Teuchos::RCP<const Epetra_MultiVector> coords,
248 const Teuchos::ParameterList& paramlist, int base);
249
250
270 Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
271 Teuchos::RCP<CostDescriber> costs,
272 const Teuchos::ParameterList& paramlist, int base);
273
274
301 Operator(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
302 Teuchos::RCP<CostDescriber> costs,
303 Teuchos::RCP<const Epetra_MultiVector> coords,
304 Teuchos::RCP<const Epetra_MultiVector> weights,
305 const Teuchos::ParameterList& paramlist, int base);
306
307
324 Operator(Teuchos::RCP<const Epetra_MultiVector> coords,
325 const Teuchos::ParameterList& paramlist, int base);
326
346 Operator(Teuchos::RCP<const Epetra_MultiVector> coords,
347 Teuchos::RCP<const Epetra_MultiVector> weights,
348 const Teuchos::ParameterList& paramlist, int base);
349
351 virtual ~Operator();
352
356 void setParameters(const Teuchos::ParameterList& paramlist);
357
361 Teuchos::RCP<Isorropia::Epetra::CostDescriber> & getCosts() { return costs_; }
362
363 virtual void compute(bool force_compute) = 0 ;
364
367 bool alreadyComputed() const {
369 }
370
371 int numProperties() const {
372 return (numberOfProperties_);
373 }
374
375 int numLocalProperties() const {
377 }
378
382 virtual const int& operator[](int myElem) const;
383
386 virtual int numElemsWithProperty(int property) const;
387
391 virtual void elemsWithProperty(int property,
392 int* elementList,
393 int len) const;
394
395 virtual int extractPropertiesCopy(int len,
396 int& size,
397 int* array) const ;
398
399 virtual int extractPropertiesView(int& size,
400 const int*& array) const;
401
402private:
403
404 void paramsToUpper(Teuchos::ParameterList &, int &changed, bool rmUnderscore=true);
405 void stringToUpper(std::string &s, int &changed, bool rmUnderscore=false);
408 std::vector<int> numberElemsByProperties_;
409
410protected:
411 Teuchos::RCP<const Epetra_BlockMap> input_map_;
412 Teuchos::RCP<const Epetra_CrsGraph> input_graph_;
413 Teuchos::RCP<const Epetra_RowMatrix> input_matrix_;
414 Teuchos::RCP<const Epetra_MultiVector> input_coords_;
415 Teuchos::RCP<Isorropia::Epetra::CostDescriber> costs_;
416 Teuchos::RCP<const Epetra_MultiVector> weights_;
417
418 Teuchos::ParameterList paramlist_;
419
421 std::vector<int> imports_;
422 std::vector<int> properties_;
423
425
429
430 Teuchos::RCP<Library> lib_;
431
432 int base_;
433
435};//class Operator
436
437}//namespace Epetra
438}//namespace Isorropia
439
440#endif //HAVE_EPETRA
441
442#endif
443
An implementation of the Partitioner interface that operates on Epetra matrices and linear systems.
Definition: Isorropia_EpetraOperator.hpp:72
std::vector< int > properties_
Definition: Isorropia_EpetraOperator.hpp:422
int numProperties() const
Return the number of different values used for "properties".
Definition: Isorropia_EpetraOperator.hpp:371
int numberOfProperties_
Definition: Isorropia_EpetraOperator.hpp:406
virtual ~Operator()
Destructor.
Teuchos::RCP< const Epetra_BlockMap > input_map_
Definition: Isorropia_EpetraOperator.hpp:411
int numLocalProperties() const
Return the number of different values used for "properties" for this process only.
Definition: Isorropia_EpetraOperator.hpp:375
Operator(Teuchos::RCP< const Epetra_CrsGraph > input_graph, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_CrsGraph object.
Teuchos::RCP< const Epetra_CrsGraph > input_graph_
Definition: Isorropia_EpetraOperator.hpp:412
int global_num_vertex_weights_
Definition: Isorropia_EpetraOperator.hpp:426
std::vector< int > numberElemsByProperties_
Definition: Isorropia_EpetraOperator.hpp:408
Operator(Teuchos::RCP< const Epetra_BlockMap > input_map, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_BlockMap object.
std::vector< int > imports_
Definition: Isorropia_EpetraOperator.hpp:421
virtual void elemsWithProperty(int property, int *elementList, int len) const
Fill user-allocated list (of length len) with the global element ids to be located in the given parti...
void stringToUpper(std::string &s, int &changed, bool rmUnderscore=false)
Teuchos::RCP< Isorropia::Epetra::CostDescriber > costs_
Definition: Isorropia_EpetraOperator.hpp:415
virtual const int & operator[](int myElem) const
Return the new partition ID for a given element that resided locally in the old operation.
bool alreadyComputed() const
Query whether compute_operation() has already been called.
Definition: Isorropia_EpetraOperator.hpp:367
int localNumberOfProperties_
Definition: Isorropia_EpetraOperator.hpp:407
virtual int extractPropertiesView(int &size, const int *&array) const
Give access of the property array that is owned by the current processor.
int base_
Definition: Isorropia_EpetraOperator.hpp:432
Operator(Teuchos::RCP< const Epetra_RowMatrix > input_matrix, Teuchos::RCP< CostDescriber > costs, Teuchos::RCP< const Epetra_MultiVector > coords, Teuchos::RCP< const Epetra_MultiVector > weights, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_RowMatrix object, a CostDescriber, an Epetra_MultiVector object of...
Teuchos::RCP< Isorropia::Epetra::CostDescriber > & getCosts()
Get the cost object.
Definition: Isorropia_EpetraOperator.hpp:361
Operator(Teuchos::RCP< const Epetra_CrsGraph > input_graph, Teuchos::RCP< CostDescriber > costs, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_CrsGraph object, a CostDescriber, an Epetra_MultiVector object of ...
Operator(Teuchos::RCP< const Epetra_RowMatrix > input_matrix, Teuchos::RCP< CostDescriber > costs, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_RowMatrix object and a CostDescriber.
void setParameters(const Teuchos::ParameterList &paramlist)
setParameters() is an internal method which handles the parameters from a Teuchos::ParameterList obje...
Operator(Teuchos::RCP< const Epetra_RowMatrix > input_matrix, Teuchos::RCP< const Epetra_MultiVector > coords, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_RowMatrix object and an Epetra_MultiVector object of coordinates.
Teuchos::ParameterList paramlist_
Definition: Isorropia_EpetraOperator.hpp:418
Operator(Teuchos::RCP< const Epetra_CrsGraph > input_graph, Teuchos::RCP< CostDescriber > costs, Teuchos::RCP< const Epetra_MultiVector > coords, Teuchos::RCP< const Epetra_MultiVector > weights, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_CrsGraph object, a CostDescriber, an Epetra_MultiVector object of ...
virtual int numElemsWithProperty(int property) const
Return the number of elements in a given partition.
void paramsToUpper(Teuchos::ParameterList &, int &changed, bool rmUnderscore=true)
Teuchos::RCP< Library > lib_
Definition: Isorropia_EpetraOperator.hpp:430
Operator(Teuchos::RCP< const Epetra_RowMatrix > input_matrix, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_RowMatrix object.
int global_num_graph_edge_weights_
Definition: Isorropia_EpetraOperator.hpp:427
Operator(Teuchos::RCP< const Epetra_MultiVector > coords, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_MultiVector object and a ParameterList.
virtual void compute(bool force_compute)=0
Method which does the work of computing a new partitioning/coloring/ordering, depending on the child ...
int global_num_hg_edge_weights_
Definition: Isorropia_EpetraOperator.hpp:428
Teuchos::RCP< const Epetra_MultiVector > input_coords_
Definition: Isorropia_EpetraOperator.hpp:414
Operator(Teuchos::RCP< const Epetra_CrsGraph > input_graph, Teuchos::RCP< const Epetra_MultiVector > input_coords, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_CrsGraph object and an Epetra_MultiVector object of coordinates.
Teuchos::RCP< const Epetra_RowMatrix > input_matrix_
Definition: Isorropia_EpetraOperator.hpp:413
virtual int extractPropertiesCopy(int len, int &size, int *array) const
Copy a part of the property array.
bool operation_already_computed_
Definition: Isorropia_EpetraOperator.hpp:424
Operator(Teuchos::RCP< const Epetra_MultiVector > coords, Teuchos::RCP< const Epetra_MultiVector > weights, const Teuchos::ParameterList &paramlist, int base)
Constructor that accepts an Epetra_MultiVector object and a ParameterList.
int exportsSize_
Definition: Isorropia_EpetraOperator.hpp:420
Teuchos::RCP< const Epetra_MultiVector > weights_
Definition: Isorropia_EpetraOperator.hpp:416
Interface (abstract base class) for computing a new partitioning/coloring/ ordering and exploiting th...
Definition: Isorropia_Operator.hpp:58
Isorropia is the namespace that contains general definitions that apply to all partitioners and that ...
Definition: Isorropia_Epetra.hpp:60